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> importExcel(HttpServletResponse response, + @RequestParam("file") MultipartFile file, + @RequestParam(value = "mode") Integer mode, + @RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { + + List list = ExcelUtils.read(file, AsyncOprLogExcelVO.class); + List errorList = asyncOprLogService.importAsyncOprLogList(list, mode, updatePart); + + Map returnMap = new HashMap<>(); + returnMap.put("errorCount", errorList.size()); + if(!errorList.isEmpty()) { + String url = ExcelUtils.writeLocalFile("实验室-主动同步日志基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); + returnMap.put("errorFile", url); + } + + return success(returnMap); + } + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogBaseVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogBaseVO.java new file mode 100644 index 0000000..613c368 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogBaseVO.java @@ -0,0 +1,34 @@ +package com.win.module.lab.controller.asyncoprlog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; + +/** + * 实验室-主动同步日志 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class AsyncOprLogBaseVO { + + @Schema(description = "业务类型", example = "2") + private String busType; + + @Schema(description = "操作类型", example = "1") + private String oprType; + + @Schema(description = "操作结果") + private String oprResult; + + @Schema(description = "描述") + private String oprMsg; + + @Schema(description = "业务日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) + private LocalDate busDate; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogCreateReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogCreateReqVO.java new file mode 100644 index 0000000..fa18b3f --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogCreateReqVO.java @@ -0,0 +1,12 @@ +package com.win.module.lab.controller.asyncoprlog.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "管理后台 - 实验室-主动同步日志创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class AsyncOprLogCreateReqVO extends AsyncOprLogBaseVO { + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogExcelVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogExcelVO.java new file mode 100644 index 0000000..24ed1c5 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogExcelVO.java @@ -0,0 +1,39 @@ +package com.win.module.lab.controller.asyncoprlog.vo; + +import lombok.*; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 实验室-主动同步日志 Excel VO + * + * @author 超级管理员 + */ +@Data +public class AsyncOprLogExcelVO { + + @ExcelProperty("主键、自增") + private Long id; + + @ExcelProperty("业务类型") + private String busType; + + @ExcelProperty("操作类型") + private String oprType; + + @ExcelProperty("操作结果") + private String oprResult; + + @ExcelProperty("描述") + private String oprMsg; + + @ExcelProperty("业务日期") + private LocalDate busDate; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogExportReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogExportReqVO.java new file mode 100644 index 0000000..1cebb4b --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogExportReqVO.java @@ -0,0 +1,37 @@ +package com.win.module.lab.controller.asyncoprlog.vo; + +import lombok.*; + +import java.time.LocalDate; +import io.swagger.v3.oas.annotations.media.Schema; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; + +@Schema(description = "管理后台 - 实验室-主动同步日志 Excel 导出 Request VO,参数和 AsyncOprLogPageReqVO 是一致的") +@Data +public class AsyncOprLogExportReqVO { + + @Schema(description = "业务类型", example = "2") + private String busType; + + @Schema(description = "操作类型", example = "1") + private String oprType; + + @Schema(description = "操作结果") + private String oprResult; + + @Schema(description = "描述") + private String oprMsg; + + @Schema(description = "业务日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) + private LocalDate[] busDate; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogPageReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogPageReqVO.java new file mode 100644 index 0000000..61c3eae --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogPageReqVO.java @@ -0,0 +1,39 @@ +package com.win.module.lab.controller.asyncoprlog.vo; + +import lombok.*; + +import java.time.LocalDate; +import io.swagger.v3.oas.annotations.media.Schema; +import com.win.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 实验室-主动同步日志分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class AsyncOprLogPageReqVO extends PageParam { + + @Schema(description = "业务类型", example = "2") + private String busType; + + @Schema(description = "操作类型", example = "1") + private String oprType; + + @Schema(description = "操作结果") + private String oprResult; + + @Schema(description = "描述") + private String oprMsg; + + @Schema(description = "业务日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDate[] busDate; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogRespVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogRespVO.java new file mode 100644 index 0000000..d87633b --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogRespVO.java @@ -0,0 +1,19 @@ +package com.win.module.lab.controller.asyncoprlog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 实验室-主动同步日志 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class AsyncOprLogRespVO extends AsyncOprLogBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "17285") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogUpdateReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogUpdateReqVO.java new file mode 100644 index 0000000..080c26c --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/asyncoprlog/vo/AsyncOprLogUpdateReqVO.java @@ -0,0 +1,17 @@ +package com.win.module.lab.controller.asyncoprlog.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 实验室-主动同步日志更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class AsyncOprLogUpdateReqVO extends AsyncOprLogBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "17285") + @NotNull(message = "主键、自增不能为空") + private Long id; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/HardnessThreeController.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/HardnessThreeController.java new file mode 100644 index 0000000..1abb9a2 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/HardnessThreeController.java @@ -0,0 +1,125 @@ +package com.win.module.lab.controller.hardnessthree; + +import io.swagger.v3.oas.annotations.Parameters; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +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.constraints.*; +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.hardnessthree.vo.*; +import com.win.module.lab.dal.dataobject.hardnessthree.HardnessThreeDO; +import com.win.module.lab.convert.hardnessthree.HardnessThreeConvert; +import com.win.module.lab.service.hardnessthree.HardnessThreeService; +import org.springframework.web.multipart.MultipartFile; + +@Tag(name = "管理后台 - 实验室-布氏硬度") +@RestController +@RequestMapping("/lab/hardnessthree") +@Validated +public class HardnessThreeController { + + @Resource + private HardnessThreeService hardnessThreeService; + + @PostMapping("/create") + @Operation(summary = "创建实验室-布氏硬度") + public CommonResult createHardnessThree(@Valid @RequestBody HardnessThreeCreateReqVO createReqVO) { + return success(hardnessThreeService.createHardnessThree(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新实验室-布氏硬度") + public CommonResult updateHardnessThree(@Valid @RequestBody HardnessThreeUpdateReqVO updateReqVO) { + hardnessThreeService.updateHardnessThree(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除实验室-布氏硬度") + @Parameter(name = "id", description = "编号", required = true) + public CommonResult deleteHardnessThree(@RequestParam("id") Long id) { + hardnessThreeService.deleteHardnessThree(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得实验室-布氏硬度") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getHardnessThree(@RequestParam("id") Long id) { + HardnessThreeDO hardnessThree = hardnessThreeService.getHardnessThree(id); + return success(HardnessThreeConvert.INSTANCE.convert(hardnessThree)); + } + + + @GetMapping("/page") + @Operation(summary = "获得实验室-布氏硬度分页") + public CommonResult> getHardnessThreePage(@Valid HardnessThreePageReqVO pageVO) { + PageResult pageResult = hardnessThreeService.getHardnessThreePage(pageVO); + return success(HardnessThreeConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出实验室-布氏硬度 Excel") + @OperateLog(type = EXPORT) + public void exportHardnessThreeExcel(@Valid HardnessThreeExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = hardnessThreeService.getHardnessThreeList(exportReqVO); + // 导出 Excel + List datas = HardnessThreeConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "实验室-布氏硬度.xls", "数据", HardnessThreeExcelVO.class, datas); + } + + @GetMapping("/get-import-template") + @Operation(summary = "获得导入实验室-布氏硬度模板") + public void importTemplate(HttpServletResponse response) throws IOException { + List list = Arrays.asList(); + // 输出 + ExcelUtils.write(response, "实验室-布氏硬度基本信息导入模板.xls", "实验室-布氏硬度基本信息列表", HardnessThreeExcelVO.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> importExcel(HttpServletResponse response, + @RequestParam("file") MultipartFile file, + @RequestParam(value = "mode") Integer mode, + @RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { + + List list = ExcelUtils.read(file, HardnessThreeExcelVO.class); + List errorList = hardnessThreeService.importHardnessThreeList(list, mode, updatePart); + + Map returnMap = new HashMap<>(); + returnMap.put("errorCount", errorList.size()); + if(!errorList.isEmpty()) { + String url = ExcelUtils.writeLocalFile("实验室-布氏硬度基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); + returnMap.put("errorFile", url); + } + + return success(returnMap); + } + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeBaseVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeBaseVO.java new file mode 100644 index 0000000..8216341 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeBaseVO.java @@ -0,0 +1,48 @@ +package com.win.module.lab.controller.hardnessthree.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +/** + * 实验室-布氏硬度 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class HardnessThreeBaseVO { + + @Schema(description = "批次号") + private String batchNo; + + @Schema(description = "送样单位") + private String sydw; + + @Schema(description = "硬度") + private String standard; + + @Schema(description = "材质") + private String cz; + + @Schema(description = "规格") + private String guig; + + @Schema(description = "实验人") + private String testUser; + + @Schema(description = "实验日期") + private String testDate; + + @Schema(description = "实验力(KN)") + private String syl; + + @Schema(description = "压头尺寸(mm)") + private String ytcc; + + @Schema(description = "压痕直径(mm)") + private String yhzj; + + @Schema(description = "硬度") + private String testYd; + + @Schema(description = "审核状态") + private String auditStatus; +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeCreateReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeCreateReqVO.java new file mode 100644 index 0000000..03f34b9 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeCreateReqVO.java @@ -0,0 +1,12 @@ +package com.win.module.lab.controller.hardnessthree.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "管理后台 - 实验室-布氏硬度创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class HardnessThreeCreateReqVO extends HardnessThreeBaseVO { + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeExcelVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeExcelVO.java new file mode 100644 index 0000000..68a3707 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeExcelVO.java @@ -0,0 +1,58 @@ +package com.win.module.lab.controller.hardnessthree.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 实验室-布氏硬度 Excel VO + * + * @author 超级管理员 + */ +@Data +public class HardnessThreeExcelVO { + + @ExcelProperty("主键、自增") + private Long id; + + @ExcelProperty("批次号") + private String batchNo; + + @ExcelProperty("送样单位") + private String sydw; + + @ExcelProperty("硬度") + private String standard; + + @ExcelProperty("材质") + private String cz; + + @ExcelProperty("规格") + private String guig; + + @ExcelProperty("实验人") + private String testUser; + + @ExcelProperty("实验日期") + private String testDate; + + @ExcelProperty("实验力(KN)") + private String syl; + + @ExcelProperty("压头尺寸(mm)") + private String ytcc; + + @ExcelProperty("压痕直径(mm)") + private String yhzj; + + @ExcelProperty("硬度") + private String testYd; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @ExcelProperty("审核状态") + private String auditStatus; +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeExportReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeExportReqVO.java new file mode 100644 index 0000000..48472df --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeExportReqVO.java @@ -0,0 +1,54 @@ +package com.win.module.lab.controller.hardnessthree.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 实验室-布氏硬度 Excel 导出 Request VO,参数和 HardnessThreePageReqVO 是一致的") +@Data +public class HardnessThreeExportReqVO { + + @Schema(description = "批次号") + private String batchNo; + + @Schema(description = "送样单位") + private String sydw; + + @Schema(description = "硬度") + private String standard; + + @Schema(description = "材质") + private String cz; + + @Schema(description = "规格") + private String guig; + + @Schema(description = "实验人") + private String testUser; + + @Schema(description = "实验日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] testDate; + + @Schema(description = "实验力(KN)") + private String syl; + + @Schema(description = "压头尺寸(mm)") + private String ytcc; + + @Schema(description = "压痕直径(mm)") + private String yhzj; + + @Schema(description = "硬度") + private String testYd; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "审核状态") + private String auditStatus; +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreePageReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreePageReqVO.java new file mode 100644 index 0000000..aed23b4 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreePageReqVO.java @@ -0,0 +1,57 @@ +package com.win.module.lab.controller.hardnessthree.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.win.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 实验室-布氏硬度分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class HardnessThreePageReqVO extends PageParam { + + @Schema(description = "批次号") + private String batchNo; + + @Schema(description = "送样单位") + private String sydw; + + @Schema(description = "硬度") + private String standard; + + @Schema(description = "材质") + private String cz; + + @Schema(description = "规格") + private String guig; + + @Schema(description = "实验人") + private String testUser; + + @Schema(description = "实验日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] testDate; + + @Schema(description = "实验力(KN)") + private String syl; + + @Schema(description = "压头尺寸(mm)") + private String ytcc; + + @Schema(description = "压痕直径(mm)") + private String yhzj; + + @Schema(description = "硬度") + private String testYd; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "审核状态") + private String auditStatus; +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeRespVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeRespVO.java new file mode 100644 index 0000000..9bf6d82 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeRespVO.java @@ -0,0 +1,19 @@ +package com.win.module.lab.controller.hardnessthree.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 实验室-布氏硬度 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class HardnessThreeRespVO extends HardnessThreeBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "28090") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeUpdateReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeUpdateReqVO.java new file mode 100644 index 0000000..6f61619 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnessthree/vo/HardnessThreeUpdateReqVO.java @@ -0,0 +1,17 @@ +package com.win.module.lab.controller.hardnessthree.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 实验室-布氏硬度更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class HardnessThreeUpdateReqVO extends HardnessThreeBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "28090") + @NotNull(message = "主键、自增不能为空") + private Long id; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/HardnessTwoController.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/HardnessTwoController.java new file mode 100644 index 0000000..b4e08a3 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/HardnessTwoController.java @@ -0,0 +1,125 @@ +package com.win.module.lab.controller.hardnesstwo; + +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.hardnesstwo.vo.*; +import com.win.module.lab.dal.dataobject.hardnesstwo.HardnessTwoDO; +import com.win.module.lab.convert.hardnesstwo.HardnessTwoConvert; +import com.win.module.lab.service.hardnesstwo.HardnessTwoService; +import org.springframework.web.multipart.MultipartFile; + + +@Tag(name = "管理后台 - 实验室-韦氏硬度2") +@RestController +@RequestMapping("/lab/hardnesstwo") +@Validated +public class HardnessTwoController { + + @Resource + private HardnessTwoService hardnessTwoService; + + + @PostMapping("/create") + @Operation(summary = "创建实验室-韦氏硬度2") + public CommonResult createHardnessTwo(@Valid @RequestBody HardnessTwoCreateReqVO createReqVO) { + return success(hardnessTwoService.createHardnessTwo(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新实验室-韦氏硬度2") + public CommonResult updateHardnessTwo(@Valid @RequestBody HardnessTwoUpdateReqVO updateReqVO) { + hardnessTwoService.updateHardnessTwo(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除实验室-韦氏硬度2") + @Parameter(name = "id", description = "编号", required = true) + public CommonResult deleteHardnessTwo(@RequestParam("id") Long id) { + hardnessTwoService.deleteHardnessTwo(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得实验室-韦氏硬度2") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getHardnessTwo(@RequestParam("id") Long id) { + HardnessTwoDO hardnessTwo = hardnessTwoService.getHardnessTwo(id); + return success(HardnessTwoConvert.INSTANCE.convert(hardnessTwo)); + } + + + @GetMapping("/page") + @Operation(summary = "获得实验室-韦氏硬度2分页") + public CommonResult> getHardnessTwoPage(@Valid HardnessTwoPageReqVO pageVO) { + PageResult pageResult = hardnessTwoService.getHardnessTwoPage(pageVO); + return success(HardnessTwoConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出实验室-韦氏硬度2 Excel") + @OperateLog(type = EXPORT) + public void exportHardnessTwoExcel(@Valid HardnessTwoExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = hardnessTwoService.getHardnessTwoList(exportReqVO); + // 导出 Excel + List datas = HardnessTwoConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "实验室-韦氏硬度2.xls", "数据", HardnessTwoExcelVO.class, datas); + } + + @GetMapping("/get-import-template") + @Operation(summary = "获得导入实验室-韦氏硬度2模板") + public void importTemplate(HttpServletResponse response) throws IOException { + List list = Arrays.asList(); + // 输出 + ExcelUtils.write(response, "实验室-韦氏硬度2基本信息导入模板.xls", "实验室-韦氏硬度2基本信息列表", HardnessTwoExcelVO.class, list); + } + + @PostMapping("/import") + @Operation(summary = "导入实验室-韦氏硬度2基本信息") + @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> importExcel(HttpServletResponse response, + @RequestParam("file") MultipartFile file, + @RequestParam(value = "mode") Integer mode, + @RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { + + List list = ExcelUtils.read(file, HardnessTwoExcelVO.class); + List errorList = hardnessTwoService.importHardnessTwoList(list, mode, updatePart); + + Map returnMap = new HashMap<>(); + returnMap.put("errorCount", errorList.size()); + if(!errorList.isEmpty()) { + String url = ExcelUtils.writeLocalFile("实验室-韦氏硬度2基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); + returnMap.put("errorFile", url); + } + + return success(returnMap); + } + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoBaseVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoBaseVO.java new file mode 100644 index 0000000..ba87459 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoBaseVO.java @@ -0,0 +1,52 @@ +package com.win.module.lab.controller.hardnesstwo.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +/** + * 实验室-韦氏硬度2 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class HardnessTwoBaseVO { + + @Schema(description = "批次号") + private String batchNo; + + @Schema(description = "送样单位") + private String sydw; + + @Schema(description = "标准") + private String standard; + + @Schema(description = "材质") + private String cz; + + @Schema(description = "规格") + private String guig; + + @Schema(description = "实验人") + private String testUser; + + @Schema(description = "实验日期") + private String testDate; + + @Schema(description = "类别", example = "2") + private String testType; + + @Schema(description = "d1(um)") + private String dfirst; + + @Schema(description = "d2(um)") + private String dtwo; + + @Schema(description = "平均(um)") + private String davg; + + @Schema(description = "硬度") + private String testYd; + + @Schema(description = "审核状态") + private String auditStatus; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoCreateReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoCreateReqVO.java new file mode 100644 index 0000000..603cfe0 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoCreateReqVO.java @@ -0,0 +1,12 @@ +package com.win.module.lab.controller.hardnesstwo.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "管理后台 - 实验室-韦氏硬度2创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class HardnessTwoCreateReqVO extends HardnessTwoBaseVO { + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoExcelVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoExcelVO.java new file mode 100644 index 0000000..90b0e0b --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoExcelVO.java @@ -0,0 +1,60 @@ +package com.win.module.lab.controller.hardnesstwo.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 实验室-韦氏硬度2 Excel VO + * + * @author 超级管理员 + */ +@Data +public class HardnessTwoExcelVO { + + @ExcelProperty("主键、自增") + private Long id; + + @ExcelProperty("批次号") + private String batchNo; + + @ExcelProperty("送样单位") + private String sydw; + + @ExcelProperty("标准") + private String standard; + + @ExcelProperty("材质") + private String cz; + + @ExcelProperty("规格") + private String guig; + + @ExcelProperty("实验人") + private String testUser; + + @ExcelProperty("实验日期") + private String testDate; + + @ExcelProperty("类别") + private String testType; + + @ExcelProperty("d1(um)") + private String dfirst; + + @ExcelProperty("d2(um)") + private String dtwo; + + @ExcelProperty("平均(um)") + private String davg; + + @ExcelProperty("硬度") + private String testYd; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + + @ExcelProperty("审核状态") + private String auditStatus; +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoExportReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoExportReqVO.java new file mode 100644 index 0000000..b7023e7 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoExportReqVO.java @@ -0,0 +1,57 @@ +package com.win.module.lab.controller.hardnesstwo.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 实验室-韦氏硬度2 Excel 导出 Request VO,参数和 HardnessTwoPageReqVO 是一致的") +@Data +public class HardnessTwoExportReqVO { + + @Schema(description = "批次号") + private String batchNo; + + @Schema(description = "送样单位") + private String sydw; + + @Schema(description = "标准") + private String standard; + + @Schema(description = "材质") + private String cz; + + @Schema(description = "规格") + private String guig; + + @Schema(description = "实验人") + private String testUser; + + @Schema(description = "实验日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] testDate; + + @Schema(description = "类别", example = "2") + private String testType; + + @Schema(description = "d1(um)") + private String dfirst; + + @Schema(description = "d2(um)") + private String dtwo; + + @Schema(description = "平均(um)") + private String davg; + + @Schema(description = "硬度") + private String testYd; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "审核状态") + private String auditStatus; +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoPageReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoPageReqVO.java new file mode 100644 index 0000000..b298779 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoPageReqVO.java @@ -0,0 +1,60 @@ +package com.win.module.lab.controller.hardnesstwo.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.win.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 实验室-韦氏硬度2分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class HardnessTwoPageReqVO extends PageParam { + + @Schema(description = "批次号") + private String batchNo; + + @Schema(description = "送样单位") + private String sydw; + + @Schema(description = "标准") + private String standard; + + @Schema(description = "材质") + private String cz; + + @Schema(description = "规格") + private String guig; + + @Schema(description = "实验人") + private String testUser; + + @Schema(description = "实验日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] testDate; + + @Schema(description = "类别", example = "2") + private String testType; + + @Schema(description = "d1(um)") + private String dfirst; + + @Schema(description = "d2(um)") + private String dtwo; + + @Schema(description = "平均(um)") + private String davg; + + @Schema(description = "硬度") + private String testYd; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + + @Schema(description = "审核状态") + private String auditStatus; +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoRespVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoRespVO.java new file mode 100644 index 0000000..0dffac1 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoRespVO.java @@ -0,0 +1,19 @@ +package com.win.module.lab.controller.hardnesstwo.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 实验室-韦氏硬度2 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class HardnessTwoRespVO extends HardnessTwoBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "1589") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoUpdateReqVO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoUpdateReqVO.java new file mode 100644 index 0000000..879cda0 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/controller/hardnesstwo/vo/HardnessTwoUpdateReqVO.java @@ -0,0 +1,17 @@ +package com.win.module.lab.controller.hardnesstwo.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 实验室-韦氏硬度2更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class HardnessTwoUpdateReqVO extends HardnessTwoBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "1589") + @NotNull(message = "主键、自增不能为空") + private Long id; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/asyncoprlog/AsyncOprLogConvert.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/asyncoprlog/AsyncOprLogConvert.java new file mode 100644 index 0000000..dee3972 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/asyncoprlog/AsyncOprLogConvert.java @@ -0,0 +1,37 @@ +package com.win.module.lab.convert.asyncoprlog; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; + +import com.win.module.lab.api.asyncoprlog.dto.AsyncOprLogDTO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import com.win.module.lab.controller.asyncoprlog.vo.*; +import com.win.module.lab.dal.dataobject.asyncoprlog.AsyncOprLogDO; + +/** + * 实验室-主动同步日志 Convert + * + * @author 超级管理员 + */ +@Mapper +public interface AsyncOprLogConvert { + + AsyncOprLogConvert INSTANCE = Mappers.getMapper(AsyncOprLogConvert.class); + + AsyncOprLogDO convert(AsyncOprLogCreateReqVO bean); + + AsyncOprLogDO convert(AsyncOprLogUpdateReqVO bean); + + AsyncOprLogDO convert(AsyncOprLogDTO bean); + + AsyncOprLogRespVO convert(AsyncOprLogDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/hardnessthree/HardnessThreeConvert.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/hardnessthree/HardnessThreeConvert.java new file mode 100644 index 0000000..9dea9d0 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/hardnessthree/HardnessThreeConvert.java @@ -0,0 +1,34 @@ +package com.win.module.lab.convert.hardnessthree; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import com.win.module.lab.controller.hardnessthree.vo.*; +import com.win.module.lab.dal.dataobject.hardnessthree.HardnessThreeDO; + +/** + * 实验室-布氏硬度 Convert + * + * @author 超级管理员 + */ +@Mapper +public interface HardnessThreeConvert { + + HardnessThreeConvert INSTANCE = Mappers.getMapper(HardnessThreeConvert.class); + + HardnessThreeDO convert(HardnessThreeCreateReqVO bean); + + HardnessThreeDO convert(HardnessThreeUpdateReqVO bean); + + HardnessThreeRespVO convert(HardnessThreeDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/hardnesstwo/HardnessTwoConvert.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/hardnesstwo/HardnessTwoConvert.java new file mode 100644 index 0000000..b4e5260 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/hardnesstwo/HardnessTwoConvert.java @@ -0,0 +1,34 @@ +package com.win.module.lab.convert.hardnesstwo; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import com.win.module.lab.controller.hardnesstwo.vo.*; +import com.win.module.lab.dal.dataobject.hardnesstwo.HardnessTwoDO; + +/** + * 实验室-韦氏硬度2 Convert + * + * @author 超级管理员 + */ +@Mapper +public interface HardnessTwoConvert { + + HardnessTwoConvert INSTANCE = Mappers.getMapper(HardnessTwoConvert.class); + + HardnessTwoDO convert(HardnessTwoCreateReqVO bean); + + HardnessTwoDO convert(HardnessTwoUpdateReqVO bean); + + HardnessTwoRespVO convert(HardnessTwoDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/platscale/PlatscaleConvert.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/platscale/PlatscaleConvert.java index 207a7e6..5e1a387 100644 --- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/platscale/PlatscaleConvert.java +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/convert/platscale/PlatscaleConvert.java @@ -30,6 +30,8 @@ public interface PlatscaleConvert { List convertList(List list); + List convertList2(List list); + PageResult convertPage(PageResult page); List convertList02(List list); diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/dataobject/asyncoprlog/AsyncOprLogDO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/dataobject/asyncoprlog/AsyncOprLogDO.java new file mode 100644 index 0000000..4ca201f --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/dataobject/asyncoprlog/AsyncOprLogDO.java @@ -0,0 +1,49 @@ +package com.win.module.lab.dal.dataobject.asyncoprlog; + +import lombok.*; + +import java.time.LocalDate; +import com.baomidou.mybatisplus.annotation.*; +import com.win.framework.mybatis.core.dataobject.BaseDO; + +/** + * 实验室-主动同步日志 DO + * + * @author 超级管理员 + */ +@TableName("lab_async_opr_log") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AsyncOprLogDO extends BaseDO { + + /** + * 主键、自增 + */ + @TableId + private Long id; + /** + * 业务类型 + */ + private String busType; + /** + * 操作类型 + */ + private String oprType; + /** + * 操作结果 + */ + private String oprResult; + /** + * 描述 + */ + private String oprMsg; + /** + * 业务日期 + */ + private LocalDate busDate; + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/dataobject/hardnessthree/HardnessThreeDO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/dataobject/hardnessthree/HardnessThreeDO.java new file mode 100644 index 0000000..7f80eee --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/dataobject/hardnessthree/HardnessThreeDO.java @@ -0,0 +1,74 @@ +package com.win.module.lab.dal.dataobject.hardnessthree; + +import lombok.*; +import com.baomidou.mybatisplus.annotation.*; +import com.win.framework.mybatis.core.dataobject.BaseDO; + +/** + * 实验室-布氏硬度 DO + * + * @author 超级管理员 + */ +@TableName("lab_hardness_three") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class HardnessThreeDO extends BaseDO { + + /** + * 主键、自增 + */ + @TableId + private Long id; + /** + * 批次号 + */ + private String batchNo; + /** + * 送样单位 + */ + private String sydw; + /** + * 硬度 + */ + private String standard; + /** + * 材质 + */ + private String cz; + /** + * 规格 + */ + private String guig; + /** + * 实验人 + */ + private String testUser; + /** + * 实验日期 + */ + private String testDate; + /** + * 实验力(KN) + */ + private String syl; + /** + * 压头尺寸(mm) + */ + private String ytcc; + /** + * 压痕直径(mm) + */ + private String yhzj; + /** + * 硬度 + */ + private String testYd; + /** + * 审核状态 + */ + private String auditStatus; +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/dataobject/hardnesstwo/HardnessTwoDO.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/dataobject/hardnesstwo/HardnessTwoDO.java new file mode 100644 index 0000000..857a284 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/dataobject/hardnesstwo/HardnessTwoDO.java @@ -0,0 +1,78 @@ +package com.win.module.lab.dal.dataobject.hardnesstwo; + +import lombok.*; +import com.baomidou.mybatisplus.annotation.*; +import com.win.framework.mybatis.core.dataobject.BaseDO; + +/** + * 实验室-韦氏硬度2 DO + * + * @author 超级管理员 + */ +@TableName("lab_hardness_two") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class HardnessTwoDO extends BaseDO { + + /** + * 主键、自增 + */ + @TableId + private Long id; + /** + * 批次号 + */ + private String batchNo; + /** + * 送样单位 + */ + private String sydw; + /** + * 标准 + */ + private String standard; + /** + * 材质 + */ + private String cz; + /** + * 规格 + */ + private String guig; + /** + * 实验人 + */ + private String testUser; + /** + * 实验日期 + */ + private String testDate; + /** + * 类别 + */ + private String testType; + /** + * d1(um) + */ + private String dfirst; + /** + * d2(um) + */ + private String dtwo; + /** + * 平均(um) + */ + private String davg; + /** + * 硬度 + */ + private String testYd; + /** + * 审核状态 + */ + private String auditStatus; +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/asyncoprlog/AsyncOprLogMapper.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/asyncoprlog/AsyncOprLogMapper.java new file mode 100644 index 0000000..64e6fb7 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/asyncoprlog/AsyncOprLogMapper.java @@ -0,0 +1,42 @@ +package com.win.module.lab.dal.mysql.asyncoprlog; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; +import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.win.framework.mybatis.core.mapper.BaseMapperX; +import com.win.module.lab.dal.dataobject.asyncoprlog.AsyncOprLogDO; +import org.apache.ibatis.annotations.Mapper; +import com.win.module.lab.controller.asyncoprlog.vo.*; + +/** + * 实验室-主动同步日志 Mapper + * + * @author 超级管理员 + */ +@Mapper +public interface AsyncOprLogMapper extends BaseMapperX { + + default PageResult selectPage(AsyncOprLogPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(AsyncOprLogDO::getBusType, reqVO.getBusType()) + .eqIfPresent(AsyncOprLogDO::getOprType, reqVO.getOprType()) + .eqIfPresent(AsyncOprLogDO::getOprResult, reqVO.getOprResult()) + .eqIfPresent(AsyncOprLogDO::getOprMsg, reqVO.getOprMsg()) + .betweenIfPresent(AsyncOprLogDO::getBusDate, reqVO.getBusDate()) + .betweenIfPresent(AsyncOprLogDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(AsyncOprLogDO::getId)); + } + + default List selectList(AsyncOprLogExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(AsyncOprLogDO::getBusType, reqVO.getBusType()) + .eqIfPresent(AsyncOprLogDO::getOprType, reqVO.getOprType()) + .eqIfPresent(AsyncOprLogDO::getOprResult, reqVO.getOprResult()) + .eqIfPresent(AsyncOprLogDO::getOprMsg, reqVO.getOprMsg()) + .betweenIfPresent(AsyncOprLogDO::getBusDate, reqVO.getBusDate()) + .betweenIfPresent(AsyncOprLogDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(AsyncOprLogDO::getId)); + } + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/hardnessthree/HardnessThreeMapper.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/hardnessthree/HardnessThreeMapper.java new file mode 100644 index 0000000..b09aef7 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/hardnessthree/HardnessThreeMapper.java @@ -0,0 +1,56 @@ +package com.win.module.lab.dal.mysql.hardnessthree; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; +import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.win.framework.mybatis.core.mapper.BaseMapperX; +import com.win.module.lab.dal.dataobject.hardnessthree.HardnessThreeDO; +import org.apache.ibatis.annotations.Mapper; +import com.win.module.lab.controller.hardnessthree.vo.*; + +/** + * 实验室-布氏硬度 Mapper + * + * @author 超级管理员 + */ +@Mapper +public interface HardnessThreeMapper extends BaseMapperX { + + default PageResult selectPage(HardnessThreePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(HardnessThreeDO::getBatchNo, reqVO.getBatchNo()) + .eqIfPresent(HardnessThreeDO::getSydw, reqVO.getSydw()) + .eqIfPresent(HardnessThreeDO::getStandard, reqVO.getStandard()) + .eqIfPresent(HardnessThreeDO::getCz, reqVO.getCz()) + .eqIfPresent(HardnessThreeDO::getGuig, reqVO.getGuig()) + .eqIfPresent(HardnessThreeDO::getTestUser, reqVO.getTestUser()) + .betweenIfPresent(HardnessThreeDO::getTestDate, reqVO.getTestDate()) + .eqIfPresent(HardnessThreeDO::getSyl, reqVO.getSyl()) + .eqIfPresent(HardnessThreeDO::getYtcc, reqVO.getYtcc()) + .eqIfPresent(HardnessThreeDO::getYhzj, reqVO.getYhzj()) + .eqIfPresent(HardnessThreeDO::getTestYd, reqVO.getTestYd()) + .betweenIfPresent(HardnessThreeDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(HardnessThreeDO::getAuditStatus, reqVO.getAuditStatus()) + .orderByDesc(HardnessThreeDO::getId)); + } + + default List selectList(HardnessThreeExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(HardnessThreeDO::getBatchNo, reqVO.getBatchNo()) + .eqIfPresent(HardnessThreeDO::getSydw, reqVO.getSydw()) + .eqIfPresent(HardnessThreeDO::getStandard, reqVO.getStandard()) + .eqIfPresent(HardnessThreeDO::getCz, reqVO.getCz()) + .eqIfPresent(HardnessThreeDO::getGuig, reqVO.getGuig()) + .eqIfPresent(HardnessThreeDO::getTestUser, reqVO.getTestUser()) + .betweenIfPresent(HardnessThreeDO::getTestDate, reqVO.getTestDate()) + .eqIfPresent(HardnessThreeDO::getSyl, reqVO.getSyl()) + .eqIfPresent(HardnessThreeDO::getYtcc, reqVO.getYtcc()) + .eqIfPresent(HardnessThreeDO::getYhzj, reqVO.getYhzj()) + .eqIfPresent(HardnessThreeDO::getTestYd, reqVO.getTestYd()) + .betweenIfPresent(HardnessThreeDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(HardnessThreeDO::getAuditStatus, reqVO.getAuditStatus()) + .orderByDesc(HardnessThreeDO::getId)); + } + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/hardnesstwo/HardnessTwoMapper.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/hardnesstwo/HardnessTwoMapper.java new file mode 100644 index 0000000..560121c --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/hardnesstwo/HardnessTwoMapper.java @@ -0,0 +1,58 @@ +package com.win.module.lab.dal.mysql.hardnesstwo; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; +import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.win.framework.mybatis.core.mapper.BaseMapperX; +import com.win.module.lab.dal.dataobject.hardnesstwo.HardnessTwoDO; +import org.apache.ibatis.annotations.Mapper; +import com.win.module.lab.controller.hardnesstwo.vo.*; + +/** + * 实验室-韦氏硬度2 Mapper + * + * @author 超级管理员 + */ +@Mapper +public interface HardnessTwoMapper extends BaseMapperX { + + default PageResult selectPage(HardnessTwoPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(HardnessTwoDO::getBatchNo, reqVO.getBatchNo()) + .eqIfPresent(HardnessTwoDO::getSydw, reqVO.getSydw()) + .eqIfPresent(HardnessTwoDO::getStandard, reqVO.getStandard()) + .eqIfPresent(HardnessTwoDO::getCz, reqVO.getCz()) + .eqIfPresent(HardnessTwoDO::getGuig, reqVO.getGuig()) + .eqIfPresent(HardnessTwoDO::getTestUser, reqVO.getTestUser()) + .betweenIfPresent(HardnessTwoDO::getTestDate, reqVO.getTestDate()) + .eqIfPresent(HardnessTwoDO::getTestType, reqVO.getTestType()) + .eqIfPresent(HardnessTwoDO::getDfirst, reqVO.getDfirst()) + .eqIfPresent(HardnessTwoDO::getDtwo, reqVO.getDtwo()) + .eqIfPresent(HardnessTwoDO::getDavg, reqVO.getDavg()) + .eqIfPresent(HardnessTwoDO::getTestYd, reqVO.getTestYd()) + .betweenIfPresent(HardnessTwoDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(HardnessTwoDO::getAuditStatus, reqVO.getAuditStatus()) + .orderByDesc(HardnessTwoDO::getId)); + } + + default List selectList(HardnessTwoExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(HardnessTwoDO::getBatchNo, reqVO.getBatchNo()) + .eqIfPresent(HardnessTwoDO::getSydw, reqVO.getSydw()) + .eqIfPresent(HardnessTwoDO::getStandard, reqVO.getStandard()) + .eqIfPresent(HardnessTwoDO::getCz, reqVO.getCz()) + .eqIfPresent(HardnessTwoDO::getGuig, reqVO.getGuig()) + .eqIfPresent(HardnessTwoDO::getTestUser, reqVO.getTestUser()) + .betweenIfPresent(HardnessTwoDO::getTestDate, reqVO.getTestDate()) + .eqIfPresent(HardnessTwoDO::getTestType, reqVO.getTestType()) + .eqIfPresent(HardnessTwoDO::getDfirst, reqVO.getDfirst()) + .eqIfPresent(HardnessTwoDO::getDtwo, reqVO.getDtwo()) + .eqIfPresent(HardnessTwoDO::getDavg, reqVO.getDavg()) + .eqIfPresent(HardnessTwoDO::getTestYd, reqVO.getTestYd()) + .betweenIfPresent(HardnessTwoDO::getCreateTime, reqVO.getCreateTime()) + .eqIfPresent(HardnessTwoDO::getAuditStatus, reqVO.getAuditStatus()) + .orderByDesc(HardnessTwoDO::getId)); + } + +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/impact/ImpactMapper.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/impact/ImpactMapper.java index 1cca757..a0c0bd3 100644 --- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/impact/ImpactMapper.java +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/impact/ImpactMapper.java @@ -17,6 +17,8 @@ import com.win.module.lab.controller.impact.vo.*; @Mapper public interface ImpactMapper extends BaseMapperX { + public void deleteByBusDate(String busDate); + default PageResult selectPage(ImpactPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(ImpactDO::getDataId, reqVO.getDataId()) diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/platscale/PlatscaleMapper.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/platscale/PlatscaleMapper.java index 2024481..3a2b062 100644 --- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/platscale/PlatscaleMapper.java +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/platscale/PlatscaleMapper.java @@ -17,6 +17,8 @@ import com.win.module.lab.controller.platscale.vo.*; @Mapper public interface PlatscaleMapper extends BaseMapperX { + public void deleteByBusDate(String busDate); + default PageResult selectPage(PlatscalePageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(PlatscaleDO::getCh, reqVO.getCh()) diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/spectrum/SpectrumMapper.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/spectrum/SpectrumMapper.java index a86cc83..e53d72b 100644 --- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/spectrum/SpectrumMapper.java +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/spectrum/SpectrumMapper.java @@ -16,6 +16,8 @@ import com.win.module.lab.controller.spectrum.vo.*; @Mapper public interface SpectrumMapper extends BaseMapperX{ + public void deleteByBusDate(String busDate); + default PageResult selectPage(SpectrumPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(SpectrumDO::getBatchNo, reqVO.getBatchNo()) diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthousandnew/StretchThousandnewMapper.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthousandnew/StretchThousandnewMapper.java index 2757ee0..ede2073 100644 --- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthousandnew/StretchThousandnewMapper.java +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthousandnew/StretchThousandnewMapper.java @@ -17,6 +17,8 @@ import com.win.module.lab.controller.stretchthousandnew.vo.*; @Mapper public interface StretchThousandnewMapper extends BaseMapperX { + public void deleteByBusDate(String busDate); + default PageResult selectPage(StretchThousandnewPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(StretchThousandnewDO::getQxId, reqVO.getQxId()) diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthousandqx/StretchThousandQxMapper.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthousandqx/StretchThousandQxMapper.java index b6d8a25..4155a38 100644 --- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthousandqx/StretchThousandQxMapper.java +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthousandqx/StretchThousandQxMapper.java @@ -17,6 +17,8 @@ import com.win.module.lab.controller.stretchthousandqx.vo.*; @Mapper public interface StretchThousandQxMapper extends BaseMapperX{ + public void deleteByBusDate(String busDate); + default PageResult selectPage(StretchThousandQxPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(StretchThousandQxDO::getQxId, reqVO.getQxId()) diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthreehundred/StretchThreeHundredMapper.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthreehundred/StretchThreeHundredMapper.java index e35d379..b725914 100644 --- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthreehundred/StretchThreeHundredMapper.java +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthreehundred/StretchThreeHundredMapper.java @@ -18,6 +18,8 @@ import java.util.List; @Mapper public interface StretchThreeHundredMapper extends BaseMapperX { + public void deleteByBusDate(String busDate); + default PageResult selectPage(StretchThreeHundredPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(StretchThreeHundredDO::getSyid, reqVO.getSyid()) diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthreehundredqx/StretchThreeHundredQxMapper.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthreehundredqx/StretchThreeHundredQxMapper.java index 3e775f2..5161791 100644 --- a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthreehundredqx/StretchThreeHundredQxMapper.java +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/dal/mysql/stretchthreehundredqx/StretchThreeHundredQxMapper.java @@ -15,6 +15,7 @@ public interface StretchThreeHundredQxMapper extends BaseMapperX selectListForQx(String syzbh); + public void deleteByBusDate(String busDate); default PageResult selectPage(StretchThreeHundredQxPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/asyncoprlog/AsyncOprLogService.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/asyncoprlog/AsyncOprLogService.java new file mode 100644 index 0000000..142a628 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/asyncoprlog/AsyncOprLogService.java @@ -0,0 +1,79 @@ +package com.win.module.lab.service.asyncoprlog; + +import java.util.*; +import javax.validation.*; +import com.win.module.lab.controller.asyncoprlog.vo.*; +import com.win.module.lab.dal.dataobject.asyncoprlog.AsyncOprLogDO; +import com.win.framework.common.pojo.PageResult; + +/** + * 实验室-主动同步日志 Service 接口 + * + * @author 超级管理员 + */ +public interface AsyncOprLogService { + + /** + * 创建实验室-主动同步日志 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createAsyncOprLog(@Valid AsyncOprLogCreateReqVO createReqVO); + + /** + * 更新实验室-主动同步日志 + * + * @param updateReqVO 更新信息 + */ + void updateAsyncOprLog(@Valid AsyncOprLogUpdateReqVO updateReqVO); + + /** + * 删除实验室-主动同步日志 + * + * @param id 编号 + */ + void deleteAsyncOprLog(Long id); + + /** + * 获得实验室-主动同步日志 + * + * @param id 编号 + * @return 实验室-主动同步日志 + */ + AsyncOprLogDO getAsyncOprLog(Long id); + + /** + * 获得实验室-主动同步日志列表 + * + * @param ids 编号 + * @return 实验室-主动同步日志列表 + */ + List getAsyncOprLogList(Collection ids); + + /** + * 获得实验室-主动同步日志分页 + * + * @param pageReqVO 分页查询 + * @return 实验室-主动同步日志分页 + */ + PageResult getAsyncOprLogPage(AsyncOprLogPageReqVO pageReqVO); + + /** + * 获得实验室-主动同步日志列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 实验室-主动同步日志列表 + */ + List getAsyncOprLogList(AsyncOprLogExportReqVO exportReqVO); + + /** + * 导入实验室-主动同步日志主信息 + * + * @param datas 导入实验室-主动同步日志主信息列表 + * @param mode 导入模式1更新2追加3覆盖 + * @param updatePart 是否支持更新 + * @return 导入结果 + */ + public List importAsyncOprLogList(List datas, Integer mode, boolean updatePart); +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/asyncoprlog/AsyncOprLogServiceImpl.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/asyncoprlog/AsyncOprLogServiceImpl.java new file mode 100644 index 0000000..f03bb6f --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/asyncoprlog/AsyncOprLogServiceImpl.java @@ -0,0 +1,107 @@ +package com.win.module.lab.service.asyncoprlog; + +import com.win.module.lab.enums.ErrorCodeEnum; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import com.win.module.lab.controller.asyncoprlog.vo.*; +import com.win.module.lab.dal.dataobject.asyncoprlog.AsyncOprLogDO; +import com.win.framework.common.pojo.PageResult; + +import com.win.module.lab.convert.asyncoprlog.AsyncOprLogConvert; +import com.win.module.lab.dal.mysql.asyncoprlog.AsyncOprLogMapper; + +import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; + + +/** + * 实验室-主动同步日志 Service 实现类 + * + * @author 超级管理员 + */ +@Service +@Validated +public class AsyncOprLogServiceImpl implements AsyncOprLogService { + + @Resource + private AsyncOprLogMapper asyncOprLogMapper; + + @Override + public Long createAsyncOprLog(AsyncOprLogCreateReqVO createReqVO) { + // 插入 + AsyncOprLogDO asyncOprLog = AsyncOprLogConvert.INSTANCE.convert(createReqVO); + asyncOprLogMapper.insert(asyncOprLog); + // 返回 + return asyncOprLog.getId(); + } + + @Override + public void updateAsyncOprLog(AsyncOprLogUpdateReqVO updateReqVO) { + // 校验存在 + validateAsyncOprLogExists(updateReqVO.getId()); + // 更新 + AsyncOprLogDO updateObj = AsyncOprLogConvert.INSTANCE.convert(updateReqVO); + asyncOprLogMapper.updateById(updateObj); + } + + @Override + public void deleteAsyncOprLog(Long id) { + // 校验存在 + validateAsyncOprLogExists(id); + // 删除 + asyncOprLogMapper.deleteById(id); + } + + private void validateAsyncOprLogExists(Long id) { + if (asyncOprLogMapper.selectById(id) == null) { + throw exception(ErrorCodeEnum.ASYNC_OPR_LOG_NOT_EXISTS.getCode() , ErrorCodeEnum.ASYNC_OPR_LOG_NOT_EXISTS.getLabel()); + } + } + + @Override + public AsyncOprLogDO getAsyncOprLog(Long id) { + return asyncOprLogMapper.selectById(id); + } + + @Override + public List getAsyncOprLogList(Collection ids) { + return asyncOprLogMapper.selectBatchIds(ids); + } + + @Override + public PageResult getAsyncOprLogPage(AsyncOprLogPageReqVO pageReqVO) { + return asyncOprLogMapper.selectPage(pageReqVO); + } + + @Override + public List getAsyncOprLogList(AsyncOprLogExportReqVO exportReqVO) { + return asyncOprLogMapper.selectList(exportReqVO); + } + + @Override + public List importAsyncOprLogList(List datas, Integer mode, boolean updatePart) { +// if (CollUtil.isEmpty(datas)) { +// throw exception(ASYNC_OPR_LOG_IMPORT_LIST_IS_EMPTY); +// } + + List errorList = new ArrayList<>(); +// datas.forEach(item -> { +// if(errorList == null){ +// // 判断如果不存在,在进行插入 +// AsyncOprLogDO obj = asyncOprLogMapper.selectByCode(item.getCode()); +// if (obj == null&& mode != 3) { +// asyncOprLogMapper.insert(AsyncOprLogConvert.INSTANCE.convert(item)); +// } +// else if (obj != null && mode != 2) {// 如果存在,判断是否允许更新 +// AsyncOprLogDO asyncOprLogDO = AsyncOprLogConvert.INSTANCE.convert(item); +// asyncOprLogDO.setId(obj.getId()); +// asyncOprLogMapper.updateById(obj); +// } +// } +// }); + + return errorList; + } +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnessthree/HardnessThreeService.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnessthree/HardnessThreeService.java new file mode 100644 index 0000000..1c88a33 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnessthree/HardnessThreeService.java @@ -0,0 +1,79 @@ +package com.win.module.lab.service.hardnessthree; + +import java.util.*; +import javax.validation.*; +import com.win.module.lab.controller.hardnessthree.vo.*; +import com.win.module.lab.dal.dataobject.hardnessthree.HardnessThreeDO; +import com.win.framework.common.pojo.PageResult; + +/** + * 实验室-布氏硬度 Service 接口 + * + * @author 超级管理员 + */ +public interface HardnessThreeService { + + /** + * 创建实验室-布氏硬度 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createHardnessThree(@Valid HardnessThreeCreateReqVO createReqVO); + + /** + * 更新实验室-布氏硬度 + * + * @param updateReqVO 更新信息 + */ + void updateHardnessThree(@Valid HardnessThreeUpdateReqVO updateReqVO); + + /** + * 删除实验室-布氏硬度 + * + * @param id 编号 + */ + void deleteHardnessThree(Long id); + + /** + * 获得实验室-布氏硬度 + * + * @param id 编号 + * @return 实验室-布氏硬度 + */ + HardnessThreeDO getHardnessThree(Long id); + + /** + * 获得实验室-布氏硬度列表 + * + * @param ids 编号 + * @return 实验室-布氏硬度列表 + */ + List getHardnessThreeList(Collection ids); + + /** + * 获得实验室-布氏硬度分页 + * + * @param pageReqVO 分页查询 + * @return 实验室-布氏硬度分页 + */ + PageResult getHardnessThreePage(HardnessThreePageReqVO pageReqVO); + + /** + * 获得实验室-布氏硬度列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 实验室-布氏硬度列表 + */ + List getHardnessThreeList(HardnessThreeExportReqVO exportReqVO); + + /** + * 导入实验室-布氏硬度主信息 + * + * @param datas 导入实验室-布氏硬度主信息列表 + * @param mode 导入模式1更新2追加3覆盖 + * @param updatePart 是否支持更新 + * @return 导入结果 + */ + public List importHardnessThreeList(List datas, Integer mode, boolean updatePart); +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnessthree/HardnessThreeServiceImpl.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnessthree/HardnessThreeServiceImpl.java new file mode 100644 index 0000000..80932f8 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnessthree/HardnessThreeServiceImpl.java @@ -0,0 +1,106 @@ +package com.win.module.lab.service.hardnessthree; + +import com.win.module.lab.enums.ErrorCodeEnum; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import com.win.module.lab.controller.hardnessthree.vo.*; +import com.win.module.lab.dal.dataobject.hardnessthree.HardnessThreeDO; +import com.win.framework.common.pojo.PageResult; + +import com.win.module.lab.convert.hardnessthree.HardnessThreeConvert; +import com.win.module.lab.dal.mysql.hardnessthree.HardnessThreeMapper; + +import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; + +/** + * 实验室-布氏硬度 Service 实现类 + * + * @author 超级管理员 + */ +@Service +@Validated +public class HardnessThreeServiceImpl implements HardnessThreeService { + + @Resource + private HardnessThreeMapper hardnessThreeMapper; + + @Override + public Long createHardnessThree(HardnessThreeCreateReqVO createReqVO) { + // 插入 + HardnessThreeDO hardnessThree = HardnessThreeConvert.INSTANCE.convert(createReqVO); + hardnessThreeMapper.insert(hardnessThree); + // 返回 + return hardnessThree.getId(); + } + + @Override + public void updateHardnessThree(HardnessThreeUpdateReqVO updateReqVO) { + // 校验存在 + validateHardnessThreeExists(updateReqVO.getId()); + // 更新 + HardnessThreeDO updateObj = HardnessThreeConvert.INSTANCE.convert(updateReqVO); + hardnessThreeMapper.updateById(updateObj); + } + + @Override + public void deleteHardnessThree(Long id) { + // 校验存在 + validateHardnessThreeExists(id); + // 删除 + hardnessThreeMapper.deleteById(id); + } + + private void validateHardnessThreeExists(Long id) { + if (hardnessThreeMapper.selectById(id) == null) { + throw exception(ErrorCodeEnum.HARDNESS_THREE_NOT_EXISTS.getCode() , ErrorCodeEnum.HARDNESS_THREE_NOT_EXISTS.getLabel()); + } + } + + @Override + public HardnessThreeDO getHardnessThree(Long id) { + return hardnessThreeMapper.selectById(id); + } + + @Override + public List getHardnessThreeList(Collection ids) { + return hardnessThreeMapper.selectBatchIds(ids); + } + + @Override + public PageResult getHardnessThreePage(HardnessThreePageReqVO pageReqVO) { + return hardnessThreeMapper.selectPage(pageReqVO); + } + + @Override + public List getHardnessThreeList(HardnessThreeExportReqVO exportReqVO) { + return hardnessThreeMapper.selectList(exportReqVO); + } + + @Override + public List importHardnessThreeList(List datas, Integer mode, boolean updatePart) { +// if (CollUtil.isEmpty(datas)) { +// throw exception(HARDNESS_THREE_IMPORT_LIST_IS_EMPTY); +// } + + List errorList = new ArrayList<>(); +// datas.forEach(item -> { +// if(errorList == null){ +// // 判断如果不存在,在进行插入 +// HardnessThreeDO obj = hardnessThreeMapper.selectByCode(item.getCode()); +// if (obj == null&& mode != 3) { +// hardnessThreeMapper.insert(HardnessThreeConvert.INSTANCE.convert(item)); +// } +// else if (obj != null && mode != 2) {// 如果存在,判断是否允许更新 +// HardnessThreeDO hardnessThreeDO = HardnessThreeConvert.INSTANCE.convert(item); +// hardnessThreeDO.setId(obj.getId()); +// hardnessThreeMapper.updateById(obj); +// } +// } +// }); + + return errorList; + } +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnesstwo/HardnessTwoService.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnesstwo/HardnessTwoService.java new file mode 100644 index 0000000..7fb375c --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnesstwo/HardnessTwoService.java @@ -0,0 +1,79 @@ +package com.win.module.lab.service.hardnesstwo; + +import java.util.*; +import javax.validation.*; +import com.win.module.lab.controller.hardnesstwo.vo.*; +import com.win.module.lab.dal.dataobject.hardnesstwo.HardnessTwoDO; +import com.win.framework.common.pojo.PageResult; + +/** + * 实验室-韦氏硬度2 Service 接口 + * + * @author 超级管理员 + */ +public interface HardnessTwoService { + + /** + * 创建实验室-韦氏硬度2 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createHardnessTwo(@Valid HardnessTwoCreateReqVO createReqVO); + + /** + * 更新实验室-韦氏硬度2 + * + * @param updateReqVO 更新信息 + */ + void updateHardnessTwo(@Valid HardnessTwoUpdateReqVO updateReqVO); + + /** + * 删除实验室-韦氏硬度2 + * + * @param id 编号 + */ + void deleteHardnessTwo(Long id); + + /** + * 获得实验室-韦氏硬度2 + * + * @param id 编号 + * @return 实验室-韦氏硬度2 + */ + HardnessTwoDO getHardnessTwo(Long id); + + /** + * 获得实验室-韦氏硬度2列表 + * + * @param ids 编号 + * @return 实验室-韦氏硬度2列表 + */ + List getHardnessTwoList(Collection ids); + + /** + * 获得实验室-韦氏硬度2分页 + * + * @param pageReqVO 分页查询 + * @return 实验室-韦氏硬度2分页 + */ + PageResult getHardnessTwoPage(HardnessTwoPageReqVO pageReqVO); + + /** + * 获得实验室-韦氏硬度2列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 实验室-韦氏硬度2列表 + */ + List getHardnessTwoList(HardnessTwoExportReqVO exportReqVO); + + /** + * 导入实验室-韦氏硬度2主信息 + * + * @param datas 导入实验室-韦氏硬度2主信息列表 + * @param mode 导入模式1更新2追加3覆盖 + * @param updatePart 是否支持更新 + * @return 导入结果 + */ + public List importHardnessTwoList(List datas, Integer mode, boolean updatePart); +} diff --git a/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnesstwo/HardnessTwoServiceImpl.java b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnesstwo/HardnessTwoServiceImpl.java new file mode 100644 index 0000000..2bee398 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/java/com/win/module/lab/service/hardnesstwo/HardnessTwoServiceImpl.java @@ -0,0 +1,107 @@ +package com.win.module.lab.service.hardnesstwo; + +import com.win.module.lab.enums.ErrorCodeEnum; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import com.win.module.lab.controller.hardnesstwo.vo.*; +import com.win.module.lab.dal.dataobject.hardnesstwo.HardnessTwoDO; +import com.win.framework.common.pojo.PageResult; + +import com.win.module.lab.convert.hardnesstwo.HardnessTwoConvert; +import com.win.module.lab.dal.mysql.hardnesstwo.HardnessTwoMapper; + +import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; + + +/** + * 实验室-韦氏硬度2 Service 实现类 + * + * @author 超级管理员 + */ +@Service +@Validated +public class HardnessTwoServiceImpl implements HardnessTwoService { + + @Resource + private HardnessTwoMapper hardnessTwoMapper; + + @Override + public Long createHardnessTwo(HardnessTwoCreateReqVO createReqVO) { + // 插入 + HardnessTwoDO hardnessTwo = HardnessTwoConvert.INSTANCE.convert(createReqVO); + hardnessTwoMapper.insert(hardnessTwo); + // 返回 + return hardnessTwo.getId(); + } + + @Override + public void updateHardnessTwo(HardnessTwoUpdateReqVO updateReqVO) { + // 校验存在 + validateHardnessTwoExists(updateReqVO.getId()); + // 更新 + HardnessTwoDO updateObj = HardnessTwoConvert.INSTANCE.convert(updateReqVO); + hardnessTwoMapper.updateById(updateObj); + } + + @Override + public void deleteHardnessTwo(Long id) { + // 校验存在 + validateHardnessTwoExists(id); + // 删除 + hardnessTwoMapper.deleteById(id); + } + + private void validateHardnessTwoExists(Long id) { + if (hardnessTwoMapper.selectById(id) == null) { + throw exception(ErrorCodeEnum.HARDNESS_TWO_NOT_EXISTS.getCode() , ErrorCodeEnum.HARDNESS_TWO_NOT_EXISTS.getLabel()); + } + } + + @Override + public HardnessTwoDO getHardnessTwo(Long id) { + return hardnessTwoMapper.selectById(id); + } + + @Override + public List getHardnessTwoList(Collection ids) { + return hardnessTwoMapper.selectBatchIds(ids); + } + + @Override + public PageResult getHardnessTwoPage(HardnessTwoPageReqVO pageReqVO) { + return hardnessTwoMapper.selectPage(pageReqVO); + } + + @Override + public List getHardnessTwoList(HardnessTwoExportReqVO exportReqVO) { + return hardnessTwoMapper.selectList(exportReqVO); + } + + @Override + public List importHardnessTwoList(List datas, Integer mode, boolean updatePart) { +// if (CollUtil.isEmpty(datas)) { +// throw exception(HARDNESS_TWO_IMPORT_LIST_IS_EMPTY); +// } + + List errorList = new ArrayList<>(); +// datas.forEach(item -> { +// if(errorList == null){ +// // 判断如果不存在,在进行插入 +// HardnessTwoDO obj = hardnessTwoMapper.selectByCode(item.getCode()); +// if (obj == null&& mode != 3) { +// hardnessTwoMapper.insert(HardnessTwoConvert.INSTANCE.convert(item)); +// } +// else if (obj != null && mode != 2) {// 如果存在,判断是否允许更新 +// HardnessTwoDO hardnessTwoDO = HardnessTwoConvert.INSTANCE.convert(item); +// hardnessTwoDO.setId(obj.getId()); +// hardnessTwoMapper.updateById(obj); +// } +// } +// }); + + return errorList; + } +} diff --git a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/asyncoprlog/AsyncOprLogMapper.xml b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/asyncoprlog/AsyncOprLogMapper.xml new file mode 100644 index 0000000..163b083 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/asyncoprlog/AsyncOprLogMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/hardnessthree/HardnessThreeMapper.xml b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/hardnessthree/HardnessThreeMapper.xml new file mode 100644 index 0000000..0fbfb25 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/hardnessthree/HardnessThreeMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/hardnesstwo/HardnessTwoMapper.xml b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/hardnesstwo/HardnessTwoMapper.xml new file mode 100644 index 0000000..39151d2 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/hardnesstwo/HardnessTwoMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/impact/ImpactMapper.xml b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/impact/ImpactMapper.xml index 0c993e8..0bca4b8 100644 --- a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/impact/ImpactMapper.xml +++ b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/impact/ImpactMapper.xml @@ -2,6 +2,8 @@ - + + delete from lab_impact where DATE_FORMAT(create_time , '%Y%m%d') = #{busDate} + diff --git a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/platscale/PlatscaleMapper.xml b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/platscale/PlatscaleMapper.xml index ba844b1..3d4f8ad 100644 --- a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/platscale/PlatscaleMapper.xml +++ b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/platscale/PlatscaleMapper.xml @@ -2,11 +2,8 @@ - + + delete from lab_platscale where DATE_FORMAT(create_time , '%Y-%m-%d') = #{busDate} + diff --git a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/spectrum/SpectrumMapper.xml b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/spectrum/SpectrumMapper.xml index 3bb4f09..064ff28 100644 --- a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/spectrum/SpectrumMapper.xml +++ b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/spectrum/SpectrumMapper.xml @@ -2,6 +2,8 @@ - + + delete from lab_spectrum where DATE_FORMAT(create_time , '%Y-%m-%d') = #{busDate} + diff --git a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthousandnew/StretchThousandnewMapper.xml b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthousandnew/StretchThousandnewMapper.xml index b6f60db..dc3ba71 100644 --- a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthousandnew/StretchThousandnewMapper.xml +++ b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthousandnew/StretchThousandnewMapper.xml @@ -2,6 +2,8 @@ - + + delete from lab_stretch_thousandnew where DATE_FORMAT(create_time , '%Y-%m-%d') = #{busDate} + diff --git a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthousandqx/StretchThousandQxMapper.xml b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthousandqx/StretchThousandQxMapper.xml new file mode 100644 index 0000000..45c7261 --- /dev/null +++ b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthousandqx/StretchThousandQxMapper.xml @@ -0,0 +1,9 @@ + + + + + + delete from lab_stretch_1000_qx where DATE_FORMAT(create_time , '%Y-%m-%d') = #{busDate} + + + diff --git a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthreehundred/StretchThreeHundredMapper.xml b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthreehundred/StretchThreeHundredMapper.xml index 80ecea5..94d26bb 100644 --- a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthreehundred/StretchThreeHundredMapper.xml +++ b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthreehundred/StretchThreeHundredMapper.xml @@ -2,6 +2,8 @@ - + + delete from lab_stretch_300 where DATE_FORMAT(create_time , '%Y-%m-%d') = #{busDate} + diff --git a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthreehundred/StretchThreeHundredQxMapper.xml b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthreehundred/StretchThreeHundredQxMapper.xml index b07fd1f..02d628e 100644 --- a/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthreehundred/StretchThreeHundredQxMapper.xml +++ b/win-module-lab/win-module-lab-biz/src/main/resources/mapper/stretchthreehundred/StretchThreeHundredQxMapper.xml @@ -14,4 +14,8 @@ order by t.id + + delete from lab_stretch_300_qx where DATE_FORMAT(create_time , '%Y-%m-%d') = #{busDate} + + diff --git a/win-module-pszc/pom.xml b/win-module-pszc/pom.xml new file mode 100644 index 0000000..7f4e0d9 --- /dev/null +++ b/win-module-pszc/pom.xml @@ -0,0 +1,18 @@ + + + + win + com.win + 3.0.0 + + 4.0.0 + + win-module-pszc + pom + + win-module-pszc-api + win-module-pszc-biz + + \ No newline at end of file diff --git a/win-module-pszc/win-module-pszc-api/pom.xml b/win-module-pszc/win-module-pszc-api/pom.xml new file mode 100644 index 0000000..d2a104c --- /dev/null +++ b/win-module-pszc/win-module-pszc-api/pom.xml @@ -0,0 +1,29 @@ + + + + win-module-pszc + com.win + 3.0.0 + + 4.0.0 + + win-module-pszc-api + + + + com.win + win-common + + + + + org.springframework.boot + spring-boot-starter-validation + true + + + + + \ No newline at end of file diff --git a/win-module-pszc/win-module-pszc-api/src/main/java/com/win/module/pszc/enums/PszcErrorCode.java b/win-module-pszc/win-module-pszc-api/src/main/java/com/win/module/pszc/enums/PszcErrorCode.java new file mode 100644 index 0000000..1d674a1 --- /dev/null +++ b/win-module-pszc/win-module-pszc-api/src/main/java/com/win/module/pszc/enums/PszcErrorCode.java @@ -0,0 +1,41 @@ +package com.win.module.pszc.enums; + +public enum PszcErrorCode { + + PS_ELECTRICDATA_NOT_EXISTS(5001 , "智能电表数据不存在"), + + PS_ELECTRICDATA_IMPORT_LIST_IS_EMPTY(5002 , "导入智能电表数据不存在"), + + PS_IREALDATA_NOT_EXISTS(5003 , "一次主表数据不存在"), + + PS_IREALDATA_IMPORT_LIST_IS_EMPTY(5004 , "导入一次主表数据不存在"), + + PS_PUMPDATA_NOT_EXISTS(5005 , "泵站数据不存在"), + + PS_PUMPDATA_IMPORT_LIST_IS_EMPTY(5006 , "导入泵站数据不存在"); + + private Integer code; + + private String label; + + PszcErrorCode(Integer code , String label) { + this.code = code; + this.label = label; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } +} diff --git a/win-module-pszc/win-module-pszc-biz/pom.xml b/win-module-pszc/win-module-pszc-biz/pom.xml new file mode 100644 index 0000000..3c6507d --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/pom.xml @@ -0,0 +1,96 @@ + + + + win-module-pszc + com.win + 3.0.0 + + 4.0.0 + + win-module-pszc-biz + + + + com.win + win-module-pszc-api + ${revision} + + + + + com.win + win-spring-boot-starter-biz-operatelog + + + + com.win + win-spring-boot-starter-biz-dict + + + + + com.win + win-spring-boot-starter-security + + + + org.springframework.boot + spring-boot-starter-validation + + + + + com.win + win-spring-boot-starter-mybatis + + + + com.win + win-spring-boot-starter-redis + + + + + com.win + win-spring-boot-starter-job + + + + + com.win + win-spring-boot-starter-excel + + + + com.win + win-spring-boot-starter-captcha + + + + org.springframework.boot + spring-boot-starter-mail + + + com.win + win-spring-boot-starter-job + + + org.apache.poi + poi + 4.1.2 + + + org.apache.poi + poi-ooxml + 4.1.2 + + + org.apache.poi + poi-scratchpad + 4.1.2 + + + + \ No newline at end of file diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/PsElectricdataController.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/PsElectricdataController.java new file mode 100644 index 0000000..80890a9 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/PsElectricdataController.java @@ -0,0 +1,126 @@ +package com.win.module.pszc.controller.pselectricdata; + +import io.swagger.v3.oas.annotations.Parameters; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +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.pszc.controller.pselectricdata.vo.*; +import com.win.module.pszc.dal.dataobject.pselectricdata.PsElectricdataDO; +import com.win.module.pszc.convert.pselectricdata.PsElectricdataConvert; +import com.win.module.pszc.service.pselectricdata.PsElectricdataService; +import org.springframework.web.multipart.MultipartFile; + + +@Tag(name = "管理后台 - 变电所-智能电") +@RestController +@RequestMapping("/pszc/pselectricdata") +@Validated +public class PsElectricdataController { + + @Resource + private PsElectricdataService psElectricdataService; + + + @PostMapping("/create") + @Operation(summary = "创建变电所-智能电") + public CommonResult createPsElectricdata(@Valid @RequestBody PsElectricdataCreateReqVO createReqVO) { + return success(psElectricdataService.createPsElectricdata(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新变电所-智能电") + public CommonResult updatePsElectricdata(@Valid @RequestBody PsElectricdataUpdateReqVO updateReqVO) { + psElectricdataService.updatePsElectricdata(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除变电所-智能电") + @Parameter(name = "id", description = "编号", required = true) + public CommonResult deletePsElectricdata(@RequestParam("id") Long id) { + psElectricdataService.deletePsElectricdata(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得变电所-智能电") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getPsElectricdata(@RequestParam("id") Long id) { + PsElectricdataDO psElectricdata = psElectricdataService.getPsElectricdata(id); + return success(PsElectricdataConvert.INSTANCE.convert(psElectricdata)); + } + + + @GetMapping("/page") + @Operation(summary = "获得变电所-智能电分页") + public CommonResult> getPsElectricdataPage(@Valid PsElectricdataPageReqVO pageVO) { + PageResult pageResult = psElectricdataService.getPsElectricdataPage(pageVO); + return success(PsElectricdataConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出变电所-智能电 Excel") + @OperateLog(type = EXPORT) + public void exportPsElectricdataExcel(@Valid PsElectricdataExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = psElectricdataService.getPsElectricdataList(exportReqVO); + // 导出 Excel + List datas = PsElectricdataConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "变电所-智能电.xls", "数据", PsElectricdataExcelVO.class, datas); + } + + @GetMapping("/get-import-template") + @Operation(summary = "获得导入变电所-智能电模板") + public void importTemplate(HttpServletResponse response) throws IOException { + List list = Arrays.asList(); + // 输出 + ExcelUtils.write(response, "变电所-智能电基本信息导入模板.xls", "变电所-智能电基本信息列表", PsElectricdataExcelVO.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") + }) + @PreAuthorize("@ss.hasPermission('pszc:ps-electricdata:import')") + public CommonResult> importExcel(HttpServletResponse response, + @RequestParam("file") MultipartFile file, + @RequestParam(value = "mode") Integer mode, + @RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { + + List list = ExcelUtils.read(file, PsElectricdataExcelVO.class); + List errorList = psElectricdataService.importPsElectricdataList(list, mode, updatePart); + + Map returnMap = new HashMap<>(); + returnMap.put("errorCount", errorList.size()); + if(!errorList.isEmpty()) { + String url = ExcelUtils.writeLocalFile("变电所-智能电基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); + returnMap.put("errorFile", url); + } + + return success(returnMap); + } + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataBaseVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataBaseVO.java new file mode 100644 index 0000000..e635beb --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataBaseVO.java @@ -0,0 +1,34 @@ +package com.win.module.pszc.controller.pselectricdata.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import javax.validation.constraints.*; + +/** + * 变电所-智能电 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class PsElectricdataBaseVO { + + @Schema(description = "数据点编号,例如Ua、Ia", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "数据点编号,例如Ua、Ia不能为空") + private String icode; + + @Schema(description = "数据点名称,例如电压、电流", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @NotNull(message = "数据点名称,例如电压、电流不能为空") + private String iname; + + @Schema(description = "采集值", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采集值不能为空") + private String ivalue; + + @Schema(description = "仪表的编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "仪表的编号不能为空") + private String mcode; + + @Schema(description = "仪表的名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") + @NotNull(message = "仪表的名称不能为空") + private String mname; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataCreateReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataCreateReqVO.java new file mode 100644 index 0000000..6f805ab --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataCreateReqVO.java @@ -0,0 +1,12 @@ +package com.win.module.pszc.controller.pselectricdata.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "管理后台 - 变电所-智能电创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsElectricdataCreateReqVO extends PsElectricdataBaseVO { + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataExcelVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataExcelVO.java new file mode 100644 index 0000000..b07e250 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataExcelVO.java @@ -0,0 +1,37 @@ +package com.win.module.pszc.controller.pselectricdata.vo; + +import lombok.*; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 变电所-智能电 Excel VO + * + * @author 超级管理员 + */ +@Data +public class PsElectricdataExcelVO { + + @ExcelProperty("主键、自增") + private Long id; + + @ExcelProperty("数据点编号,例如Ua、Ia") + private String icode; + + @ExcelProperty("数据点名称,例如电压、电流") + private String iname; + + @ExcelProperty("采集值") + private String ivalue; + + @ExcelProperty("仪表的编号") + private String mcode; + + @ExcelProperty("仪表的名称") + private String mname; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataExportReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataExportReqVO.java new file mode 100644 index 0000000..9ca574d --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataExportReqVO.java @@ -0,0 +1,33 @@ +package com.win.module.pszc.controller.pselectricdata.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 变电所-智能电 Excel 导出 Request VO,参数和 PsElectricdataPageReqVO 是一致的") +@Data +public class PsElectricdataExportReqVO { + + @Schema(description = "数据点编号,例如Ua、Ia") + private String icode; + + @Schema(description = "数据点名称,例如电压、电流", example = "芋艿") + private String iname; + + @Schema(description = "采集值") + private String ivalue; + + @Schema(description = "仪表的编号") + private String mcode; + + @Schema(description = "仪表的名称", example = "王五") + private String mname; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataPageReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataPageReqVO.java new file mode 100644 index 0000000..6c25eda --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataPageReqVO.java @@ -0,0 +1,36 @@ +package com.win.module.pszc.controller.pselectricdata.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.win.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 变电所-智能电分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsElectricdataPageReqVO extends PageParam { + + @Schema(description = "数据点编号,例如Ua、Ia") + private String icode; + + @Schema(description = "数据点名称,例如电压、电流", example = "芋艿") + private String iname; + + @Schema(description = "采集值") + private String ivalue; + + @Schema(description = "仪表的编号") + private String mcode; + + @Schema(description = "仪表的名称", example = "王五") + private String mname; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataRespVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataRespVO.java new file mode 100644 index 0000000..4096971 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataRespVO.java @@ -0,0 +1,19 @@ +package com.win.module.pszc.controller.pselectricdata.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 变电所-智能电 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsElectricdataRespVO extends PsElectricdataBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "29985") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataUpdateReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataUpdateReqVO.java new file mode 100644 index 0000000..878ad30 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pselectricdata/vo/PsElectricdataUpdateReqVO.java @@ -0,0 +1,17 @@ +package com.win.module.pszc.controller.pselectricdata.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 变电所-智能电更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsElectricdataUpdateReqVO extends PsElectricdataBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "29985") + @NotNull(message = "主键、自增不能为空") + private Long id; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/PsIrealdataController.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/PsIrealdataController.java new file mode 100644 index 0000000..7be4adb --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/PsIrealdataController.java @@ -0,0 +1,126 @@ +package com.win.module.pszc.controller.psirealdata; + +import io.swagger.v3.oas.annotations.Parameters; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +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.constraints.*; +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.pszc.controller.psirealdata.vo.*; +import com.win.module.pszc.dal.dataobject.psirealdata.PsIrealdataDO; +import com.win.module.pszc.convert.psirealdata.PsIrealdataConvert; +import com.win.module.pszc.service.psirealdata.PsIrealdataService; +import org.springframework.web.multipart.MultipartFile; + +@Tag(name = "管理后台 - 变电所-一次主表") +@RestController +@RequestMapping("/pszc/psirealdata") +@Validated +public class PsIrealdataController { + + @Resource + private PsIrealdataService psIrealdataService; + + + @PostMapping("/create") + @Operation(summary = "创建变电所-一次主表") + public CommonResult createPsIrealdata(@Valid @RequestBody PsIrealdataCreateReqVO createReqVO) { + return success(psIrealdataService.createPsIrealdata(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新变电所-一次主表") + public CommonResult updatePsIrealdata(@Valid @RequestBody PsIrealdataUpdateReqVO updateReqVO) { + psIrealdataService.updatePsIrealdata(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除变电所-一次主表") + @Parameter(name = "id", description = "编号", required = true) + public CommonResult deletePsIrealdata(@RequestParam("id") Long id) { + psIrealdataService.deletePsIrealdata(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得变电所-一次主表") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getPsIrealdata(@RequestParam("id") Long id) { + PsIrealdataDO psIrealdata = psIrealdataService.getPsIrealdata(id); + return success(PsIrealdataConvert.INSTANCE.convert(psIrealdata)); + } + + + @GetMapping("/page") + @Operation(summary = "获得变电所-一次主表分页") + public CommonResult> getPsIrealdataPage(@Valid PsIrealdataPageReqVO pageVO) { + PageResult pageResult = psIrealdataService.getPsIrealdataPage(pageVO); + return success(PsIrealdataConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出变电所-一次主表 Excel") + @OperateLog(type = EXPORT) + public void exportPsIrealdataExcel(@Valid PsIrealdataExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = psIrealdataService.getPsIrealdataList(exportReqVO); + // 导出 Excel + List datas = PsIrealdataConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "变电所-一次主表.xls", "数据", PsIrealdataExcelVO.class, datas); + } + + @GetMapping("/get-import-template") + @Operation(summary = "获得导入变电所-一次主表模板") + public void importTemplate(HttpServletResponse response) throws IOException { + List list = Arrays.asList(); + // 输出 + ExcelUtils.write(response, "变电所-一次主表基本信息导入模板.xls", "变电所-一次主表基本信息列表", PsIrealdataExcelVO.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> importExcel(HttpServletResponse response, + @RequestParam("file") MultipartFile file, + @RequestParam(value = "mode") Integer mode, + @RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { + + List list = ExcelUtils.read(file, PsIrealdataExcelVO.class); + List errorList = psIrealdataService.importPsIrealdataList(list, mode, updatePart); + + Map returnMap = new HashMap<>(); + returnMap.put("errorCount", errorList.size()); + if(!errorList.isEmpty()) { + String url = ExcelUtils.writeLocalFile("变电所-一次主表基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); + returnMap.put("errorFile", url); + } + + return success(returnMap); + } + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataBaseVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataBaseVO.java new file mode 100644 index 0000000..71e790d --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataBaseVO.java @@ -0,0 +1,61 @@ +package com.win.module.pszc.controller.psirealdata.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; +import javax.validation.constraints.*; +import org.springframework.format.annotation.DateTimeFormat; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +/** + * 变电所-一次主表 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class PsIrealdataBaseVO { + + @Schema(description = "原始表key(RTU+仪表索引号+Pt+点索引号);子设备key(S+子设备序列号+RTU+仪表索引号+Pt+点索引号)") + private String ikey; + + @Schema(description = "数据点编号,例如Ua、Ia", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "数据点编号,例如Ua、Ia不能为空") + private String icode; + + @Schema(description = "数据点描述,例如电压、电流", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "数据点描述,例如电压、电流不能为空") + private String idesc; + + @Schema(description = "内部编号") + private String icls; + + @Schema(description = "每个仪表内的索引号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "每个仪表内的索引号不能为空") + private Integer ino; + + @Schema(description = "采集值", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采集值不能为空") + private String ivalue; + + @Schema(description = "该仪表在系统内的编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "该仪表在系统内的编号不能为空") + private Integer irtuno; + + @Schema(description = "仪表的编号Meter01", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") + @NotNull(message = "仪表的编号Meter01不能为空") + private String irtuname; + + @Schema(description = "仪表的描述总用电表", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "仪表的描述总用电表不能为空") + private String irtudesc; + + @Schema(description = "仪表编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") + @NotNull(message = "仪表编号不能为空") + private Integer irtutype; + + @Schema(description = "采集系统向数据库更新数据的时间", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采集系统向数据库更新数据的时间不能为空") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime iupdatetime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataCreateReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataCreateReqVO.java new file mode 100644 index 0000000..c3c35e8 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataCreateReqVO.java @@ -0,0 +1,12 @@ +package com.win.module.pszc.controller.psirealdata.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "管理后台 - 变电所-一次主表创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsIrealdataCreateReqVO extends PsIrealdataBaseVO { + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataExcelVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataExcelVO.java new file mode 100644 index 0000000..766c133 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataExcelVO.java @@ -0,0 +1,55 @@ +package com.win.module.pszc.controller.psirealdata.vo; + +import lombok.*; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 变电所-一次主表 Excel VO + * + * @author 超级管理员 + */ +@Data +public class PsIrealdataExcelVO { + + @ExcelProperty("主键、自增") + private Long id; + + @ExcelProperty("原始表key(RTU+仪表索引号+Pt+点索引号);子设备key(S+子设备序列号+RTU+仪表索引号+Pt+点索引号)") + private String ikey; + + @ExcelProperty("数据点编号,例如Ua、Ia") + private String icode; + + @ExcelProperty("数据点描述,例如电压、电流") + private String idesc; + + @ExcelProperty("内部编号") + private String icls; + + @ExcelProperty("每个仪表内的索引号") + private Integer ino; + + @ExcelProperty("采集值") + private String ivalue; + + @ExcelProperty("该仪表在系统内的编号") + private Integer irtuno; + + @ExcelProperty("仪表的编号Meter01") + private String irtuname; + + @ExcelProperty("仪表的描述总用电表") + private String irtudesc; + + @ExcelProperty("仪表编号") + private Integer irtutype; + + @ExcelProperty("采集系统向数据库更新数据的时间") + private LocalDateTime iupdatetime; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataExportReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataExportReqVO.java new file mode 100644 index 0000000..04aea0b --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataExportReqVO.java @@ -0,0 +1,52 @@ +package com.win.module.pszc.controller.psirealdata.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 变电所-一次主表 Excel 导出 Request VO,参数和 PsIrealdataPageReqVO 是一致的") +@Data +public class PsIrealdataExportReqVO { + + @Schema(description = "原始表key(RTU+仪表索引号+Pt+点索引号);子设备key(S+子设备序列号+RTU+仪表索引号+Pt+点索引号)") + private String ikey; + + @Schema(description = "数据点编号,例如Ua、Ia") + private String icode; + + @Schema(description = "数据点描述,例如电压、电流") + private String idesc; + + @Schema(description = "内部编号") + private String icls; + + @Schema(description = "每个仪表内的索引号") + private Integer ino; + + @Schema(description = "采集值") + private String ivalue; + + @Schema(description = "该仪表在系统内的编号") + private Integer irtuno; + + @Schema(description = "仪表的编号Meter01", example = "李四") + private String irtuname; + + @Schema(description = "仪表的描述总用电表") + private String irtudesc; + + @Schema(description = "仪表编号", example = "2") + private Integer irtutype; + + @Schema(description = "采集系统向数据库更新数据的时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] iupdatetime; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataPageReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataPageReqVO.java new file mode 100644 index 0000000..d3ca15d --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataPageReqVO.java @@ -0,0 +1,55 @@ +package com.win.module.pszc.controller.psirealdata.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.win.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 变电所-一次主表分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsIrealdataPageReqVO extends PageParam { + + @Schema(description = "原始表key(RTU+仪表索引号+Pt+点索引号);子设备key(S+子设备序列号+RTU+仪表索引号+Pt+点索引号)") + private String ikey; + + @Schema(description = "数据点编号,例如Ua、Ia") + private String icode; + + @Schema(description = "数据点描述,例如电压、电流") + private String idesc; + + @Schema(description = "内部编号") + private String icls; + + @Schema(description = "每个仪表内的索引号") + private Integer ino; + + @Schema(description = "采集值") + private String ivalue; + + @Schema(description = "该仪表在系统内的编号") + private Integer irtuno; + + @Schema(description = "仪表的编号Meter01", example = "李四") + private String irtuname; + + @Schema(description = "仪表的描述总用电表") + private String irtudesc; + + @Schema(description = "仪表编号", example = "2") + private Integer irtutype; + + @Schema(description = "采集系统向数据库更新数据的时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] iupdatetime; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataRespVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataRespVO.java new file mode 100644 index 0000000..5d12b64 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataRespVO.java @@ -0,0 +1,19 @@ +package com.win.module.pszc.controller.psirealdata.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 变电所-一次主表 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsIrealdataRespVO extends PsIrealdataBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "26875") + private Long id; + + @Schema(description = "创建时间") + private LocalDateTime createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataUpdateReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataUpdateReqVO.java new file mode 100644 index 0000000..0881868 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/psirealdata/vo/PsIrealdataUpdateReqVO.java @@ -0,0 +1,17 @@ +package com.win.module.pszc.controller.psirealdata.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 变电所-一次主表更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsIrealdataUpdateReqVO extends PsIrealdataBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "26875") + @NotNull(message = "主键、自增不能为空") + private Long id; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/PsPumpdataController.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/PsPumpdataController.java new file mode 100644 index 0000000..5985270 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/PsPumpdataController.java @@ -0,0 +1,123 @@ +package com.win.module.pszc.controller.pspumpdata; + +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.pszc.controller.pspumpdata.vo.*; +import com.win.module.pszc.dal.dataobject.pspumpdata.PsPumpdataDO; +import com.win.module.pszc.convert.pspumpdata.PsPumpdataConvert; +import com.win.module.pszc.service.pspumpdata.PsPumpdataService; +import org.springframework.web.multipart.MultipartFile; + +@Tag(name = "管理后台 - 变电所-泵站") +@RestController +@RequestMapping("/pszc/pspumpdata") +@Validated +public class PsPumpdataController { + + @Resource + private PsPumpdataService psPumpdataService; + + + @PostMapping("/create") + @Operation(summary = "创建变电所-泵站") + public CommonResult createPsPumpdata(@Valid @RequestBody PsPumpdataCreateReqVO createReqVO) { + return success(psPumpdataService.createPsPumpdata(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新变电所-泵站") + public CommonResult updatePsPumpdata(@Valid @RequestBody PsPumpdataUpdateReqVO updateReqVO) { + psPumpdataService.updatePsPumpdata(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除变电所-泵站") + @Parameter(name = "id", description = "编号", required = true) + public CommonResult deletePsPumpdata(@RequestParam("id") Long id) { + psPumpdataService.deletePsPumpdata(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得变电所-泵站") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + public CommonResult getPsPumpdata(@RequestParam("id") Long id) { + PsPumpdataDO psPumpdata = psPumpdataService.getPsPumpdata(id); + return success(PsPumpdataConvert.INSTANCE.convert(psPumpdata)); + } + + + @GetMapping("/page") + @Operation(summary = "获得变电所-泵站分页") + public CommonResult> getPsPumpdataPage(@Valid PsPumpdataPageReqVO pageVO) { + PageResult pageResult = psPumpdataService.getPsPumpdataPage(pageVO); + return success(PsPumpdataConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出变电所-泵站 Excel") + @OperateLog(type = EXPORT) + public void exportPsPumpdataExcel(@Valid PsPumpdataExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = psPumpdataService.getPsPumpdataList(exportReqVO); + // 导出 Excel + List datas = PsPumpdataConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "变电所-泵站.xls", "数据", PsPumpdataExcelVO.class, datas); + } + + @GetMapping("/get-import-template") + @Operation(summary = "获得导入变电所-泵站模板") + public void importTemplate(HttpServletResponse response) throws IOException { + List list = Arrays.asList(); + // 输出 + ExcelUtils.write(response, "变电所-泵站基本信息导入模板.xls", "变电所-泵站基本信息列表", PsPumpdataExcelVO.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> importExcel(HttpServletResponse response, + @RequestParam("file") MultipartFile file, + @RequestParam(value = "mode") Integer mode, + @RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { + + List list = ExcelUtils.read(file, PsPumpdataExcelVO.class); + List errorList = psPumpdataService.importPsPumpdataList(list, mode, updatePart); + + Map returnMap = new HashMap<>(); + returnMap.put("errorCount", errorList.size()); + if(!errorList.isEmpty()) { + String url = ExcelUtils.writeLocalFile("变电所-泵站基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); + returnMap.put("errorFile", url); + } + + return success(returnMap); + } + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataBaseVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataBaseVO.java new file mode 100644 index 0000000..5e92723 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataBaseVO.java @@ -0,0 +1,35 @@ +package com.win.module.pszc.controller.pspumpdata.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import javax.validation.constraints.*; + +/** + * 变电所-泵站 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + * + */ +@Data +public class PsPumpdataBaseVO { + + @Schema(description = "数据点编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "数据点编号不能为空") + private String icode; + + @Schema(description = "数据点名称,例如状态,流量", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") + @NotNull(message = "数据点名称,例如状态,流量不能为空") + private String iname; + + @Schema(description = "采集值", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "采集值不能为空") + private String ivalue; + + @Schema(description = "仪表的编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "仪表的编号不能为空") + private String mcode; + + @Schema(description = "仪表的名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") + @NotNull(message = "仪表的名称不能为空") + private String mname; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataCreateReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataCreateReqVO.java new file mode 100644 index 0000000..7902489 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataCreateReqVO.java @@ -0,0 +1,12 @@ +package com.win.module.pszc.controller.pspumpdata.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "管理后台 - 变电所-泵站创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsPumpdataCreateReqVO extends PsPumpdataBaseVO { + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataExcelVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataExcelVO.java new file mode 100644 index 0000000..a040c20 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataExcelVO.java @@ -0,0 +1,36 @@ +package com.win.module.pszc.controller.pspumpdata.vo; + +import lombok.*; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 变电所-泵站 Excel VO + * + * @author 超级管理员 + */ +@Data +public class PsPumpdataExcelVO { + + @ExcelProperty("主键、自增") + private Long id; + + @ExcelProperty("数据点编号") + private String icode; + + @ExcelProperty("数据点名称,例如状态,流量") + private String iname; + + @ExcelProperty("采集值") + private String ivalue; + + @ExcelProperty("仪表的编号") + private String mcode; + + @ExcelProperty("仪表的名称") + private String mname; + + @ExcelProperty("采集数据的时间") + private LocalDateTime createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataExportReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataExportReqVO.java new file mode 100644 index 0000000..33a7933 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataExportReqVO.java @@ -0,0 +1,33 @@ +package com.win.module.pszc.controller.pspumpdata.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 变电所-泵站 Excel 导出 Request VO,参数和 PsPumpdataPageReqVO 是一致的") +@Data +public class PsPumpdataExportReqVO { + + @Schema(description = "数据点编号") + private String icode; + + @Schema(description = "数据点名称,例如状态,流量", example = "张三") + private String iname; + + @Schema(description = "采集值") + private String ivalue; + + @Schema(description = "仪表的编号") + private String mcode; + + @Schema(description = "仪表的名称", example = "芋艿") + private String mname; + + @Schema(description = "采集数据的时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataPageReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataPageReqVO.java new file mode 100644 index 0000000..69d7903 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataPageReqVO.java @@ -0,0 +1,36 @@ +package com.win.module.pszc.controller.pspumpdata.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.win.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 变电所-泵站分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsPumpdataPageReqVO extends PageParam { + + @Schema(description = "数据点编号") + private String icode; + + @Schema(description = "数据点名称,例如状态,流量", example = "张三") + private String iname; + + @Schema(description = "采集值") + private String ivalue; + + @Schema(description = "仪表的编号") + private String mcode; + + @Schema(description = "仪表的名称", example = "芋艿") + private String mname; + + @Schema(description = "采集数据的时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataRespVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataRespVO.java new file mode 100644 index 0000000..c2bd2da --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataRespVO.java @@ -0,0 +1,19 @@ +package com.win.module.pszc.controller.pspumpdata.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 变电所-泵站 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsPumpdataRespVO extends PsPumpdataBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "2533") + private Long id; + + @Schema(description = "采集数据的时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataUpdateReqVO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataUpdateReqVO.java new file mode 100644 index 0000000..decd436 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/controller/pspumpdata/vo/PsPumpdataUpdateReqVO.java @@ -0,0 +1,17 @@ +package com.win.module.pszc.controller.pspumpdata.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 变电所-泵站更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PsPumpdataUpdateReqVO extends PsPumpdataBaseVO { + + @Schema(description = "主键、自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "2533") + @NotNull(message = "主键、自增不能为空") + private Long id; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/convert/pselectricdata/PsElectricdataConvert.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/convert/pselectricdata/PsElectricdataConvert.java new file mode 100644 index 0000000..41ca4e2 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/convert/pselectricdata/PsElectricdataConvert.java @@ -0,0 +1,34 @@ +package com.win.module.pszc.convert.pselectricdata; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import com.win.module.pszc.controller.pselectricdata.vo.*; +import com.win.module.pszc.dal.dataobject.pselectricdata.PsElectricdataDO; + +/** + * 变电所-智能电 Convert + * + * @author 超级管理员 + */ +@Mapper +public interface PsElectricdataConvert { + + PsElectricdataConvert INSTANCE = Mappers.getMapper(PsElectricdataConvert.class); + + PsElectricdataDO convert(PsElectricdataCreateReqVO bean); + + PsElectricdataDO convert(PsElectricdataUpdateReqVO bean); + + PsElectricdataRespVO convert(PsElectricdataDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/convert/psirealdata/PsIrealdataConvert.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/convert/psirealdata/PsIrealdataConvert.java new file mode 100644 index 0000000..474e2b9 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/convert/psirealdata/PsIrealdataConvert.java @@ -0,0 +1,34 @@ +package com.win.module.pszc.convert.psirealdata; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import com.win.module.pszc.controller.psirealdata.vo.*; +import com.win.module.pszc.dal.dataobject.psirealdata.PsIrealdataDO; + +/** + * 变电所-一次主表 Convert + * + * @author 超级管理员 + */ +@Mapper +public interface PsIrealdataConvert { + + PsIrealdataConvert INSTANCE = Mappers.getMapper(PsIrealdataConvert.class); + + PsIrealdataDO convert(PsIrealdataCreateReqVO bean); + + PsIrealdataDO convert(PsIrealdataUpdateReqVO bean); + + PsIrealdataRespVO convert(PsIrealdataDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/convert/pspumpdata/PsPumpdataConvert.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/convert/pspumpdata/PsPumpdataConvert.java new file mode 100644 index 0000000..d0399fe --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/convert/pspumpdata/PsPumpdataConvert.java @@ -0,0 +1,34 @@ +package com.win.module.pszc.convert.pspumpdata; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import com.win.module.pszc.controller.pspumpdata.vo.*; +import com.win.module.pszc.dal.dataobject.pspumpdata.PsPumpdataDO; + +/** + * 变电所-泵站 Convert + * + * @author 超级管理员 + */ +@Mapper +public interface PsPumpdataConvert { + + PsPumpdataConvert INSTANCE = Mappers.getMapper(PsPumpdataConvert.class); + + PsPumpdataDO convert(PsPumpdataCreateReqVO bean); + + PsPumpdataDO convert(PsPumpdataUpdateReqVO bean); + + PsPumpdataRespVO convert(PsPumpdataDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/dataobject/pselectricdata/PsElectricdataDO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/dataobject/pselectricdata/PsElectricdataDO.java new file mode 100644 index 0000000..5379575 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/dataobject/pselectricdata/PsElectricdataDO.java @@ -0,0 +1,47 @@ +package com.win.module.pszc.dal.dataobject.pselectricdata; + +import lombok.*; +import com.baomidou.mybatisplus.annotation.*; +import com.win.framework.mybatis.core.dataobject.BaseDO; + +/** + * 变电所-智能电 DO + * + * @author 超级管理员 + */ +@TableName("pszc_ps_electricdata") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PsElectricdataDO extends BaseDO { + + /** + * 主键、自增 + */ + @TableId + private Long id; + /** + * 数据点编号,例如Ua、Ia + */ + private String icode; + /** + * 数据点名称,例如电压、电流 + */ + private String iname; + /** + * 采集值 + */ + private String ivalue; + /** + * 仪表的编号 + */ + private String mcode; + /** + * 仪表的名称 + */ + private String mname; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/dataobject/psirealdata/PsIrealdataDO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/dataobject/psirealdata/PsIrealdataDO.java new file mode 100644 index 0000000..392dba4 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/dataobject/psirealdata/PsIrealdataDO.java @@ -0,0 +1,72 @@ +package com.win.module.pszc.dal.dataobject.psirealdata; + +import lombok.*; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import com.win.framework.mybatis.core.dataobject.BaseDO; + +/** + * 变电所-一次主表 DO + * + * @author 超级管理员 + */ +@TableName("pszc_ps_irealdata") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PsIrealdataDO extends BaseDO { + + /** + * 主键、自增 + */ + @TableId + private Long id; + /** + * 原始表key(RTU+仪表索引号+Pt+点索引号);子设备key(S+子设备序列号+RTU+仪表索引号+Pt+点索引号) + */ + private String ikey; + /** + * 数据点编号,例如Ua、Ia + */ + private String icode; + /** + * 数据点描述,例如电压、电流 + */ + private String idesc; + /** + * 内部编号 + */ + private String icls; + /** + * 每个仪表内的索引号 + */ + private Integer ino; + /** + * 采集值 + */ + private String ivalue; + /** + * 该仪表在系统内的编号 + */ + private Integer irtuno; + /** + * 仪表的编号Meter01 + */ + private String irtuname; + /** + * 仪表的描述总用电表 + */ + private String irtudesc; + /** + * 仪表编号 + */ + private Integer irtutype; + /** + * 采集系统向数据库更新数据的时间 + */ + private LocalDateTime iupdatetime; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/dataobject/pspumpdata/PsPumpdataDO.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/dataobject/pspumpdata/PsPumpdataDO.java new file mode 100644 index 0000000..986e4ae --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/dataobject/pspumpdata/PsPumpdataDO.java @@ -0,0 +1,47 @@ +package com.win.module.pszc.dal.dataobject.pspumpdata; + +import lombok.*; +import com.baomidou.mybatisplus.annotation.*; +import com.win.framework.mybatis.core.dataobject.BaseDO; + +/** + * 变电所-泵站 DO + * + * @author 超级管理员 + */ +@TableName("pszc_ps_pumpdata") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PsPumpdataDO extends BaseDO { + + /** + * 主键、自增 + */ + @TableId + private Long id; + /** + * 数据点编号 + */ + private String icode; + /** + * 数据点名称,例如状态,流量 + */ + private String iname; + /** + * 采集值 + */ + private String ivalue; + /** + * 仪表的编号 + */ + private String mcode; + /** + * 仪表的名称 + */ + private String mname; + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/mysql/pselectricdata/PsElectricdataMapper.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/mysql/pselectricdata/PsElectricdataMapper.java new file mode 100644 index 0000000..ce51394 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/mysql/pselectricdata/PsElectricdataMapper.java @@ -0,0 +1,42 @@ +package com.win.module.pszc.dal.mysql.pselectricdata; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; +import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.win.framework.mybatis.core.mapper.BaseMapperX; +import com.win.module.pszc.dal.dataobject.pselectricdata.PsElectricdataDO; +import org.apache.ibatis.annotations.Mapper; +import com.win.module.pszc.controller.pselectricdata.vo.*; + +/** + * 变电所-智能电 Mapper + * + * @author 超级管理员 + */ +@Mapper +public interface PsElectricdataMapper extends BaseMapperX { + + default PageResult selectPage(PsElectricdataPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(PsElectricdataDO::getIcode, reqVO.getIcode()) + .likeIfPresent(PsElectricdataDO::getIname, reqVO.getIname()) + .eqIfPresent(PsElectricdataDO::getIvalue, reqVO.getIvalue()) + .eqIfPresent(PsElectricdataDO::getMcode, reqVO.getMcode()) + .likeIfPresent(PsElectricdataDO::getMname, reqVO.getMname()) + .betweenIfPresent(PsElectricdataDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PsElectricdataDO::getId)); + } + + default List selectList(PsElectricdataExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(PsElectricdataDO::getIcode, reqVO.getIcode()) + .likeIfPresent(PsElectricdataDO::getIname, reqVO.getIname()) + .eqIfPresent(PsElectricdataDO::getIvalue, reqVO.getIvalue()) + .eqIfPresent(PsElectricdataDO::getMcode, reqVO.getMcode()) + .likeIfPresent(PsElectricdataDO::getMname, reqVO.getMname()) + .betweenIfPresent(PsElectricdataDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PsElectricdataDO::getId)); + } + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/mysql/psirealdata/PsIrealdataMapper.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/mysql/psirealdata/PsIrealdataMapper.java new file mode 100644 index 0000000..5a24a37 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/mysql/psirealdata/PsIrealdataMapper.java @@ -0,0 +1,54 @@ +package com.win.module.pszc.dal.mysql.psirealdata; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; +import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.win.framework.mybatis.core.mapper.BaseMapperX; +import com.win.module.pszc.dal.dataobject.psirealdata.PsIrealdataDO; +import org.apache.ibatis.annotations.Mapper; +import com.win.module.pszc.controller.psirealdata.vo.*; + +/** + * 变电所-一次主表 Mapper + * + * @author 超级管理员 + */ +@Mapper +public interface PsIrealdataMapper extends BaseMapperX { + + default PageResult selectPage(PsIrealdataPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(PsIrealdataDO::getIkey, reqVO.getIkey()) + .eqIfPresent(PsIrealdataDO::getIcode, reqVO.getIcode()) + .eqIfPresent(PsIrealdataDO::getIdesc, reqVO.getIdesc()) + .eqIfPresent(PsIrealdataDO::getIcls, reqVO.getIcls()) + .eqIfPresent(PsIrealdataDO::getIno, reqVO.getIno()) + .eqIfPresent(PsIrealdataDO::getIvalue, reqVO.getIvalue()) + .eqIfPresent(PsIrealdataDO::getIrtuno, reqVO.getIrtuno()) + .likeIfPresent(PsIrealdataDO::getIrtuname, reqVO.getIrtuname()) + .eqIfPresent(PsIrealdataDO::getIrtudesc, reqVO.getIrtudesc()) + .eqIfPresent(PsIrealdataDO::getIrtutype, reqVO.getIrtutype()) + .betweenIfPresent(PsIrealdataDO::getIupdatetime, reqVO.getIupdatetime()) + .betweenIfPresent(PsIrealdataDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PsIrealdataDO::getId)); + } + + default List selectList(PsIrealdataExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(PsIrealdataDO::getIkey, reqVO.getIkey()) + .eqIfPresent(PsIrealdataDO::getIcode, reqVO.getIcode()) + .eqIfPresent(PsIrealdataDO::getIdesc, reqVO.getIdesc()) + .eqIfPresent(PsIrealdataDO::getIcls, reqVO.getIcls()) + .eqIfPresent(PsIrealdataDO::getIno, reqVO.getIno()) + .eqIfPresent(PsIrealdataDO::getIvalue, reqVO.getIvalue()) + .eqIfPresent(PsIrealdataDO::getIrtuno, reqVO.getIrtuno()) + .likeIfPresent(PsIrealdataDO::getIrtuname, reqVO.getIrtuname()) + .eqIfPresent(PsIrealdataDO::getIrtudesc, reqVO.getIrtudesc()) + .eqIfPresent(PsIrealdataDO::getIrtutype, reqVO.getIrtutype()) + .betweenIfPresent(PsIrealdataDO::getIupdatetime, reqVO.getIupdatetime()) + .betweenIfPresent(PsIrealdataDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PsIrealdataDO::getId)); + } + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/mysql/pspumpdata/PsPumpdataMapper.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/mysql/pspumpdata/PsPumpdataMapper.java new file mode 100644 index 0000000..7d61a15 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/dal/mysql/pspumpdata/PsPumpdataMapper.java @@ -0,0 +1,42 @@ +package com.win.module.pszc.dal.mysql.pspumpdata; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; +import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.win.framework.mybatis.core.mapper.BaseMapperX; +import com.win.module.pszc.dal.dataobject.pspumpdata.PsPumpdataDO; +import org.apache.ibatis.annotations.Mapper; +import com.win.module.pszc.controller.pspumpdata.vo.*; + +/** + * 变电所-泵站 Mapper + * + * @author 超级管理员 + */ +@Mapper +public interface PsPumpdataMapper extends BaseMapperX { + + default PageResult selectPage(PsPumpdataPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(PsPumpdataDO::getIcode, reqVO.getIcode()) + .likeIfPresent(PsPumpdataDO::getIname, reqVO.getIname()) + .eqIfPresent(PsPumpdataDO::getIvalue, reqVO.getIvalue()) + .eqIfPresent(PsPumpdataDO::getMcode, reqVO.getMcode()) + .likeIfPresent(PsPumpdataDO::getMname, reqVO.getMname()) + .betweenIfPresent(PsPumpdataDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PsPumpdataDO::getId)); + } + + default List selectList(PsPumpdataExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(PsPumpdataDO::getIcode, reqVO.getIcode()) + .likeIfPresent(PsPumpdataDO::getIname, reqVO.getIname()) + .eqIfPresent(PsPumpdataDO::getIvalue, reqVO.getIvalue()) + .eqIfPresent(PsPumpdataDO::getMcode, reqVO.getMcode()) + .likeIfPresent(PsPumpdataDO::getMname, reqVO.getMname()) + .betweenIfPresent(PsPumpdataDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(PsPumpdataDO::getId)); + } + +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pselectricdata/PsElectricdataService.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pselectricdata/PsElectricdataService.java new file mode 100644 index 0000000..fa7e396 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pselectricdata/PsElectricdataService.java @@ -0,0 +1,79 @@ +package com.win.module.pszc.service.pselectricdata; + +import java.util.*; +import javax.validation.*; +import com.win.module.pszc.controller.pselectricdata.vo.*; +import com.win.module.pszc.dal.dataobject.pselectricdata.PsElectricdataDO; +import com.win.framework.common.pojo.PageResult; + +/** + * 变电所-智能电 Service 接口 + * + * @author 超级管理员 + */ +public interface PsElectricdataService { + + /** + * 创建变电所-智能电 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createPsElectricdata(@Valid PsElectricdataCreateReqVO createReqVO); + + /** + * 更新变电所-智能电 + * + * @param updateReqVO 更新信息 + */ + void updatePsElectricdata(@Valid PsElectricdataUpdateReqVO updateReqVO); + + /** + * 删除变电所-智能电 + * + * @param id 编号 + */ + void deletePsElectricdata(Long id); + + /** + * 获得变电所-智能电 + * + * @param id 编号 + * @return 变电所-智能电 + */ + PsElectricdataDO getPsElectricdata(Long id); + + /** + * 获得变电所-智能电列表 + * + * @param ids 编号 + * @return 变电所-智能电列表 + */ + List getPsElectricdataList(Collection ids); + + /** + * 获得变电所-智能电分页 + * + * @param pageReqVO 分页查询 + * @return 变电所-智能电分页 + */ + PageResult getPsElectricdataPage(PsElectricdataPageReqVO pageReqVO); + + /** + * 获得变电所-智能电列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 变电所-智能电列表 + */ + List getPsElectricdataList(PsElectricdataExportReqVO exportReqVO); + + /** + * 导入变电所-智能电主信息 + * + * @param datas 导入变电所-智能电主信息列表 + * @param mode 导入模式1更新2追加3覆盖 + * @param updatePart 是否支持更新 + * @return 导入结果 + */ + public List importPsElectricdataList(List datas, Integer mode, boolean updatePart); +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pselectricdata/PsElectricdataServiceImpl.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pselectricdata/PsElectricdataServiceImpl.java new file mode 100644 index 0000000..465a35a --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pselectricdata/PsElectricdataServiceImpl.java @@ -0,0 +1,104 @@ +package com.win.module.pszc.service.pselectricdata; + +import com.win.module.pszc.enums.PszcErrorCode; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import java.util.*; +import com.win.module.pszc.controller.pselectricdata.vo.*; +import com.win.module.pszc.dal.dataobject.pselectricdata.PsElectricdataDO; +import com.win.framework.common.pojo.PageResult; +import com.win.module.pszc.convert.pselectricdata.PsElectricdataConvert; +import com.win.module.pszc.dal.mysql.pselectricdata.PsElectricdataMapper; +import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; + + +/** + * 变电所-智能电 Service 实现类 + * + * @author 超级管理员 + */ +@Service +@Validated +public class PsElectricdataServiceImpl implements PsElectricdataService { + + @Resource + private PsElectricdataMapper psElectricdataMapper; + + @Override + public Long createPsElectricdata(PsElectricdataCreateReqVO createReqVO) { + // 插入 + PsElectricdataDO psElectricdata = PsElectricdataConvert.INSTANCE.convert(createReqVO); + psElectricdataMapper.insert(psElectricdata); + // 返回 + return psElectricdata.getId(); + } + + @Override + public void updatePsElectricdata(PsElectricdataUpdateReqVO updateReqVO) { + // 校验存在 + validatePsElectricdataExists(updateReqVO.getId()); + // 更新 + PsElectricdataDO updateObj = PsElectricdataConvert.INSTANCE.convert(updateReqVO); + psElectricdataMapper.updateById(updateObj); + } + + @Override + public void deletePsElectricdata(Long id) { + // 校验存在 + validatePsElectricdataExists(id); + // 删除 + psElectricdataMapper.deleteById(id); + } + + private void validatePsElectricdataExists(Long id) { + if (psElectricdataMapper.selectById(id) == null) { + throw exception(PszcErrorCode.PS_ELECTRICDATA_NOT_EXISTS.getCode() , PszcErrorCode.PS_ELECTRICDATA_NOT_EXISTS.getLabel()); + } + } + + @Override + public PsElectricdataDO getPsElectricdata(Long id) { + return psElectricdataMapper.selectById(id); + } + + @Override + public List getPsElectricdataList(Collection ids) { + return psElectricdataMapper.selectBatchIds(ids); + } + + @Override + public PageResult getPsElectricdataPage(PsElectricdataPageReqVO pageReqVO) { + return psElectricdataMapper.selectPage(pageReqVO); + } + + @Override + public List getPsElectricdataList(PsElectricdataExportReqVO exportReqVO) { + return psElectricdataMapper.selectList(exportReqVO); + } + + @Override + public List importPsElectricdataList(List datas, Integer mode, boolean updatePart) { +// if (CollUtil.isEmpty(datas)) { +// throw exception(PS_ELECTRICDATA_IMPORT_LIST_IS_EMPTY); +// } + + List errorList = new ArrayList<>(); +// datas.forEach(item -> { +// if(errorList == null){ +// // 判断如果不存在,在进行插入 +// PsElectricdataDO obj = psElectricdataMapper.selectByCode(item.getCode()); +// if (obj == null&& mode != 3) { +// psElectricdataMapper.insert(PsElectricdataConvert.INSTANCE.convert(item)); +// } +// else if (obj != null && mode != 2) {// 如果存在,判断是否允许更新 +// PsElectricdataDO psElectricdataDO = PsElectricdataConvert.INSTANCE.convert(item); +// psElectricdataDO.setId(obj.getId()); +// psElectricdataMapper.updateById(obj); +// } +// } +// }); + + return errorList; + } +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/psirealdata/PsIrealdataService.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/psirealdata/PsIrealdataService.java new file mode 100644 index 0000000..33a023e --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/psirealdata/PsIrealdataService.java @@ -0,0 +1,79 @@ +package com.win.module.pszc.service.psirealdata; + +import java.util.*; +import javax.validation.*; +import com.win.module.pszc.controller.psirealdata.vo.*; +import com.win.module.pszc.dal.dataobject.psirealdata.PsIrealdataDO; +import com.win.framework.common.pojo.PageResult; + +/** + * 变电所-一次主表 Service 接口 + * + * @author 超级管理员 + */ +public interface PsIrealdataService { + + /** + * 创建变电所-一次主表 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createPsIrealdata(@Valid PsIrealdataCreateReqVO createReqVO); + + /** + * 更新变电所-一次主表 + * + * @param updateReqVO 更新信息 + */ + void updatePsIrealdata(@Valid PsIrealdataUpdateReqVO updateReqVO); + + /** + * 删除变电所-一次主表 + * + * @param id 编号 + */ + void deletePsIrealdata(Long id); + + /** + * 获得变电所-一次主表 + * + * @param id 编号 + * @return 变电所-一次主表 + */ + PsIrealdataDO getPsIrealdata(Long id); + + /** + * 获得变电所-一次主表列表 + * + * @param ids 编号 + * @return 变电所-一次主表列表 + */ + List getPsIrealdataList(Collection ids); + + /** + * 获得变电所-一次主表分页 + * + * @param pageReqVO 分页查询 + * @return 变电所-一次主表分页 + */ + PageResult getPsIrealdataPage(PsIrealdataPageReqVO pageReqVO); + + /** + * 获得变电所-一次主表列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 变电所-一次主表列表 + */ + List getPsIrealdataList(PsIrealdataExportReqVO exportReqVO); + + /** + * 导入变电所-一次主表主信息 + * + * @param datas 导入变电所-一次主表主信息列表 + * @param mode 导入模式1更新2追加3覆盖 + * @param updatePart 是否支持更新 + * @return 导入结果 + */ + public List importPsIrealdataList(List datas, Integer mode, boolean updatePart); +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/psirealdata/PsIrealdataServiceImpl.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/psirealdata/PsIrealdataServiceImpl.java new file mode 100644 index 0000000..4c70cc8 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/psirealdata/PsIrealdataServiceImpl.java @@ -0,0 +1,109 @@ +package com.win.module.pszc.service.psirealdata; + +import com.win.framework.common.pojo.PageParam; +import com.win.module.pszc.enums.PszcErrorCode; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import com.win.module.pszc.controller.psirealdata.vo.*; +import com.win.module.pszc.dal.dataobject.psirealdata.PsIrealdataDO; +import com.win.framework.common.pojo.PageResult; + +import com.win.module.pszc.convert.psirealdata.PsIrealdataConvert; +import com.win.module.pszc.dal.mysql.psirealdata.PsIrealdataMapper; + +import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; + +/** + * 变电所-一次主表 Service 实现类 + * + * @author 超级管理员 + */ +@Service +@Validated +public class PsIrealdataServiceImpl implements PsIrealdataService { + + @Resource + private PsIrealdataMapper psIrealdataMapper; + + @Override + public Long createPsIrealdata(PsIrealdataCreateReqVO createReqVO) { + // 插入 + PsIrealdataDO psIrealdata = PsIrealdataConvert.INSTANCE.convert(createReqVO); + psIrealdataMapper.insert(psIrealdata); + // 返回 + return psIrealdata.getId(); + } + + @Override + public void updatePsIrealdata(PsIrealdataUpdateReqVO updateReqVO) { + // 校验存在 + validatePsIrealdataExists(updateReqVO.getId()); + // 更新 + PsIrealdataDO updateObj = PsIrealdataConvert.INSTANCE.convert(updateReqVO); + psIrealdataMapper.updateById(updateObj); + } + + @Override + public void deletePsIrealdata(Long id) { + // 校验存在 + validatePsIrealdataExists(id); + // 删除 + psIrealdataMapper.deleteById(id); + } + + private void validatePsIrealdataExists(Long id) { + if (psIrealdataMapper.selectById(id) == null) { + throw exception(PszcErrorCode.PS_IREALDATA_NOT_EXISTS.getCode() , PszcErrorCode.PS_IREALDATA_NOT_EXISTS.getLabel()); + } + } + + @Override + public PsIrealdataDO getPsIrealdata(Long id) { + return psIrealdataMapper.selectById(id); + } + + @Override + public List getPsIrealdataList(Collection ids) { + return psIrealdataMapper.selectBatchIds(ids); + } + + @Override + public PageResult getPsIrealdataPage(PsIrealdataPageReqVO pageReqVO) { + pageReqVO.setSort("iupdatetime"); + pageReqVO.setBy(PageParam.ORDER_DESC); + return psIrealdataMapper.selectPage(pageReqVO); + } + + @Override + public List getPsIrealdataList(PsIrealdataExportReqVO exportReqVO) { + return psIrealdataMapper.selectList(exportReqVO); + } + + @Override + public List importPsIrealdataList(List datas, Integer mode, boolean updatePart) { +// if (CollUtil.isEmpty(datas)) { +// throw exception(PS_IREALDATA_IMPORT_LIST_IS_EMPTY); +// } + + List errorList = new ArrayList<>(); +// datas.forEach(item -> { +// if(errorList == null){ +// // 判断如果不存在,在进行插入 +// PsIrealdataDO obj = psIrealdataMapper.selectByCode(item.getCode()); +// if (obj == null&& mode != 3) { +// psIrealdataMapper.insert(PsIrealdataConvert.INSTANCE.convert(item)); +// } +// else if (obj != null && mode != 2) {// 如果存在,判断是否允许更新 +// PsIrealdataDO psIrealdataDO = PsIrealdataConvert.INSTANCE.convert(item); +// psIrealdataDO.setId(obj.getId()); +// psIrealdataMapper.updateById(obj); +// } +// } +// }); + + return errorList; + } +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pspumpdata/PsPumpdataService.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pspumpdata/PsPumpdataService.java new file mode 100644 index 0000000..1110df8 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pspumpdata/PsPumpdataService.java @@ -0,0 +1,79 @@ +package com.win.module.pszc.service.pspumpdata; + +import java.util.*; +import javax.validation.*; +import com.win.module.pszc.controller.pspumpdata.vo.*; +import com.win.module.pszc.dal.dataobject.pspumpdata.PsPumpdataDO; +import com.win.framework.common.pojo.PageResult; + +/** + * 变电所-泵站 Service 接口 + * + * @author 超级管理员 + */ +public interface PsPumpdataService { + + /** + * 创建变电所-泵站 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createPsPumpdata(@Valid PsPumpdataCreateReqVO createReqVO); + + /** + * 更新变电所-泵站 + * + * @param updateReqVO 更新信息 + */ + void updatePsPumpdata(@Valid PsPumpdataUpdateReqVO updateReqVO); + + /** + * 删除变电所-泵站 + * + * @param id 编号 + */ + void deletePsPumpdata(Long id); + + /** + * 获得变电所-泵站 + * + * @param id 编号 + * @return 变电所-泵站 + */ + PsPumpdataDO getPsPumpdata(Long id); + + /** + * 获得变电所-泵站列表 + * + * @param ids 编号 + * @return 变电所-泵站列表 + */ + List getPsPumpdataList(Collection ids); + + /** + * 获得变电所-泵站分页 + * + * @param pageReqVO 分页查询 + * @return 变电所-泵站分页 + */ + PageResult getPsPumpdataPage(PsPumpdataPageReqVO pageReqVO); + + /** + * 获得变电所-泵站列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 变电所-泵站列表 + */ + List getPsPumpdataList(PsPumpdataExportReqVO exportReqVO); + + /** + * 导入变电所-泵站主信息 + * + * @param datas 导入变电所-泵站主信息列表 + * @param mode 导入模式1更新2追加3覆盖 + * @param updatePart 是否支持更新 + * @return 导入结果 + */ + public List importPsPumpdataList(List datas, Integer mode, boolean updatePart); +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pspumpdata/PsPumpdataServiceImpl.java b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pspumpdata/PsPumpdataServiceImpl.java new file mode 100644 index 0000000..6d00fa3 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/java/com/win/module/pszc/service/pspumpdata/PsPumpdataServiceImpl.java @@ -0,0 +1,104 @@ +package com.win.module.pszc.service.pspumpdata; + +import com.win.module.pszc.enums.PszcErrorCode; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import java.util.*; +import com.win.module.pszc.controller.pspumpdata.vo.*; +import com.win.module.pszc.dal.dataobject.pspumpdata.PsPumpdataDO; +import com.win.framework.common.pojo.PageResult; +import com.win.module.pszc.convert.pspumpdata.PsPumpdataConvert; +import com.win.module.pszc.dal.mysql.pspumpdata.PsPumpdataMapper; +import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; + + +/** + * 变电所-泵站 Service 实现类 + * + * @author 超级管理员 + */ +@Service +@Validated +public class PsPumpdataServiceImpl implements PsPumpdataService { + + @Resource + private PsPumpdataMapper psPumpdataMapper; + + @Override + public Long createPsPumpdata(PsPumpdataCreateReqVO createReqVO) { + // 插入 + PsPumpdataDO psPumpdata = PsPumpdataConvert.INSTANCE.convert(createReqVO); + psPumpdataMapper.insert(psPumpdata); + // 返回 + return psPumpdata.getId(); + } + + @Override + public void updatePsPumpdata(PsPumpdataUpdateReqVO updateReqVO) { + // 校验存在 + validatePsPumpdataExists(updateReqVO.getId()); + // 更新 + PsPumpdataDO updateObj = PsPumpdataConvert.INSTANCE.convert(updateReqVO); + psPumpdataMapper.updateById(updateObj); + } + + @Override + public void deletePsPumpdata(Long id) { + // 校验存在 + validatePsPumpdataExists(id); + // 删除 + psPumpdataMapper.deleteById(id); + } + + private void validatePsPumpdataExists(Long id) { + if (psPumpdataMapper.selectById(id) == null) { + throw exception(PszcErrorCode.PS_PUMPDATA_NOT_EXISTS.getCode() , PszcErrorCode.PS_PUMPDATA_NOT_EXISTS.getLabel()); + } + } + + @Override + public PsPumpdataDO getPsPumpdata(Long id) { + return psPumpdataMapper.selectById(id); + } + + @Override + public List getPsPumpdataList(Collection ids) { + return psPumpdataMapper.selectBatchIds(ids); + } + + @Override + public PageResult getPsPumpdataPage(PsPumpdataPageReqVO pageReqVO) { + return psPumpdataMapper.selectPage(pageReqVO); + } + + @Override + public List getPsPumpdataList(PsPumpdataExportReqVO exportReqVO) { + return psPumpdataMapper.selectList(exportReqVO); + } + + @Override + public List importPsPumpdataList(List datas, Integer mode, boolean updatePart) { +// if (CollUtil.isEmpty(datas)) { +// throw exception(PS_PUMPDATA_IMPORT_LIST_IS_EMPTY); +// } + + List errorList = new ArrayList<>(); +// datas.forEach(item -> { +// if(errorList == null){ +// // 判断如果不存在,在进行插入 +// PsPumpdataDO obj = psPumpdataMapper.selectByCode(item.getCode()); +// if (obj == null&& mode != 3) { +// psPumpdataMapper.insert(PsPumpdataConvert.INSTANCE.convert(item)); +// } +// else if (obj != null && mode != 2) {// 如果存在,判断是否允许更新 +// PsPumpdataDO psPumpdataDO = PsPumpdataConvert.INSTANCE.convert(item); +// psPumpdataDO.setId(obj.getId()); +// psPumpdataMapper.updateById(obj); +// } +// } +// }); + + return errorList; + } +} diff --git a/win-module-pszc/win-module-pszc-biz/src/main/resources/mapper/pselectricdata/PsElectricdataMapper.xml b/win-module-pszc/win-module-pszc-biz/src/main/resources/mapper/pselectricdata/PsElectricdataMapper.xml new file mode 100644 index 0000000..7a1406c --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/resources/mapper/pselectricdata/PsElectricdataMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/win-module-pszc/win-module-pszc-biz/src/main/resources/mapper/psirealdata/PsIrealdataMapper.xml b/win-module-pszc/win-module-pszc-biz/src/main/resources/mapper/psirealdata/PsIrealdataMapper.xml new file mode 100644 index 0000000..a37d308 --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/resources/mapper/psirealdata/PsIrealdataMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/win-module-pszc/win-module-pszc-biz/src/main/resources/mapper/pspumpdata/PsPumpdataMapper.xml b/win-module-pszc/win-module-pszc-biz/src/main/resources/mapper/pspumpdata/PsPumpdataMapper.xml new file mode 100644 index 0000000..c2fa2bc --- /dev/null +++ b/win-module-pszc/win-module-pszc-biz/src/main/resources/mapper/pspumpdata/PsPumpdataMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/permission/PermissionServiceImpl.java b/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/permission/PermissionServiceImpl.java index aad386f..612f9ce 100644 --- a/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/permission/PermissionServiceImpl.java +++ b/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/permission/PermissionServiceImpl.java @@ -131,7 +131,7 @@ public class PermissionServiceImpl implements PermissionService { // ========== 角色-菜单的相关方法 ========== @Override - @DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换 + @Transactional // 多数据源,使用 @Transactional 保证本地事务,以及数据源的切换 @CacheEvict(value = RedisKeyConstants.MENU_ROLE_ID_LIST, allEntries = true) // allEntries 清空所有缓存,主要一次更新涉及到的 menuIds 较多,反倒批量会更快 public void assignRoleMenu(Long roleId, Set menuIds) { @@ -198,7 +198,7 @@ public class PermissionServiceImpl implements PermissionService { // ========== 用户-角色的相关方法 ========== @Override - @DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换 + @Transactional // 多数据源,使用 @Transactional 保证本地事务,以及数据源的切换 @CacheEvict(value = RedisKeyConstants.USER_ROLE_ID_LIST, key = "#userId") public void assignUserRole(Long userId, Set roleIds) { // 获得角色拥有角色编号 diff --git a/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/tenant/TenantPackageServiceImpl.java b/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/tenant/TenantPackageServiceImpl.java index 222c89e..0056e47 100644 --- a/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/tenant/TenantPackageServiceImpl.java +++ b/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/tenant/TenantPackageServiceImpl.java @@ -13,6 +13,7 @@ import com.win.module.system.dal.mysql.tenant.TenantPackageMapper; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; @@ -47,7 +48,7 @@ public class TenantPackageServiceImpl implements TenantPackageService { } @Override - @DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换 + @Transactional // 多数据源,使用 @Transactional 保证本地事务,以及数据源的切换 public void updateTenantPackage(TenantPackageUpdateReqVO updateReqVO) { // 校验存在 TenantPackageDO tenantPackage = validateTenantPackageExists(updateReqVO.getId()); diff --git a/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/tenant/TenantServiceImpl.java b/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/tenant/TenantServiceImpl.java index c11b631..b5bf2e7 100644 --- a/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/tenant/TenantServiceImpl.java +++ b/win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/tenant/TenantServiceImpl.java @@ -34,6 +34,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; @@ -95,7 +96,7 @@ public class TenantServiceImpl implements TenantService { } @Override - @DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换 + @Transactional // 多数据源,使用 @Transactional 保证本地事务,以及数据源的切换 public Long createTenant(TenantCreateReqVO createReqVO) { // 校验租户名称是否重复 validTenantNameDuplicate(createReqVO.getName(), null); @@ -137,7 +138,7 @@ public class TenantServiceImpl implements TenantService { } @Override - @DSTransactional + @Transactional public void updateTenant(TenantUpdateReqVO updateReqVO) { // 校验存在 TenantDO tenant = validateUpdateTenant(updateReqVO.getId()); @@ -170,7 +171,7 @@ public class TenantServiceImpl implements TenantService { } @Override - @DSTransactional + @Transactional public void updateTenantRoleMenu(Long tenantId, Set menuIds) { TenantUtils.execute(tenantId, () -> { // 获得所有角色 diff --git a/win-server/pom.xml b/win-server/pom.xml index 6f846f7..3316c10 100644 --- a/win-server/pom.xml +++ b/win-server/pom.xml @@ -40,6 +40,12 @@ ${revision} + + com.win + win-module-pszc-biz + ${revision} + + org.ssssssss magic-api-spring-boot-starter