From 423e9749d04b1f6d8d8a9a41f0bafd85c7773047 Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Sat, 11 Jun 2022 18:08:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A7=94=E6=89=98=E9=AA=8C=E6=94=B6=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=96=B0=E5=A2=9E=EF=BC=8C=20=E5=8D=95=E6=8D=AE?= =?UTF-8?q?=E6=B5=81=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sync/BasicDowmloadController.java | 5 ++ .../sync/BussinessChangeTypeEntity.java | 25 +++++++ .../admin/entity/sync/EntrustReceEntity.java | 21 ++++++ .../sale/admin/entity/sync/OrderEntity.java | 6 +- .../admin/res/sync/SpsSyncBusResponse.java | 6 +- .../sale/admin/thread/DlAllDataService.java | 74 ++++++++++++------- pom.xml | 5 +- 7 files changed, 108 insertions(+), 34 deletions(-) create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/entity/sync/BussinessChangeTypeEntity.java create mode 100644 api-admin/src/main/java/com/glxp/sale/admin/entity/sync/EntrustReceEntity.java diff --git a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/BasicDowmloadController.java b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/BasicDowmloadController.java index 601d9a0..a1add34 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/BasicDowmloadController.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/controller/sync/BasicDowmloadController.java @@ -73,6 +73,11 @@ public class BasicDowmloadController { } else if (basicExportStatusRequest.getType() == BasicProcessStatus.NEW_ALL_ORDER) {//单据 SpsSyncOrderResponse spsSyncDataResponse = (SpsSyncOrderResponse) redisUtil.get(basicExportStatusRequest.getId() + ""); return ResultVOUtils.success(spsSyncDataResponse); + } else if (basicExportStatusRequest.getType() == BasicProcessStatus.NEW_ALL_UDIS) {//单据 + String data = (String) redisUtil.get(basicExportStatusRequest.getId() + ""); + SpSyncUdiResponse spSyncUdiResponse = JSONObject.parseObject(data, new TypeReference() { + }); + return ResultVOUtils.success(spSyncUdiResponse); } return ResultVOUtils.error(500, "数据不存在!"); diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/BussinessChangeTypeEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/BussinessChangeTypeEntity.java new file mode 100644 index 0000000..19c2fb7 --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/BussinessChangeTypeEntity.java @@ -0,0 +1,25 @@ +package com.glxp.sale.admin.entity.sync; + +import lombok.Data; + +@Data +public class BussinessChangeTypeEntity { + + + private Integer id; + private String intro; + private String action; + private String scAction; + private Integer index; + private Integer beforeTime; + private String remark; + private String name; + private Integer changeType; + + + public Integer getBeforeTime() { + if (beforeTime == null) + return 0; + return beforeTime; + } +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/EntrustReceEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/EntrustReceEntity.java new file mode 100644 index 0000000..ad8559b --- /dev/null +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/EntrustReceEntity.java @@ -0,0 +1,21 @@ +package com.glxp.sale.admin.entity.sync; + +import lombok.Data; + +import java.util.Date; + +@Data +public class EntrustReceEntity { + + private Integer id; + private String action; + private String curInv; + private String entrustInv; + private String entrustUser; + private String userId; + private String entrustAction; + private Date updateTime; + private String remark; + private boolean finishRece; + +} diff --git a/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/OrderEntity.java b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/OrderEntity.java index 84d00f1..a3f19b3 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/OrderEntity.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/entity/sync/OrderEntity.java @@ -6,7 +6,6 @@ import java.util.Date; @Data public class OrderEntity { - private String id; private String corpOrderId; private String action; @@ -46,7 +45,10 @@ public class OrderEntity { private boolean isError; private boolean outChangeEnable; private String originUllageSupNo; - + private Date updateTime; + private boolean preCheck; + //审核时间 + private Date auditTime; } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/res/sync/SpsSyncBusResponse.java b/api-admin/src/main/java/com/glxp/sale/admin/res/sync/SpsSyncBusResponse.java index b775386..961c9ca 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/res/sync/SpsSyncBusResponse.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/res/sync/SpsSyncBusResponse.java @@ -1,8 +1,6 @@ package com.glxp.sale.admin.res.sync; -import com.glxp.sale.admin.entity.sync.BussinessLocalTypeEntity; -import com.glxp.sale.admin.entity.sync.BussinessOriginTypeEntity; -import com.glxp.sale.admin.entity.sync.BussinessTypeEntity; +import com.glxp.sale.admin.entity.sync.*; import lombok.Data; import java.util.List; @@ -15,4 +13,6 @@ public class SpsSyncBusResponse { private List bussinessTypeEntities; private List bussinessOriginTypeEntities; private List bussinessLocalTypeEntities; + private List bussinessChangeTypeEntities; + private List entrustReceEntities; } diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java index af59774..8933180 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java @@ -308,13 +308,33 @@ public class DlAllDataService { if (lastUpdateTime.equals("1949-01-01 00:00:00")) { lastUpdateTime = DateUtil.getBeforeDay(1); } - List mProductInfoEntities = new ArrayList<>(); + //更新产品信息 int page = 1; - int limit = 300; + int limit = 2000; while (true) { List productInfoEntityList = asyncDiDlHelper.dlByTime(page, limit, lastUpdateTime); if (productInfoEntityList != null && productInfoEntityList.size() > 0) { - mProductInfoEntities.addAll(productInfoEntityList); + SpSyncUdiResponse spSyncUdiResponse = new SpSyncUdiResponse(); + spSyncUdiResponse.setProductInfoEntityList(productInfoEntityList); + if (CollUtil.isNotEmpty(spSyncUdiResponse.getProductInfoEntityList()) || CollUtil.isNotEmpty(spSyncUdiResponse.getUdiCompanyEntities())) { + String key = "UdiPrdoucts" + System.currentTimeMillis(); + if (downstream.getParamValue().equals("1")) { + String datas = JSON.toJSON(spSyncUdiResponse).toString(); + redisUtil.set(key, datas); + BasicExportStatusEntity myEntity = new BasicExportStatusEntity(); + myEntity.setId(key); + myEntity.setStatus(0); + myEntity.setUpdateTime(new Date()); + myEntity.setType(BasicProcessStatus.NEW_ALL_UDIS); + basicExportService.insertExportStatus(myEntity); + } else { + String path = getPath(); + String fileName = path + FileConstant.upWaitCopy_products + "UdiPrdoucts_" + key + ".LowerIn"; + String datas = JSON.toJSON(spSyncUdiResponse).toString(); + FileUtils.SaveFileAs(datas, fileName); + } + } + if (productInfoEntityList.size() < limit) { break; } else { @@ -324,14 +344,36 @@ public class DlAllDataService { break; } } + //更新企业信息 - List mUdiCompanyEntities = new ArrayList<>(); int page1 = 1; - int limit1 = 300; + int limit1 = 2000; while (true) { List udiCompanyEntities = asyncDiDlHelper.dlCompanyByTime(page1, limit1, lastUpdateTime); if (udiCompanyEntities != null && udiCompanyEntities.size() > 0) { - mUdiCompanyEntities.addAll(udiCompanyEntities); + + SpSyncUdiResponse spSyncUdiResponse = new SpSyncUdiResponse(); + spSyncUdiResponse.setUdiCompanyEntities(udiCompanyEntities); + if (CollUtil.isNotEmpty(spSyncUdiResponse.getUdiCompanyEntities()) || CollUtil.isNotEmpty(spSyncUdiResponse.getUdiCompanyEntities())) { + String key = "UdiPrdoucts" + System.currentTimeMillis(); + if (downstream.getParamValue().equals("1")) { + String datas = JSON.toJSON(spSyncUdiResponse).toString(); + redisUtil.set(key, datas); + BasicExportStatusEntity myEntity = new BasicExportStatusEntity(); + myEntity.setId(key); + myEntity.setStatus(0); + myEntity.setUpdateTime(new Date()); + myEntity.setType(BasicProcessStatus.NEW_ALL_UDIS); + basicExportService.insertExportStatus(myEntity); + } else { + String path = getPath(); + String fileName = path + FileConstant.upWaitCopy_products + "UdiPrdoucts_" + key + ".LowerIn"; + String datas = JSON.toJSON(spSyncUdiResponse).toString(); + FileUtils.SaveFileAs(datas, fileName); + } + } + + if (udiCompanyEntities.size() < limit1) { break; } else { @@ -343,25 +385,6 @@ public class DlAllDataService { } - SpSyncUdiResponse spSyncUdiResponse = new SpSyncUdiResponse(); - spSyncUdiResponse.setUdiCompanyEntities(mUdiCompanyEntities); - spSyncUdiResponse.setProductInfoEntityList(mProductInfoEntities); - - - if (CollUtil.isNotEmpty(spSyncUdiResponse.getProductInfoEntityList()) || CollUtil.isNotEmpty(spSyncUdiResponse.getUdiCompanyEntities())) { - String key = "UdiPrdoucts" + System.currentTimeMillis(); - String datas = JSON.toJSON(spSyncUdiResponse).toString(); - if (downstream.getParamValue().equals("1")) { - redisUtil.set(key, datas); - BasicExportStatusEntity myEntity = new BasicExportStatusEntity(); - myEntity.setId(key); - basicExportService.insertExportStatus(myEntity); - } else { - String path = getPath(); - String fileName = path + FileConstant.upWaitCopy_products + "UdiPrdoucts_" + key + ".LowerIn"; - FileUtils.SaveFileAs(datas, fileName); - } - } BasicExportStatusEntity basicExportStatusEntity1 = basicExportStatusEntities.get(0); basicExportStatusEntity1.setStatus(1); spGetHttp.postUpdateBasicStatus(basicExportStatusEntity1); @@ -386,7 +409,6 @@ public class DlAllDataService { String fileName = path + FileConstant.upWaitCopy_products + "UdiPrdoucts_" + DateUtil.formatDate(new Date(), "yyyyMMddHHmmss") + ".LowerIn"; String datas = JSON.toJSONString(baseResponse.getData()); FileUtils.SaveFileAs(datas, fileName); - } spGetHttp.postDeleteBasicStatus(basicExportStatusEntity.getId()); diff --git a/pom.xml b/pom.xml index 5f1b1b9..0658dec 100644 --- a/pom.xml +++ b/pom.xml @@ -37,14 +37,13 @@ - + com.alibaba fastjson - 2.0.4 + 1.2.83 - org.apache.commons