|
@@ -2,21 +2,26 @@ package org.dromara.bulk.service.impl;
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.dromara.bulk.domain.BulkOrderList;
|
|
|
+import org.dromara.bulk.domain.UserOrderTemplate;
|
|
|
import org.dromara.bulk.domain.bo.BulkOrderListBo;
|
|
|
import org.dromara.bulk.domain.bo.NewBulkOrderBo;
|
|
|
import org.dromara.bulk.domain.bo.OrderListBo;
|
|
|
import org.dromara.bulk.mapper.BulkOrderListMapper;
|
|
|
+import org.dromara.bulk.mapper.UserOrderMapper;
|
|
|
+import org.dromara.bulk.mapper.UserOrderTemplateMapper;
|
|
|
import org.dromara.bulk.service.BulkOrderManagementService;
|
|
|
-import org.dromara.commodityManagement.mapper.OemMapper;
|
|
|
+import org.dromara.commodityManagement.domain.Template;
|
|
|
+import org.dromara.commodityManagement.domain.bo.TemplateBo;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.OrderNumberGenerator;
|
|
|
import org.dromara.common.json.utils.JsonUtils;
|
|
|
import org.dromara.productionManagement.domain.ProductionPlan;
|
|
|
-import org.dromara.productionManagement.domain.bo.ProductionPlanBo;
|
|
|
import org.dromara.productionManagement.mapper.ProductionPlanMapper;
|
|
|
-import org.jetbrains.annotations.NotNull;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
/**
|
|
|
* 大货订单管理服务层实现
|
|
|
*/
|
|
@@ -26,7 +31,8 @@ public class BulkOrderManagementServiceImpl implements BulkOrderManagementServic
|
|
|
|
|
|
private final ProductionPlanMapper productionPlanMapper;
|
|
|
private final BulkOrderListMapper bulkOrderListMapper;
|
|
|
- private final OemMapper oemMapper;
|
|
|
+ private final UserOrderMapper userOrderMapper;
|
|
|
+ private final UserOrderTemplateMapper userOrderTemplateMapper;
|
|
|
|
|
|
@Override
|
|
|
public int insertBulkOrder(NewBulkOrderBo newBulkOrderBo) {
|
|
@@ -36,11 +42,15 @@ public class BulkOrderManagementServiceImpl implements BulkOrderManagementServic
|
|
|
String purchaseCode = orderNumberGenerator.generateOrderNumber("SC");
|
|
|
String orderNumber = orderNumberGenerator.generateOrderNumber("DH");
|
|
|
|
|
|
- ProductionPlanBo productionPlanBo = initProductionPlanBo(orderList, sysNo, purchaseCode, orderNumber);
|
|
|
- productionPlanMapper.insert(MapstructUtils.convert(productionPlanBo, ProductionPlan.class));
|
|
|
+ productionPlanMapper.insert(initProductionPlanBo(orderList, sysNo, purchaseCode, orderNumber));
|
|
|
+
|
|
|
+ bulkOrderListMapper.insert(initBulkOrderListBo(orderList, sysNo, purchaseCode));
|
|
|
+
|
|
|
+ Long orderId = userOrderMapper.selectLastId();
|
|
|
+ Long planId = productionPlanMapper.selectLastId();
|
|
|
|
|
|
- BulkOrderListBo bulkOrderListBo = initBulkOrderListBo(orderList, sysNo, purchaseCode);
|
|
|
- bulkOrderListMapper.insert(MapstructUtils.convert(bulkOrderListBo, BulkOrderList.class));
|
|
|
+ List<UserOrderTemplate> userOrderTemplate = initUserOrderTemplate(orderList, orderId, planId);
|
|
|
+ userOrderTemplateMapper.insert(userOrderTemplate);
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
@@ -53,50 +63,49 @@ public class BulkOrderManagementServiceImpl implements BulkOrderManagementServic
|
|
|
* @param purchaseCode 生产单号
|
|
|
* @return 构建完毕的BO对象
|
|
|
*/
|
|
|
- @NotNull
|
|
|
- private BulkOrderListBo initBulkOrderListBo(@NotNull OrderListBo orderList, String sysNo, String purchaseCode) {
|
|
|
- BulkOrderListBo bulkOrderListBo = new BulkOrderListBo();
|
|
|
+ private BulkOrderList initBulkOrderListBo(OrderListBo orderList, String sysNo, String purchaseCode) {
|
|
|
+ BulkOrderList bulkOrderList = new BulkOrderList();
|
|
|
//设置系统单号
|
|
|
- bulkOrderListBo.setSysNo(sysNo);
|
|
|
+ bulkOrderList.setSysNo(sysNo);
|
|
|
//设置生产单号
|
|
|
- bulkOrderListBo.setScNo(purchaseCode);
|
|
|
+ bulkOrderList.setScNo(purchaseCode);
|
|
|
//设置商品ID
|
|
|
- bulkOrderListBo.setGoodsId(9L);
|
|
|
+ bulkOrderList.setGoodsId(9L);
|
|
|
//设置商品编号
|
|
|
- bulkOrderListBo.setGoodsCode("SP001");
|
|
|
+ bulkOrderList.setGoodsCode("SP001");
|
|
|
//设置商品名称
|
|
|
- bulkOrderListBo.setGoodsName("图片下单");
|
|
|
+ bulkOrderList.setGoodsName("图片下单");
|
|
|
//设置单位ID
|
|
|
- bulkOrderListBo.setUnitId(5);
|
|
|
+ bulkOrderList.setUnitId(5);
|
|
|
//设置默认单位ID
|
|
|
- bulkOrderListBo.setDefaultUnit(5);
|
|
|
+ bulkOrderList.setDefaultUnit(5);
|
|
|
//设置大货编号
|
|
|
- bulkOrderListBo.setGoodsTypeExtend1Id(orderList.getDaHuoNumber());
|
|
|
+ bulkOrderList.setGoodsTypeExtend1Id(orderList.getDaHuoNumberBo().getName());
|
|
|
//设置成衣厂
|
|
|
- bulkOrderListBo.setGarmentFactory(orderList.getGarmentFactory());
|
|
|
+ bulkOrderList.setGarmentFactory(orderList.getGarmentFactory());
|
|
|
//设置成衣厂联系人
|
|
|
- bulkOrderListBo.setGarmentFactoryPeople(orderList.getGarmentFactoryPeople());
|
|
|
+ bulkOrderList.setGarmentFactoryPeople(orderList.getGarmentFactoryPeople());
|
|
|
//设置成衣厂电话
|
|
|
- bulkOrderListBo.setGarmentFactoryTel(orderList.getGarmentFactoryTel());
|
|
|
+ bulkOrderList.setGarmentFactoryTel(orderList.getGarmentFactoryTel());
|
|
|
//设置收货地址
|
|
|
- bulkOrderListBo.setReceivingAddress(orderList.getReceivingAddress());
|
|
|
+ bulkOrderList.setReceivingAddress(orderList.getReceivingAddress());
|
|
|
//设置当前消耗时间
|
|
|
- bulkOrderListBo.setCurrentTimeConsumption(orderList.getCurrentTimeConsumption());
|
|
|
+ bulkOrderList.setCurrentTimeConsumption(orderList.getCurrentTimeConsumption());
|
|
|
//设置下单时间
|
|
|
- bulkOrderListBo.setOrderTime(orderList.getOrderTime());
|
|
|
+ bulkOrderList.setOrderTime(orderList.getOrderTime());
|
|
|
//设置目标时间
|
|
|
- bulkOrderListBo.setTargetDate(orderList.getTargetDate());
|
|
|
+ bulkOrderList.setTargetDate(orderList.getTargetDate());
|
|
|
//设置底布
|
|
|
- bulkOrderListBo.setBaseCloth(orderList.getBaseCloth());
|
|
|
+ bulkOrderList.setBaseCloth(orderList.getBaseCloth());
|
|
|
//设置底布价格
|
|
|
- bulkOrderListBo.setBaseClothPrice(orderList.getBaseClothPrice());
|
|
|
+ bulkOrderList.setBaseClothPrice(orderList.getBaseClothPrice());
|
|
|
//设置品牌组
|
|
|
- bulkOrderListBo.setBrandGroup(orderList.getBrandGroup());
|
|
|
+ bulkOrderList.setBrandGroup(orderList.getBrandGroup());
|
|
|
//设置工艺类型并转换为JSON格式后存入
|
|
|
- bulkOrderListBo.setGoodsTypeExtend3Attr(JsonUtils.toJsonString(orderList.getCraft()));
|
|
|
+ bulkOrderList.setGoodsTypeExtend3Attr(JsonUtils.toJsonString(orderList.getCraft()));
|
|
|
//设置花型号类型并转换为JSON格式存入
|
|
|
- bulkOrderListBo.setGoodsTypeExtend4Attr(JsonUtils.toJsonString(orderList.getOem()));
|
|
|
- return bulkOrderListBo;
|
|
|
+ bulkOrderList.setGoodsTypeExtend4Attr(JsonUtils.toJsonString(orderList.getOem()));
|
|
|
+ return bulkOrderList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -106,35 +115,59 @@ public class BulkOrderManagementServiceImpl implements BulkOrderManagementServic
|
|
|
* @param purchaseCode 生产单号
|
|
|
* @return 构建完毕的生产计划BO对象
|
|
|
*/
|
|
|
- @NotNull
|
|
|
- private ProductionPlanBo initProductionPlanBo(@NotNull OrderListBo orderList, String sysNo, String purchaseCode, String orderNumber) {
|
|
|
- ProductionPlanBo productionPlanBo = new ProductionPlanBo();
|
|
|
+ private ProductionPlan initProductionPlanBo(OrderListBo orderList, String sysNo, String purchaseCode, String orderNumber) {
|
|
|
+ ProductionPlan productionPlan = new ProductionPlan();
|
|
|
//设置系统单号
|
|
|
- productionPlanBo.setSysNo(sysNo);
|
|
|
+ productionPlan.setSysNo(sysNo);
|
|
|
//设置生产单号
|
|
|
- productionPlanBo.setPurchaseCode(purchaseCode);
|
|
|
+ productionPlan.setPurchaseCode(purchaseCode);
|
|
|
//设置订单单号
|
|
|
- productionPlanBo.setOrderNum(orderNumber);
|
|
|
+ productionPlan.setOrderNum(orderNumber);
|
|
|
//设置用户id
|
|
|
- productionPlanBo.setUserId(orderList.getUserId());
|
|
|
+ productionPlan.setUserId(orderList.getUserId());
|
|
|
//设置是否烧花
|
|
|
- productionPlanBo.setIsBurnFlowers(orderList.getIsBurnFlowers());
|
|
|
+ productionPlan.setIsBurnFlowers(orderList.getIsBurnFlowers());
|
|
|
//设置是否快返
|
|
|
- productionPlanBo.setIsQuickReturn(orderList.getIsQuickReturn());
|
|
|
+ productionPlan.setIsQuickReturn(orderList.getIsQuickReturn());
|
|
|
//设置是否作废
|
|
|
- productionPlanBo.setIsToVoid(orderList.getIsToVoid());
|
|
|
+ productionPlan.setIsToVoid(orderList.getIsToVoid());
|
|
|
//设置是否多色
|
|
|
- productionPlanBo.setIsMulticolor(orderList.getIsMulticolor());
|
|
|
+ productionPlan.setIsMulticolor(orderList.getIsMulticolor());
|
|
|
//设置是否首单
|
|
|
- productionPlanBo.setIsFirstOrder(orderList.getIsFirstOrder());
|
|
|
+ productionPlan.setIsFirstOrder(orderList.getIsFirstOrder());
|
|
|
//设置是否紧急
|
|
|
- productionPlanBo.setIsUrgent(orderList.getIsUrgent());
|
|
|
+ productionPlan.setIsUrgent(orderList.getIsUrgent());
|
|
|
//设置是否补货
|
|
|
- productionPlanBo.setIsBuhuo(orderList.getIsBuhuo());
|
|
|
+ productionPlan.setIsBuhuo(orderList.getIsBuhuo());
|
|
|
//设置是否系统单
|
|
|
- productionPlanBo.setIsSys(orderList.getIsSys());
|
|
|
+ productionPlan.setIsSys(orderList.getIsSys());
|
|
|
//设置创建时间
|
|
|
- productionPlanBo.setCreateTime(orderList.getCreateTime());
|
|
|
- return productionPlanBo;
|
|
|
+ productionPlan.setCreateTime(orderList.getCreateTime());
|
|
|
+ return productionPlan;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<UserOrderTemplate> initUserOrderTemplate(OrderListBo orderList, Long orderId, Long planId) {
|
|
|
+ ArrayList<UserOrderTemplate> userOrderTemplateList = new ArrayList<>();
|
|
|
+ for (TemplateBo templateBo : orderList.getTemplateList()) {
|
|
|
+ UserOrderTemplate userOrderTemplate = new UserOrderTemplate();
|
|
|
+ //设置用户id
|
|
|
+ userOrderTemplate.setUserId(orderList.getUserId());
|
|
|
+ //设置订单id 对应fa_kuyou_user_order表id
|
|
|
+ userOrderTemplate.setOrderId(orderId);
|
|
|
+ //设置生产计划id 对应fa_kuyou_production_plan表id
|
|
|
+ userOrderTemplate.setPlanId(planId);
|
|
|
+ //设置大货编号id
|
|
|
+ userOrderTemplate.setItemId(orderList.getDaHuoNumberBo().getId());
|
|
|
+ //设置份数
|
|
|
+ userOrderTemplate.setNumber(templateBo.getNumber());
|
|
|
+ //设置米数
|
|
|
+ userOrderTemplate.setMiter(templateBo.getMiter());
|
|
|
+ //设置版图名称
|
|
|
+ userOrderTemplate.setName(templateBo.getName());
|
|
|
+ //设置版图图片
|
|
|
+ userOrderTemplate.setImage(templateBo.getImage());
|
|
|
+ userOrderTemplateList.add(userOrderTemplate);
|
|
|
+ }
|
|
|
+ return userOrderTemplateList;
|
|
|
}
|
|
|
}
|