diff --git a/blade-biz-common/src/main/java/org/springblade/common/exception/CustomerException.java b/blade-biz-common/src/main/java/org/springblade/common/exception/CustomerException.java
new file mode 100644
index 000000000..99e91ac76
--- /dev/null
+++ b/blade-biz-common/src/main/java/org/springblade/common/exception/CustomerException.java
@@ -0,0 +1,41 @@
+package org.springblade.common.exception;
+
+/**
+ *
+*类说明: 自定义异常
+*
+* @author zhy
+* @date 2023年6月1日
+ */
+public class CustomerException extends RuntimeException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public Integer code;
+
+ public String message;
+
+ public CustomerException() {
+ };
+
+ public CustomerException(String message) {
+ this();
+ this.message = message;
+ }
+
+ public CustomerException(Integer code, String message) {
+ this();
+ this.message = message;
+ this.code = code;
+ }
+ @Override
+ public String toString() {
+ return "CustomerException{" +
+ "code=" + code +
+ ", message='" + message + '\'' +
+ '}';
+ }
+}
+
diff --git a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java
index c9e65ab7f..550295f28 100644
--- a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java
+++ b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java
@@ -19,8 +19,10 @@ package org.springblade.common.utils;
import lombok.extern.log4j.Log4j2;
import org.springframework.util.StringUtils;
+import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
+import java.util.TimeZone;
/**
* 通用工具类
@@ -40,5 +42,27 @@ public class CommonUtil {
return parse;
}
+ public static boolean checkDateFormat(String time,String format){
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format);
+ try{
+ LocalDate.parse(time,formatter);
+ }catch(Exception e){
+ return false;
+ }
+ return true;
+ }
+
+
+ public static String datoLongToString(Long dateTime,String format,String timeZone){
+ if (StringUtils.isEmpty(timeZone)) {
+ timeZone = "Asia/Shanghai";
+ }
+ if (dateTime != null) {
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
+ simpleDateFormat.setTimeZone(TimeZone.getTimeZone(timeZone));
+ return simpleDateFormat.format(dateTime);
+ }
+ return null;
+ }
}
diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStorageServicesEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStorageServicesEntity.java
index 67c755c16..59514f90a 100644
--- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStorageServicesEntity.java
+++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataStorageServicesEntity.java
@@ -16,6 +16,7 @@
*/
package com.logpm.basicdata.entity;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import io.swagger.annotations.ApiModel;
@@ -66,6 +67,11 @@ public class BasicdataStorageServicesEntity extends TenantEntity {
*/
@ApiModelProperty(value = "门店ID")
private Long shopId;
+ /**
+ * 区分类型
+ */
+ @ApiModelProperty(value = "区分类型")
+ private Long distinguish;
/**
* 发货单位
*/
@@ -77,4 +83,11 @@ public class BasicdataStorageServicesEntity extends TenantEntity {
@ApiModelProperty(value = "服务仓库")
private String warehouseService;
+ /**
+ * 门店ID
+ */
+ @ApiModelProperty(value = "门店ID")
+ @TableField(exist = false)
+ private String shopIds;
+
}
diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataSupportValueEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataSupportValueEntity.java
index b5cf7fe5a..7427992f2 100644
--- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataSupportValueEntity.java
+++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataSupportValueEntity.java
@@ -41,6 +41,11 @@ public class BasicdataSupportValueEntity extends TenantEntity {
*/
@ApiModelProperty(value = "收货用户名称")
private String userName;
+ /**
+ * 价格区间
+ */
+ @ApiModelProperty(value = "价格区间")
+ private String priceRange;
/**
* 保费率
*/
diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataStorageServicesMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataStorageServicesMapper.xml
index 0d245238a..2e2cb8707 100644
--- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataStorageServicesMapper.xml
+++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataStorageServicesMapper.xml
@@ -18,6 +18,7 @@
lbss.is_deleted = 0
and lbs.store_name like concat('%',#{param.shopId},'%')
+ and lbss.shop_id = #{param.shopIds}
and lbsc.linkman like concat('%',#{param.forwardingUnit} ,'%')
and lbss.warehouse_service like concat('%',#{param.warehouseService},'%')
diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/FactoryApplication.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/FactoryApplication.java
index c6ed8056c..d5181a390 100644
--- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/FactoryApplication.java
+++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/FactoryApplication.java
@@ -16,7 +16,6 @@
*/
package com.logpm.factory;
-import org.springblade.common.constant.LauncherConstant;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.core.cloud.client.BladeCloudApplication;
import org.springblade.core.launch.BladeApplication;
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 c79301c25..122130ee7 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
@@ -1,7 +1,7 @@
package com.logpm.factory.jobhandler;
import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.factory.snm.dto.GroupByPackagesDTO;
import com.logpm.factory.snm.entity.OrderLogEntity;
@@ -18,16 +18,21 @@ import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor;
+import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springblade.common.constant.LogpmDataStatusEnum;
import org.springblade.common.constant.PackagesTypeEnum;
+import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@@ -37,7 +42,7 @@ import java.util.stream.Collectors;
* 开发步骤:
* 1、在Spring Bean实例中,开发Job方法,方式格式要求为 "public ReturnT execute(String param)"
* 2、为Job方法添加注解 "@XxlJob(value="自定义jobhandler名称", init = "JobHandler初始化方法", destroy = "JobHandler销毁方法")",注解value值对应的是调度中心新建任务的JobHandler属性的值。
- * 3、执行日志:需要通过 "//XxlJobLogger.log" 打印执行日志;
+ * 3、执行日志:需要通过 "XxlJobLogger.log" 打印执行日志;
*
* @author xuxueli
*/
@@ -69,20 +74,57 @@ public class FactoryXxlJob {
@XxlJob("factoryJobHandler")
public ReturnT factoryJobHandler(String param) throws Exception {
// 获取当前时间
- LocalDate date;
+ LocalDate date = LocalDate.now();
List ls = stationlinenumService.lambdaQuery().eq(StationlinenumEntity::getIsDeleted, 0).eq(StationlinenumEntity::getStatus, LogpmDataStatusEnum.OPEN.getValue()).list();
if (!ObjectUtils.isEmpty(ls)) {
- if (StringUtils.isNotBlank(param)) {
- date = LocalDate.parse(param);
- } else {
- date = LocalDate.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+ String startTime;
+ String endTime;
+ int type = 1;
+ if (StringUtils.isNotBlank(param)){
+ String[] split = param.split("/");
+ if(split.length == 2){
+ startTime = split[0];
+ endTime = split[1];
+ }else{
+ throw new CustomerException(401,"参数传入有误!");
+ }
+ //判断时间格式是否正确
+ boolean flagStart = CommonUtil.checkDateFormat(startTime,"yyyy-MM-dd HH:mm:ss");
+ boolean flagEnd = CommonUtil.checkDateFormat(endTime,"yyyy-MM-dd HH:mm:ss");
+ if(!flagStart || !flagEnd){
+ throw new CustomerException(401,"参数传入有误!");
+ }
+ //设置类型为2手动
+ type = 2;
+ }else{
+ //如果参数传入为空就用当前时间作为结束时间,上一次拉取的最后一条数的结束时间为本次的开始时间
+ endTime = LocalDateTime.now().format(formatter);
+ //获取最后一条数据
+ OrderLogEntity lastOne = orderLogService.selectOrderLogLastOne();
+ if (Objects.isNull(lastOne)){
+ //如果为空就暂时还没有拉取过的数据就用当天的0点为开始时间
+ Long zeroTime = LocalDate.now()
+ .atStartOfDay(ZoneOffset.ofHours(8))
+ .toInstant()
+ .toEpochMilli();
+ startTime = CommonUtil.datoLongToString(zeroTime, "yyyy-MM-dd HH:mm:ss", null);
+ }else{
+ //如果不为空则开始时间为上一条数据的结束时间
+ String reqArgs = lastOne.getReqArgs();
+ JSONObject jsonObject = JSONObject.parseObject(reqArgs);
+ startTime = jsonObject.getJSONObject("data").getString("dispatch_time_end");
+ }
}
+
//查询配置站点
+ int finalType = type;
ls.forEach(stationlinenumEntity -> {
// 根据站点id和当前时间调用service 请求对方接口获取数据插入到我们的数据库
- //XxlJobLogger.log("站点线路编号{}", stationlinenumEntity.getLogisticsLineNumber());
- orderService.synOrderByLineNumData(stationlinenumEntity.getLogisticsLineNumber(), date);
+ XxlJobLogger.log("站点线路编号{}", stationlinenumEntity.getLogisticsLineNumber());
+ orderService.synOrderByLineNumData(stationlinenumEntity.getLogisticsLineNumber(), startTime,endTime, finalType);
});
}
return ReturnT.SUCCESS;
@@ -97,25 +139,21 @@ public class FactoryXxlJob {
// 获取请求日志 按照状态来识别
List ls = orderLogService.lambdaQuery().eq(OrderLogEntity::getType, 1).eq(OrderLogEntity::getStatus, 1).list();
-// //XxlJobLogger.log("日志集合 {}", ls);
+ XxlJobLogger.log("日志集合 {}", ls);
// 查询所有的数据库内容 只包含客户单号
List allDataList = stationOrderService.lambdaQuery().select(StationOrderEntity::getTcWlb008).list();
- XxlJobLogger.log("allDataList{}", allDataList.size());
-
List newList = new ArrayList<>();
- if (allDataList.size() != 0) {
- newList.addAll(allDataList.stream().map(StationOrderEntity::getTcWlb008).collect(Collectors.toList()));
- XxlJobLogger.log("newList{}", newList.size());
-
+ if(allDataList.size()!=0){
+ newList.addAll(allDataList.stream().map(StationOrderEntity::getTcWlb008).collect(Collectors.toList())) ;
}
- //XxlJobLogger.log("目前存在的数据 {}", newList);
+ XxlJobLogger.log("目前存在的数据 {}", newList);
// 解析数据
ls.forEach(orderLogEntity -> {
- //XxlJobLogger.log("日志对象 {}", orderLogEntity);
+ XxlJobLogger.log("日志对象 {}", orderLogEntity);
Map map = orderService.dataRelative(orderLogEntity);
List dataList = map.get(StationOrderEntity.class.getName());
- if (dataList.size() == 0) {
- //XxlJobLogger.log("本次解析操作没有数据");
+ if(dataList.size()==0){
+ XxlJobLogger.log("本次解析操作没有数据");
//更新数据库请求日志状态
orderLogEntity.setStatus(0);
orderLogService.updateById(orderLogEntity);
@@ -124,56 +162,32 @@ public class FactoryXxlJob {
dataList = checkDataExit(dataList, newList);
if (dataList != null && dataList.size() != 0) {
- //XxlJobLogger.log("保存对象StationOrderEntity {}", dataList);
+ XxlJobLogger.log("保存对象StationOrderEntity {}", dataList);
stationOrderService.saveBatch(dataList);
}
- //XxlJobLogger.log("日志对象 {}", dataList.get(0).getId());
+ XxlJobLogger.log("日志对象 {}", dataList.get(0).getId());
List staorderPackagesEntityList = map.get(StaorderPackagesEntity.class.getName());
List allDataStaorderPackagesEntity = staorderPackagesService.lambdaQuery().select(StaorderPackagesEntity::getTcPoa014).list();
List allStaorderPackagesEntityUnionId = allDataStaorderPackagesEntity.stream().map(StaorderPackagesEntity::getTcPoa014).collect(Collectors.toList());
-
-
-
- allStaorderPackagesEntityUnionId.forEach(t->{
- for (int i = 0; i < staorderPackagesEntityList.size(); i++) {
- if(staorderPackagesEntityList.get(i).getTcPoa014().equals(t)){
- staorderPackagesEntityList.remove(i);
- }
+ for (int i = 0; i < staorderPackagesEntityList.size(); i++) {
+ // 找到相同的ID 跳过
+ if (allStaorderPackagesEntityUnionId.contains(staorderPackagesEntityList.get(i).getTcPoa014())) {
+ staorderPackagesEntityList.remove(i);
+ continue;
}
- });
- dataList.forEach(v->{
- for (int i = 0; i < staorderPackagesEntityList.size(); i++) {
- if(staorderPackagesEntityList.get(i).getTcPoa014().equals(v.getTcWlb008())){
- staorderPackagesEntityList.get(i).setOrderId(v.getId());
+ // 为包件信息增加订单ID
+ for (int j = 0; j < dataList.size(); j++) {
+ if (staorderPackagesEntityList.get(i).getTcPoa014().equals(dataList.get(j).getTcWlb008())) {
+ staorderPackagesEntityList.get(i).setOrderId(dataList.get(j).getId());
+ break;
}
}
- });
-
-
-
-// for (int i = 0; i < staorderPackagesEntityList.size(); i++) {
-// // 找到相同的ID 跳过
-// if (allStaorderPackagesEntityUnionId.contains(staorderPackagesEntityList.get(i).getTcPoa014())) {
-// staorderPackagesEntityList.remove(i);
-// continue;
-// }
-// // 为包件信息增加订单ID
-// for (int j = 0; j < dataList.size(); j++) {
-// if (staorderPackagesEntityList.get(i).getTcPoa014().equals(dataList.get(j).getTcWlb008())) {
-// staorderPackagesEntityList.get(i).setOrderId(dataList.get(j).getId());
-// break;
-// }
-// }
-//
-// }
-
-
-
+ }
// 插入数据库
if (staorderPackagesEntityList != null && staorderPackagesEntityList.size() != 0) {
- //XxlJobLogger.log("保存对象StaorderPackagesEntity {}", staorderPackagesEntityList);
+ XxlJobLogger.log("保存对象StaorderPackagesEntity {}", staorderPackagesEntityList);
staorderPackagesService.saveBatch(staorderPackagesEntityList);
}
@@ -189,7 +203,7 @@ public class FactoryXxlJob {
@Transactional(rollbackFor = Exception.class)
public Boolean resoveFactoryData() {
- Map> map = new HashMap<>();
+ Map> map = new HashMap<>();
//TODO 调用Service 获取需要处理的数据
//查询要处理的订单信息
List stationOrderList = stationOrderService.list(Wrappers.query().lambda()
@@ -199,33 +213,33 @@ public class FactoryXxlJob {
//TODO 获取老系统中存在的数据 与当前需要处理的数据进行判断是否存在重复
AdvanceDTO advanceDTO = new AdvanceDTO();
List queryData = iAdvanceClient.getQueryData(advanceDTO);
- if (queryData.size() > 0) {
- queryData.forEach(it -> {
+ if(queryData.size() > 0){
+ queryData.forEach( it ->{
StationOrderEntity stationOrderEntity = collect.get(it.getOrderSelfNum());
- if (ObjectUtil.isNotNull(stationOrderEntity)) {
+ if(ObjectUtil.isNotNull(stationOrderEntity)){
collect.remove(it.getOrderSelfNum());
}
});
}
Map longIntegerMap = new HashMap<>(); //订单ID
List list = new ArrayList<>(); // 服务号 自编码
- if (collect.size() > 0) {
- collect.forEach((k, v) -> {
+ if(collect.size() > 0){
+ collect.forEach((k,v) ->{
List staorderPackagesList = staorderPackagesService.list(Wrappers.query().lambda()
.eq(StaorderPackagesEntity::getIdentification, "2")
- .eq(StaorderPackagesEntity::getOrderId, k)
+ .eq(StaorderPackagesEntity::getOrderId,k)
);
- if (staorderPackagesList.size() > 0) {
- map.put(k, staorderPackagesList);
+ if(staorderPackagesList.size() > 0){
+ map.put(k,staorderPackagesList);
}
//查询基地名称
- StationlinenumEntity stationlinenumEntity = stationlinenumService.selectNameByNumber(v.getTcWlb006());
+ StationlinenumEntity stationlinenumEntity = stationlinenumService.selectNameByNumber(","+v.getTcWlb006()+",");
String siteName = Objects.isNull(stationlinenumEntity) ? null : stationlinenumEntity.getLogisticsLineName();
Integer warehouseId = warehouseClient.selectIdByName(siteName);
- logger.info("###########resoveFactoryData: warehouseId={}", warehouseId);
+ logger.info("###########resoveFactoryData: warehouseId={}",warehouseId);
//添加订单信息
- AdvanceEntity advanceEntity = new AdvanceEntity();
+ AdvanceEntity advanceEntity = new AdvanceEntity();
advanceEntity.setOrderSelfNum(v.getTcWlb008()); //订单自编号
advanceEntity.setSiteName(siteName); // 基地
advanceEntity.setArea(""); // 区域
@@ -262,79 +276,79 @@ public class FactoryXxlJob {
advanceEntity.setCarsNum(v.getTcWla001()); //派车单--snm 可以为空
advanceEntity.setDeleteTime(0); // 删除时间
advanceEntity.setWaybillNo("");//运单号 可以为空
- advanceEntity.setWarehouseId(Objects.isNull(warehouseId) ? 0 : warehouseId); //导入人仓库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=冻结
advanceEntity.setDeleteReason("");//删除原因
advanceEntity.setDeleteAdministratorsId(0);//删除用户
Integer integer = iAdvanceClient.addAdvanceClient(advanceEntity);
- if (integer > 0) {
+ if (integer > 0){
//订单id
- longIntegerMap.put(k, integer);
+ longIntegerMap.put(k,integer);
// longIntegerMap.put(k,advanceEntity.getId());
}
});
//TODO 插入到老系统的的数据库
- map.forEach((k, v) -> {
- StationOrderEntity stationOrderEntity = collect.get(k); // 订单
- Integer aLong = longIntegerMap.get(k);//订单ID
-
- //查询基地名称
- StationlinenumEntity stationlinenumEntity = stationlinenumService.selectNameByNumber(stationOrderEntity.getTcWlb006());
-
- List 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);//导入人
+ map.forEach((k,v) ->{
+ StationOrderEntity stationOrderEntity = collect.get(k); // 订单
+ Integer aLong = longIntegerMap.get(k);//订单ID
+
+ //查询基地名称
+ StationlinenumEntity stationlinenumEntity = stationlinenumService.selectNameByNumber(","+stationOrderEntity.getTcWlb006()+",");
+
+ List 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();
@@ -349,35 +363,36 @@ public class FactoryXxlJob {
// 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(stationOrderEntity.getOcc02()); //商场名
- serviceNum.setStoreNo(""); // 商场编号
- serviceNum.setCustomerName(stationOrderEntity.getTcWlb010()); //顾客姓名
- serviceNum.setCustomerPhone(stationOrderEntity.getTcWlb011()); //顾客电话
- serviceNum.setCustomerRoad(""); //顾客地址
- serviceNum.setIsOpai(1); //是否干仓配
- serviceNum.setCompleteSet("V"); //齐套标识:Y=齐套,N=未齐套,V=未知
+// XxlJobLogger.log("addDetailProduct 添加状态 {}", aBoolean11);
+
+
+
+ ServiceNumEntity serviceNum = new ServiceNumEntity();
+ serviceNum.setServiceNum(stationOrderEntity.getTcWlb007()); //服务号
+ serviceNum.setTotal(stationOrderEntity.getTcWlb009().toString()); //订单数量
+ serviceNum.setDetailTotal(stationOrderEntity.getTcWlb009().toString()); // 包数量
+ serviceNum.setStoreName(stationOrderEntity.getOcc02()); //商场名
+ serviceNum.setStoreNo(""); // 商场编号
+ serviceNum.setCustomerName(stationOrderEntity.getTcWlb010()); //顾客姓名
+ serviceNum.setCustomerPhone(stationOrderEntity.getTcWlb011()); //顾客电话
+ serviceNum.setCustomerRoad(""); //顾客地址
+ serviceNum.setIsOpai(1); //是否干仓配
+ serviceNum.setCompleteSet("V"); //齐套标识:Y=齐套,N=未齐套,V=未知
// serviceNum.setCreateTime(LocalDate.now());
- serviceNum.setDeleteTime(0);
- list.add(serviceNum);
- v.forEach(it -> {
- it.setIdentification("1");
- staorderPackagesService.updateById(it);
- });
+ serviceNum.setDeleteTime(0);
+ list.add(serviceNum);
+ v.forEach(it ->{
+ it.setIdentification("1");
+ staorderPackagesService.updateById(it);
+ });
- });
- //添加服务号和订单自编号表
+ });
+ //添加服务号和订单自编号表
Boolean aBoolean123 = serviceNumClient.addServiceNum(list);
- //XxlJobLogger.log("addServiceNum添加状态 {}", aBoolean123);
+ XxlJobLogger.log("addServiceNum添加状态 {}", aBoolean123);
//修改提交状态
- stationOrderList.forEach(it -> {
+ stationOrderList.forEach(it ->{
it.setIdentification("1");
stationOrderService.updateById(it);
});
@@ -387,18 +402,12 @@ public class FactoryXxlJob {
}
private List checkDataExit(List dataList, List allDataList) {
- allDataList.forEach(t -> {
- for (int i = 0; i < dataList.size(); i++) {
- if (dataList.get(i).getTcWlb008().equals(t)) {
- dataList.remove(i);
- }
+ for (int i = 0; i < dataList.size(); i++) {
+ if (allDataList.contains(dataList.get(i).getTcWlb008())) {
+ // 如果存在 需要移除
+ dataList.remove(i);
}
- });
-// for (int i = 0; i < dataList.size(); i++) {
-// if (allDataList.contains(dataList.get(i).getTcWlb008())) {
-// dataList.remove(i);
-// }
-// }
+ }
return dataList;
}
diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderLogMapper.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderLogMapper.java
index bc3ecb458..518ff8ac3 100644
--- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderLogMapper.java
+++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderLogMapper.java
@@ -40,4 +40,5 @@ public interface OrderLogMapper extends BaseMapper {
List selectOrderLogPage(IPage page, OrderLogVO orderLog);
+ OrderLogEntity selectOrderLogLastOne();
}
diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderLogMapper.xml b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderLogMapper.xml
index 15bb974e9..bc6f41da1 100644
--- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderLogMapper.xml
+++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/mapper/OrderLogMapper.xml
@@ -23,4 +23,8 @@
+
+
diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderLogService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderLogService.java
index 72a41c7bf..da5770c5f 100644
--- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderLogService.java
+++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderLogService.java
@@ -39,4 +39,6 @@ public interface IOrderLogService extends BaseService {
IPage selectOrderLogPage(IPage page, OrderLogVO orderLog);
+ OrderLogEntity selectOrderLogLastOne();
+
}
diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderService.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderService.java
index 5c6d2b7f3..2d9081461 100644
--- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderService.java
+++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/IOrderService.java
@@ -1,10 +1,8 @@
package com.logpm.factory.snm.service;
import com.logpm.factory.snm.entity.OrderLogEntity;
-import com.logpm.factory.snm.entity.StationOrderEntity;
import com.logpm.factory.snm.vo.response.ResponseBaseVo;
-import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@@ -18,10 +16,9 @@ public interface IOrderService {
* 获取数据
*
* @param lineNum
- * @param date
* @return
*/
- ResponseBaseVo synOrderByLineNumData(String lineNum, LocalDate date);
+ ResponseBaseVo synOrderByLineNumData(String lineNum, String startTime,String endTime,Integer type);
/**
* 解析数据
diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/OrderLogServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/OrderLogServiceImpl.java
index a43405e59..fe75f3ae0 100644
--- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/OrderLogServiceImpl.java
+++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/snm/service/impl/OrderLogServiceImpl.java
@@ -38,5 +38,10 @@ public class OrderLogServiceImpl extends BaseServiceImpl requestVo = new RequestVo();
requestVo.setMethod("snimay.crm.externalinterface.logistics.get");
@@ -64,8 +59,8 @@ public class OrderServiceImpl implements IOrderService {
Date now = new Date();
requestLineNumberVo.setLogistics_line_number(lineNum);
- requestLineNumberVo.setDispatch_time_start(dayDate);
- requestLineNumberVo.setDispatch_time_end(dayDate);
+ requestLineNumberVo.setDispatch_time_start(startTime);
+ requestLineNumberVo.setDispatch_time_end(endTime);
SystemSign systemSign = new SystemSign();
systemSign.setTimestamp(now.getTime());
systemSign.setPublicKey(factorySnmdataProperties.getPublicKey());
@@ -94,7 +89,7 @@ public class OrderServiceImpl implements IOrderService {
OrderLogEntity orderLogEntity = new OrderLogEntity();
orderLogEntity.setReqArgs(userStr);
- orderLogEntity.setType(1);
+ orderLogEntity.setType(type);
orderLogEntity.setResBody(JSONUtil.toJsonStr(responseStationOrderVo));
orderLogService.save(orderLogEntity);
logger.info(">>>>>>>>>>>>>> 数据保存orderLogService{}", orderLogService);