hecheng пре 3 година
родитељ
комит
a3cfc27ec4

+ 28 - 28
zd-modules/zd-camera/pom.xml

@@ -288,34 +288,34 @@
 			</plugin>
 
 			<!-- docker的maven插件 -->
-			<plugin>
-				<groupId>com.spotify</groupId>
-				<artifactId>dockerfile-maven-plugin</artifactId>
-				<version>${docker.maven.verion}</version>
-
-				<executions>
-					<!--执行 mvn package 时 自动构建docker镜像并推送到仓库 -->
-					<execution>
-						<id>default</id>
-						<phase>package</phase>
-						<goals>
-							<goal>build</goal>
-							<goal>push</goal>
-						</goals>
-					</execution>
-				</executions>
-				<configuration>
-					<repository>${docker.registry}/${docker.namespace}/${project.artifactId}</repository>
-					<tag>latest</tag>
-					<!-- 镜像服务器账号密码  -->
-					<username>admin</username>
-					<password>zd123456..</password>
-					<!-- 构建参数,指定jar包名称 -->
-					<buildArgs>
-						<JAR_FILE>${project.artifactId}.jar</JAR_FILE>
-					</buildArgs>
-				</configuration>
-			</plugin>
+<!--			<plugin>-->
+<!--				<groupId>com.spotify</groupId>-->
+<!--				<artifactId>dockerfile-maven-plugin</artifactId>-->
+<!--				<version>${docker.maven.verion}</version>-->
+
+<!--				<executions>-->
+<!--					&lt;!&ndash;执行 mvn package 时 自动构建docker镜像并推送到仓库 &ndash;&gt;-->
+<!--					<execution>-->
+<!--						<id>default</id>-->
+<!--						<phase>package</phase>-->
+<!--						<goals>-->
+<!--							<goal>build</goal>-->
+<!--							<goal>push</goal>-->
+<!--						</goals>-->
+<!--					</execution>-->
+<!--				</executions>-->
+<!--				<configuration>-->
+<!--					<repository>${docker.registry}/${docker.namespace}/${project.artifactId}</repository>-->
+<!--					<tag>latest</tag>-->
+<!--					&lt;!&ndash; 镜像服务器账号密码  &ndash;&gt;-->
+<!--					<username>admin</username>-->
+<!--					<password>zd123456..</password>-->
+<!--					&lt;!&ndash; 构建参数,指定jar包名称 &ndash;&gt;-->
+<!--					<buildArgs>-->
+<!--						<JAR_FILE>${project.artifactId}.jar</JAR_FILE>-->
+<!--					</buildArgs>-->
+<!--				</configuration>-->
+<!--			</plugin>-->
 		</plugins>
 	</build>
 </project>

+ 10 - 12
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/ActAuditconfigServiceImpl.java

@@ -1,28 +1,26 @@
 package com.zd.chemical.service.impl;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.atomic.LongAdder;
-import java.util.stream.Collectors;
-
-import com.sun.xml.internal.bind.v2.util.CollisionCheckStack;
+import com.zd.chemical.domain.ActAuditconfig;
 import com.zd.chemical.domain.ActAudituser;
 import com.zd.chemical.domain.vo.ActAuditconfigVo;
 import com.zd.chemical.domain.vo.ActAudituserVo;
+import com.zd.chemical.mapper.ActAuditconfigMapper;
 import com.zd.chemical.mapper.ActAudituserMapper;
+import com.zd.chemical.service.IActAuditconfigService;
 import com.zd.common.core.utils.DateUtils;
 import com.zd.common.core.utils.SecurityUtils;
 import com.zd.common.security.utils.SaveUtil;
-
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-import com.zd.chemical.mapper.ActAuditconfigMapper;
-import com.zd.chemical.domain.ActAuditconfig;
-import com.zd.chemical.service.IActAuditconfigService;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.atomic.LongAdder;
+import java.util.stream.Collectors;
 
 /**
  * 工作流审批Service业务层处理

+ 3 - 5
zd-modules/zd-netty/src/main/java/com/zd/netty/init/NettyStartListener.java

@@ -3,7 +3,6 @@ package com.zd.netty.init;
 import com.zd.common.core.constant.HttpStatus;
 import com.zd.common.core.domain.R;
 import com.zd.common.core.enums.HardwareOperate;
-import com.zd.common.core.utils.SpringUtils;
 import com.zd.netty.service.IFridService;
 import com.zd.netty.thread.ThreadPoolTaskConfig;
 import com.zd.system.api.laboratory.RemoteLaboratoryService;
@@ -12,7 +11,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.ApplicationArguments;
 import org.springframework.boot.ApplicationRunner;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Component;
 import org.springframework.util.StringUtils;
 
@@ -33,14 +31,14 @@ public class NettyStartListener implements ApplicationRunner {
     private RemoteLaboratoryService laboratoryService;
     @Resource
     private SocketServer socketServer;
-
-    private final ThreadPoolTaskExecutor taskExecutor= SpringUtils.getBean("taskExecutor");
+    @Resource
+    private ThreadPoolTaskConfig threadPoolTaskConfig;
 
     @Override
     public void run(ApplicationArguments args) {
         socketServer.start();
 
-        taskExecutor.execute(() -> {
+        threadPoolTaskConfig.threadPoolTaskExecutor().execute(() -> {
             synchronized (this) {
                 R<List<RemoteLabHardware>> listStart = laboratoryService.listStart();
                 while (listStart.getCode() != HttpStatus.SUCCESS) {

+ 7 - 9
zd-modules/zd-netty/src/main/java/com/zd/netty/sdk/DeJuRFIDService.java

@@ -1,11 +1,8 @@
 package com.zd.netty.sdk;
 
 import com.gg.reader.api.dal.GClient;
-import com.gg.reader.api.dal.HandlerTagEpcLog;
-import com.gg.reader.api.dal.HandlerTagEpcOver;
 import com.gg.reader.api.protocol.gx.*;
 import com.zd.common.core.exception.ServiceException;
-import com.zd.common.core.utils.SpringUtils;
 import com.zd.netty.service.ISendService;
 import com.zd.netty.service.IService;
 import com.zd.netty.thread.ThreadPoolTaskConfig;
@@ -14,13 +11,14 @@ import com.zd.system.api.laboratory.domain.RemoteLabHardware;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.scheduling.annotation.Async;
-import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.*;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Objects;
+import java.util.TimerTask;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
 @Slf4j
@@ -32,7 +30,8 @@ public class DeJuRFIDService implements IService {
 
     private final Map<String, GClient> clientMap = new ConcurrentHashMap<>();
 
-    private final ScheduledExecutorService scheduledExecutorService= SpringUtils.getBean("scheduledExecutorService");
+    @Resource
+    private ThreadPoolTaskConfig threadPoolTaskConfig;
 
     @Override
     public void start(RemoteLabHardware hardware) {
@@ -161,9 +160,8 @@ public class DeJuRFIDService implements IService {
         }
     }
 
-    @Async
     public void stopGpo(GClient client){
-        scheduledExecutorService.schedule(new TimerTask() {
+        threadPoolTaskConfig.scheduledExecutorService().schedule(new TimerTask() {
             @Override
             public void run() {
                 changeGpo(0, client);

+ 17 - 15
zd-modules/zd-netty/src/main/java/com/zd/netty/thread/ThreadPoolTaskConfig.java

@@ -4,29 +4,31 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.concurrent.BasicThreadFactory;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 
 import java.util.concurrent.*;
 
+/**
+ * @author Administrator
+ */
 @Configuration
 @Slf4j
 public class ThreadPoolTaskConfig {
 
-    private static final int corePoolSize = 10;       		// 核心线程数(默认线程数)
-    private static final int maxPoolSize = 100;			    // 最大线程数
-    private static final int keepAliveTime = 10;			// 允许线程空闲时间(单位:默认为秒)
-    private static final int queueCapacity = 200;			// 缓冲队列数
-    private static final String threadNamePrefix = "Async-Service-"; // 线程池名前缀
+    private static final int CORE_POOL_SIZE = 10;
+    private static final int MAX_POOL_SIZE = 100;
+    private static final int KEEP_ALIVE_TIME = 10;
+    private static final int QUEUE_CAPACITY = 200;
+    private static final String THREAD_NAME_PREFIX = "Async-Service-";
 
-    @Bean("taskExecutor") // bean的名称,默认为首字母小写的方法名
-    public ThreadPoolTaskExecutor getAsyncExecutor(){
+    @Bean
+    public ThreadPoolTaskExecutor threadPoolTaskExecutor(){
         ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
-        executor.setCorePoolSize(corePoolSize);
-        executor.setMaxPoolSize(maxPoolSize);
-        executor.setQueueCapacity(queueCapacity);
-        executor.setKeepAliveSeconds(keepAliveTime);
-        executor.setThreadNamePrefix(threadNamePrefix);
+        executor.setCorePoolSize(CORE_POOL_SIZE);
+        executor.setMaxPoolSize(MAX_POOL_SIZE);
+        executor.setQueueCapacity(QUEUE_CAPACITY);
+        executor.setKeepAliveSeconds(KEEP_ALIVE_TIME);
+        executor.setThreadNamePrefix(THREAD_NAME_PREFIX);
 
         // 线程池对拒绝任务的处理策略
         executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
@@ -38,9 +40,9 @@ public class ThreadPoolTaskConfig {
     /**
      * 执行定时任务
      */
-    @Bean(name = "scheduledExecutorService")
+    @Bean
     public ScheduledExecutorService scheduledExecutorService() {
-        return new ScheduledThreadPoolExecutor(corePoolSize,
+        return new ScheduledThreadPoolExecutor(CORE_POOL_SIZE,
                 new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) {
             @Override
             protected void afterExecute(Runnable r, Throwable t) {