diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/DetailProductEntity.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/DetailProductEntity.java index 0180434b0..fa9ae2543 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/DetailProductEntity.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/entity/DetailProductEntity.java @@ -22,9 +22,6 @@ import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; -import org.springblade.core.tenant.mp.TenantEntity; import java.time.LocalDate; @@ -37,7 +34,7 @@ import java.time.LocalDate; @Data @TableName("ht_detail_product") @ApiModel(value = "DetailProduct对象", description = "包内产品明细") -public class DetailProductEntity { +public class DetailProductEntity{ @TableId( value = "id", diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java index 68c7f6ce1..6a37d05fc 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IAdvanceDetailClient.java @@ -21,6 +21,7 @@ import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import java.util.Map; @@ -55,7 +56,7 @@ public interface IAdvanceDetailClient { * @return */ @PostMapping(API_PREFIX + "/addAdvanceDetail") - boolean addAdvanceDetail(@RequestBody AdvanceDetailEntity advanceDetailEntity); + Integer addAdvanceDetail(@RequestBody AdvanceDetailEntity advanceDetailEntity); /** @@ -64,5 +65,5 @@ public interface IAdvanceDetailClient { * @return */ @GetMapping(API_PREFIX + "/getSupplyData") - Map getSupplyData(String unitNo); + Map getSupplyData(@RequestParam String unitNo); } diff --git a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IDetailProductClient.java b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IDetailProductClient.java index a9a5b1dc6..d51ae5a8a 100644 --- a/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IDetailProductClient.java +++ b/blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IDetailProductClient.java @@ -17,11 +17,12 @@ package com.logpm.oldproject.feign; import com.logpm.oldproject.entity.DetailProductEntity; -import org.springblade.common.constant.LauncherConstant; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import java.util.List; + /** * 包内产品明细 Feign接口类 * @@ -29,7 +30,7 @@ import org.springframework.web.bind.annotation.RequestBody; * @since 2023-05-10 */ @FeignClient( - value = "logpm-old-project-cyz" + value = "logpm-old-project" ) public interface IDetailProductClient { @@ -54,5 +55,6 @@ public interface IDetailProductClient { @PostMapping(API_PREFIX + "/addDetailProduct") Boolean addDetailProduct(@RequestBody DetailProductEntity detailProductEntity); - + @PostMapping(API_PREFIX + "/addDetailProductList") + Boolean addDetailProductList(@RequestBody List detailProductEntitys); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java index 9bd1bf418..fa415ee9f 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java @@ -313,7 +313,7 @@ public class FactoryXxlJob { // advanceDetailEntity.setDueDate(0);//交期 advanceDetailEntity.setRemark("");//备注 advanceDetailEntity.setOldId(0);// - boolean b = advanceDetailClient.addAdvanceDetail(advanceDetailEntity); + advanceDetailClient.addAdvanceDetail(advanceDetailEntity); //XxlJobLogger.log("addAdvanceDetail 添加状态 {}", b); }); // 添加包件信息 diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/constant/PanFactoryEnum.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/constant/PanFactoryEnum.java new file mode 100644 index 000000000..26c001263 --- /dev/null +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/constant/PanFactoryEnum.java @@ -0,0 +1,65 @@ +package com.logpm.factory.snm.constant; + +public enum PanFactoryEnum { + + + BF("3610","中山-广州仓",47), + FS("3110","中山市-广州仓",47), + TJ("3210","天津-天津基地仓",53), + LK("3310","河南-无",0); + + private String typeCode; + private String typeMes; + private Integer typeId; + + PanFactoryEnum(String typeCode, String typeMes,Integer typeId) { + this.typeCode = typeCode; + this.typeMes = typeMes; + this.typeId = typeId; + } + + public String getTypeCode() { + return typeCode; + } + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + } + + public String getTypeMes() { + return typeMes; + } + + public void setTypeMes(String typeMes) { + this.typeMes = typeMes; + } + + public Integer getTypeId() { + return typeId; + } + + public void setTypeId(Integer typeId) { + this.typeId = typeId; + } + + public static String getMes(String typeCode){ + PanFactoryEnum[] values = PanFactoryEnum.values(); + for(PanFactoryEnum panFactoryEnum:values){ + if(panFactoryEnum.getTypeCode().equals(typeCode)){ + return panFactoryEnum.getTypeMes(); + } + } + return typeCode; + } + + public static Integer getId(String typeCode){ + PanFactoryEnum[] values = PanFactoryEnum.values(); + for(PanFactoryEnum panFactoryEnum:values){ + if(panFactoryEnum.getTypeCode().equals(typeCode)){ + return panFactoryEnum.getTypeId(); + } + } + return 0; + } + +} diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/controller/PanFactoryDataController.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/controller/PanFactoryDataController.java index 8bd297f84..92ee6f8d7 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/controller/PanFactoryDataController.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/controller/PanFactoryDataController.java @@ -17,10 +17,12 @@ package com.logpm.factory.snm.controller; import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson.JSONObject; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.logpm.factory.snm.bean.Resp; import com.logpm.factory.snm.dto.*; import com.logpm.factory.snm.entity.PanFactoryOrder; +import com.logpm.factory.snm.entity.PanOrderStatusLog; import com.logpm.factory.snm.entity.PanPackageInfo; import com.logpm.factory.snm.entity.PanPackageList; import com.logpm.factory.snm.service.*; @@ -56,6 +58,7 @@ public class PanFactoryDataController extends BladeController { private final IPanPackageListService packageListService; private final IPanFactoryDataService factoryDataService; private final IAsyncDataService syncDataService; + private final IPanOrderStatusLogService panOrderStatusLogService; // @ResponseBody // @PostMapping("/token") @@ -96,6 +99,13 @@ public class PanFactoryDataController extends BladeController { log.info("############data: "); String corpId = request.getHeader("corpId"); + //先保存原始请求数据 + PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); + panOrderStatusLog.setArgs(JSONObject.toJSONString(factoryOrderDTO)); + panOrderStatusLog.setStatus(1); + panOrderStatusLog.setType(3); + panOrderStatusLogService.save(panOrderStatusLog); + PanFactoryOrder factoryOrder = new PanFactoryOrder(); BeanUtil.copyProperties(factoryOrderDTO,factoryOrder); factoryOrder.setCorpid(corpId); @@ -124,6 +134,10 @@ public class PanFactoryDataController extends BladeController { packageListService.saveBatch(PanPackagelist); } + //修改保存数据的状态 + panOrderStatusLog.setStatus(0); + panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); + //开启异步线程处理数据 syncDataService.handlerPanDataToHt(); @@ -138,7 +152,8 @@ public class PanFactoryDataController extends BladeController { public R sendOrders(@Validated @RequestBody OrderInfoDTO orderInfoDTO) { log.info("############sendOrders: 请求参数{}",orderInfoDTO); try{ - factoryDataService.handleData(orderInfoDTO); + R r = factoryDataService.handleData(orderInfoDTO); + return r; }catch (CustomerException e){ log.error(e.message,e); return R.fail(e.code,e.message); @@ -146,7 +161,6 @@ public class PanFactoryDataController extends BladeController { log.error("############sendOrders: 系统异常",e); return R.fail(500,"############sendOrders: 系统异常"); } - return R.success("SUCCESS"); } @@ -157,7 +171,8 @@ public class PanFactoryDataController extends BladeController { public R sendOrderStatus(@RequestBody OrderStatusDTO orderStatusDTO) { log.info("############sendOrderStatus: 请求参数{}",orderStatusDTO); try{ - factoryDataService.handleStatusData(orderStatusDTO); + R r = factoryDataService.handleStatusData(orderStatusDTO); + return r; }catch (CustomerException e){ log.error(e.message,e); return R.fail(e.code,e.message); @@ -165,7 +180,6 @@ public class PanFactoryDataController extends BladeController { log.error("############sendOrderStatus: 系统异常",e); return R.fail(500,"############sendOrderStatus: 系统异常"); } - return Resp.success("SUCCESS"); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanFactoryDataService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanFactoryDataService.java index 4291ce42d..09bd2788a 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanFactoryDataService.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IPanFactoryDataService.java @@ -2,6 +2,7 @@ package com.logpm.factory.snm.service; import com.logpm.factory.snm.dto.OrderInfoDTO; import com.logpm.factory.snm.dto.OrderStatusDTO; +import org.springblade.core.tool.api.R; /** * 工厂推送数据接口 @@ -10,7 +11,7 @@ public interface IPanFactoryDataService { - void handleData(OrderInfoDTO orderInfoDTO); + R handleData(OrderInfoDTO orderInfoDTO); - void handleStatusData(OrderStatusDTO orderStatusDTO); + R handleStatusData(OrderStatusDTO orderStatusDTO); } diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/AsyncDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/AsyncDataServiceImpl.java index aacc2498c..2bb41662b 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/AsyncDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/AsyncDataServiceImpl.java @@ -1,27 +1,30 @@ package com.logpm.factory.snm.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.logpm.factory.snm.constant.PanFactoryEnum; import com.logpm.factory.snm.entity.PanFactoryOrder; import com.logpm.factory.snm.entity.PanPackageInfo; +import com.logpm.factory.snm.entity.PanPackageList; import com.logpm.factory.snm.service.IAsyncDataService; import com.logpm.factory.snm.service.IPanFactoryOrderService; import com.logpm.factory.snm.service.IPanPackageInfoService; import com.logpm.factory.snm.service.IPanPackageListService; import com.logpm.oldproject.entity.AdvanceDetailEntity; import com.logpm.oldproject.entity.AdvanceEntity; +import com.logpm.oldproject.entity.DetailProductEntity; import com.logpm.oldproject.entity.ServiceNumEntity; -import com.logpm.oldproject.feign.IAdvanceClient; -import com.logpm.oldproject.feign.IAdvanceDetailClient; -import com.logpm.oldproject.feign.IServiceNumClient; -import com.logpm.oldproject.feign.IWarehouseClient; +import com.logpm.oldproject.feign.*; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; +import org.springblade.core.tool.utils.StringUtil; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; +import java.util.Objects; /** * 异步线程处理 @@ -34,7 +37,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService { private final IAdvanceClient iAdvanceClient; private final IAdvanceDetailClient advanceDetailClient; private final IServiceNumClient serviceNumClient; - private final IWarehouseClient warehouseClient; + private final IDetailProductClient detailProductClient; private final IPanFactoryOrderService panFactoryOrderService; private final IPanPackageInfoService panPackageInfoService; private final IPanPackageListService panPackageListService; @@ -60,43 +63,44 @@ public class AsyncDataServiceImpl implements IAsyncDataService { //添加订单信息 AdvanceEntity advanceEntity = new AdvanceEntity(); - advanceEntity.setOrderSelfNum(panFactoryOrder.getOrderNo()); //订单自编号 - advanceEntity.setSiteName(""); // 基地 TODO 通过工厂id映射 - advanceEntity.setArea(""); // 区域 + advanceEntity.setOrderSelfNum(StringUtil.isBlank(panFactoryOrder.getOrderNo())?"":panFactoryOrder.getOrderNo()); //订单自编号 + advanceEntity.setSiteName(PanFactoryEnum.getMes(panFactoryOrder.getPlantId())); // 基地 + advanceEntity.setArea(StringUtil.isBlank(panFactoryOrder.getReceiverArea())?"":panFactoryOrder.getReceiverArea()); // 区域 advanceEntity.setOrderTypeName(""); //订单类型名称 可以为空 advanceEntity.setOrderClassName("工厂"); //订单类型 可以为空 advanceEntity.setType("皮阿诺"); advanceEntity.setTotal(panFactoryOrder.getServiceCount()); //订单总数据 - advanceEntity.setMctsTruck(panFactoryOrder.getDeliveryNumber()); //车次 + advanceEntity.setMctsTruck(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber()); //车次 advanceEntity.setMtdsNo("");// MTDS单号 可以为空 advanceEntity.setFirstPackName(""); //一级品类 advanceEntity.setFirstPackCode(""); //一级品类 advanceEntity.setDealerName(""); //商场名称 - advanceEntity.setDealerCode(panFactoryOrder.getUserId()); //商场编码 + advanceEntity.setDealerCode(StringUtil.isBlank(panFactoryOrder.getUserId())?"":panFactoryOrder.getUserId()); //商场编码 advanceEntity.setDueDate(""); // 交期 advanceEntity.setIsOpai(0); //是否干仓配 advanceEntity.setOrderNum("");//MSCS订单号 可以为空 - advanceEntity.setCarrierName("汇通物流");//承运商 可以为空 - advanceEntity.setCustomerName(panFactoryOrder.getCustomerName()); //顾客名称 - advanceEntity.setCustomerPhone(panFactoryOrder.getCustomerNumber()); // 顾客电话 - advanceEntity.setCustomerRoad(panFactoryOrder.getCustomerAddress());//顾客地址 + advanceEntity.setCarrierName("汇通");//承运商 可以为空 + advanceEntity.setCustomerName(StringUtil.isBlank(panFactoryOrder.getCustomerName())?"":panFactoryOrder.getCustomerName()); //顾客名称 + advanceEntity.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); // 顾客电话 + advanceEntity.setCustomerRoad(StringUtil.isBlank(panFactoryOrder.getCustomerAddress())?"":panFactoryOrder.getCustomerAddress());//顾客地址 advanceEntity.setSystemType("线上"); //订单类型 advanceEntity.setStoreNo(""); //门店编码 advanceEntity.setStoreName(""); //门店名称 advanceEntity.setSerialKey(""); //序列号 - advanceEntity.setServiceNum(panFactoryOrder.getServiceNum()); //服务号 + advanceEntity.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum()); //服务号 advanceEntity.setMatingCode("");//齐套模式 可以为空 advanceEntity.setContractNum("");//合同号 可以为空 advanceEntity.setLeaveBehind("");//遗留:Y=是,N=否 - advanceEntity.setSenderMobile(panFactoryOrder.getSenderMobile());//发货人电话 可以为空 - advanceEntity.setSenderAddress(panFactoryOrder.getSenderAddress()); //发货地址 可以为空 - advanceEntity.setSenderName(panFactoryOrder.getSendFactory()); //发货工厂名称 可以为空 - advanceEntity.setAdministratorsId(1073);// 导入人 + advanceEntity.setSenderMobile(StringUtil.isBlank(panFactoryOrder.getSenderMobile())?"":panFactoryOrder.getSenderMobile());//发货人电话 可以为空 + advanceEntity.setSenderAddress(StringUtil.isBlank(panFactoryOrder.getSenderAddress())?"":panFactoryOrder.getSenderAddress()); //发货地址 可以为空 + advanceEntity.setSenderName(StringUtil.isBlank(panFactoryOrder.getSendFactory())?"":panFactoryOrder.getSendFactory()); //发货工厂名称 可以为空 + advanceEntity.setAdministratorsId(0);// 导入人 advanceEntity.setCreateTime(LocalDate.now()); //添加时间 - advanceEntity.setCarsNum(panFactoryOrder.getDeliveryNumber()); //派车单--snm 可以为空 + advanceEntity.setCarsNum(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber()); //派车单--snm 可以为空 advanceEntity.setDeleteTime(0); // 删除时间 advanceEntity.setWaybillNo("");//运单号 可以为空 - advanceEntity.setWarehouseId(0); //导入人仓库id TODO 通过映射去查 + Integer id = PanFactoryEnum.getId(panFactoryOrder.getPlantId()); + advanceEntity.setWarehouseId(id); //导入人仓库id advanceEntity.setWaybillStatus(Byte.parseByte("1"));//开单状态:1=未开单,2=已开单 advanceEntity.setOldId(0);// advanceEntity.setFreeze(Byte.parseByte("1"));//冻结状态:1=正常,2=冻结 @@ -116,10 +120,11 @@ public class AsyncDataServiceImpl implements IAsyncDataService { //通过订单id查询对应的包件 QueryWrapper packageQueryWrapper = new QueryWrapper<>(); - orderQueryWrapper.eq("order_id",orderId) + packageQueryWrapper.eq("order_id",orderId) .eq("is_deleted",0); List packages = panPackageInfoService.list(packageQueryWrapper); for(PanPackageInfo panPackageInfo:packages){ + Long packageId = panPackageInfo.getId(); //添加订单明细 AdvanceDetailEntity advanceDetailEntity = new AdvanceDetailEntity(); advanceDetailEntity.setAdvanceId(advanceId);//预仓id @@ -133,24 +138,24 @@ public class AsyncDataServiceImpl implements IAsyncDataService { advanceDetailEntity.setOrderNum("");//MSCS单号 可以为空 advanceDetailEntity.setIsOpai(0);//是否干仓配:1=是,0=否 advanceDetailEntity.setMtdsNo("");//MTDS单号 可以为空 - advanceDetailEntity.setFirstPackName(panPackageInfo.getFirstPackName());//一级品类 - advanceDetailEntity.setFirstPackCode(panPackageInfo.getFirstPackCode());//二级品类 - advanceDetailEntity.setSiteName("Objects.isNull(stationlinenumEntity) ? null : stationlinenumEntity.getLogisticsLineName()");//基地名称 基地 TODO 通过工厂id映射 + advanceDetailEntity.setFirstPackName(StringUtil.isBlank(panPackageInfo.getFirstPackName())?"":panPackageInfo.getFirstPackName());//一级品类 + advanceDetailEntity.setFirstPackCode(StringUtil.isBlank(panPackageInfo.getFirstPackCode())?"":panPackageInfo.getFirstPackCode());//二级品类 + advanceDetailEntity.setSiteName(PanFactoryEnum.getMes(panPackageInfo.getPlantId()));//基地名称 基地 advanceDetailEntity.setSiteCode("");//基地编码 - advanceDetailEntity.setProductCode(panPackageInfo.getProductCode());//货品名称 可以为空 - advanceDetailEntity.setSecondPackName(panPackageInfo.getSecondPackName());//二级品类名称 - advanceDetailEntity.setSecondPackCode(panPackageInfo.getSecondPackCode());//二级品类 - advanceDetailEntity.setThirdPackName(panPackageInfo.getThirdPackName());//三级品类名称 - advanceDetailEntity.setThirdPackCode(panPackageInfo.getThirdPackCode());//三级品类 + advanceDetailEntity.setProductCode(StringUtil.isBlank(panPackageInfo.getProductCode())?"":panPackageInfo.getProductCode());//货品名称 可以为空 + advanceDetailEntity.setSecondPackName(StringUtil.isBlank(panPackageInfo.getSecondPackName())?"":panPackageInfo.getSecondPackName());//二级品类名称 + advanceDetailEntity.setSecondPackCode(StringUtil.isBlank(panPackageInfo.getSecondPackCode())?"":panPackageInfo.getSecondPackCode());//二级品类 + advanceDetailEntity.setThirdPackName(StringUtil.isBlank(panPackageInfo.getThirdPackName())?"":panPackageInfo.getThirdPackName());//三级品类名称 + advanceDetailEntity.setThirdPackCode(StringUtil.isBlank(panPackageInfo.getThirdPackCode())?"":panPackageInfo.getThirdPackCode());//三级品类 advanceDetailEntity.setGoodName("");//v产品类型 可以为空 advanceDetailEntity.setIsAddin("Y");//例放:N=正常,Y=例放 advanceDetailEntity.setIsThirdAddin("N");//三级例放:N=正常,Y=例放 advanceDetailEntity.setIsSuppin("N");//补进:N=正常,Y=例放 - advanceDetailEntity.setMscsNum(panPackageInfo.getProductNum()+"");//发货数量 + advanceDetailEntity.setMscsNum(Objects.isNull(panPackageInfo.getProductNum())?"1":panPackageInfo.getProductNum()+"");//发货数量 advanceDetailEntity.setMtdsNum(0);//销售数量 advanceDetailEntity.setVolume("");//体积 - advanceDetailEntity.setUnitNo(panPackageInfo.getUnitNo());//包条码 - advanceDetailEntity.setMctsTruck(panFactoryOrder.getDeliveryNumber());//车次号 + advanceDetailEntity.setUnitNo(StringUtil.isBlank(panPackageInfo.getUnitNo())?"":panPackageInfo.getUnitNo());//包条码 + advanceDetailEntity.setMctsTruck(StringUtil.isBlank(panFactoryOrder.getDeliveryNumber())?"":panFactoryOrder.getDeliveryNumber());//车次号 advanceDetailEntity.setMctsTruckNo("");//车牌号 advanceDetailEntity.setDate100(null);//基地发货日期 advanceDetailEntity.setDate2("");//预约到厂时间 @@ -160,14 +165,14 @@ public class AsyncDataServiceImpl implements IAsyncDataService { advanceDetailEntity.setDate6("");//车辆离厂时间 advanceDetailEntity.setCreateTime(LocalDate.now());//创建时间 advanceDetailEntity.setDeleteTime(0);//删除时间 - advanceDetailEntity.setServiceNum(panFactoryOrder.getServiceNum());//服务号 + advanceDetailEntity.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum());//服务号 advanceDetailEntity.setAdmin("");// advanceDetailEntity.setAdministratorsId(0);//导入人 // advanceDetailEntity.setDueDate(0);//交期 advanceDetailEntity.setRemark("");//备注 advanceDetailEntity.setOldId(0);// - boolean b = advanceDetailClient.addAdvanceDetail(advanceDetailEntity); - if(b){ + Integer detailId = advanceDetailClient.addAdvanceDetail(advanceDetailEntity); + if(detailId > 0){ //修改数据状态 panPackageInfo.setStatus(0); panPackageInfoService.saveOrUpdate(panPackageInfo); @@ -175,31 +180,47 @@ public class AsyncDataServiceImpl implements IAsyncDataService { panPackageInfo.setStatus(2); panPackageInfoService.saveOrUpdate(panPackageInfo); } - Integer detailId = advanceDetailEntity.getId(); //查询包件明细 -// List saveList = new ArrayList<>(); -// QueryWrapper listQueryWrapper = new QueryWrapper<>(); -// orderQueryWrapper.eq("package_id",detailId) -// .eq("is_deleted",0); -// List lists = panPackageListService.list(listQueryWrapper); -// for (PanPackageList panPackageList:lists){ -// DetailProductEntity detailProductEntity = new DetailProductEntity(); -// detailProductEntity.setUnitNo(panPackageInfo.getUnitNo()); -// detailProductEntity.setProductcode(panPackageList.get); -// -// } - + List saveList = new ArrayList<>(); + QueryWrapper listQueryWrapper = new QueryWrapper<>(); + listQueryWrapper.eq("package_id",packageId) + .eq("is_deleted",0); + List lists = panPackageListService.list(listQueryWrapper); + for (PanPackageList panPackageList:lists){ + DetailProductEntity detailProductEntity = new DetailProductEntity(); + detailProductEntity.setUnitNo(panPackageInfo.getUnitNo()); + detailProductEntity.setProductcode(StringUtil.isBlank(panPackageList.getProsBarcode())?"":panPackageList.getProsBarcode()); + detailProductEntity.setProductname(StringUtil.isBlank(panPackageList.getBoardName())?"":panPackageList.getBoardName()); + detailProductEntity.setSalenum(0); + detailProductEntity.setDelivernum(Objects.isNull(panPackageList.getQuantity())?0:panPackageList.getQuantity()); + detailProductEntity.setProducttype(""); + detailProductEntity.setBuyTime(""); + detailProductEntity.setAdministratorsId(0); + detailProductEntity.setDeleteTime(0); + detailProductEntity.setCreateTime(LocalDate.now()); + saveList.add(detailProductEntity); + } + if(saveList.size()>0){ + boolean flag = detailProductClient.addDetailProductList(saveList); + UpdateWrapper listUpdateWrapper = new UpdateWrapper<>(); + if(!flag){ + listUpdateWrapper.set("status",2).eq("package_id",packageId).eq("is_deleted",0); + }else{ + listUpdateWrapper.set("status",0).eq("package_id",packageId).eq("is_deleted",0); + } + panPackageListService.update(listUpdateWrapper); + } } ServiceNumEntity serviceNum = new ServiceNumEntity(); - serviceNum.setServiceNum(panFactoryOrder.getServiceNum()); //服务号 + serviceNum.setServiceNum(StringUtil.isBlank(panFactoryOrder.getServiceNum())?"":panFactoryOrder.getServiceNum()); //服务号 serviceNum.setTotal("1"); //订单数量 - serviceNum.setDetailTotal(panFactoryOrder.getServiceCount()+""); // 包数量 - serviceNum.setStoreName(panFactoryOrder.getUserName()); //商场名 + serviceNum.setDetailTotal(Objects.isNull(panFactoryOrder.getServiceCount())?"":panFactoryOrder.getServiceCount()+""); // 包数量 + serviceNum.setStoreName(StringUtil.isBlank(panFactoryOrder.getUserName())?"":panFactoryOrder.getUserName()); //商场名 serviceNum.setStoreNo(""); // 商场编号 - serviceNum.setCustomerName(panFactoryOrder.getCustomerName()); //顾客姓名 - serviceNum.setCustomerPhone(panFactoryOrder.getCustomerNumber()); //顾客电话 + serviceNum.setCustomerName(StringUtil.isBlank(panFactoryOrder.getCustomerName())?"":panFactoryOrder.getCustomerName());//顾客姓名 + serviceNum.setCustomerPhone(StringUtil.isBlank(panFactoryOrder.getCustomerNumber())?"":panFactoryOrder.getCustomerNumber()); //顾客电话 serviceNum.setCustomerRoad(""); //顾客地址 serviceNum.setIsOpai(1); //是否干仓配 serviceNum.setCompleteSet("V"); //齐套标识:Y=齐套,N=未齐套,V=未知 diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java index ed301d19f..60097cf6e 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/AdvanceDetailClient.java @@ -51,10 +51,11 @@ public class AdvanceDetailClient implements IAdvanceDetailClient { @Override @PostMapping(API_PREFIX + "/addAdvanceDetail") - public boolean addAdvanceDetail(AdvanceDetailEntity advanceDetailEntity) { + public Integer addAdvanceDetail(AdvanceDetailEntity advanceDetailEntity) { //新增数据 System.out.println("AdvanceDetailClient执行了"); - return advanceDetailService.addAdvanceDetail(advanceDetailEntity); + advanceDetailService.addAdvanceDetail(advanceDetailEntity); + return advanceDetailEntity.getId(); } @Override diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/DetailProductClient.java b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/DetailProductClient.java index ec4410e3e..4a5e42cc7 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/DetailProductClient.java +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/DetailProductClient.java @@ -19,11 +19,12 @@ package com.logpm.oldproject.feign; import com.logpm.oldproject.entity.DetailProductEntity; import com.logpm.oldproject.service.IDetailProductService; import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; +import java.util.List; + /** * 包内产品明细 Feign实现类 * @@ -56,4 +57,9 @@ public class DetailProductClient implements IDetailProductClient { return detailProductService.addDetailProduct(detailProductEntity); } + @Override + public Boolean addDetailProductList(List detailProductEntitys) { + return detailProductService.saveBatch(detailProductEntitys); + } + } diff --git a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml index e957a99cc..5f3f110ae 100644 --- a/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml +++ b/blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/AdvanceDetailMapper.xml @@ -78,10 +78,7 @@