diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java index 94c1d3bb..f7f4f1f5 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderController.java @@ -145,10 +145,16 @@ public class OrderController extends BaseController { @Transactional(rollbackFor = Exception.class) public AjaxResult sysOrder(@RequestBody SysOrderAssignRequest request) { request.setGoodsDeptCategoryId(request.getCategory4()); - DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.selectOneByGoodsCategoryId(request.getGoodsDeptCategoryId()); + List 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.setGoodsName(request.getGoodsBrand() + " " + deptGoodsCategory.getGoodsCategoryName()); - orderTemplateGoods.setDeptGoodsCategoryIds(Arrays.asList(request.getGoodsDeptCategoryId())); + orderTemplateGoods.setDeptGoodsCategoryIds(ids); orderTemplateGoods.setDeptGoodsCategoryNames(Arrays.asList(orderTemplateGoods.getGoodsName())); request.setGoods(Arrays.asList(orderTemplateGoods)); String goodsBrand = request.getGoodsBrand(); @@ -173,13 +179,13 @@ public class OrderController extends BaseController { goods.setGoodsImgUrl(request.getImageUrl()); goods.setGoodsVideoUrl(request.getVideoUrl()); goods.setDeptGoodsCategoryId(dgcIds.get(2)); - goods.setDeptGoodsCategoryName(dgcNames.get(2)); + goods.setDeptGoodsCategoryName(dgcNames.get(0)); goods.setStatus(1); GoodsStandard standard = new GoodsStandard(); standard.setGoodsStandardName(good.getGoodsName()); standard.setDeptGoodsCategoryId(dgcIds.get(3)); - standard.setGoodsCategoryName(dgcNames.get(3)); + standard.setGoodsCategoryName(dgcNames.get(0)); if ((++goodsNum) == (goodsList.size() - 1)) { standard.setGoodsPrice(orderPrice.subtract(goodsPriceAccumulative)); } else { @@ -189,6 +195,9 @@ public class OrderController extends BaseController { goodsService.insertGoods(goods); standard.setGoodsId(goods.getGoodsId()); + standard.setExtMoney(BigDecimal.ZERO); + standard.setGoodsNum(999); + standard.setSaleNum(0); goodsStandardService.save(Collections.singletonList(standard)); // 生成主单 diff --git a/ghy-admin/src/main/resources/templates/goods/standard/addTemplate.html b/ghy-admin/src/main/resources/templates/goods/standard/addTemplate.html index 69c2d10d..1937b629 100644 --- a/ghy-admin/src/main/resources/templates/goods/standard/addTemplate.html +++ b/ghy-admin/src/main/resources/templates/goods/standard/addTemplate.html @@ -344,7 +344,7 @@ if (result.code == web_status.SUCCESS) { $('#categoryCxSelect').cxSelect({ selects: ['category1', 'category2', 'category3', 'category4'], - jsonValue: 'goodsCategoryId', + jsonValue: 'deptGoodsCategoryId', jsonName: 'goodsCategoryName', jsonSub: 'child', data: result.data diff --git a/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java b/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java index 17f494ef..58aaefd2 100644 --- a/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java +++ b/ghy-goods/src/main/java/com/ghy/goods/service/impl/DeptGoodsCategoryServiceImpl.java @@ -5,6 +5,7 @@ import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.domain.Ztree; import com.ghy.common.core.text.Convert; import com.ghy.common.utils.StringUtils; +import com.ghy.common.utils.bean.BeanUtils; import com.ghy.goods.domain.DeptGoodsCategory; import com.ghy.goods.domain.GoodsCategory; import com.ghy.goods.domain.GoodsImgs; @@ -152,8 +153,10 @@ public class DeptGoodsCategoryServiceImpl implements DeptGoodsCategoryService { private void fillChild(List goodsCategoryList) { List childList; for (DeptGoodsCategory deptGoodsCategory : goodsCategoryList) { - deptGoodsCategory.setDeptGoodsCategoryId(null); - childList = deptGoodsCategoryMapper.appList(deptGoodsCategory); + DeptGoodsCategory param = new DeptGoodsCategory(); + BeanUtils.copyProperties(deptGoodsCategory, param); + param.setDeptGoodsCategoryId(null); + childList = deptGoodsCategoryMapper.appList(param); if (childList.size() > 0) { deptGoodsCategory.setChild(childList); } diff --git a/ghy-order/src/main/java/com/ghy/order/request/SysOrderAssignRequest.java b/ghy-order/src/main/java/com/ghy/order/request/SysOrderAssignRequest.java index 9e11fbf1..8a8db7be 100644 --- a/ghy-order/src/main/java/com/ghy/order/request/SysOrderAssignRequest.java +++ b/ghy-order/src/main/java/com/ghy/order/request/SysOrderAssignRequest.java @@ -11,7 +11,11 @@ public class SysOrderAssignRequest { // 商品 private List goods; + private Long category1; + private Long category2; + private Long category3; private Long category4; + // 商品品牌 private String goodsBrand; // 商品规格