|
|
|
@ -51,6 +51,8 @@ import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import javax.annotation.PostConstruct; |
|
|
|
|
|
|
|
@Component("jobMainTask") |
|
|
|
@RestController |
|
|
|
@RequestMapping({"/jobtask"}) |
|
|
|
@ -91,11 +93,16 @@ public class JobMainTask { |
|
|
|
@Value("${spring.profiles.active}") |
|
|
|
private String activeProfile; |
|
|
|
|
|
|
|
//private static final ExecutorService threadPool = Executors.newFixedThreadPool(2); |
|
|
|
private static final int corePoolSize = 20; |
|
|
|
private static final int maximumPoolSize = 50; |
|
|
|
private static final int keepAliveTime = 100; |
|
|
|
private static final ExecutorService threadPool = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.SECONDS, new LinkedBlockingQueue<>(1000)); |
|
|
|
@Value("${jobtask.corePoolSize:20}") |
|
|
|
private int corePoolSize; |
|
|
|
|
|
|
|
@Value("${jobtask.maximumPoolSize:50}") |
|
|
|
private int maximumPoolSize; |
|
|
|
|
|
|
|
@Value("${jobtask.keepAliveTime:100}") |
|
|
|
private int keepAliveTime; |
|
|
|
|
|
|
|
private ExecutorService threadPool; |
|
|
|
|
|
|
|
final ShaoXinBigModel shaoXinBigModel; |
|
|
|
|
|
|
|
@ -121,6 +128,11 @@ public class JobMainTask { |
|
|
|
this.sftpClient = sftpClient; |
|
|
|
} |
|
|
|
|
|
|
|
@PostConstruct |
|
|
|
private void init() { |
|
|
|
threadPool = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, TimeUnit.SECONDS, new LinkedBlockingQueue<>(1000)); |
|
|
|
} |
|
|
|
|
|
|
|
private void startThread( |
|
|
|
final PatrolTaskInfo patrolTaskInfo, |
|
|
|
final PatrolPresetPos patrolPresetPos, |
|
|
|
@ -368,9 +380,8 @@ public class JobMainTask { |
|
|
|
.patrolPointId(Long.parseLong(patrolTaskInfo.getDeviceId())) |
|
|
|
.isEnable("1") |
|
|
|
.build(); |
|
|
|
log.info(Color.CYAN + "deviceId: {}" + Color.END, patrolTaskInfo.getDeviceId()); |
|
|
|
List<PatrolPresetPos> presetPosList = taskExecClient.selectPatrolPresetPosList(patrolPresetPos); |
|
|
|
log.info(Color.CYAN + "presetPosList: {}" + Color.END, JSONObject.toJSONString(presetPosList, true)); |
|
|
|
log.info(Color.CYAN + "************************** executing patrolPoint, patrolPointId: {}, patrolPresetPos: {}" + Color.END, patrolTaskInfo.getDeviceId(), JSONObject.toJSONString(presetPosList, true)); |
|
|
|
|
|
|
|
PatrolPresetPos presetPos = !presetPosList.isEmpty() ? presetPosList.get(0) : PatrolPresetPos.builder().presetPosId("0").build(); |
|
|
|
boolean bPointFinished = isPointFinished(patrolTaskInfo, taskExecRecord); |
|
|
|
@ -1011,7 +1022,6 @@ public class JobMainTask { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
log.info("points: {}, patrolTaskInfoList: {}", maintainIds, patrolTaskInfoList.size()); |
|
|
|
for (PatrolTaskInfo patrolTaskInfo : patrolTaskInfoList) { |
|
|
|
final String deviceId = patrolTaskInfo.getDeviceId(); |
|
|
|
//log.info("deviceId: {}", deviceId); |
|
|
|
@ -1020,7 +1030,6 @@ public class JobMainTask { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
log.info("resList: {}", JSONObject.toJSONString(resList, true)); |
|
|
|
return resList; |
|
|
|
} |
|
|
|
|
|
|
|
|