From b1e8a79f8595b6db7d25521ddb5d3e55e822c48b Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Sun, 19 Jun 2022 16:04:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E7=BB=A7=E6=9C=8D=E5=8A=A1=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/glxp/api/admin/constant/Constant.java | 1 + .../api/admin/constant/ConstantStatus.java | 4 +++ .../glxp/api/admin/thread/DlBasicService.java | 18 +++++------ .../glxp/api/admin/thread/HeartService.java | 31 ++++++++++--------- .../main/resources/application-pro.properties | 10 +++--- .../src/main/resources/logback-spring.xml | 2 +- 6 files changed, 36 insertions(+), 30 deletions(-) diff --git a/api-admin/src/main/java/com/glxp/api/admin/constant/Constant.java b/api-admin/src/main/java/com/glxp/api/admin/constant/Constant.java index 8fad4da3..f375074a 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/constant/Constant.java +++ b/api-admin/src/main/java/com/glxp/api/admin/constant/Constant.java @@ -7,6 +7,7 @@ public class Constant { public static final String SERIAL_CACHE_PREFIX = "serial_"; public static final String SERIAL_CACHE_PREFIX_ST = "serialst_"; + public static final String SERIAL_CACHE_SYNC_UDI = "syncUdi"; public static final String SCAN_ORDER = "MS"; public static final String BUS_ORDER = "MY"; diff --git a/api-admin/src/main/java/com/glxp/api/admin/constant/ConstantStatus.java b/api-admin/src/main/java/com/glxp/api/admin/constant/ConstantStatus.java index 1caf6585..96d2bc82 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/constant/ConstantStatus.java +++ b/api-admin/src/main/java/com/glxp/api/admin/constant/ConstantStatus.java @@ -137,4 +137,8 @@ public class ConstantStatus { public static final String SYNC_DOWNLOAD_SCAN_ORDER = "AutoDownloadOrder"; //自动下载DI数据 public static final String SYNC_DOWNLOAD_DI_PRODUCTS = "AutoDownloadDiProducts"; + + public static final int SYNC_STATUS_SUCCESS = 1; //处理成功 + public static final int SYNC_STATUS_FAIL = 2; //处理失败 + public static final int SYNC_STATUS_WAIT = 0; //等待处理 } diff --git a/api-admin/src/main/java/com/glxp/api/admin/thread/DlBasicService.java b/api-admin/src/main/java/com/glxp/api/admin/thread/DlBasicService.java index 6f0602d0..c1e234a7 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/thread/DlBasicService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/thread/DlBasicService.java @@ -109,7 +109,7 @@ public class DlBasicService { basicDownloadStatusEntity.setTaskId(syncDataResponse.getTaskId()); basicDownloadStatusEntity.setStartTime(new Date()); basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_DOWNLOAD_BASIC_DATA); - basicDownloadStatusEntity.setStatus(0); //下载中 + basicDownloadStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_WAIT); //下载中 basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_DATA); basicDownloadStatusEntity.setScheduleType(1); @@ -293,7 +293,7 @@ public class DlBasicService { basicDownloadStatusEntity.setUpdateTime(new Date()); basicDownloadStatusEntity.setEndTime(new Date()); basicDownloadStatusEntity.setRemark(remark.toString()); - basicDownloadStatusEntity.setStatus(1); + basicDownloadStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_SUCCESS); basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity); } } @@ -321,7 +321,7 @@ public class DlBasicService { basicDownloadStatusEntity.setTaskId(syncDataResponse.getTaskId()); basicDownloadStatusEntity.setStartTime(new Date()); basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_DOWNLOAD_BUS_TYPE); - basicDownloadStatusEntity.setStatus(0); //下载中 + basicDownloadStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_WAIT); //下载中 basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_BUS); basicDownloadStatusEntity.setScheduleType(1); @@ -400,7 +400,7 @@ public class DlBasicService { basicDownloadStatusEntity.setUpdateTime(new Date()); basicDownloadStatusEntity.setEndTime(new Date()); basicDownloadStatusEntity.setRemark(remark.toString()); - basicDownloadStatusEntity.setStatus(1); + basicDownloadStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_SUCCESS); basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity); } } @@ -428,7 +428,7 @@ public class DlBasicService { basicDownloadStatusEntity.setTaskId(syncDataResponse.getTaskId()); basicDownloadStatusEntity.setStartTime(new Date()); basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_DOWNLOAD_SCAN_ORDER); - basicDownloadStatusEntity.setStatus(0); //下载中 + basicDownloadStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_WAIT); //下载中 basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_ORDER); basicDownloadStatusEntity.setScheduleType(1); @@ -476,7 +476,7 @@ public class DlBasicService { if (CollUtil.isNotEmpty(syncDataResponse.getOrderDetailEntityList())) logs = logs + "单据详情:" + syncDataResponse.getOrderDetailEntityList().size() + "条\n"; if (CollUtil.isNotEmpty(syncDataResponse.getWarehouseEntityList())) - logs = logs + "UDI码信息:" + syncDataResponse.getWarehouseEntityList().size() + "条\n"; + logs = logs + "单据条码信息:" + syncDataResponse.getWarehouseEntityList().size() + "条\n"; remark.append(logs); } catch (Exception e) { } @@ -487,7 +487,7 @@ public class DlBasicService { basicDownloadStatusEntity.setUpdateTime(new Date()); basicDownloadStatusEntity.setEndTime(new Date()); basicDownloadStatusEntity.setRemark(remark.toString()); - basicDownloadStatusEntity.setStatus(1); + basicDownloadStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_SUCCESS); basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity); } } @@ -541,7 +541,7 @@ public class DlBasicService { basicDownloadStatusEntity.setTaskId(spSyncUdiResponse.getTaskId()); basicDownloadStatusEntity.setStartTime(new Date()); basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_DOWNLOAD_DI_PRODUCTS); - basicDownloadStatusEntity.setStatus(0); //下载中 + basicDownloadStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_WAIT); //下载中 basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_DI); basicDownloadStatusEntity.setScheduleType(1); @@ -574,7 +574,7 @@ public class DlBasicService { basicDownloadStatusEntity.setUpdateTime(new Date()); basicDownloadStatusEntity.setEndTime(new Date()); basicDownloadStatusEntity.setRemark(remark.toString()); - basicDownloadStatusEntity.setStatus(1); + basicDownloadStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_SUCCESS); basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity); } } diff --git a/api-admin/src/main/java/com/glxp/api/admin/thread/HeartService.java b/api-admin/src/main/java/com/glxp/api/admin/thread/HeartService.java index abf41c87..818ebe91 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/thread/HeartService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/thread/HeartService.java @@ -63,7 +63,7 @@ public class HeartService { orderStatusEntity.setType(BasicProcessStatus.NEW_ALL_ORDER); orderStatusEntity.setUpdateTime(new Date()); orderStatusEntity.setStartTime(new Date()); - orderStatusEntity.setStatus(0); + orderStatusEntity.setStatus(ConstantStatus.SYNC_STATUS_WAIT); orderStatusEntity.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL); basicExportService.insertExportStatus(orderStatusEntity); basicExportStatusEntity1 = orderStatusEntity; @@ -74,10 +74,12 @@ public class HeartService { spsSyncOrderResponse.setTaskId(basicExportStatusEntity1.getId()); BaseResponse baseResponse1 = spGetHttp.postAllOrder(spsSyncOrderResponse); if (baseResponse1.getCode() == 20000) { - basicExportStatusEntity1.setStatus(1); - basicExportStatusEntity1.setEndTime(new Date()); - basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity); + basicExportStatusEntity1.setStatus(ConstantStatus.SYNC_STATUS_SUCCESS); + } else { + basicExportStatusEntity1.setStatus(ConstantStatus.SYNC_STATUS_FAIL); } + basicExportStatusEntity1.setEndTime(new Date()); + basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity); //拼接日志 String logs = ""; if (CollUtil.isNotEmpty(spsSyncOrderResponse.getOrderEntities())) @@ -85,7 +87,7 @@ public class HeartService { if (CollUtil.isNotEmpty(spsSyncOrderResponse.getOrderDetailEntityList())) logs = logs + "单据详情:" + spsSyncOrderResponse.getOrderDetailEntityList().size() + "条\n"; if (CollUtil.isNotEmpty(spsSyncOrderResponse.getWarehouseEntityList())) - logs = logs + "UDI码信息:" + spsSyncOrderResponse.getWarehouseEntityList().size() + "条\n"; + logs = logs + "单据条码信息:" + spsSyncOrderResponse.getWarehouseEntityList().size() + "条\n"; basicExportStatusEntity1.setRemark(logs); basicExportStatusEntity1.setUpdateTime(new Date()); basicExportService.updateExportStatus(basicExportStatusEntity1); @@ -128,11 +130,14 @@ public class HeartService { basicExportStatusTimeEntity.setKey(ConstantStatus.SYNC_BUS_TYPE); spsSyncBusResponse.setTaskId(basicExportStatusEntity2.getId()); BaseResponse baseResponse2 = spGetHttp.postAllBus(spsSyncBusResponse); + if (baseResponse2.getCode() == 20000) { basicExportStatusEntity2.setStatus(1); - basicExportStatusEntity2.setEndTime(new Date()); - basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity); + } else { + basicExportStatusEntity2.setStatus(ConstantStatus.SYNC_STATUS_FAIL); } + basicExportStatusEntity2.setEndTime(new Date()); + basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity); //拼接日志 String logs = ""; if (CollUtil.isNotEmpty(spsSyncBusResponse.getBussinessTypeEntities())) @@ -202,9 +207,11 @@ public class HeartService { BaseResponse baseResponse = spGetHttp.postAllBaseData(syncDataResponse); if (baseResponse.getCode() == 20000) { basicExportStatusEntity3.setStatus(1); - basicExportStatusEntity3.setEndTime(new Date()); - basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity); + } else { + basicExportStatusEntity3.setStatus(ConstantStatus.SYNC_STATUS_FAIL); } + basicExportStatusEntity3.setEndTime(new Date()); + basicExportTimeService.insertExportStatus(basicExportStatusTimeEntity); String logs = ""; if (CollUtil.isNotEmpty(syncDataResponse.getUdiRelevanceEntities())) logs = logs + "耗材字典:" + syncDataResponse.getUdiRelevanceEntities().size() + "条\n"; @@ -232,7 +239,6 @@ public class HeartService { public void uploadScheduleList() { //自动创建要求被下载基础信息任务 - BasicExportStatusRequest basicExportStatusRequest = new BasicExportStatusRequest(); basicExportStatusRequest.setScheduleType(2); List basicExportStatusEntities = basicExportService.filterExportStatus(basicExportStatusRequest); @@ -245,7 +251,6 @@ public class HeartService { basicExportService.deleteById(basicExportStatusEntity.getId()); } } else { - for (BasicExportStatusEntity basicExportStatusEntity : basicExportStatusEntities) { String logs = ""; if (CollUtil.isNotEmpty(spsSyncScheduleResponse.getBasicExportStatusEntities())) { @@ -256,11 +261,7 @@ public class HeartService { basicExportService.updateExportStatus(basicExportStatusEntity); } } - - } - - } } diff --git a/api-admin/src/main/resources/application-pro.properties b/api-admin/src/main/resources/application-pro.properties index 503457b8..42207b73 100644 --- a/api-admin/src/main/resources/application-pro.properties +++ b/api-admin/src/main/resources/application-pro.properties @@ -1,9 +1,9 @@ # 本地环境 server.port=9991 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.jdbc-url=jdbc:mysql://127.0.0.1:3306/udiwms?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true +spring.datasource.jdbc-url=jdbc:mysql://192.168.0.148:3306/udiwms?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true spring.datasource.username=root -spring.datasource.password=123456 +spring.datasource.password=Glxp@6066 #spring.datasource.password=89083fb2fc145533 server.servlet.context-path= #logging.level.com.glxp.api.admin.dao=debug @@ -20,8 +20,8 @@ logging.path=output/logs # 不指定的情况下默认生成在项目根目录,按照配置生成所需的日志名称 #logging.file=D:/udi.log -file_path=D:/udi/udiwms/udiwmsfile/ -#file_path=/home/glxp/udiwms +#file_path=D:/udi/udiwms/udiwmsfile/ +file_path=/home/glxp/udiwms #UDI数据下载 UDI_KEY=6b137c66-6286-46c6-8efa-c2f5dd9237df UDI_SERVER_URL=https://www.udims.com/UDI_DL_Server_test @@ -35,7 +35,7 @@ SPSYNC_IP=http://127.0.0.1:9989 # Redis数据库索引(默认为0) spring.redis.database=8 # Redis服务器地址 -spring.redis.host=127.0.0.1 +spring.redis.host=192.168.0.148 # Redis服务器连接端口 spring.redis.port=6379 # Redis服务器连接密码(默认为空) diff --git a/api-admin/src/main/resources/logback-spring.xml b/api-admin/src/main/resources/logback-spring.xml index b67920b1..229d4f07 100644 --- a/api-admin/src/main/resources/logback-spring.xml +++ b/api-admin/src/main/resources/logback-spring.xml @@ -1,7 +1,7 @@ logback - +