From 95e221907d5e75c4092a49a82a6d2502ee833461 Mon Sep 17 00:00:00 2001
From: huangjiayang <5265313@qq.com>
Date: 星期三, 23 四月 2025 18:26:06 +0800
Subject: [PATCH] 【UPDATE】简化标准工序代码
---
aps-modules/aps-job/src/main/java/com/aps/job/service/impl/ApsWorkOrderProcessServiceImpl.java | 90 +++++++++++++++++++++++++++++++++++++--------
1 files changed, 74 insertions(+), 16 deletions(-)
diff --git a/aps-modules/aps-job/src/main/java/com/aps/job/service/impl/ApsWorkOrderProcessServiceImpl.java b/aps-modules/aps-job/src/main/java/com/aps/job/service/impl/ApsWorkOrderProcessServiceImpl.java
index 39ea457..a847e60 100644
--- a/aps-modules/aps-job/src/main/java/com/aps/job/service/impl/ApsWorkOrderProcessServiceImpl.java
+++ b/aps-modules/aps-job/src/main/java/com/aps/job/service/impl/ApsWorkOrderProcessServiceImpl.java
@@ -7,6 +7,7 @@
import com.aps.job.domain.ApsWorkOrderJob;
import com.aps.job.domain.ApsWorkOrderJobLog;
import com.aps.job.domain.ApsWorkOrderProcess;
+import com.aps.job.mapper.ApsWorkOrderJobLogMapper;
import com.aps.job.mapper.ApsWorkOrderJobMapper;
import com.aps.job.mapper.ApsWorkOrderProcessMapper;
import com.aps.job.service.IApsWorkOrderJobLogService;
@@ -53,6 +54,9 @@
@Autowired
private IApsWorkOrderJobLogService apsWorkOrderJobLogService;
+
+ @Autowired
+ private ApsWorkOrderJobLogMapper apsWorkOrderJobLogMapper;
/**
* 鏌ヨ宸ュ崟宸ュ簭
@@ -185,8 +189,10 @@
apsWorkOrderProcess.setOrgCode(process.getString("OrgCode"));
if (existsId != null) {
apsWorkOrderProcess.setId(existsId);
+ apsWorkOrderProcess.setUpdateTime(DateUtils.getNowDate());
updateList.add(apsWorkOrderProcess);
} else {
+ apsWorkOrderProcess.setCreateTime(DateUtils.getNowDate());
addList.add(apsWorkOrderProcess);
}
if(!nowDocNo.equals(process.getString("DocNo"))){
@@ -235,26 +241,56 @@
}
@Override
- public void syncWorkOrderProcessData() {
+ public void syncWorkOrderProcessData(String status, Integer pageSize) {
try{
//鍒嗛〉鏌ヨ宸ュ崟
ApsWorkOrderJob apsWorkOrderJob = new ApsWorkOrderJob();
- apsWorkOrderJob.setProcessStatus("0");
- while (true){
- PageHelper.startPage(1, 100);
- List<ApsWorkOrderJob> pageList = apsWorkOrderJobMapper.selectApsWorkOrderJobList(apsWorkOrderJob);
- if(!pageList.isEmpty()){
- long startTime = System.currentTimeMillis();
- List<String> docNos = new ArrayList<>();
- for (ApsWorkOrderJob apsWorkOrderJob1 : pageList){
- docNos.add(apsWorkOrderJob1.getDocNo());
+ if("".equals(status)){
+ status = "0";
+ }
+ apsWorkOrderJob.setProcessStatus(status);
+ // 琛ユ煡涔嬪墠娌℃湁鏌ュ埌宸ュ簭鐨勫伐鍗�
+ if("2".equals(status)){
+ int total = apsWorkOrderJobMapper.selectApsWorkOrderJobList(apsWorkOrderJob).size();
+ int pages = total % pageSize == 0 ? total / pageSize : total / pageSize + 1;
+ for (int i = 1; i <= pages; i++){
+ PageHelper.startPage(i, pageSize);
+ List<ApsWorkOrderJob> pageList = apsWorkOrderJobMapper.selectApsWorkOrderJobList(apsWorkOrderJob);
+ if(!pageList.isEmpty()){
+ long startTime = System.currentTimeMillis();
+ List<String> docNos = new ArrayList<>();
+ for (ApsWorkOrderJob apsWorkOrderJob1 : pageList){
+ docNos.add(apsWorkOrderJob1.getDocNo());
+ }
+ getWorkOrderProcessFromU9(docNos);
+ long endTime = System.currentTimeMillis(); // 璁板綍缁撴潫鏃堕棿
+ long duration = endTime - startTime; // 璁$畻杩愯鏃堕棿
+ System.out.println("杩愯鏃堕棿锛�"+ duration +"姣");
}
- getWorkOrderProcessFromU9(docNos);
- long endTime = System.currentTimeMillis(); // 璁板綍缁撴潫鏃堕棿
- long duration = endTime - startTime; // 璁$畻杩愯鏃堕棿
- System.out.println("杩愯鏃堕棿锛�"+ duration +"姣");
- }else{
- break;
+ }
+ }else{
+ while (true){
+ PageHelper.startPage(1, pageSize);
+ List<ApsWorkOrderJob> pageList = apsWorkOrderJobMapper.selectApsWorkOrderJobList(apsWorkOrderJob);
+ if(!pageList.isEmpty()){
+ long startTime = System.currentTimeMillis();
+ List<String> docNos = new ArrayList<>();
+ for (ApsWorkOrderJob apsWorkOrderJob1 : pageList){
+ if(apsWorkOrderJob1.getDocNo()!=null){
+ docNos.add(apsWorkOrderJob1.getDocNo());
+ }
+ }
+ if(!docNos.isEmpty()){
+ getWorkOrderProcessFromU9(docNos);
+ long endTime = System.currentTimeMillis(); // 璁板綍缁撴潫鏃堕棿
+ long duration = endTime - startTime; // 璁$畻杩愯鏃堕棿
+ System.out.println("杩愯鏃堕棿锛�"+ duration +"姣");
+ }else{
+ break;
+ }
+ }else{
+ break;
+ }
}
}
}catch (Exception e){
@@ -272,4 +308,26 @@
public void deleteApsProcessRoute() {
apsWorkOrderProcessMapper.deleteApsProcessRoute();
}
+
+ @Override
+ public boolean retryRequestWorkOrderProcessByLogId(Long id) {
+ try {
+ ApsWorkOrderJobLog apsWorkOrderJobLog = apsWorkOrderJobLogMapper.selectApsWorkOrderJobLogById(id);
+ JSONObject requestBodyJson = JSONObject.parseObject(apsWorkOrderJobLog.getRequestData());
+ JSONArray docListArray = requestBodyJson.getJSONArray("DocList");
+ List<String> docNos = new ArrayList<>();
+ for (int i = 0; i < docListArray.size(); i++) {
+ if(docListArray.getString(i)!=null){
+ docNos.add(docListArray.getString(i));
+ }
+ }
+ if(!docNos.isEmpty()){
+ getWorkOrderProcessFromU9(docNos);
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ return false;
+ }
+ return true;
+ }
}
--
Gitblit v1.9.3