From 5dc29176a534828b7dc22b3738e7ed379e2dc7ba Mon Sep 17 00:00:00 2001 From: zhangzq Date: Thu, 7 Mar 2024 09:06:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?opt:=E4=BC=98=E5=8C=96=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0=EF=BC=8C=E5=B7=A5=E5=8D=95=E5=90=8C=E6=AD=A5=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ext_manage/acs/service/impl/AcsToWmsServiceImpl.java | 8 ++++++++ .../src/main/resources/config/application-dev3.yml | 3 +++ .../src/main/resources/config/application-prod.yml | 3 +++ 3 files changed, 14 insertions(+) diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext_manage/acs/service/impl/AcsToWmsServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext_manage/acs/service/impl/AcsToWmsServiceImpl.java index 2df046b2..e6e3fa04 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext_manage/acs/service/impl/AcsToWmsServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext_manage/acs/service/impl/AcsToWmsServiceImpl.java @@ -358,9 +358,17 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{ @Override @Async public void feedOrderRealQty(JSONObject param) { + String today = DateUtil.today().replace("-", ""); if (CollectionUtils.isEmpty(param)){ return; } + Iterator check = param.keySet().iterator(); + while (check.hasNext()){ + String key = check.next(); + if (!key.contains(today)){ + check.remove(); + } + } Iterator iterator = param.keySet().iterator(); Map map = workorderService.list(new QueryWrapper() .in("workorder_code", param.keySet())) diff --git a/mes/hd/nladmin-system/src/main/resources/config/application-dev3.yml b/mes/hd/nladmin-system/src/main/resources/config/application-dev3.yml index c4569f14..550c0b83 100644 --- a/mes/hd/nladmin-system/src/main/resources/config/application-dev3.yml +++ b/mes/hd/nladmin-system/src/main/resources/config/application-dev3.yml @@ -1,5 +1,8 @@ server: port: 8011 + tomcat: + max-threads: 300 + min-spare-threads: 30 #配置数据源 spring: datasource: diff --git a/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml b/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml index 06e5f7fa..b4284c9f 100644 --- a/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml +++ b/mes/hd/nladmin-system/src/main/resources/config/application-prod.yml @@ -1,5 +1,8 @@ server: port: 8011 + tomcat: + max-threads: 300 + min-spare-threads: 30 #配置数据源 spring: datasource: From c7b66b7c95cd26fb9daa909f1d8bdcb9bcba3875 Mon Sep 17 00:00:00 2001 From: zhangzq Date: Thu, 7 Mar 2024 09:11:04 +0800 Subject: [PATCH 2/3] =?UTF-8?q?opt:=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/config/application.yml | 2 +- mes/hd/nladmin-system/src/main/resources/logback-spring.xml | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mes/hd/nladmin-system/src/main/resources/config/application.yml b/mes/hd/nladmin-system/src/main/resources/config/application.yml index aaf699a8..3cb17f3c 100644 --- a/mes/hd/nladmin-system/src/main/resources/config/application.yml +++ b/mes/hd/nladmin-system/src/main/resources/config/application.yml @@ -2,7 +2,7 @@ spring: freemarker: check-template-location: false profiles: - active: dev3 + active: prod jackson: time-zone: GMT+8 data: diff --git a/mes/hd/nladmin-system/src/main/resources/logback-spring.xml b/mes/hd/nladmin-system/src/main/resources/logback-spring.xml index 463071cd..8fd81e4d 100644 --- a/mes/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/mes/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -79,8 +79,8 @@ - - + + @@ -111,6 +111,8 @@ + + From 900d54279e977fa02a4e694660464829a0a8d48d Mon Sep 17 00:00:00 2001 From: zhangzq Date: Mon, 11 Mar 2024 15:27:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?opt:=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/AppRun.java | 8 ++-- .../nl/modules/logging/aspect/LogAspect.java | 10 ++--- .../java/org/nl/modules/wql/util/WqlUtil.java | 1 + .../acs/service/impl/AcsToWmsServiceImpl.java | 44 ++++++++++--------- .../resources/config/application-dev3.yml | 2 +- .../src/main/resources/logback-spring.xml | 8 ++-- 6 files changed, 40 insertions(+), 33 deletions(-) diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/AppRun.java b/mes/hd/nladmin-system/src/main/java/org/nl/AppRun.java index 807d4d0f..a7e7e76f 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/AppRun.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/AppRun.java @@ -4,7 +4,8 @@ import cn.dev33.satoken.annotation.SaIgnore; import com.alicp.jetcache.Cache; import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; import com.alicp.jetcache.anno.config.EnableMethodCache; - + +import lombok.extern.slf4j.Slf4j; import org.mybatis.spring.annotation.MapperScan; import org.nl.modules.wql.util.SpringContextHolder; import org.springframework.boot.CommandLineRunner; @@ -29,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController; */ @EnableAsync @RestController - + @SpringBootApplication(exclude = { org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class }) @@ -40,6 +41,7 @@ import org.springframework.web.bind.annotation.RestController; @EnableMethodCache(basePackages = "org.nl") @EnableCreateCacheAnnotation @MapperScan("org.nl.**.mapper") +@Slf4j public class AppRun implements CommandLineRunner { private Cache userCache; @@ -53,7 +55,7 @@ public class AppRun implements CommandLineRunner { @Override public void run(String... args) throws Exception { - System.out.println(111); + log.warn("项目启动完成"); } @Bean diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/modules/logging/aspect/LogAspect.java b/mes/hd/nladmin-system/src/main/java/org/nl/modules/logging/aspect/LogAspect.java index 505b8a32..52148db9 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/modules/logging/aspect/LogAspect.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/modules/logging/aspect/LogAspect.java @@ -85,11 +85,11 @@ public class LogAspect { try { log.info("[--request--][请求接口:{}][请求参数:{}]",url,params); result = joinPoint.proceed(); - //是否把日志存到日志表 - if (logInfo.isAddLogTable()) { - Log log = new Log("INFO", System.currentTimeMillis() - comming); - logService.save(getUsername(), StringUtils.getBrowser(request), requestIp, joinPoint, log); - } +// //是否把日志存到日志表 +// if (logInfo.isAddLogTable()) { +// Log log = new Log("INFO", System.currentTimeMillis() - comming); +// logService.save(getUsername(), StringUtils.getBrowser(request), requestIp, joinPoint, log); +// } }catch (Exception ex){ StringBuffer errorStack = new StringBuffer(); errorStack.append("
【异常堆栈:"); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/modules/wql/util/WqlUtil.java b/mes/hd/nladmin-system/src/main/java/org/nl/modules/wql/util/WqlUtil.java index 289ba676..91b80d2f 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/modules/wql/util/WqlUtil.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/modules/wql/util/WqlUtil.java @@ -173,6 +173,7 @@ public class WqlUtil{ str = str.substring(str.indexOf(beginStr) + 1, str.indexOf(endStr)); } catch(Exception arg3) { + arg3.printStackTrace(); } return str; } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext_manage/acs/service/impl/AcsToWmsServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext_manage/acs/service/impl/AcsToWmsServiceImpl.java index e6e3fa04..ec9db7d4 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext_manage/acs/service/impl/AcsToWmsServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext_manage/acs/service/impl/AcsToWmsServiceImpl.java @@ -369,28 +369,30 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{ check.remove(); } } - Iterator iterator = param.keySet().iterator(); - Map map = workorderService.list(new QueryWrapper() - .in("workorder_code", param.keySet())) - .stream().collect(HashMap::new, (k, v) -> k.put(v.getWorkorder_code(), v), HashMap::putAll); - Date now = new Date(); - BigDecimal divide = new BigDecimal(0); - while (iterator.hasNext()){ - String workorderCode = iterator.next(); - BigDecimal dq_real_qty = param.getBigDecimal(workorderCode); - PdmProduceWorkorder workorder = map.get(workorderCode); - if(workorder == null){ - continue; + if (!CollectionUtils.isEmpty(param)){ + Iterator iterator = param.keySet().iterator(); + Map map = workorderService.list(new QueryWrapper() + .in("workorder_code", param.keySet())) + .stream().collect(HashMap::new, (k, v) -> k.put(v.getWorkorder_code(), v), HashMap::putAll); + Date now = new Date(); + BigDecimal divide = new BigDecimal(0); + while (iterator.hasNext()){ + String workorderCode = iterator.next(); + BigDecimal dq_real_qty = param.getBigDecimal(workorderCode); + PdmProduceWorkorder workorder = map.get(workorderCode); + if(workorder == null){ + continue; + } + BigDecimal subtract = dq_real_qty.subtract(workorder.getDq_real_qty()); + if (workorder.getUpdate_time() !=null){ + divide = subtract.divide(new BigDecimal(DateUtil.between(workorder.getUpdate_time(), now, DateUnit.SECOND)), 3, RoundingMode.HALF_UP); + } + workorderService.update(new UpdateWrapper() + .set("dq_real_qty",dq_real_qty) + .set("update_time",DateUtil.now()) + .set("slope",divide) + .eq("workorder_code",workorderCode)); } - BigDecimal subtract = dq_real_qty.subtract(workorder.getDq_real_qty()); - if (workorder.getUpdate_time() !=null){ - divide = subtract.divide(new BigDecimal(DateUtil.between(workorder.getUpdate_time(), now, DateUnit.SECOND)), 3, RoundingMode.HALF_UP); - } - workorderService.update(new UpdateWrapper() - .set("dq_real_qty",dq_real_qty) - .set("update_time",DateUtil.now()) - .set("slope",divide) - .eq("workorder_code",workorderCode)); } } diff --git a/mes/hd/nladmin-system/src/main/resources/config/application-dev3.yml b/mes/hd/nladmin-system/src/main/resources/config/application-dev3.yml index 550c0b83..29c74a9d 100644 --- a/mes/hd/nladmin-system/src/main/resources/config/application-dev3.yml +++ b/mes/hd/nladmin-system/src/main/resources/config/application-dev3.yml @@ -15,7 +15,7 @@ spring: url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false username: ${DB_USER:root} # password: ${DB_PWD:123456} - password: ${DB_PWD:942464Yy} + password: ${DB_PWD:123456} # 初始连接数 initial-size: 5 diff --git a/mes/hd/nladmin-system/src/main/resources/logback-spring.xml b/mes/hd/nladmin-system/src/main/resources/logback-spring.xml index 8fd81e4d..c7bc5d88 100644 --- a/mes/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/mes/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -81,7 +81,6 @@ - @@ -89,6 +88,9 @@ + + + @@ -112,9 +114,9 @@ - + - +