diff --git a/pom.xml b/pom.xml
index 54eea17..8e338bf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,6 +20,7 @@
win-module-basedata
win-module-dataacqu
win-module-lab
+ win-module-pszc
${project.artifactId}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/AsyncLabController.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/AsyncLabController.java
new file mode 100644
index 0000000..0babacb
--- /dev/null
+++ b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/AsyncLabController.java
@@ -0,0 +1,23 @@
+package com.win.module.dataacqu.controller;
+
+import com.win.framework.common.pojo.CommonResult;
+import com.win.module.dataacqu.service.asynclab.AsyncLabService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/asynclab/")
+public class AsyncLabController {
+
+ @Autowired
+ private AsyncLabService asyncLabService;
+
+
+// @GetMapping("/asyncLab")
+// public CommonResult asyncLab(String busDate , String busType) {
+//
+// }
+
+}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/ImpController.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/ImpController.java
deleted file mode 100644
index 1aa0cb9..0000000
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/ImpController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.win.module.dataacqu.controller;
-
-import com.win.module.dataacqu.service.ImpactScheduleServie;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/impact")
-public class ImpController {
-
- @Autowired
- private ImpactScheduleServie impactScheduleServie;
-
-
- @GetMapping("/syncImpactInfos")
- public String syncImpactInfos() {
- impactScheduleServie.syncImpactInfos();
- return "SUCCESS";
- }
-}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/PScaleController.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/PScaleController.java
deleted file mode 100644
index 3393cad..0000000
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/PScaleController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.win.module.dataacqu.controller;
-
-import com.win.module.dataacqu.service.PlatScaleScheduleService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/pscale")
-public class PScaleController {
-
- @Autowired
- private PlatScaleScheduleService slatScaleScheduleService;
-
-
- @GetMapping("/syncPlatScaleDatas")
- public String syncPlatScaleDatas() throws Exception{
- slatScaleScheduleService.syncPlatScaleDatas();
- return "SUCCESS";
- }
-}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThousandController.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThousandController.java
deleted file mode 100644
index a5627eb..0000000
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThousandController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.win.module.dataacqu.controller;
-
-import com.win.module.dataacqu.service.StretchThousandScheduleService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/stretchthousand")
-public class SThousandController {
-
- @Autowired
- private StretchThousandScheduleService stretchThousandScheduleService;
-
-
- @GetMapping("/syncThousandData")
- public String syncThousandData() throws Exception{
- stretchThousandScheduleService.syncThousandData();
- return "SUCCESS";
- }
-}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThousandQxController.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThousandQxController.java
deleted file mode 100644
index a6c743a..0000000
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThousandQxController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.win.module.dataacqu.controller;
-
-import com.win.module.dataacqu.service.StretchThousandQxScheduleService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/sthousandqx")
-public class SThousandQxController {
-
- @Autowired
- private StretchThousandQxScheduleService stretchThousandQxScheduleService;
-
-
- @GetMapping("/syncQxInfos")
- public String syncQxInfos() {
- stretchThousandQxScheduleService.syncQxInfos();
- return "SUCCESS";
- }
-}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThousandnewController.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThousandnewController.java
deleted file mode 100644
index 1a644e3..0000000
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThousandnewController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.win.module.dataacqu.controller;
-
-import com.win.module.dataacqu.service.StretchThousandnewScheduleService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/sthousandnew")
-public class SThousandnewController {
-
- @Autowired
- private StretchThousandnewScheduleService sScheduleService;
-
-
- @GetMapping("/syncThousandData")
- public String syncThousandData() throws Exception{
- sScheduleService.syncThousandData();
- return "success";
- }
-}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThreeHundredContrller.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThreeHundredContrller.java
deleted file mode 100644
index 8c08043..0000000
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SThreeHundredContrller.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.win.module.dataacqu.controller;
-
-
-import com.win.module.dataacqu.service.StretchThreeQxScheduleService;
-import com.win.module.dataacqu.service.StretchThreeScheduleService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping(value = "/stretch")
-public class SThreeHundredContrller {
-
- @Autowired
- private StretchThreeScheduleService stretchThreeScheduleService;
-
- @Autowired
- private StretchThreeQxScheduleService stretchThreeQxScheduleService;
-
-
- @GetMapping(value = "/syncThreeHundredData")
- public String syncThreeHundredData() throws Exception{
- stretchThreeScheduleService.syncThreeHundredData();
- return "SUCCESS";
- }
-
- @GetMapping(value = "/syncQxInfos")
- public String syncQxInfos() throws Exception{
- stretchThreeQxScheduleService.syncQxInfos();
- return "SUCCESS";
- }
-}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SpectController.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SpectController.java
deleted file mode 100644
index deda917..0000000
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/SpectController.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.win.module.dataacqu.controller;
-
-import com.win.module.dataacqu.service.SpectrumScheduleService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/spect")
-public class SpectController {
-
- @Autowired
- private SpectrumScheduleService spectrumScheduleService;
-
-
- @GetMapping("/syncSpectrumInfos")
- public String syncSpectrumInfos() {
- spectrumScheduleService.syncSpectrumInfos();
- return "SUCCESS";
- }
-}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/TTestController.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/TTestController.java
new file mode 100644
index 0000000..1187763
--- /dev/null
+++ b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/controller/TTestController.java
@@ -0,0 +1,33 @@
+package com.win.module.dataacqu.controller;
+
+import com.win.module.dataacqu.service.PlatScaleScheduleService;
+import com.win.module.dataacqu.service.StretchThousandnewScheduleService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/ttest")
+public class TTestController {
+
+ @Autowired
+ private PlatScaleScheduleService platScaleScheduleService;
+
+ @Autowired
+ private StretchThousandnewScheduleService stretchThousandnewScheduleService;
+
+
+ @GetMapping("/test1")
+ public String test1(String date) {
+ platScaleScheduleService.syncPlatScaleDatas(date);
+ return "SUCCESS";
+ }
+
+ @GetMapping("/test2")
+ public String test2(String date) throws Exception{
+ stretchThousandnewScheduleService.syncThousandData(date);
+ return "SUCCESS";
+ }
+
+}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/job/LabStretchThreeJob.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/job/LabStretchThreeJob.java
index fc5f2b7..02f091e 100644
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/job/LabStretchThreeJob.java
+++ b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/job/LabStretchThreeJob.java
@@ -18,7 +18,7 @@ public class LabStretchThreeJob implements JobHandler {
@Override
public String execute(String param) throws Exception {
- stretchThreeScheduleService.syncThreeHundredData();
+// stretchThreeScheduleService.syncThreeHundredData();
return null;
}
}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/ImpactScheduleServie.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/ImpactScheduleServie.java
index d7347f3..5e1353b 100644
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/ImpactScheduleServie.java
+++ b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/ImpactScheduleServie.java
@@ -1,8 +1,11 @@
package com.win.module.dataacqu.service;
import com.win.framework.common.util.date.DateUtils;
+import com.win.module.lab.api.asyncoprlog.AsyncOprLogApi;
import com.win.module.lab.api.impact.ImpactApi;
import com.win.module.lab.api.impact.dto.ImpactDTO;
+import com.win.module.lab.enums.BusTypeEnum;
+import com.win.module.lab.enums.OprTypeEnum;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.Element;
@@ -10,8 +13,10 @@ import org.dom4j.io.SAXReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
import java.io.File;
+import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -23,27 +28,91 @@ public class ImpactScheduleServie {
@Value("${win.impact.url}")
private String impactUrl;
+ @Value("${win.impact.isSyncAll}")
+ private boolean isSyncAll;
+
@Autowired
private ImpactApi impactApi;
+ @Autowired
+ private AsyncOprLogApi asyncOprLogApi;
+
+
+ // busDate 2023-11-24
+ public void syncImpactInfos(String busDate) {
+ List impList = new ArrayList<>();
+ String date = "";
+ String delDate = "";
+ String oprType = "";
+ String oprResult= "成功";
+ String oprMsg = "";
+ try {
+ if (StringUtils.isEmpty(busDate)) {
+ date = DateUtils.getDateStr(new Date() , "yyyyMMdd");
+ delDate = DateUtils.getDateStr(new Date() , "yyyy-MM-dd");
+ oprType = OprTypeEnum.OprType_1.getCode();
+ } else {
+ date = busDate.replaceAll("-" , "");
+ delDate = busDate;
+ oprType = OprTypeEnum.OprType_2.getCode();
+ }
+ toParseDatas(date , impList);
- public void syncImpactInfos() {
- String path = impactUrl + "/" + DateUtils.getDateStr(new Date() , "yyyyMMdd");
+ if (impList != null && impList.size() > 0) {
+ toSaveDats(impList , delDate);
+ }
+ isSyncAll = false;
+ } catch (Exception e) {
+ e.printStackTrace();
+ oprResult = "失败";
+ oprMsg = e.getMessage();
+ } finally {
+ asyncOprLogApi.saveAsyncOprLog(BusTypeEnum.BusType_2.getCode() , oprType , oprResult , oprMsg , LocalDate.parse(delDate));
+ }
+ }
- File file = new File(path);
- if (file.isDirectory()) {
- File[] files = file.listFiles();
- if (files != null && files.length > 0) {
- for (File f : files) {
- readFile(f);
+ @Transactional
+ public void toSaveDats(List impList , String date) {
+ if (!isSyncAll) {
+ impactApi.deleteDatasByBusDate(date);
+ }
+ impactApi.saveImpacts(impList);
+ }
+
+ public void toParseDatas(String date , List impList) {
+ File file = null;
+ if (isSyncAll) {
+ file = new File(impactUrl);
+ if (file.isDirectory()) {
+ File[] files = file.listFiles();
+ if (files != null && files.length > 0) {
+ for (File fs : files) {
+ if (fs.isDirectory()) {
+ File[] _fss = fs.listFiles();
+ if (_fss != null && _fss.length > 0) {
+ for (File _f : _fss) {
+ readFile(_f , impList);
+ }
+ }
+ }
+ }
+ }
+ }
+ } else {
+ file = new File(impactUrl + "/" + date);
+ if (file.isDirectory()) {
+ File[] files = file.listFiles();
+ if (files != null && files.length > 0) {
+ for (File f : files) {
+ readFile(f , impList);
+ }
}
}
}
}
- private void readFile(File f) {
+ private void readFile(File f , List impList) {
try {
- List impList = new ArrayList<>();
if (f != null && f.isFile()) {
String fileName = f.getName().split("\\.")[0];
SAXReader reader = new SAXReader();
@@ -58,10 +127,6 @@ public class ImpactScheduleServie {
impList.add(idto);
}
}
-
- if (impList != null && impList.size() > 0) {
- impactApi.saveImpacts(impList);
- }
}
}catch (Exception e) {
e.printStackTrace();
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/PlatScaleScheduleService.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/PlatScaleScheduleService.java
index 1d33d11..1a12007 100644
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/PlatScaleScheduleService.java
+++ b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/PlatScaleScheduleService.java
@@ -1,20 +1,27 @@
package com.win.module.dataacqu.service;
-import cn.hutool.core.io.CharsetDetector;
import com.healthmarketscience.jackcess.Database;
import com.healthmarketscience.jackcess.DatabaseBuilder;
import com.healthmarketscience.jackcess.Row;
import com.healthmarketscience.jackcess.Table;
import com.win.framework.common.util.date.DateUtils;
+import com.win.module.lab.api.asyncoprlog.AsyncOprLogApi;
import com.win.module.lab.api.platscale.PlatScaleApi;
import com.win.module.lab.api.platscale.dto.PlatScaleDTO;
+import com.win.module.lab.enums.BusTypeEnum;
+import com.win.module.lab.enums.OprTypeEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
import java.io.File;
import java.nio.charset.Charset;
+import java.time.LocalDate;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
/**
@@ -32,15 +39,53 @@ public class PlatScaleScheduleService {
@Autowired
private PlatScaleApi platScaleApi;
+ @Autowired
+ private AsyncOprLogApi asyncOprLogApi;
- public void syncPlatScaleDatas() throws Exception{
- String curDate = DateUtils.getDateStr(new Date() , "yyyy-MM-dd");
+ // busDate 2023-11-24
+ public void syncPlatScaleDatas(String busDate) {
+ List dtos = new ArrayList<>();
+ String _busDate = "";
+ String oprType = "";
+ String oprResult= "成功";
+ String oprMsg = "";
+ try {
+ if (StringUtils.isEmpty(busDate)) {
+ _busDate = DateUtils.getDateStr(new Date() , "yyyy-MM-dd");
+ oprType = OprTypeEnum.OprType_1.getCode();
+ } else {
+ _busDate = busDate;
+ oprType = OprTypeEnum.OprType_2.getCode();
+ }
+ toReadDatas(_busDate , dtos);
+ if (dtos != null && dtos.size() > 0) {
+ toSaveDats(_busDate , dtos);
+ }
+ isSyncAll = false;
+ }catch (Exception e) {
+ e.printStackTrace();
+ oprResult = "失败";
+ oprMsg = e.getMessage();
+ } finally {
+ asyncOprLogApi.saveAsyncOprLog(BusTypeEnum.BusType_1.getCode() , oprType , oprResult , oprMsg , LocalDate.parse(_busDate));
+ }
+ }
+
+ @Transactional
+ public void toSaveDats (String busDate , List dtos) {
+ if (isSyncAll) {
+ platScaleApi.saveDatas(dtos);
+ } else {
+ platScaleApi.deleteDatasByBusDate(busDate);
+ platScaleApi.saveDatas(dtos);
+ }
+ }
+
+ public void toReadDatas(String busDate , List dtos) throws Exception {
DatabaseBuilder databaseBuilder = null;
Database db = null;
-
try {
-
File file = new File(platScaleUrl);
databaseBuilder = new DatabaseBuilder(file);
databaseBuilder.setCharset(Charset.forName("gb2312"));
@@ -50,11 +95,10 @@ public class PlatScaleScheduleService {
for(Row row : myTable) {
String date = row.getString("日期");
if (isSyncAll) { // 全量同步
- toSaveData(row);
- } else if (curDate.equals(date)){
- toSaveData(row);
+ toParseDatas(row , dtos);
+ } else if (busDate.equals(date)){
+ toParseDatas(row , dtos);
}
-// System.out.println("车号:" + row.getString("车号") + "|| 日期:" + row.getString("日期") + "|| 抽样时间:" + row.getString("抽样时间"));
}
} catch (Exception e) {
e.printStackTrace();
@@ -65,7 +109,7 @@ public class PlatScaleScheduleService {
}
}
- private void toSaveData(Row row) {
+ private void toParseDatas(Row row , List dtos) {
if (row != null) {
PlatScaleDTO pdto = new PlatScaleDTO();
if (StringUtils.isNotBlank(row.getString("车号"))) {
@@ -134,7 +178,7 @@ public class PlatScaleScheduleService {
if (row.getBoolean("是否抽检") != null) {
pdto.setSfcj(row.getBoolean("是否抽检") + "");
}
- platScaleApi.saveDatas(pdto);
+ dtos.add(pdto);
}
}
}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/SpectrumScheduleService.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/SpectrumScheduleService.java
index e0c47f4..a4c603e 100644
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/SpectrumScheduleService.java
+++ b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/SpectrumScheduleService.java
@@ -13,19 +13,25 @@ import org.springframework.stereotype.Service;
import java.io.File;
import java.util.Date;
+/**
+ * 同步光谱数据
+ */
@Service
public class SpectrumScheduleService {
@Value("${win.spectrum.url}")
private String spectrumUrl;
+ @Value("${win.spectrum.isSyncAll}")
+ private boolean isSyncAll;
+
@Autowired
private SpectrumApi spectrumApi;
- public void syncSpectrumInfos() {
+ // busDate 2023-11-24
+ public void syncSpectrumInfos(String busDate) {
String path = spectrumUrl + "/" + DateUtils.getDateStr(new Date() , "yyyyMMdd");
-
File file = new File(path);
if (file.isDirectory()) {
File[] files = file.listFiles();
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThousandScheduleService.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThousandScheduleService.java
index 97df79d..47247d2 100644
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThousandScheduleService.java
+++ b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThousandScheduleService.java
@@ -15,7 +15,7 @@ import java.util.ArrayList;
import java.util.List;
/**
- * 拉伸1000 access数据
+ * 拉伸1000 access数据 已经废弃
*/
@Component
public class StretchThousandScheduleService {
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThousandnewScheduleService.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThousandnewScheduleService.java
index 6f8b240..f3c07f6 100644
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThousandnewScheduleService.java
+++ b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThousandnewScheduleService.java
@@ -1,9 +1,12 @@
package com.win.module.dataacqu.service;
+import com.win.framework.common.util.date.DateUtils;
import com.win.module.dataacqu.utils.AccessConnectionUtil;
-import com.win.module.lab.api.stretchthousand.dto.StretchThousandDTO;
+import com.win.module.lab.api.asyncoprlog.AsyncOprLogApi;
import com.win.module.lab.api.stretchthousandnew.StretchThousandnewApi;
import com.win.module.lab.api.stretchthousandnew.dto.StretchThousandnewDto;
+import com.win.module.lab.enums.BusTypeEnum;
+import com.win.module.lab.enums.OprTypeEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -12,7 +15,9 @@ import org.springframework.stereotype.Component;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
+import java.time.LocalDate;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
@@ -34,28 +39,50 @@ public class StretchThousandnewScheduleService {
@Value("${win.stretch.thousand.isSyncAll}")
private boolean isSyncAll;
+ @Autowired
+ private AsyncOprLogApi asyncOprLogApi;
+
- public void syncThousandData() throws Exception{
+ // busDate 2023-11-24
+ public void syncThousandData(String busDate) throws Exception{
+ String _busDate = "";
Statement st = null;
ResultSet rs = null;
+ String oprType = "";
+ String oprResult= "成功";
+ String oprMsg = "";
+ List dtos = new ArrayList<>();
Connection con = AccessConnectionUtil.getCon(stretchThreeAccessUrl , username , password);
try {
+ if (StringUtils.isEmpty(busDate)) {
+ _busDate = DateUtils.getDateStr(new Date() , "yyyy-MM-dd");
+ oprType = OprTypeEnum.OprType_1.getCode();
+ } else {
+ _busDate = busDate;
+ oprType = OprTypeEnum.OprType_2.getCode();
+ }
+
String sql = "";
if (isSyncAll) { // 全量同步
sql = "select * from NewTension";
- isSyncAll = false;
} else { // 获取实验日期为当天的数据
- sql = "select * from NewTension where 试验日期 = Format(now() , 'yyyy-MM-dd')";
+ sql = "select * from NewTension where Format(cdate(试验日期) , 'yyyy-MM-dd') = '" + _busDate + "'";
}
if (con != null) {
st = con.createStatement();
rs = st.executeQuery(sql);
if (rs != null) {
- saveData(rs);
+ toParseData(rs , dtos);
}
}
+ if (dtos != null && dtos.size() > 0) {
+ toSaveDatas(dtos , _busDate);
+ }
+ isSyncAll = false;
}catch (Exception e) {
e.printStackTrace();
+ oprResult = "失败";
+ oprMsg = e.getMessage();
} finally {
if (rs != null) {
rs.close();
@@ -66,11 +93,18 @@ public class StretchThousandnewScheduleService {
if (con != null) {
con.close();
}
+ asyncOprLogApi.saveAsyncOprLog(BusTypeEnum.BusType_5.getCode() , oprType , oprResult , oprMsg , LocalDate.parse(_busDate));
}
}
- private void saveData(ResultSet rs) throws Exception{
- List dtos = new ArrayList<>();
+ public void toSaveDatas (List dtos , String busDate) {
+ if (!isSyncAll) {
+ stretchThousandnewApi.deleteDatasByBusDate(busDate);
+ }
+ stretchThousandnewApi.saveDatas(dtos);
+ }
+
+ private void toParseData(ResultSet rs , List dtos) throws Exception{
while (rs.next()) {
StretchThousandnewDto dto = new StretchThousandnewDto();
if (StringUtils.isNotBlank(rs.getString("曲线ID"))) {
@@ -213,8 +247,5 @@ public class StretchThousandnewScheduleService {
}
dtos.add(dto);
}
- if (dtos != null && dtos.size() > 0) {
- stretchThousandnewApi.saveDatas(dtos);
- }
}
}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThreeScheduleService.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThreeScheduleService.java
index 163be38..f57ae70 100644
--- a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThreeScheduleService.java
+++ b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/StretchThreeScheduleService.java
@@ -1,17 +1,24 @@
package com.win.module.dataacqu.service;
+import com.win.framework.common.util.date.DateUtils;
import com.win.module.dataacqu.utils.AccessConnectionUtil;
+import com.win.module.lab.api.asyncoprlog.AsyncOprLogApi;
import com.win.module.lab.api.stretchthreeHundred.StretchThreeHundredApi;
import com.win.module.lab.api.stretchthreeHundred.dto.StretchThreeHundredDTO;
+import com.win.module.lab.enums.BusTypeEnum;
+import com.win.module.lab.enums.OprTypeEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
+import java.time.LocalDate;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
/**
@@ -32,31 +39,52 @@ public class StretchThreeScheduleService {
@Value("${win.stretch.three.isSyncAll}")
private boolean isSyncAll;
+ @Autowired
+ private AsyncOprLogApi asyncOprLogApi;
+
@Autowired
private StretchThreeHundredApi stretchThreeHundredApi;
- public void syncThreeHundredData() throws Exception{
- Statement st = null;
- ResultSet rs = null;
+ // busDate 2023-11-24
+ public void syncThreeHundredData(String busDate) throws Exception{
+ Statement st = null;
+ ResultSet rs = null;
+ String _busDate = "";
+ String oprType = "";
+ String sql = "";
+ String oprResult= "成功";
+ String oprMsg = "";
+ List dtos = new ArrayList<>();
Connection con = AccessConnectionUtil.getCon(stretchThreeAccessUrl , username , password);
try {
- String sql = "";
+ if (StringUtils.isEmpty(busDate)) {
+ _busDate = DateUtils.getDateStr(new Date() , "yyyy-MM-dd");
+ oprType = OprTypeEnum.OprType_1.getCode();
+ } else {
+ _busDate = busDate;
+ oprType = OprTypeEnum.OprType_2.getCode();
+ }
if (isSyncAll) { // 全量同步
sql = "select * from js_ls";
- isSyncAll = false;
} else { // 获取实验日期为当天的数据
- sql = "select * from js_ls where Format(TestDate , 'yyyy-MM-dd') = Format(now() , 'yyyy-MM-dd')";
+ sql = "select * from js_ls where Format(TestDate , 'yyyy-MM-dd') = " + _busDate;
}
if (con != null) {
st = con.createStatement();
rs = st.executeQuery(sql);
if (rs != null) {
- saveData(rs);
+ toParseData(rs , dtos);
}
}
+ if (dtos != null && dtos.size() > 0) {
+ toSaveDatas(dtos , _busDate);
+ }
+ isSyncAll = false;
}catch (Exception e) {
e.printStackTrace();
+ oprResult = "失败";
+ oprMsg = e.getMessage();
} finally {
if (rs != null) {
rs.close();
@@ -67,11 +95,19 @@ public class StretchThreeScheduleService {
if (con != null) {
con.close();
}
+ asyncOprLogApi.saveAsyncOprLog(BusTypeEnum.BusType_4.getCode() , oprType , oprResult , oprMsg , LocalDate.parse(_busDate));
}
}
- private void saveData(ResultSet rs) throws Exception{
- List dtos = new ArrayList<>();
+ @Transactional
+ public void toSaveDatas(List dtos , String busDate) {
+ if (!isSyncAll) {
+ stretchThreeHundredApi.deleteDatasByBusDate(busDate);
+ }
+ stretchThreeHundredApi.saveStretchThreeHundreds(dtos);
+ }
+
+ private void toParseData(ResultSet rs , List dtos) throws Exception{
while (rs.next()) {
StretchThreeHundredDTO dto = new StretchThreeHundredDTO();
if (StringUtils.isNotBlank(rs.getString("SYID"))) {
@@ -280,8 +316,5 @@ public class StretchThreeScheduleService {
}
dtos.add(dto);
}
- if (dtos != null && dtos.size() > 0) {
- stretchThreeHundredApi.saveStretchThreeHundreds(dtos);
- }
}
}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/asynclab/AsyncLabService.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/asynclab/AsyncLabService.java
new file mode 100644
index 0000000..a374c8c
--- /dev/null
+++ b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/asynclab/AsyncLabService.java
@@ -0,0 +1,6 @@
+package com.win.module.dataacqu.service.asynclab;
+
+public interface AsyncLabService {
+
+ public String asyncLab(String busDate , String busType) throws Exception ;
+}
diff --git a/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/asynclab/AsyncLabServiceImpl.java b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/asynclab/AsyncLabServiceImpl.java
new file mode 100644
index 0000000..fde7a6a
--- /dev/null
+++ b/win-module-dataacqu/win-module-dataacqu-biz/src/main/java/com/win/module/dataacqu/service/asynclab/AsyncLabServiceImpl.java
@@ -0,0 +1,59 @@
+package com.win.module.dataacqu.service.asynclab;
+
+import com.win.module.dataacqu.service.*;
+import com.win.module.lab.api.asyncoprlog.AsyncOprLogApi;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AsyncLabServiceImpl implements AsyncLabService{
+
+ @Autowired
+ private ImpactScheduleServie impactScheduleServie;
+
+ @Autowired
+ private PlatScaleScheduleService platScaleScheduleService;
+
+ @Autowired
+ private SpectrumScheduleService spectrumScheduleService;
+
+ @Autowired
+ private StretchThousandnewScheduleService sScheduleService;
+
+ @Autowired
+ private StretchThousandQxScheduleService sQxScheduleService;
+
+ @Autowired
+ private StretchThreeScheduleService stretchThreeScheduleService;
+
+ @Autowired
+ private StretchThreeQxScheduleService stretchThreeQxScheduleService;
+
+
+ @Override
+ public String asyncLab(String busDate , String busType) throws Exception {
+ switch (busType) {
+ case "1" : // 地衡
+ platScaleScheduleService.syncPlatScaleDatas(busDate);
+ break;
+ case "2": // 冲击
+ impactScheduleServie.syncImpactInfos(busDate);
+ break;
+ case "3": // 光谱
+// spectrumScheduleService.syncSpectrumInfos(busDate);
+ break;
+ case "4": // 拉伸300
+ stretchThreeScheduleService.syncThreeHundredData(busDate);
+// stretchThreeQxScheduleService.syncQxInfos();
+ break;
+ case "5": // 拉伸1000
+ sScheduleService.syncThousandData(busDate);
+// sQxScheduleService.syncQxInfos();
+ break;
+ default:
+ break;
+ }
+
+ return null;
+ }
+}
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/asyncoprlog/AsyncOprLogApi.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/asyncoprlog/AsyncOprLogApi.java
new file mode 100644
index 0000000..6bee24e
--- /dev/null
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/asyncoprlog/AsyncOprLogApi.java
@@ -0,0 +1,12 @@
+package com.win.module.lab.api.asyncoprlog;
+
+import com.win.module.lab.api.asyncoprlog.dto.AsyncOprLogDTO;
+
+import java.time.LocalDate;
+
+public interface AsyncOprLogApi {
+
+ public boolean saveAsyncOprLog(AsyncOprLogDTO dto);
+
+ public boolean saveAsyncOprLog(String busType , String oprType , String oprResult , String oprMsg , LocalDate busDate);
+}
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/asyncoprlog/dto/AsyncOprLogDTO.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/asyncoprlog/dto/AsyncOprLogDTO.java
new file mode 100644
index 0000000..b8fdbbd
--- /dev/null
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/asyncoprlog/dto/AsyncOprLogDTO.java
@@ -0,0 +1,27 @@
+package com.win.module.lab.api.asyncoprlog.dto;
+
+import java.time.LocalDate;
+
+public class AsyncOprLogDTO {
+
+ /**
+ * 业务类型
+ */
+ private String busType;
+ /**
+ * 操作类型
+ */
+ private String oprType;
+ /**
+ * 操作结果
+ */
+ private String oprResult;
+ /**
+ * 描述
+ */
+ private String oprMsg;
+ /**
+ * 业务日期
+ */
+ private LocalDate busDate;
+}
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/impact/ImpactApi.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/impact/ImpactApi.java
index 8dd19ca..0ffc730 100644
--- a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/impact/ImpactApi.java
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/impact/ImpactApi.java
@@ -7,4 +7,6 @@ import java.util.List;
public interface ImpactApi {
public String saveImpacts(List list);
+
+ public boolean deleteDatasByBusDate(String busDate);
}
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/platscale/PlatScaleApi.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/platscale/PlatScaleApi.java
index 17b25c6..0d2b451 100644
--- a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/platscale/PlatScaleApi.java
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/platscale/PlatScaleApi.java
@@ -2,8 +2,12 @@ package com.win.module.lab.api.platscale;
import com.win.module.lab.api.platscale.dto.PlatScaleDTO;
+import java.util.List;
+
public interface PlatScaleApi {
- public String saveDatas(PlatScaleDTO pdto);
+ public String saveDatas(List pdtos);
+
+ public boolean deleteDatasByBusDate(String busDate);
}
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/spectrum/SpectrumApi.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/spectrum/SpectrumApi.java
index 77284ab..a67f555 100644
--- a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/spectrum/SpectrumApi.java
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/spectrum/SpectrumApi.java
@@ -7,4 +7,6 @@ public interface SpectrumApi {
public String saveData(SpectrumDTO dto);
public boolean checkBatchNo(String batchNo);
+
+ public boolean deleteDatasByBusDate(String busDate);
}
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthousandnew/StretchThousandnewApi.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthousandnew/StretchThousandnewApi.java
index 3d22d06..4e2f45f 100644
--- a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthousandnew/StretchThousandnewApi.java
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthousandnew/StretchThousandnewApi.java
@@ -7,4 +7,6 @@ import java.util.List;
public interface StretchThousandnewApi {
public boolean saveDatas(List list);
+
+ public boolean deleteDatasByBusDate(String busDate);
}
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthousandqx/StretchThousandQxApi.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthousandqx/StretchThousandQxApi.java
index bea4316..f1ba80a 100644
--- a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthousandqx/StretchThousandQxApi.java
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthousandqx/StretchThousandQxApi.java
@@ -7,4 +7,6 @@ import java.util.List;
public interface StretchThousandQxApi {
public String saveData(StretchThousandQxDTO dto);
+
+ public boolean deleteDatasByBusDate(String busDate);
}
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthreeHundred/StretchThreeHundredApi.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthreeHundred/StretchThreeHundredApi.java
index abd1f98..e8b5cd1 100644
--- a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthreeHundred/StretchThreeHundredApi.java
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthreeHundred/StretchThreeHundredApi.java
@@ -12,4 +12,6 @@ public interface StretchThreeHundredApi {
* @return
*/
public String saveStretchThreeHundreds(List list);
+
+ public boolean deleteDatasByBusDate(String busDate);
}
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthreeHundredqx/StretchThreeHundredQxApi.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthreeHundredqx/StretchThreeHundredQxApi.java
index eb6f12d..1501021 100644
--- a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthreeHundredqx/StretchThreeHundredQxApi.java
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/api/stretchthreeHundredqx/StretchThreeHundredQxApi.java
@@ -7,4 +7,6 @@ import com.win.module.lab.api.stretchthreeHundredqx.dto.StretchThreeHundredQxDTO
public interface StretchThreeHundredQxApi {
public String saveStretchThreeHundredQxs(StretchThreeHundredQxDTO dto);
+
+ public boolean deleteDatasByBusDate(String busDate);
}
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/enums/BusTypeEnum.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/enums/BusTypeEnum.java
new file mode 100644
index 0000000..1e3d0e3
--- /dev/null
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/enums/BusTypeEnum.java
@@ -0,0 +1,37 @@
+package com.win.module.lab.enums;
+
+public enum BusTypeEnum {
+
+ BusType_1("1" , "地衡"),
+ BusType_2("2" , "冲击"),
+ BusType_3("3" , "光谱"),
+ BusType_4("4" , "拉伸300"),
+ BusType_5("5" , "拉伸1000"),
+ BusType_6("6" , "拉伸300曲线"),
+ BusType_7("7" , "拉伸1000曲线");
+
+ private String code;
+
+ private String label;
+
+ BusTypeEnum(String code , String label) {
+ this.code = code;
+ this.label = label;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+}
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/enums/ErrorCodeEnum.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/enums/ErrorCodeEnum.java
index 0f40147..fd331b1 100644
--- a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/enums/ErrorCodeEnum.java
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/enums/ErrorCodeEnum.java
@@ -32,7 +32,19 @@ public enum ErrorCodeEnum {
PLATSCALE_NOT_EXISTS(5015, "地衡数据不存在"),
- PLATSCALE_IMPORT_LIST_IS_EMPTY(5016, "地衡文档数据不能为空");
+ PLATSCALE_IMPORT_LIST_IS_EMPTY(5016, "地衡文档数据不能为空"),
+
+ HARDNESS_TWO_NOT_EXISTS(5017, "韦氏硬度2数据不存在"),
+
+ HARDNESS_TWO_IMPORT_LIST_IS_EMPTY(5018 , "导入韦氏硬度2数据不存在"),
+
+ HARDNESS_THREE_NOT_EXISTS(5019 , "布氏硬度数据不存在"),
+
+ HARDNESS_THREE_IMPORT_LIST_IS_EMPTY(5020 , "导入布氏硬度数据不存在"),
+
+ ASYNC_OPR_LOG_NOT_EXISTS(5021 , "实验室业务同步操作日志不存在"),
+
+ ASYNC_OPR_LOG_IMPORT_LIST_IS_EMPTY(5022 , "导入实验室同步操作日志不存在");
private Integer code;
diff --git a/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/enums/OprTypeEnum.java b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/enums/OprTypeEnum.java
new file mode 100644
index 0000000..f09c171
--- /dev/null
+++ b/win-module-lab/win-module-lab-api/src/main/java/com/win/module/lab/enums/OprTypeEnum.java
@@ -0,0 +1,33 @@
+package com.win.module.lab.enums;
+
+public enum OprTypeEnum {
+
+ OprType_1("1" , "自动同步"),
+
+ OprType_2("2" , "手动同步");
+
+ private String code;
+
+ private String label;
+
+ OprTypeEnum (String code , String label) {
+ this.code = code;
+ this.label = label;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+}
diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/asyncoprlog/AsyncOprLogApiImpl.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/asyncoprlog/AsyncOprLogApiImpl.java
new file mode 100644
index 0000000..d35e66c
--- /dev/null
+++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/asyncoprlog/AsyncOprLogApiImpl.java
@@ -0,0 +1,36 @@
+package com.win.module.lab.api.asyncoprlog;
+
+import com.win.module.lab.api.asyncoprlog.dto.AsyncOprLogDTO;
+import com.win.module.lab.convert.asyncoprlog.AsyncOprLogConvert;
+import com.win.module.lab.dal.dataobject.asyncoprlog.AsyncOprLogDO;
+import com.win.module.lab.dal.mysql.asyncoprlog.AsyncOprLogMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDate;
+
+@Service
+public class AsyncOprLogApiImpl implements AsyncOprLogApi{
+
+ @Autowired
+ private AsyncOprLogMapper asyncOprLogMapper;
+
+
+ @Override
+ public boolean saveAsyncOprLog(AsyncOprLogDTO dto) {
+ asyncOprLogMapper.insert(AsyncOprLogConvert.INSTANCE.convert(dto));
+ return true;
+ }
+
+ @Override
+ public boolean saveAsyncOprLog(String busType, String oprType, String oprResult, String oprMsg, LocalDate busDate) {
+ AsyncOprLogDO ado = new AsyncOprLogDO();
+ ado.setBusType(busType);
+ ado.setOprType(oprType);
+ ado.setOprResult(oprResult);
+ ado.setOprMsg(oprMsg);
+ ado.setBusDate(busDate);
+ asyncOprLogMapper.insert(ado);
+ return true;
+ }
+}
diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/impact/ImpactApiImpl.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/impact/ImpactApiImpl.java
index f6fcd5c..79625f2 100644
--- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/impact/ImpactApiImpl.java
+++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/impact/ImpactApiImpl.java
@@ -6,10 +6,12 @@ import com.win.module.lab.dal.dataobject.impact.ImpactDO;
import com.win.module.lab.dal.mysql.impact.ImpactMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
+@Transactional
public class ImpactApiImpl implements ImpactApi{
@Autowired
@@ -28,4 +30,10 @@ public class ImpactApiImpl implements ImpactApi{
}
return null;
}
+
+ @Override
+ public boolean deleteDatasByBusDate(String busDate) {
+ impactMapper.deleteByBusDate(busDate);
+ return true;
+ }
}
diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/platscale/PlatScaleApiImpl.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/platscale/PlatScaleApiImpl.java
index b09e99e..48a3d41 100644
--- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/platscale/PlatScaleApiImpl.java
+++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/platscale/PlatScaleApiImpl.java
@@ -6,9 +6,13 @@ import com.win.module.lab.dal.dataobject.platscale.PlatscaleDO;
import com.win.module.lab.dal.mysql.platscale.PlatscaleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
@Service
+@Transactional
public class PlatScaleApiImpl implements PlatScaleApi{
@Autowired
@@ -16,11 +20,19 @@ public class PlatScaleApiImpl implements PlatScaleApi{
@Override
- public String saveDatas(PlatScaleDTO pdto) {
- PlatscaleDO pdo = PlatscaleConvert.INSTANCE.convert(pdto);
- pdo.setCreator("1");
- pdo.setUpdater("1");
- platscaleMapper.insert(pdo);
+ public String saveDatas(List pdtos) {
+ for (PlatScaleDTO pdto : pdtos) {
+ PlatscaleDO pdo = PlatscaleConvert.INSTANCE.convert(pdto);
+ pdo.setCreator("1");
+ pdo.setUpdater("1");
+ platscaleMapper.insert(pdo);
+ }
return null;
}
+
+ @Override
+ public boolean deleteDatasByBusDate(String busDate) {
+ platscaleMapper.deleteByBusDate(busDate);
+ return true;
+ }
}
diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/spectrum/SpectrumApiImpl.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/spectrum/SpectrumApiImpl.java
index 0dda014..05c01f2 100644
--- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/spectrum/SpectrumApiImpl.java
+++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/spectrum/SpectrumApiImpl.java
@@ -36,4 +36,10 @@ public class SpectrumApiImpl implements SpectrumApi{
}
return true;
}
+
+ @Override
+ public boolean deleteDatasByBusDate(String busDate) {
+ spectrumMapper.deleteByBusDate(busDate);
+ return true;
+ }
}
diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthousandnew/StretchThousandnewApiImpl.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthousandnew/StretchThousandnewApiImpl.java
index f33d586..622cae4 100644
--- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthousandnew/StretchThousandnewApiImpl.java
+++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthousandnew/StretchThousandnewApiImpl.java
@@ -26,4 +26,10 @@ public class StretchThousandnewApiImpl implements StretchThousandnewApi{
}
return true;
}
+
+ @Override
+ public boolean deleteDatasByBusDate(String busDate) {
+ stretchThousandnewMapper.deleteByBusDate(busDate);
+ return true;
+ }
}
diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthousandqx/StretchThousandQxApiImpl.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthousandqx/StretchThousandQxApiImpl.java
index 45ea272..32063ba 100644
--- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthousandqx/StretchThousandQxApiImpl.java
+++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthousandqx/StretchThousandQxApiImpl.java
@@ -23,4 +23,10 @@ public class StretchThousandQxApiImpl implements StretchThousandQxApi{
stretchThousandQxMapper.insert(sdo);
return null;
}
+
+ @Override
+ public boolean deleteDatasByBusDate(String busDate) {
+ stretchThousandQxMapper.deleteByBusDate(busDate);
+ return true;
+ }
}
diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthreeHundred/StretchThreeHundredApiImpl.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthreeHundred/StretchThreeHundredApiImpl.java
index 79a122d..97e3871 100644
--- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthreeHundred/StretchThreeHundredApiImpl.java
+++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthreeHundred/StretchThreeHundredApiImpl.java
@@ -5,12 +5,13 @@ import com.win.module.lab.convert.stretchthreeHundred.StretchThreeHundredConvert
import com.win.module.lab.dal.dataobject.stretchthreehundred.StretchThreeHundredDO;
import com.win.module.lab.dal.mysql.stretchthreehundred.StretchThreeHundredMapper;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
-import java.util.Date;
import java.util.List;
@Service
+@Transactional
public class StretchThreeHundredApiImpl implements StretchThreeHundredApi{
@Resource
@@ -19,9 +20,6 @@ public class StretchThreeHundredApiImpl implements StretchThreeHundredApi{
@Override
public String saveStretchThreeHundreds(List list) {
-
-// Date curDate = new Date();
-
if (list != null && list.size() > 0) {
for (StretchThreeHundredDTO sdto : list) {
StretchThreeHundredDO sdo = StretchThreeHundredConvert.INSTANCE.convert(sdto);
@@ -32,7 +30,12 @@ public class StretchThreeHundredApiImpl implements StretchThreeHundredApi{
}
}
}
-
return null;
}
+
+ @Override
+ public boolean deleteDatasByBusDate(String busDate) {
+ stretchThreeHundredMapper.deleteByBusDate(busDate);
+ return true;
+ }
}
diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthreeHundredqx/StretchThreeHundredQxApiImpl.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthreeHundredqx/StretchThreeHundredQxApiImpl.java
index 80269bd..996fabd 100644
--- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthreeHundredqx/StretchThreeHundredQxApiImpl.java
+++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/api/stretchthreeHundredqx/StretchThreeHundredQxApiImpl.java
@@ -23,4 +23,10 @@ public class StretchThreeHundredQxApiImpl implements StretchThreeHundredQxApi{
}
return null;
}
+
+ @Override
+ public boolean deleteDatasByBusDate(String busDate) {
+ stretchThreeHundredQxMapper.deleteByBusDate(busDate);
+ return true;
+ }
}
diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/AsyncOprLogController.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/AsyncOprLogController.java
new file mode 100644
index 0000000..68874fd
--- /dev/null
+++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/AsyncOprLogController.java
@@ -0,0 +1,123 @@
+package com.win.module.lab.controller.asyncoprlog;
+
+import io.swagger.v3.oas.annotations.Parameters;
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Operation;
+import javax.validation.*;
+import javax.servlet.http.*;
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
+import java.util.*;
+import java.io.IOException;
+
+import com.win.framework.common.pojo.PageResult;
+import com.win.framework.common.pojo.CommonResult;
+import static com.win.framework.common.pojo.CommonResult.success;
+
+import com.win.framework.excel.core.util.ExcelUtils;
+
+import com.win.framework.operatelog.core.annotations.OperateLog;
+import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*;
+
+import com.win.module.lab.controller.asyncoprlog.vo.*;
+import com.win.module.lab.dal.dataobject.asyncoprlog.AsyncOprLogDO;
+import com.win.module.lab.convert.asyncoprlog.AsyncOprLogConvert;
+import com.win.module.lab.service.asyncoprlog.AsyncOprLogService;
+import org.springframework.web.multipart.MultipartFile;
+
+@Tag(name = "管理后台 - 实验室-主动同步日志")
+@RestController
+@RequestMapping("/lab/asyncoprlog")
+@Validated
+public class AsyncOprLogController {
+
+ @Resource
+ private AsyncOprLogService asyncOprLogService;
+
+
+ @PostMapping("/create")
+ @Operation(summary = "创建实验室-主动同步日志")
+ public CommonResult createAsyncOprLog(@Valid @RequestBody AsyncOprLogCreateReqVO createReqVO) {
+ return success(asyncOprLogService.createAsyncOprLog(createReqVO));
+ }
+
+ @PutMapping("/update")
+ @Operation(summary = "更新实验室-主动同步日志")
+ public CommonResult updateAsyncOprLog(@Valid @RequestBody AsyncOprLogUpdateReqVO updateReqVO) {
+ asyncOprLogService.updateAsyncOprLog(updateReqVO);
+ return success(true);
+ }
+
+ @DeleteMapping("/delete")
+ @Operation(summary = "删除实验室-主动同步日志")
+ @Parameter(name = "id", description = "编号", required = true)
+ public CommonResult deleteAsyncOprLog(@RequestParam("id") Long id) {
+ asyncOprLogService.deleteAsyncOprLog(id);
+ return success(true);
+ }
+
+ @GetMapping("/get")
+ @Operation(summary = "获得实验室-主动同步日志")
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
+ public CommonResult getAsyncOprLog(@RequestParam("id") Long id) {
+ AsyncOprLogDO asyncOprLog = asyncOprLogService.getAsyncOprLog(id);
+ return success(AsyncOprLogConvert.INSTANCE.convert(asyncOprLog));
+ }
+
+
+ @GetMapping("/page")
+ @Operation(summary = "获得实验室-主动同步日志分页")
+ public CommonResult> getAsyncOprLogPage(@Valid AsyncOprLogPageReqVO pageVO) {
+ PageResult pageResult = asyncOprLogService.getAsyncOprLogPage(pageVO);
+ return success(AsyncOprLogConvert.INSTANCE.convertPage(pageResult));
+ }
+
+ @GetMapping("/export-excel")
+ @Operation(summary = "导出实验室-主动同步日志 Excel")
+ @OperateLog(type = EXPORT)
+ public void exportAsyncOprLogExcel(@Valid AsyncOprLogExportReqVO exportReqVO,
+ HttpServletResponse response) throws IOException {
+ List list = asyncOprLogService.getAsyncOprLogList(exportReqVO);
+ // 导出 Excel
+ List datas = AsyncOprLogConvert.INSTANCE.convertList02(list);
+ ExcelUtils.write(response, "实验室-主动同步日志.xls", "数据", AsyncOprLogExcelVO.class, datas);
+ }
+
+ @GetMapping("/get-import-template")
+ @Operation(summary = "获得导入实验室-主动同步日志模板")
+ public void importTemplate(HttpServletResponse response) throws IOException {
+ List list = Arrays.asList();
+ // 输出
+ ExcelUtils.write(response, "实验室-主动同步日志基本信息导入模板.xls", "实验室-主动同步日志基本信息列表", AsyncOprLogExcelVO.class, list);
+ }
+
+ @PostMapping("/import")
+ @Operation(summary = "导入实验室-主动同步日志基本信息")
+ @Parameters({
+ @Parameter(name = "file", description = "Excel 文件", required = true),
+ @Parameter(name = "mode", description = "导入模式1更新2追加3覆盖", example = "1"),
+ @Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true")
+ })
+ public CommonResult