PC下单-fix

This commit is contained in:
kuang.yife 2023-04-16 23:24:35 +08:00
parent d19c428ebd
commit 9e165fe9b9
4 changed files with 23 additions and 7 deletions

View File

@ -145,10 +145,16 @@ public class OrderController extends BaseController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult sysOrder(@RequestBody SysOrderAssignRequest request) { public AjaxResult sysOrder(@RequestBody SysOrderAssignRequest request) {
request.setGoodsDeptCategoryId(request.getCategory4()); request.setGoodsDeptCategoryId(request.getCategory4());
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.selectOneByGoodsCategoryId(request.getGoodsDeptCategoryId()); List<Long> ids = new ArrayList<>();
ids.add(request.getCategory1());
ids.add(request.getCategory2());
ids.add(request.getCategory3());
ids.add(request.getCategory4());
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(request.getGoodsDeptCategoryId());
OrderTemplateGoods orderTemplateGoods = new OrderTemplateGoods(); OrderTemplateGoods orderTemplateGoods = new OrderTemplateGoods();
orderTemplateGoods.setGoodsName(request.getGoodsBrand() + " " + deptGoodsCategory.getGoodsCategoryName()); orderTemplateGoods.setGoodsName(request.getGoodsBrand() + " " + deptGoodsCategory.getGoodsCategoryName());
orderTemplateGoods.setDeptGoodsCategoryIds(Arrays.asList(request.getGoodsDeptCategoryId())); orderTemplateGoods.setDeptGoodsCategoryIds(ids);
orderTemplateGoods.setDeptGoodsCategoryNames(Arrays.asList(orderTemplateGoods.getGoodsName())); orderTemplateGoods.setDeptGoodsCategoryNames(Arrays.asList(orderTemplateGoods.getGoodsName()));
request.setGoods(Arrays.asList(orderTemplateGoods)); request.setGoods(Arrays.asList(orderTemplateGoods));
String goodsBrand = request.getGoodsBrand(); String goodsBrand = request.getGoodsBrand();
@ -173,13 +179,13 @@ public class OrderController extends BaseController {
goods.setGoodsImgUrl(request.getImageUrl()); goods.setGoodsImgUrl(request.getImageUrl());
goods.setGoodsVideoUrl(request.getVideoUrl()); goods.setGoodsVideoUrl(request.getVideoUrl());
goods.setDeptGoodsCategoryId(dgcIds.get(2)); goods.setDeptGoodsCategoryId(dgcIds.get(2));
goods.setDeptGoodsCategoryName(dgcNames.get(2)); goods.setDeptGoodsCategoryName(dgcNames.get(0));
goods.setStatus(1); goods.setStatus(1);
GoodsStandard standard = new GoodsStandard(); GoodsStandard standard = new GoodsStandard();
standard.setGoodsStandardName(good.getGoodsName()); standard.setGoodsStandardName(good.getGoodsName());
standard.setDeptGoodsCategoryId(dgcIds.get(3)); standard.setDeptGoodsCategoryId(dgcIds.get(3));
standard.setGoodsCategoryName(dgcNames.get(3)); standard.setGoodsCategoryName(dgcNames.get(0));
if ((++goodsNum) == (goodsList.size() - 1)) { if ((++goodsNum) == (goodsList.size() - 1)) {
standard.setGoodsPrice(orderPrice.subtract(goodsPriceAccumulative)); standard.setGoodsPrice(orderPrice.subtract(goodsPriceAccumulative));
} else { } else {
@ -189,6 +195,9 @@ public class OrderController extends BaseController {
goodsService.insertGoods(goods); goodsService.insertGoods(goods);
standard.setGoodsId(goods.getGoodsId()); standard.setGoodsId(goods.getGoodsId());
standard.setExtMoney(BigDecimal.ZERO);
standard.setGoodsNum(999);
standard.setSaleNum(0);
goodsStandardService.save(Collections.singletonList(standard)); goodsStandardService.save(Collections.singletonList(standard));
// 生成主单 // 生成主单

View File

@ -344,7 +344,7 @@
if (result.code == web_status.SUCCESS) { if (result.code == web_status.SUCCESS) {
$('#categoryCxSelect').cxSelect({ $('#categoryCxSelect').cxSelect({
selects: ['category1', 'category2', 'category3', 'category4'], selects: ['category1', 'category2', 'category3', 'category4'],
jsonValue: 'goodsCategoryId', jsonValue: 'deptGoodsCategoryId',
jsonName: 'goodsCategoryName', jsonName: 'goodsCategoryName',
jsonSub: 'child', jsonSub: 'child',
data: result.data data: result.data

View File

@ -5,6 +5,7 @@ import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.core.domain.Ztree; import com.ghy.common.core.domain.Ztree;
import com.ghy.common.core.text.Convert; import com.ghy.common.core.text.Convert;
import com.ghy.common.utils.StringUtils; import com.ghy.common.utils.StringUtils;
import com.ghy.common.utils.bean.BeanUtils;
import com.ghy.goods.domain.DeptGoodsCategory; import com.ghy.goods.domain.DeptGoodsCategory;
import com.ghy.goods.domain.GoodsCategory; import com.ghy.goods.domain.GoodsCategory;
import com.ghy.goods.domain.GoodsImgs; import com.ghy.goods.domain.GoodsImgs;
@ -152,8 +153,10 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService {
private void fillChild(List<DeptGoodsCategory> goodsCategoryList) { private void fillChild(List<DeptGoodsCategory> goodsCategoryList) {
List<DeptGoodsCategory> childList; List<DeptGoodsCategory> childList;
for (DeptGoodsCategory deptGoodsCategory : goodsCategoryList) { for (DeptGoodsCategory deptGoodsCategory : goodsCategoryList) {
deptGoodsCategory.setDeptGoodsCategoryId(null); DeptGoodsCategory param = new DeptGoodsCategory();
childList = deptGoodsCategoryMapper.appList(deptGoodsCategory); BeanUtils.copyProperties(deptGoodsCategory, param);
param.setDeptGoodsCategoryId(null);
childList = deptGoodsCategoryMapper.appList(param);
if (childList.size() > 0) { if (childList.size() > 0) {
deptGoodsCategory.setChild(childList); deptGoodsCategory.setChild(childList);
} }

View File

@ -11,7 +11,11 @@ public class SysOrderAssignRequest {
// 商品 // 商品
private List<OrderTemplateGoods> goods; private List<OrderTemplateGoods> goods;
private Long category1;
private Long category2;
private Long category3;
private Long category4; private Long category4;
// 商品品牌 // 商品品牌
private String goodsBrand; private String goodsBrand;
// 商品规格 // 商品规格