|
|
|
@ -3,35 +3,30 @@ package com.logpm.factory.jobhandler;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.logpm.factory.snm.dto.GroupByPackagesDTO; |
|
|
|
|
import com.logpm.factory.snm.entity.OrderLogEntity; |
|
|
|
|
import com.logpm.factory.snm.entity.StaorderPackagesEntity; |
|
|
|
|
import com.logpm.factory.snm.entity.StationOrderEntity; |
|
|
|
|
import com.logpm.factory.snm.entity.StationlinenumEntity; |
|
|
|
|
import com.logpm.factory.snm.service.*; |
|
|
|
|
import com.logpm.oldproject.dto.AdvanceDTO; |
|
|
|
|
import com.logpm.oldproject.dto.DetailProductDTO; |
|
|
|
|
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.IDetailProductClient; |
|
|
|
|
import com.logpm.oldproject.feign.IServiceNumClient; |
|
|
|
|
import com.logpm.oldproject.feign.*; |
|
|
|
|
import com.xxl.job.core.biz.model.ReturnT; |
|
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob; |
|
|
|
|
import com.xxl.job.core.log.XxlJobLogger; |
|
|
|
|
import io.jsonwebtoken.lang.Strings; |
|
|
|
|
import io.swagger.models.auth.In; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springblade.common.constant.LogpmDataStatusEnum; |
|
|
|
|
import org.springblade.common.constant.PackagesTypeEnum; |
|
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
|
import java.awt.datatransfer.StringSelection; |
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
@ -65,6 +60,7 @@ public class FactoryXxlJob {
|
|
|
|
|
private IAdvanceDetailClient advanceDetailClient; |
|
|
|
|
private IDetailProductClient detailProductClient; |
|
|
|
|
private IServiceNumClient serviceNumClient; |
|
|
|
|
private IWarehouseClient warehouseClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -116,6 +112,9 @@ public class FactoryXxlJob {
|
|
|
|
|
List<StationOrderEntity> dataList = map.get(StationOrderEntity.class.getName()); |
|
|
|
|
if(dataList.size()==0){ |
|
|
|
|
XxlJobLogger.log("本次解析操作没有数据"); |
|
|
|
|
//更新数据库请求日志状态
|
|
|
|
|
orderLogEntity.setStatus(0); |
|
|
|
|
orderLogService.updateById(orderLogEntity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -191,10 +190,16 @@ public class FactoryXxlJob {
|
|
|
|
|
if(staorderPackagesList.size() > 0){ |
|
|
|
|
map.put(k,staorderPackagesList); |
|
|
|
|
} |
|
|
|
|
//查询基地名称
|
|
|
|
|
StationlinenumEntity stationlinenumEntity = stationlinenumService.selectNameByNumber(","+v.getTcWlb006()+","); |
|
|
|
|
String siteName = Objects.isNull(stationlinenumEntity) ? null : stationlinenumEntity.getLogisticsLineName(); |
|
|
|
|
Integer warehouseId = warehouseClient.selectIdByName(siteName); |
|
|
|
|
logger.info("###########resoveFactoryData: warehouseId={}",warehouseId); |
|
|
|
|
|
|
|
|
|
//添加订单信息
|
|
|
|
|
AdvanceEntity advanceEntity = new AdvanceEntity(); |
|
|
|
|
advanceEntity.setOrderSelfNum(v.getTcWlb008()); //订单自编号
|
|
|
|
|
advanceEntity.setSiteName(v.getTcPoa061()); // 基地
|
|
|
|
|
advanceEntity.setSiteName(siteName); // 基地
|
|
|
|
|
advanceEntity.setArea(""); // 区域
|
|
|
|
|
advanceEntity.setOrderTypeName(""); //订单类型名称 可以为空
|
|
|
|
|
advanceEntity.setOrderClassName(""); //订单类型 可以为空
|
|
|
|
@ -204,12 +209,12 @@ public class FactoryXxlJob {
|
|
|
|
|
advanceEntity.setMtdsNo("");// MTDS单号 可以为空
|
|
|
|
|
advanceEntity.setFirstPackName(""); //一级品类
|
|
|
|
|
advanceEntity.setFirstPackCode(""); //一级品类
|
|
|
|
|
advanceEntity.setDealerName(""); //商场名称
|
|
|
|
|
advanceEntity.setDealerName(v.getOcc02()); //商场名称
|
|
|
|
|
advanceEntity.setDealerCode(""); //商场编码
|
|
|
|
|
advanceEntity.setDueDate(""); // 交期
|
|
|
|
|
advanceEntity.setIsOpai(0); //是否干仓配
|
|
|
|
|
advanceEntity.setOrderNum("");//MSCS订单号 可以为空
|
|
|
|
|
advanceEntity.setCarrierName("");//承运商 可以为空
|
|
|
|
|
advanceEntity.setCarrierName(v.getTcBmb003());//承运商 可以为空
|
|
|
|
|
advanceEntity.setCustomerName(v.getTcWlb010()); //顾客名称
|
|
|
|
|
advanceEntity.setCustomerPhone(v.getTcWlb011()); // 顾客电话
|
|
|
|
|
advanceEntity.setCustomerRoad(v.getOcc02());//顾客地址
|
|
|
|
@ -217,19 +222,19 @@ public class FactoryXxlJob {
|
|
|
|
|
advanceEntity.setStoreNo(""); //门店编码
|
|
|
|
|
advanceEntity.setStoreName(v.getOcc02()); //门店名称
|
|
|
|
|
advanceEntity.setSerialKey(""); //序列号
|
|
|
|
|
advanceEntity.setServiceNum(v.getTcWlb007()); //服务号
|
|
|
|
|
advanceEntity.setServiceNum(v.getTcWlb008()); //服务号
|
|
|
|
|
advanceEntity.setMatingCode("");//齐套模式 可以为空
|
|
|
|
|
advanceEntity.setContractNum("");//合同号 可以为空
|
|
|
|
|
advanceEntity.setLeaveBehind("");//遗留:Y=是,N=否
|
|
|
|
|
advanceEntity.setSenderMobile("");//发货人电话 可以为空
|
|
|
|
|
advanceEntity.setSenderAddress(""); //发货地址 可以为空
|
|
|
|
|
advanceEntity.setSenderName(""); //发货工厂名称 可以为空
|
|
|
|
|
advanceEntity.setAdministratorsId(0);// 导入人
|
|
|
|
|
advanceEntity.setAdministratorsId(851);// 导入人
|
|
|
|
|
advanceEntity.setCreateTime(LocalDate.now()); //添加时间
|
|
|
|
|
advanceEntity.setCarsNum(v.getTcWla001()); //派车单--snm 可以为空
|
|
|
|
|
advanceEntity.setDeleteTime(0); // 删除时间
|
|
|
|
|
advanceEntity.setWaybillNo("");//运单号 可以为空
|
|
|
|
|
advanceEntity.setWarehouseId(0); //导入人仓库id
|
|
|
|
|
advanceEntity.setWarehouseId(Objects.isNull(warehouseId)?0:warehouseId); //导入人仓库id
|
|
|
|
|
advanceEntity.setWaybillStatus(Byte.parseByte("1"));//开单状态:1=未开单,2=已开单
|
|
|
|
|
advanceEntity.setOldId(0);//
|
|
|
|
|
advanceEntity.setFreeze(Byte.parseByte("1"));//冻结状态:1=正常,2=冻结
|
|
|
|
@ -244,79 +249,87 @@ public class FactoryXxlJob {
|
|
|
|
|
}); |
|
|
|
|
//TODO 插入到老系统的的数据库
|
|
|
|
|
map.forEach((k,v) ->{ |
|
|
|
|
Integer aLong = longIntegerMap.get(k);//订单ID
|
|
|
|
|
StationOrderEntity stationOrderEntity = collect.get(k); // 订单
|
|
|
|
|
Integer aLong = longIntegerMap.get(k);//订单ID
|
|
|
|
|
|
|
|
|
|
//查询基地名称
|
|
|
|
|
StationlinenumEntity stationlinenumEntity = stationlinenumService.selectNameByNumber(","+stationOrderEntity.getTcWlb006()+","); |
|
|
|
|
|
|
|
|
|
//添加订单明细
|
|
|
|
|
AdvanceDetailEntity advanceDetailEntity = new AdvanceDetailEntity(); |
|
|
|
|
advanceDetailEntity.setAdvanceId(aLong);//预仓id
|
|
|
|
|
advanceDetailEntity.setIsPay(Byte.parseByte("0"));//
|
|
|
|
|
advanceDetailEntity.setLineID("");//线下订单明细标时 可以为空
|
|
|
|
|
advanceDetailEntity.setSerialKey("");//序列号 可以为空
|
|
|
|
|
advanceDetailEntity.setArea("");//区域
|
|
|
|
|
advanceDetailEntity.setOrderSelfNum(stationOrderEntity.getTcWlb008());//订单自编号
|
|
|
|
|
advanceDetailEntity.setType("诗尼曼");//订单来源
|
|
|
|
|
advanceDetailEntity.setSystemType("线上");//订单类型
|
|
|
|
|
advanceDetailEntity.setOrderNum("");//MSCS单号 可以为空
|
|
|
|
|
advanceDetailEntity.setIsOpai(0);//是否干仓配:1=是,0=否
|
|
|
|
|
advanceDetailEntity.setMtdsNo("");//MTDS单号 可以为空
|
|
|
|
|
advanceDetailEntity.setFirstPackName("");//一级品类
|
|
|
|
|
advanceDetailEntity.setFirstPackCode("");//二级品类
|
|
|
|
|
advanceDetailEntity.setSiteName("");//基地名称
|
|
|
|
|
advanceDetailEntity.setSiteCode("");//基地编码
|
|
|
|
|
advanceDetailEntity.setProductCode("");//货品名称 可以为空
|
|
|
|
|
advanceDetailEntity.setSecondPackName("");//二级品类名称
|
|
|
|
|
advanceDetailEntity.setSecondPackCode("");//二级品类
|
|
|
|
|
advanceDetailEntity.setThirdPackName("");//三级品类名称
|
|
|
|
|
advanceDetailEntity.setThirdPackCode("");//三级品类
|
|
|
|
|
advanceDetailEntity.setGoodName("");//v产品类型 可以为空
|
|
|
|
|
advanceDetailEntity.setIsAddin("Y");//例放:N=正常,Y=例放
|
|
|
|
|
advanceDetailEntity.setIsThirdAddin("N");//三级例放:N=正常,Y=例放
|
|
|
|
|
advanceDetailEntity.setIsSuppin("N");//补进:N=正常,Y=例放
|
|
|
|
|
advanceDetailEntity.setMscsNum("");//发货数量
|
|
|
|
|
advanceDetailEntity.setMtdsNum(0);//销售数量
|
|
|
|
|
advanceDetailEntity.setVolume("");//体积
|
|
|
|
|
advanceDetailEntity.setUnitNo("");//包条码
|
|
|
|
|
advanceDetailEntity.setMctsTruck("");//车次号
|
|
|
|
|
advanceDetailEntity.setMctsTruckNo("");//车牌号
|
|
|
|
|
// advanceDetailEntity.setDate100(0);//基地发货日期
|
|
|
|
|
advanceDetailEntity.setDate2("");//预约到厂时间
|
|
|
|
|
advanceDetailEntity.setDate3("");//实际到厂时间
|
|
|
|
|
advanceDetailEntity.setDate4("");//开始装车时间
|
|
|
|
|
advanceDetailEntity.setDate5("");//完成装车时间
|
|
|
|
|
advanceDetailEntity.setDate6("");//车辆离厂时间
|
|
|
|
|
advanceDetailEntity.setCreateTime(LocalDate.now());//创建时间
|
|
|
|
|
advanceDetailEntity.setDeleteTime(0);//删除时间
|
|
|
|
|
advanceDetailEntity.setServiceNum(stationOrderEntity.getTcWlb007());//服务号
|
|
|
|
|
advanceDetailEntity.setAdmin("");//
|
|
|
|
|
advanceDetailEntity.setAdministratorsId(0);//导入人
|
|
|
|
|
List<GroupByPackagesDTO> groupByPackages = staorderPackagesService.selectGroupByLxAndPackNumByOrderId(k); |
|
|
|
|
groupByPackages.forEach(gpd->{ |
|
|
|
|
//添加订单明细
|
|
|
|
|
AdvanceDetailEntity advanceDetailEntity = new AdvanceDetailEntity(); |
|
|
|
|
advanceDetailEntity.setAdvanceId(aLong);//预仓id
|
|
|
|
|
advanceDetailEntity.setIsPay(Byte.parseByte("0"));//
|
|
|
|
|
advanceDetailEntity.setLineID("");//线下订单明细标时 可以为空
|
|
|
|
|
advanceDetailEntity.setSerialKey("");//序列号 可以为空
|
|
|
|
|
advanceDetailEntity.setArea("");//区域
|
|
|
|
|
advanceDetailEntity.setOrderSelfNum(stationOrderEntity.getTcWlb008());//订单自编号
|
|
|
|
|
advanceDetailEntity.setType("诗尼曼");//订单来源
|
|
|
|
|
advanceDetailEntity.setSystemType("线上");//订单类型
|
|
|
|
|
advanceDetailEntity.setOrderNum("");//MSCS单号 可以为空
|
|
|
|
|
advanceDetailEntity.setIsOpai(0);//是否干仓配:1=是,0=否
|
|
|
|
|
advanceDetailEntity.setMtdsNo("");//MTDS单号 可以为空
|
|
|
|
|
advanceDetailEntity.setFirstPackName(PackagesTypeEnum.getMes(gpd.getLx()));//一级品类
|
|
|
|
|
advanceDetailEntity.setFirstPackCode("");//二级品类
|
|
|
|
|
advanceDetailEntity.setSiteName(Objects.isNull(stationlinenumEntity)?null:stationlinenumEntity.getLogisticsLineName());//基地名称
|
|
|
|
|
advanceDetailEntity.setSiteCode("");//基地编码
|
|
|
|
|
advanceDetailEntity.setProductCode("");//货品名称 可以为空
|
|
|
|
|
advanceDetailEntity.setSecondPackName(PackagesTypeEnum.getMes(gpd.getLx()));//二级品类名称
|
|
|
|
|
advanceDetailEntity.setSecondPackCode("");//二级品类
|
|
|
|
|
advanceDetailEntity.setThirdPackName(PackagesTypeEnum.getMes(gpd.getLx()));//三级品类名称
|
|
|
|
|
advanceDetailEntity.setThirdPackCode(gpd.getLx());//三级品类
|
|
|
|
|
advanceDetailEntity.setGoodName("");//v产品类型 可以为空
|
|
|
|
|
advanceDetailEntity.setIsAddin("Y");//例放:N=正常,Y=例放
|
|
|
|
|
advanceDetailEntity.setIsThirdAddin("N");//三级例放:N=正常,Y=例放
|
|
|
|
|
advanceDetailEntity.setIsSuppin("N");//补进:N=正常,Y=例放
|
|
|
|
|
advanceDetailEntity.setMscsNum(gpd.getTotal().toString());//发货数量
|
|
|
|
|
advanceDetailEntity.setMtdsNum(0);//销售数量
|
|
|
|
|
advanceDetailEntity.setVolume("");//体积
|
|
|
|
|
advanceDetailEntity.setUnitNo(gpd.getPackagenum());//包条码
|
|
|
|
|
advanceDetailEntity.setMctsTruck(stationOrderEntity.getTcWla001());//车次号
|
|
|
|
|
advanceDetailEntity.setMctsTruckNo("");//车牌号
|
|
|
|
|
advanceDetailEntity.setDate100(CommonUtil.stringToLocalDate(stationOrderEntity.getTcWla002()));//基地发货日期
|
|
|
|
|
advanceDetailEntity.setDate2("");//预约到厂时间
|
|
|
|
|
advanceDetailEntity.setDate3("");//实际到厂时间
|
|
|
|
|
advanceDetailEntity.setDate4("");//开始装车时间
|
|
|
|
|
advanceDetailEntity.setDate5("");//完成装车时间
|
|
|
|
|
advanceDetailEntity.setDate6("");//车辆离厂时间
|
|
|
|
|
advanceDetailEntity.setCreateTime(LocalDate.now());//创建时间
|
|
|
|
|
advanceDetailEntity.setDeleteTime(0);//删除时间
|
|
|
|
|
advanceDetailEntity.setServiceNum(stationOrderEntity.getTcWlb008());//服务号
|
|
|
|
|
advanceDetailEntity.setAdmin("");//
|
|
|
|
|
advanceDetailEntity.setAdministratorsId(0);//导入人
|
|
|
|
|
// advanceDetailEntity.setDueDate(0);//交期
|
|
|
|
|
advanceDetailEntity.setRemark("");//备注
|
|
|
|
|
advanceDetailEntity.setOldId(0);//
|
|
|
|
|
boolean b = advanceDetailClient.addAdvanceDetail(advanceDetailEntity); |
|
|
|
|
XxlJobLogger.log("addAdvanceDetail 添加状态 {}", b); |
|
|
|
|
advanceDetailEntity.setRemark("");//备注
|
|
|
|
|
advanceDetailEntity.setOldId(0);//
|
|
|
|
|
boolean b = advanceDetailClient.addAdvanceDetail(advanceDetailEntity); |
|
|
|
|
XxlJobLogger.log("addAdvanceDetail 添加状态 {}", b); |
|
|
|
|
}); |
|
|
|
|
// 添加包件信息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DetailProductEntity detailProductEntity = new DetailProductEntity(); |
|
|
|
|
detailProductEntity.setUnitNo("");//包条码
|
|
|
|
|
detailProductEntity.setProductcode("");//货品代码
|
|
|
|
|
detailProductEntity.setProductname("");//货品名称
|
|
|
|
|
detailProductEntity.setSalenum(0);//销售数量
|
|
|
|
|
detailProductEntity.setDelivernum(1);//发货数量
|
|
|
|
|
detailProductEntity.setProducttype("");// 口可以为空
|
|
|
|
|
detailProductEntity.setBuyTime("");//下单日期 可以为空
|
|
|
|
|
detailProductEntity.setCreateTime(LocalDate.now());//创建时间
|
|
|
|
|
detailProductEntity.setAdministratorsId(0);//创建人
|
|
|
|
|
detailProductEntity.setDeleteTime(0);//删除时间
|
|
|
|
|
Boolean aBoolean11 = detailProductClient.addDetailProduct(detailProductEntity); |
|
|
|
|
XxlJobLogger.log("addDetailProduct 添加状态 {}", aBoolean11); |
|
|
|
|
// DetailProductEntity detailProductEntity = new DetailProductEntity();
|
|
|
|
|
// detailProductEntity.setUnitNo("");//包条码
|
|
|
|
|
// detailProductEntity.setProductcode("");//货品代码
|
|
|
|
|
// detailProductEntity.setProductname("");//货品名称
|
|
|
|
|
// detailProductEntity.setSalenum(0);//销售数量
|
|
|
|
|
// detailProductEntity.setDelivernum(1);//发货数量
|
|
|
|
|
// detailProductEntity.setProducttype("");// 口可以为空
|
|
|
|
|
// detailProductEntity.setBuyTime("");//下单日期 可以为空
|
|
|
|
|
// detailProductEntity.setCreateTime(LocalDate.now());//创建时间
|
|
|
|
|
// detailProductEntity.setAdministratorsId(0);//创建人
|
|
|
|
|
// detailProductEntity.setDeleteTime(0);//删除时间
|
|
|
|
|
// Boolean aBoolean11 = detailProductClient.addDetailProduct(detailProductEntity);
|
|
|
|
|
// XxlJobLogger.log("addDetailProduct 添加状态 {}", aBoolean11);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ServiceNumEntity serviceNum = new ServiceNumEntity(); |
|
|
|
|
serviceNum.setServiceNum(stationOrderEntity.getTcWlb007()); //服务号
|
|
|
|
|
serviceNum.setTotal(stationOrderEntity.getTcWlb009().toString()); //订单数量
|
|
|
|
|
serviceNum.setDetailTotal(stationOrderEntity.getTcWlb009().toString()); // 包数量
|
|
|
|
|
serviceNum.setStoreName(""); //商场名
|
|
|
|
|
serviceNum.setStoreName(stationOrderEntity.getOcc02()); //商场名
|
|
|
|
|
serviceNum.setStoreNo(""); // 商场编号
|
|
|
|
|
serviceNum.setCustomerName(stationOrderEntity.getTcWlb010()); //顾客姓名
|
|
|
|
|
serviceNum.setCustomerPhone(stationOrderEntity.getTcWlb011()); //顾客电话
|
|
|
|
|