From c9026a3f800d94039c1dae0b873a351df43f684a Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Sat, 11 May 2024 11:24:57 +0800 Subject: [PATCH 01/35] =?UTF-8?q?fix:=E8=BF=94=E5=9B=9E=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E5=AF=B9=E8=B1=A1extras=E6=B7=BB=E5=8A=A0fun?= =?UTF-8?q?cCode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigmodel/configuration/BigModelInvokeUrl.java | 2 ++ .../interactive/service/IInteractiveService.java | 2 ++ .../service/impl/ExtraResolveStrategyService.java | 1 + .../service/impl/InteractiveServiceImpl.java | 9 +++++++++ .../service/impl/JumpRouteJoinStrategy.java | 1 + .../interactive/service/impl/ParamStrategy.java | 1 + .../bigmodel/schedule/InteractiveSchedule.java | 21 +++++++++++++++++++++ .../bigmodel/schedule/XxlJobHandlerConstant.java | 2 ++ 8 files changed, 39 insertions(+) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java index 0456fa2..7f8d6d5 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java @@ -23,6 +23,8 @@ public class BigModelInvokeUrl { private String updateVideo; + private String updateFault; + private String updateCanvas; } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java index f740a40..b85ad2f 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java @@ -26,6 +26,8 @@ public interface IInteractiveService { Boolean updateCanvas(Map request); + void updateFault(Map request); + List getAnswerBySessionIds(String sessionIds); Boolean authentication(String stationId, String userId, String funcCode); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java index 45a7d25..8419dee 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java @@ -64,6 +64,7 @@ public class ExtraResolveStrategyService { params.put("fdpDeviceName",data.getString("device_name")); params.put("fdpOrd",data.getString("ord")); result.setParams(params); + result.setFuncCode(FuncRouteEnum.DIAGNOSE.getFuncCode()); result.setType(FunctionConstants.TypeEnum.PARAMS.getType()); return result; } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index 0ac3ff3..d70bcd4 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -162,6 +162,15 @@ public class InteractiveServiceImpl implements IInteractiveService { } @Override + public void updateFault(Map request) { + HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getUpdateFault()) + .body(JSON.toJSONString(request)).execute(); + Assert.isTrue(response.getStatus() == HttpServletResponse.SC_OK, () -> { + throw new ServiceException("远程调用大模型【更新故障列表】接口失败!"); + }); + } + + @Override public List getAnswerBySessionIds(String sessionIds) { Map params = new HashMap<>(); params.put("ids",Func.toStrList(",",sessionIds).toArray()); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java index 907266e..e3b7f55 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java @@ -47,6 +47,7 @@ public class JumpRouteJoinStrategy { // 跳转页面逻辑 ExtraVO extraVO = new ExtraVO(); extraVO.setImmediatelyJump(true); + extraVO.setFuncCode(FuncRouteEnum.OPEN_SCADA.getFuncCode()); Map params = this.scadaResolve(args); // 根据hz3000画面版本获取path Integer picResource = Integer.valueOf(params.get("picResource")); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java index ef081db..6e9cd62 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java @@ -55,6 +55,7 @@ public class ParamStrategy { if(videoR.isSuccess()) { StationVideoTypeEntity video = videoR.getData(); extraVO.setType(FunctionConstants.TypeEnum.PARAMS.getType()); + extraVO.setFuncCode(FuncRouteEnum.OPEN_VIDEO.getFuncCode()); Map params = new HashMap<>(); params.put("name", video.getName()); params.put("videoHost", video.getVideoHost()); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java index 7af5118..629d287 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java @@ -192,4 +192,25 @@ public class InteractiveSchedule { Boolean status = interactiveService.updateCanvas(param); return ReturnT.SUCCESS; } + + //@XxlJob(SYNCHRONOUS_FAULT_INSTRUCT) String params + @Scheduled(cron = "0/10 * * * * ?") + public ReturnT synchronousFaultInstruct() { + Map request = new HashMap<>(2); + // 获取站点列表 + R> stationsR = stationClient.list(new StationEntity()); + if(!stationsR.isSuccess() || CollectionUtil.isEmpty(stationsR.getData())) { + XxlJobLogger.log("获取站点列表失败!"); + return ReturnT.FAIL; + } + List updateStationList = stationsR.getData().stream().map(station -> { + UpdateStationVO stationVO = new UpdateStationVO(); + stationVO.setId(station.getCode()); + stationVO.setName(station.getName()); + return stationVO; + }).collect(Collectors.toList()); + request.put("stations", updateStationList); + interactiveService.updateFault(request); + return ReturnT.SUCCESS; + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/XxlJobHandlerConstant.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/XxlJobHandlerConstant.java index 9d3cefd..7317f54 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/XxlJobHandlerConstant.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/XxlJobHandlerConstant.java @@ -9,6 +9,8 @@ public interface XxlJobHandlerConstant { /**获取问答结果**/ String GET_INTERACTIVE_RESULT = "getInteractiveResult"; + String SYNCHRONOUS_FAULT_INSTRUCT = "synchronousFaultInstruct"; + /**同步视频指令**/ String SYNCHRONOUS_VIDEO_INSTRUCT = "synchronousVideoInstruct"; From 232cd3523ad793243ca5dfc815aca08872890f88 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Sat, 11 May 2024 15:55:58 +0800 Subject: [PATCH 02/35] =?UTF-8?q?fix:=E8=BF=94=E5=9B=9E=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E5=AF=B9=E8=B1=A1extras=E6=B7=BB=E5=8A=A0fun?= =?UTF-8?q?cCode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interactive/service/impl/InteractiveServiceImpl.java | 10 ++++++---- .../interactive/service/impl/JumpRouteJoinStrategy.java | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index d70bcd4..e596097 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -209,10 +209,12 @@ public class InteractiveServiceImpl implements IInteractiveService { Assert.isTrue(Func.isNotEmpty(function) && StringUtil.isNotBlank(function.getRoute()),() -> { throw new ServiceException("传入函数未获取到菜单,鉴权失败!"); }); - R authenticationR = userClient.permissionMenuById(Long.valueOf(userId), function.getRoute()); - Assert.isTrue(authenticationR.isSuccess() && authenticationR.getData(), () -> { - throw new ServiceException("人员菜单鉴权失败!"); - }); + if(Func.isNotEmpty(function.getRoute()) && StringUtil.isNotBlank(function.getRoute())) { + R authenticationR = userClient.permissionMenuById(Long.valueOf(userId), function.getRoute()); + Assert.isTrue(authenticationR.isSuccess() && authenticationR.getData(), () -> { + throw new ServiceException("人员菜单鉴权失败!"); + }); + } } return true; } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java index e3b7f55..b0deed6 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java @@ -52,6 +52,7 @@ public class JumpRouteJoinStrategy { // 根据hz3000画面版本获取path Integer picResource = Integer.valueOf(params.get("picResource")); JSONObject pathObject = JSONObject.parseObject(function.getPath()); + extraVO.setLabel(params.get("name")); // 云组态 if(picResource == 0) { String scada = pathObject.getString("scada"); From 8ea15ba11fd5efd8483310603e760ad21a2cf214 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Mon, 13 May 2024 08:37:39 +0800 Subject: [PATCH 03/35] =?UTF-8?q?add:choose=5Fvideo/choose=5Fcanvas?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interactive/constants/SelectionVO.java | 20 ------ .../interactive/constants/StationSelectionVO.java | 12 ---- .../hzims/bigmodel/interactive/vo/ExtraVO.java | 2 - .../bigmodel/interactive/vo/ScadaSelectionVO.java | 16 +++++ .../hzims/bigmodel/interactive/vo/SelectionVO.java | 20 ++++++ .../interactive/vo/StationSelectionVO.java | 15 ++++ .../bigmodel/interactive/vo/VideoSelectionVO.java | 16 +++++ .../interactive/constants/FuncRouteEnum.java | 2 + .../service/impl/ExtraResolveStrategyService.java | 57 ++++++++++++++- .../service/impl/JumpRouteJoinStrategy.java | 11 +-- .../interactive/service/impl/ParamStrategy.java | 2 +- .../websocket/handler/InteractiveHandler.java | 81 ++++++++++++++++++++-- 12 files changed, 204 insertions(+), 50 deletions(-) delete mode 100644 hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SelectionVO.java delete mode 100644 hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/StationSelectionVO.java create mode 100644 hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ScadaSelectionVO.java create mode 100644 hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/SelectionVO.java create mode 100644 hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/StationSelectionVO.java create mode 100644 hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/VideoSelectionVO.java diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SelectionVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SelectionVO.java deleted file mode 100644 index a7a271f..0000000 --- a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/SelectionVO.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hnac.hzims.bigmodel.interactive.constants; - -import lombok.Data; - -import java.io.Serializable; - -/** - * @Author: huangxing - * @Date: 2024/05/09 16:30 - */ -@Data -public class SelectionVO implements Serializable { - - /**选项ID**/ - private String id; - - /**选项名称**/ - private String name; - -} diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/StationSelectionVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/StationSelectionVO.java deleted file mode 100644 index d67a829..0000000 --- a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/StationSelectionVO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.hnac.hzims.bigmodel.interactive.constants; - -import lombok.Data; - -/** - * @Author: huangxing - * @Date: 2024/05/09 16:32 - */ -@Data -public class StationSelectionVO extends SelectionVO { - -} diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java index cda702f..951bf42 100644 --- a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ExtraVO.java @@ -1,10 +1,8 @@ package com.hnac.hzims.bigmodel.interactive.vo; -import com.hnac.hzims.bigmodel.interactive.constants.SelectionVO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import net.sf.jsqlparser.statement.select.Select; import java.io.Serializable; import java.util.List; diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ScadaSelectionVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ScadaSelectionVO.java new file mode 100644 index 0000000..b32cca2 --- /dev/null +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/ScadaSelectionVO.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/11 16:21 + */ +@Data +@EqualsAndHashCode +public class ScadaSelectionVO extends SelectionVO implements Serializable { + +} diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/SelectionVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/SelectionVO.java new file mode 100644 index 0000000..57899c9 --- /dev/null +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/SelectionVO.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/09 16:30 + */ +@Data +public class SelectionVO implements Serializable { + + /**选项ID**/ + private String id; + + /**选项名称**/ + private String name; + +} diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/StationSelectionVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/StationSelectionVO.java new file mode 100644 index 0000000..84209d9 --- /dev/null +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/StationSelectionVO.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import com.hnac.hzims.bigmodel.interactive.vo.SelectionVO; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/09 16:32 + */ +@Data +public class StationSelectionVO extends SelectionVO implements Serializable { + +} diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/VideoSelectionVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/VideoSelectionVO.java new file mode 100644 index 0000000..0bcc529 --- /dev/null +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/VideoSelectionVO.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/11 16:20 + */ +@Data +@EqualsAndHashCode +public class VideoSelectionVO extends SelectionVO implements Serializable { + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java index 724f97e..a78b0e9 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java @@ -16,6 +16,8 @@ public enum FuncRouteEnum { OPEN_VIDEO("open_video","打开视频监控"), DIAGNOSE("diagnose","智能诊断"), CHOOSE_STATION("choose_station","选择站点"), + CHOOSE_VIDEO("choose_video","选择视频"), + CHOOSE_CANVAS("choose_canvas","选择画面"), ; @Getter private String funcCode; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java index 8419dee..9ab95cd 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java @@ -5,12 +5,15 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; import com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants; -import com.hnac.hzims.bigmodel.interactive.constants.StationSelectionVO; +import com.hnac.hzims.bigmodel.interactive.vo.ScadaSelectionVO; +import com.hnac.hzims.bigmodel.interactive.vo.StationSelectionVO; import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; +import com.hnac.hzims.bigmodel.interactive.vo.VideoSelectionVO; import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; import com.hnac.hzims.operational.station.feign.IStationClient; +import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient; import lombok.AllArgsConstructor; -import lombok.Data; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; @@ -31,6 +34,8 @@ import java.util.stream.Collectors; public class ExtraResolveStrategyService { private final IStationClient stationClient; + private final IStationVideoTypeClient videoTypeClient; + private final JumpRouteJoinStrategy jumpRouteJoinStrategy; /** * 解析DFP返回extra @@ -39,7 +44,7 @@ public class ExtraResolveStrategyService { */ public ExtraVO resolve(String extraStr) { JSONObject extra = JSONObject.parseObject(extraStr); - String functionCode = Optional.ofNullable(extra.get("func")).map(String::valueOf).orElse(""); + String functionCode = Optional.ofNullable(extra.get("func")).map(String::valueOf).orElse("ttps"); if(StringUtil.isNotBlank(functionCode)) { FuncRouteEnum funcRouteEnum = FuncRouteEnum.getEnumByFuncCode(functionCode); switch (funcRouteEnum) { @@ -47,6 +52,10 @@ public class ExtraResolveStrategyService { return this.resolveDiagnose(extra); case CHOOSE_STATION: return this.resolveChooseStation(extra); + case CHOOSE_VIDEO: + return this.resolveChooseVideo(extra); + case CHOOSE_CANVAS: + return this.resolveChooseScada(extra); default: break; } @@ -96,4 +105,46 @@ public class ExtraResolveStrategyService { result.setType(FunctionConstants.TypeEnum.CHOOSE.getType()); return result; } + + private ExtraVO resolveChooseVideo(Map extra) { + ExtraVO result = new ExtraVO(); + JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); + if(data.containsKey("videos")) { + List videoIds = JSONArray.parseArray(JSON.toJSONString(data.get("videos")), JSONObject.class); + List selections = videoIds.stream().map(video -> { + R videoR = videoTypeClient.getById(Long.valueOf(video.getString("id"))); + VideoSelectionVO selectionVO = new VideoSelectionVO(); + if (videoR.isSuccess() && Func.isNotEmpty(videoR.getData())) { + selectionVO.setId(video.getString("id")); + selectionVO.setName(videoR.getData().getName()); + } + return selectionVO; + }).collect(Collectors.toList()); + result.setFuncCode(FuncRouteEnum.CHOOSE_VIDEO.getFuncCode()); + result.setSpecial(true); + result.setSelection(selections); + } + result.setType(FunctionConstants.TypeEnum.CHOOSE.getType()); + return result; + } + + private ExtraVO resolveChooseScada(Map extra) { + ExtraVO result = new ExtraVO(); + JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); + if(data.containsKey("canvases")) { + List canvases = JSONArray.parseArray(JSON.toJSONString(data.get("canvases")), JSONObject.class); + List selections = canvases.stream().map(canvas -> { + ScadaSelectionVO selectionVO = new ScadaSelectionVO(); + Map resolve = jumpRouteJoinStrategy.resolve(canvas.getString("id"), JumpRouteJoinStrategy.SCADA_PARAMS_SOLVE); + selectionVO.setId(canvas.getString("id")); + selectionVO.setName(resolve.get("name")); + return selectionVO; + }).collect(Collectors.toList()); + result.setFuncCode(FuncRouteEnum.CHOOSE_CANVAS.getFuncCode()); + result.setSpecial(true); + result.setSelection(selections); + } + result.setType(FunctionConstants.TypeEnum.CHOOSE.getType()); + return result; + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java index b0deed6..4d51428 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java @@ -25,6 +25,8 @@ import java.util.stream.IntStream; @Component public class JumpRouteJoinStrategy { + public static String[] SCADA_PARAMS_SOLVE = new String[]{"picResource","context","stationNum","projectId","taskId","name","id"}; + /** * 解析大模型传参 * @param args 大模型传参 @@ -43,7 +45,7 @@ public class JumpRouteJoinStrategy { return null; } - private ExtraVO getScadaExtra(Map args,FunctionEntity function) { + public ExtraVO getScadaExtra(Map args,FunctionEntity function) { // 跳转页面逻辑 ExtraVO extraVO = new ExtraVO(); extraVO.setImmediatelyJump(true); @@ -86,14 +88,13 @@ public class JumpRouteJoinStrategy { * @param args 大模型解析参数 * @return 实时画面路径拼接所需参数 */ - private Map scadaResolve(Map args) { + public Map scadaResolve(Map args) { String params = args.get("canvas_id"); // 参数格式为:picResource^context^stationNum^projectId^taskId^name^id - String[] keys = new String[]{"picResource","context","stationNum","projectId","taskId","name","id"}; - return this.resolve(params,keys); + return this.resolve(params,SCADA_PARAMS_SOLVE); } - private Map resolve(String paramsStr,String... keys) { + public Map resolve(String paramsStr,String... keys) { Map result = new HashMap<>(); List params = Func.toStrList("\\^", paramsStr); Assert.isTrue(params.size() == keys.length, () -> { diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java index 6e9cd62..76a22d5 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java @@ -46,7 +46,7 @@ public class ParamStrategy { return null; } - private ExtraVO getVideoExtra(Map args) { + public ExtraVO getVideoExtra(Map args) { // 跳转页面逻辑 ExtraVO extraVO = new ExtraVO(); String id = args.get("canvas_id"); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java index 3a25314..700e44b 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java @@ -2,16 +2,19 @@ package com.hnac.hzims.bigmodel.websocket.handler; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.hnac.hzims.bigmodel.entity.FunctionEntity; +import com.hnac.hzims.bigmodel.function.service.IFunctionService; import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; -import com.hnac.hzims.bigmodel.interactive.constants.StationSelectionVO; +import com.hnac.hzims.bigmodel.interactive.service.impl.JumpRouteJoinStrategy; +import com.hnac.hzims.bigmodel.interactive.service.impl.ParamStrategy; +import com.hnac.hzims.bigmodel.interactive.vo.*; import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService; +import com.hnac.hzims.bigmodel.websocket.service.InteractiveWsService; import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager; import lombok.extern.slf4j.Slf4j; -import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.SpringUtil; -import org.springframework.util.Assert; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; @@ -20,8 +23,7 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; import java.io.IOException; import java.util.HashMap; import java.util.Map; -import java.util.Optional; -import java.util.Set; +import java.util.function.Function; /** * @Author: huangxing @@ -80,7 +82,13 @@ public class InteractiveHandler extends TextWebSocketHandler { FuncRouteEnum funcEnum = FuncRouteEnum.getEnumByFuncCode(funcCode); switch (funcEnum) { case CHOOSE_STATION: - this.handleChooseStation(messageContext,sessionId); + this.handleDefaultChoose(messageContext,sessionId); + break; + case CHOOSE_VIDEO: + this.handleVideoChoose(messageContext,sessionId); + break; + case CHOOSE_CANVAS: + this.handleScadaChoose(messageContext,sessionId); break; default: break; @@ -88,7 +96,7 @@ public class InteractiveHandler extends TextWebSocketHandler { } } - private void handleChooseStation(JSONObject messageContext,String sessionId) { + private void handleDefaultChoose(JSONObject messageContext,String sessionId) { IInteractiveService interactiveService = SpringUtil.getBean(IInteractiveService.class); String userId = messageContext.getString("userId"); String funcCode = messageContext.getString("funcCode"); @@ -101,4 +109,63 @@ public class InteractiveHandler extends TextWebSocketHandler { extra.put("data",data); interactiveService.specialAsk(sessionId,userId,extra); } + + private void handleVideoChoose(JSONObject messageContext,String sessionId) { + InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class); + try { + ParamStrategy strategy = SpringUtil.getBean(ParamStrategy.class); + VideoSelectionVO selection = messageContext.getObject("selection", VideoSelectionVO.class); + String videoId = selection.getId(); + Map param = new HashMap<>(1); + param.put("canvas_id",videoId); + ExtraVO videoExtras = strategy.getVideoExtra(param); + AnswerVO answerVO = new AnswerVO(); + answerVO.setSessionId(sessionId); + answerVO.setQuery(selection.getName()); + answerVO.setRunning(0); + answerVO.setStatus(0); + answerVO.setAnswer("已成功打开"+selection.getName()+"视频"); + answerVO.setExtras(new Object[]{JSON.toJSONString(videoExtras)}); + TextMessage textMessage = InteractiveSessionManager.getTextMessage("1", JSON.toJSONString(answerVO)); + wsService.sendMessage(sessionId,textMessage); + } + catch (Exception e) { + AnswerVO answerVO = new AnswerVO(); + answerVO.setRunning(0); + answerVO.setStatus(-2); + answerVO.setAnswer("视频解析失败!"); + TextMessage textMessage = InteractiveSessionManager.getTextMessage("1", JSON.toJSONString(answerVO)); + wsService.sendMessage(sessionId,textMessage); + } + } + + private void handleScadaChoose(JSONObject messageContext,String sessionId) { + InteractiveWsService wsService = SpringUtil.getBean(InteractiveWsService.class); + try { + JumpRouteJoinStrategy strategy = SpringUtil.getBean(JumpRouteJoinStrategy.class); + ScadaSelectionVO selection = messageContext.getObject("selection", ScadaSelectionVO.class); + Map param = new HashMap<>(1); + param.put("canvas_id",selection.getId()); + IFunctionService functionService = SpringUtil.getBean(IFunctionService.class); + FunctionEntity function = functionService.getFunctionByCode("open_scada"); + ExtraVO scadaExtra = strategy.getScadaExtra(param, function); + AnswerVO answerVO = new AnswerVO(); + answerVO.setSessionId(sessionId); + answerVO.setRunning(0); + answerVO.setStatus(0); + answerVO.setQuery(selection.getName()); + answerVO.setAnswer("已成功打开"+selection.getName()+"实时画面"); + answerVO.setExtras(new Object[]{JSON.toJSONString(scadaExtra)}); + TextMessage textMessage = InteractiveSessionManager.getTextMessage("1", JSON.toJSONString(answerVO)); + wsService.sendMessage(sessionId,textMessage); + } + catch (Exception e) { + AnswerVO answerVO = new AnswerVO(); + answerVO.setRunning(0); + answerVO.setStatus(-2); + answerVO.setAnswer("实时画面解析失败!"); + TextMessage textMessage = InteractiveSessionManager.getTextMessage("1", JSON.toJSONString(answerVO)); + wsService.sendMessage(sessionId,textMessage); + } + } } From e7df146953b53232f2861113e7ca03e3fc090ddb Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Mon, 13 May 2024 11:18:06 +0800 Subject: [PATCH 04/35] =?UTF-8?q?add:=E8=A7=86=E9=A2=91=E7=AB=8B=E5=8D=B3?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=AD=97=E6=AE=B5=E8=B5=8B=E5=80=BC=E4=B8=BA?= =?UTF-8?q?true?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java index 76a22d5..e84f616 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ParamStrategy.java @@ -55,6 +55,7 @@ public class ParamStrategy { if(videoR.isSuccess()) { StationVideoTypeEntity video = videoR.getData(); extraVO.setType(FunctionConstants.TypeEnum.PARAMS.getType()); + extraVO.setImmediatelyJump(true); extraVO.setFuncCode(FuncRouteEnum.OPEN_VIDEO.getFuncCode()); Map params = new HashMap<>(); params.put("name", video.getName()); From f7b8cfd53dec9a936ca132c65967f897539e1aed Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Mon, 13 May 2024 16:24:46 +0800 Subject: [PATCH 05/35] =?UTF-8?q?fix:=E5=AE=9E=E6=97=B6=E7=94=BB=E9=9D=A2l?= =?UTF-8?q?abel=E6=B7=BB=E5=8A=A0=E7=AB=99=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ExtraResolveStrategyService.java | 5 ++++- .../interactive/service/impl/JumpRouteJoinStrategy.java | 15 ++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java index 9ab95cd..3e5f6c6 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java @@ -13,6 +13,8 @@ import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient; +import com.xxl.job.core.handler.annotation.XxlJob; +import com.xxl.job.core.log.XxlJobLogger; import lombok.AllArgsConstructor; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; @@ -44,8 +46,9 @@ public class ExtraResolveStrategyService { */ public ExtraVO resolve(String extraStr) { JSONObject extra = JSONObject.parseObject(extraStr); - String functionCode = Optional.ofNullable(extra.get("func")).map(String::valueOf).orElse("ttps"); + String functionCode = Optional.ofNullable(extra.get("func")).map(String::valueOf).orElse(""); if(StringUtil.isNotBlank(functionCode)) { + XxlJobLogger.log("函数编号为:" + functionCode); FuncRouteEnum funcRouteEnum = FuncRouteEnum.getEnumByFuncCode(functionCode); switch (funcRouteEnum) { case DIAGNOSE: diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java index 4d51428..d24a4c0 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java @@ -6,16 +6,17 @@ import com.hnac.hzims.bigmodel.entity.FunctionEntity; import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; import com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants; import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.operational.station.feign.IStationClient; +import lombok.RequiredArgsConstructor; import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import org.springframework.stereotype.Component; import org.springframework.util.Assert; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.stream.IntStream; /** @@ -23,8 +24,11 @@ import java.util.stream.IntStream; * @Date: 2024/04/30 11:38 */ @Component +@RequiredArgsConstructor public class JumpRouteJoinStrategy { + private final IStationClient stationClient; + public static String[] SCADA_PARAMS_SOLVE = new String[]{"picResource","context","stationNum","projectId","taskId","name","id"}; /** @@ -54,7 +58,8 @@ public class JumpRouteJoinStrategy { // 根据hz3000画面版本获取path Integer picResource = Integer.valueOf(params.get("picResource")); JSONObject pathObject = JSONObject.parseObject(function.getPath()); - extraVO.setLabel(params.get("name")); + R stationR = stationClient.getStationByCode(params.get("projectId")); + extraVO.setLabel(Optional.ofNullable(stationR).filter(r -> r.isSuccess()).map(R::getData).map(StationEntity::getName) + "_" + params.get("name")); // 云组态 if(picResource == 0) { String scada = pathObject.getString("scada"); From 71d1e85dc2c224c9930a17f8812b3a375b0bfa89 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 13 May 2024 16:57:53 +0800 Subject: [PATCH 06/35] =?UTF-8?q?#=E7=94=A8=E6=88=B7=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E9=89=B4=E6=9D=83=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigmodel/interactive/service/impl/InteractiveServiceImpl.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index e596097..f59aefb 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -204,11 +204,8 @@ public class InteractiveServiceImpl implements IInteractiveService { }); } // 菜单鉴权 - if(StringUtil.isNotBlank(funcCode)) { + if(StringUtil.isNotBlank(funcCode) && StringUtil.isNotBlank(userId)) { FunctionEntity function = functionService.getFunctionByCode(funcCode); - Assert.isTrue(Func.isNotEmpty(function) && StringUtil.isNotBlank(function.getRoute()),() -> { - throw new ServiceException("传入函数未获取到菜单,鉴权失败!"); - }); if(Func.isNotEmpty(function.getRoute()) && StringUtil.isNotBlank(function.getRoute())) { R authenticationR = userClient.permissionMenuById(Long.valueOf(userId), function.getRoute()); Assert.isTrue(authenticationR.isSuccess() && authenticationR.getData(), () -> { From 995b318b1f75eea8d7780172e8d65112d9b0b3b4 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 14 May 2024 08:14:20 +0800 Subject: [PATCH 07/35] =?UTF-8?q?fix:=E5=AE=9E=E6=97=B6=E7=94=BB=E9=9D=A2l?= =?UTF-8?q?abel=E6=B7=BB=E5=8A=A0=E7=AB=99=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java index d24a4c0..2ad7ae3 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java @@ -59,7 +59,7 @@ public class JumpRouteJoinStrategy { Integer picResource = Integer.valueOf(params.get("picResource")); JSONObject pathObject = JSONObject.parseObject(function.getPath()); R stationR = stationClient.getStationByCode(params.get("projectId")); - extraVO.setLabel(Optional.ofNullable(stationR).filter(r -> r.isSuccess()).map(R::getData).map(StationEntity::getName) + "_" + params.get("name")); + extraVO.setLabel(Optional.ofNullable(stationR).filter(r -> r.isSuccess()).map(R::getData).map(StationEntity::getName).orElse("") + "_" + params.get("name")); // 云组态 if(picResource == 0) { String scada = pathObject.getString("scada"); From 99a4ad830e2108cf94f66f975d4b43dcc10720f4 Mon Sep 17 00:00:00 2001 From: RnhaiWang <393727820@qq.com> Date: Tue, 14 May 2024 10:18:57 +0800 Subject: [PATCH 08/35] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E4=BA=BA=E5=91=8A=E8=AD=A6=E4=BF=A1=E6=81=AF=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java index f8313af..558bf50 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java @@ -145,7 +145,7 @@ public class RobotServiceImpl extends BaseServiceImpl Result> deviceSoeDataResult = deviceDataClient.getDeviceSoeData(robot.getStationCode(), 1, robotCode, null, startTime, endTime, true, query.getCurrent(), query.getSize()); Assert.isTrue(deviceSoeDataResult.isSuccess(), () -> { - throw new ServiceException("获取机器人告警信息失败!"); + throw new ServiceException(deviceSoeDataResult.getMsg()); }); Map deviceSoeData = deviceSoeDataResult.getData(); IPage result = Condition.getPage(query); From 27e18383a6c57c4ef8ed2b455ee134e85f0cbe39 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 15 May 2024 15:28:22 +0800 Subject: [PATCH 09/35] =?UTF-8?q?fix:open=5Fscada=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BAopen=5Fcanvas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java | 2 +- .../bigmodel/interactive/controller/InteractiveController.java | 4 ++-- .../hzims/bigmodel/interactive/service/IInteractiveService.java | 2 +- .../bigmodel/interactive/service/impl/InteractiveServiceImpl.java | 8 ++++---- .../bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java | 4 ++-- .../com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java | 5 ++--- .../hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java | 2 +- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java index a78b0e9..aca3fab 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java @@ -12,7 +12,7 @@ import java.util.Optional; */ @AllArgsConstructor public enum FuncRouteEnum { - OPEN_SCADA("open_scada","打开实时画面"), + OPEN_CANVAS("open_canvas","打开实时画面"), OPEN_VIDEO("open_video","打开视频监控"), DIAGNOSE("diagnose","智能诊断"), CHOOSE_STATION("choose_station","选择站点"), diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java index 7739800..90102a3 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java @@ -48,8 +48,8 @@ public class InteractiveController { @RequestMapping(value = "/authentication",method = {RequestMethod.GET,RequestMethod.POST}) public R authentication(@RequestParam(required = false) @ApiParam("站点编号") String stationId, @RequestParam @ApiParam("用户ID") String userId, - @RequestParam(required = false) @ApiParam("菜单ID") String funcCode) { - return R.status(interactiveService.authentication(stationId,userId,funcCode)); + @RequestParam(required = false) @ApiParam("菜单ID") String func) { + return R.status(interactiveService.authentication(stationId,userId,func)); } @ApiOperation("获取问答sessionId") diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java index b85ad2f..40b06ea 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java @@ -30,7 +30,7 @@ public interface IInteractiveService { List getAnswerBySessionIds(String sessionIds); - Boolean authentication(String stationId, String userId, String funcCode); + Boolean authentication(String stationId, String userId, String func); Boolean removeSessionId(String sessionId); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index f59aefb..1c09556 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -194,7 +194,7 @@ public class InteractiveServiceImpl implements IInteractiveService { } @Override - public Boolean authentication(String stationId, String userId, String funcCode) { + public Boolean authentication(String stationId, String userId, String func) { // 站点鉴权 if(StringUtil.isNotBlank(stationId)) { List stations = this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId) @@ -204,9 +204,9 @@ public class InteractiveServiceImpl implements IInteractiveService { }); } // 菜单鉴权 - if(StringUtil.isNotBlank(funcCode) && StringUtil.isNotBlank(userId)) { - FunctionEntity function = functionService.getFunctionByCode(funcCode); - if(Func.isNotEmpty(function.getRoute()) && StringUtil.isNotBlank(function.getRoute())) { + if(StringUtil.isNotBlank(func) && StringUtil.isNotBlank(userId)) { + FunctionEntity function = functionService.getFunctionByCode(func); + if(Func.isNotEmpty(function) && Func.isNotEmpty(function.getRoute()) && StringUtil.isNotBlank(function.getRoute())) { R authenticationR = userClient.permissionMenuById(Long.valueOf(userId), function.getRoute()); Assert.isTrue(authenticationR.isSuccess() && authenticationR.getData(), () -> { throw new ServiceException("人员菜单鉴权失败!"); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java index 2ad7ae3..6c320a3 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java @@ -40,7 +40,7 @@ public class JumpRouteJoinStrategy { FuncRouteEnum routeEnum = FuncRouteEnum.getEnumByFuncCode(function.getCode()); if(Func.isNotEmpty(routeEnum)) { switch(routeEnum) { - case OPEN_SCADA: + case OPEN_CANVAS: return this.getScadaExtra(args,function); default: break; @@ -53,7 +53,7 @@ public class JumpRouteJoinStrategy { // 跳转页面逻辑 ExtraVO extraVO = new ExtraVO(); extraVO.setImmediatelyJump(true); - extraVO.setFuncCode(FuncRouteEnum.OPEN_SCADA.getFuncCode()); + extraVO.setFuncCode(FuncRouteEnum.OPEN_CANVAS.getFuncCode()); Map params = this.scadaResolve(args); // 根据hz3000画面版本获取path Integer picResource = Integer.valueOf(params.get("picResource")); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java index 629d287..85affae 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java @@ -193,9 +193,8 @@ public class InteractiveSchedule { return ReturnT.SUCCESS; } - //@XxlJob(SYNCHRONOUS_FAULT_INSTRUCT) String params - @Scheduled(cron = "0/10 * * * * ?") - public ReturnT synchronousFaultInstruct() { + @XxlJob(SYNCHRONOUS_FAULT_INSTRUCT) + public ReturnT synchronousFaultInstruct(String params) { Map request = new HashMap<>(2); // 获取站点列表 R> stationsR = stationClient.list(new StationEntity()); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java index 700e44b..bc475f7 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java @@ -147,7 +147,7 @@ public class InteractiveHandler extends TextWebSocketHandler { Map param = new HashMap<>(1); param.put("canvas_id",selection.getId()); IFunctionService functionService = SpringUtil.getBean(IFunctionService.class); - FunctionEntity function = functionService.getFunctionByCode("open_scada"); + FunctionEntity function = functionService.getFunctionByCode(FuncRouteEnum.OPEN_CANVAS.getFuncCode()); ExtraVO scadaExtra = strategy.getScadaExtra(param, function); AnswerVO answerVO = new AnswerVO(); answerVO.setSessionId(sessionId); From 4f85176c37666eeb24b1d417d423486769658b93 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 15 May 2024 17:01:38 +0800 Subject: [PATCH 10/35] =?UTF-8?q?fix:open=5Fscada=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BAopen=5Fcanvas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interactive/constants/FuncRouteEnum.java | 2 +- .../service/impl/ExtraResolveStrategyService.java | 24 ++++++++++++---------- .../service/impl/InteractiveServiceImpl.java | 3 +++ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java index aca3fab..c4fc85e 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java @@ -26,7 +26,7 @@ public enum FuncRouteEnum { public static FuncRouteEnum getEnumByFuncCode(String funcCode) { Optional FuncRoute = Arrays.stream(FuncRouteEnum.class.getEnumConstants()).filter(e -> funcCode.equals(e.getFuncCode())).findFirst(); - return FuncRoute.get(); + return FuncRoute.orElse(null); } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java index 3e5f6c6..a9c590b 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java @@ -50,17 +50,19 @@ public class ExtraResolveStrategyService { if(StringUtil.isNotBlank(functionCode)) { XxlJobLogger.log("函数编号为:" + functionCode); FuncRouteEnum funcRouteEnum = FuncRouteEnum.getEnumByFuncCode(functionCode); - switch (funcRouteEnum) { - case DIAGNOSE: - return this.resolveDiagnose(extra); - case CHOOSE_STATION: - return this.resolveChooseStation(extra); - case CHOOSE_VIDEO: - return this.resolveChooseVideo(extra); - case CHOOSE_CANVAS: - return this.resolveChooseScada(extra); - default: - break; + if(Func.isNotEmpty(funcRouteEnum)) { + switch (funcRouteEnum) { + case DIAGNOSE: + return this.resolveDiagnose(extra); + case CHOOSE_STATION: + return this.resolveChooseStation(extra); + case CHOOSE_VIDEO: + return this.resolveChooseVideo(extra); + case CHOOSE_CANVAS: + return this.resolveChooseScada(extra); + default: + break; + } } } return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index 1c09556..4e835a0 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -73,6 +73,9 @@ public class InteractiveServiceImpl implements IInteractiveService { logger.info("interactive:resolve","开始解析大模型函数,函数内容为:" + JSON.toJSONString(req)); FunctionEntity function = functionService.getFunctionByCode(req.getFunctionName()); TypeEnum typeEnum = TypeEnum.getTypeEnumByType(function.getType()); + if(Func.isEmpty(typeEnum)) { + throw new ServiceException("函数解析失败!"); + } switch (typeEnum) { // 页面跳转 case JUMP: From 75384cd9504b5a0c3be385fb8f070fce85ce9094 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 15 May 2024 17:32:29 +0800 Subject: [PATCH 11/35] =?UTF-8?q?fix:=E5=AE=9E=E6=97=B6=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E7=B1=BB=E5=9E=8B=E8=BF=94=E5=9B=9E=E5=89=8D?= =?UTF-8?q?=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java index 6c320a3..ddb6f69 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/JumpRouteJoinStrategy.java @@ -60,6 +60,9 @@ public class JumpRouteJoinStrategy { JSONObject pathObject = JSONObject.parseObject(function.getPath()); R stationR = stationClient.getStationByCode(params.get("projectId")); extraVO.setLabel(Optional.ofNullable(stationR).filter(r -> r.isSuccess()).map(R::getData).map(StationEntity::getName).orElse("") + "_" + params.get("name")); + Map extraParams = new HashMap<>(1); + extraParams.put("picResource",picResource); + extraVO.setParams(extraParams); // 云组态 if(picResource == 0) { String scada = pathObject.getString("scada"); From bdb19c110e3be05e59bfca4f4326fcd8bc2c78c3 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Thu, 16 May 2024 15:36:17 +0800 Subject: [PATCH 12/35] =?UTF-8?q?fix:=E9=80=89=E6=8B=A9=E6=95=85=E9=9A=9C?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigmodel/interactive/vo/FaultSelectionVO.java | 16 ++++++++++++++++ .../interactive/constants/FuncRouteEnum.java | 1 + .../service/impl/ExtraResolveStrategyService.java | 20 ++++++++++++++++---- .../websocket/handler/InteractiveHandler.java | 17 +++++++++++++++++ 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/FaultSelectionVO.java diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/FaultSelectionVO.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/FaultSelectionVO.java new file mode 100644 index 0000000..00aa21e --- /dev/null +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/FaultSelectionVO.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/16 15:10 + */ +@Data +@EqualsAndHashCode +public class FaultSelectionVO extends SelectionVO implements Serializable { + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java index c4fc85e..3dd1caf 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java @@ -18,6 +18,7 @@ public enum FuncRouteEnum { CHOOSE_STATION("choose_station","选择站点"), CHOOSE_VIDEO("choose_video","选择视频"), CHOOSE_CANVAS("choose_canvas","选择画面"), + CHOOSE_FAULT("choose_fault","选择故障"), ; @Getter private String funcCode; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java index a9c590b..c1895b9 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java @@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; import com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants; -import com.hnac.hzims.bigmodel.interactive.vo.ScadaSelectionVO; -import com.hnac.hzims.bigmodel.interactive.vo.StationSelectionVO; -import com.hnac.hzims.bigmodel.interactive.vo.ExtraVO; -import com.hnac.hzims.bigmodel.interactive.vo.VideoSelectionVO; +import com.hnac.hzims.bigmodel.interactive.vo.*; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; import com.hnac.hzims.operational.station.feign.IStationClient; @@ -60,6 +57,8 @@ public class ExtraResolveStrategyService { return this.resolveChooseVideo(extra); case CHOOSE_CANVAS: return this.resolveChooseScada(extra); + case CHOOSE_FAULT: + return this.resolveChooseFault(extra); default: break; } @@ -68,6 +67,19 @@ public class ExtraResolveStrategyService { return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class); } + private ExtraVO resolveChooseFault(Map extra) { + ExtraVO result = new ExtraVO(); + JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); + if(data.containsKey("faults")) { + List faults = JSONArray.parseArray(JSON.toJSONString(data.get("faults")), FaultSelectionVO.class); + result.setSelection(faults); + } + result.setFuncCode(FuncRouteEnum.CHOOSE_FAULT.getFuncCode()); + result.setSpecial(true); + result.setType(FunctionConstants.TypeEnum.CHOOSE.getType()); + return result; + } + private ExtraVO resolveDiagnose(Map extra) { ExtraVO result = new ExtraVO(); JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java index bc475f7..96dfc4e 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java @@ -90,6 +90,9 @@ public class InteractiveHandler extends TextWebSocketHandler { case CHOOSE_CANVAS: this.handleScadaChoose(messageContext,sessionId); break; + case CHOOSE_FAULT: + this.handleFaultChoose(messageContext,sessionId); + break; default: break; } @@ -168,4 +171,18 @@ public class InteractiveHandler extends TextWebSocketHandler { wsService.sendMessage(sessionId,textMessage); } } + + private void handleFaultChoose(JSONObject messageContext,String sessionId) { + IInteractiveService interactiveService = SpringUtil.getBean(IInteractiveService.class); + String userId = messageContext.getString("userId"); + String funcCode = messageContext.getString("funcCode"); + FaultSelectionVO selectionVO = messageContext.getObject("selection",FaultSelectionVO.class); + JSONObject data = new JSONObject(); + data.put("id",selectionVO.getId()); + data.put("name",selectionVO.getName()); + Map extra = new HashMap<>(2); + extra.put("func",funcCode); + extra.put("data",data); + interactiveService.specialAsk(sessionId,userId,extra); + } } From 5fb2f2f43af4cd5389537a2565dd555811336f9b Mon Sep 17 00:00:00 2001 From: Jone <515616805@qq.com> Date: Fri, 17 May 2024 09:57:29 +0800 Subject: [PATCH 13/35] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpackage=E5=8C=85?= =?UTF-8?q?=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/message/web/MsgWsRecordHistoryController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgWsRecordHistoryController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgWsRecordHistoryController.java index a800d2b..4345391 100644 --- a/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgWsRecordHistoryController.java +++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/web/MsgWsRecordHistoryController.java @@ -1,4 +1,4 @@ -package com.hnac.hzims.message.controller; +package com.hnac.hzims.message.web; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; @@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.*; * @author xiashandong * @created 2021-06-28 16:45 **/ +@Deprecated @RestController @AllArgsConstructor @RequestMapping("/msg/ws/record/history") From da5516f038566fa0c54ab20e2119a0322acc1818 Mon Sep 17 00:00:00 2001 From: RnhaiWang <393727820@qq.com> Date: Fri, 17 May 2024 13:59:21 +0800 Subject: [PATCH 14/35] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9C=8B=E6=9D=BF?= =?UTF-8?q?=E5=8A=A0=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java | 1 + .../main/java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotRealDataVO.java | 3 +++ 2 files changed, 4 insertions(+) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java index 558bf50..13d8cb0 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotServiceImpl.java @@ -129,6 +129,7 @@ public class RobotServiceImpl extends BaseServiceImpl Optional attrOptional = paramDeviceAttrR.getData().stream().filter(deviceAttr -> k.getValue().getN().equals(deviceAttr.getName())).findFirst(); data.setModelClassifyId(attrOptional.get().getModelClassifyId()); data.setModelClassifyName(attrOptional.get().getModelClassifyName()); + data.setUnits(attrOptional.get().getUnits()); return data; })).collect(Collectors.toList()); return result.stream().collect(Collectors.groupingBy(RobotRealDataVO::getModelClassifyName)); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotRealDataVO.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotRealDataVO.java index f3371a7..00e3eda 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotRealDataVO.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotRealDataVO.java @@ -49,4 +49,7 @@ public class RobotRealDataVO implements Serializable { @ApiModelProperty("启停状态") private Integer state; + + @ApiModelProperty("单位") + private String units; } From 0f8340d0521867b7e972e1a87185c41ea217c2b1 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Fri, 17 May 2024 14:18:09 +0800 Subject: [PATCH 15/35] =?UTF-8?q?#=E5=AE=9E=E6=97=B6=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=A8=A1=E6=8B=9F&=E7=94=9F=E6=80=81=E6=B5=81=E9=87=8F?= =?UTF-8?q?=E6=8E=A5=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/common/enums/ExceptionEnum.java | 102 ++++++ .../digital-twin-display-api.iml | 238 -------------- hzims-service-api/pom.xml | 2 +- hzims-service-api/spare-api/pom.xml | 16 - hzims-service-api/spare-api/spare-api.iml | 226 ------------- .../java/com/hnac/hzims/spare/entity/Notice.java | 64 ---- .../com/hnac/hzims/spare/feign/INoticeClient.java | 50 --- .../java/com/hnac/hzims/spare/vo/NoticeVO.java | 20 -- .../video-image-api/video-image-api.iml | 239 -------------- .../water-quality-api/water-quality-api.iml | 239 -------------- .../water-rain-api/water-rain-api.iml | 239 -------------- .../bigmodel/schedule/InteractiveSchedule.java | 6 +- hzims-service/hzims-simulate/pom.xml | 129 ++++++++ .../hnac/hzims/simulate/SimulateApplication.java | 28 ++ .../simulate/constants/WriteRealDataConstant.java | 43 +++ .../hzims/simulate/controller/GageController.java | 31 ++ .../controller/SimulationDataController.java | 195 +++++++++++ .../com/hnac/hzims/simulate/entity/DataItem.java | 20 ++ .../com/hnac/hzims/simulate/entity/DataModel.java | 46 +++ .../com/hnac/hzims/simulate/entity/Device.java | 66 ++++ .../com/hnac/hzims/simulate/entity/DeviceData.java | 22 ++ .../hnac/hzims/simulate/entity/DeviceDataV4.java | 19 ++ .../hzims/simulate/entity/DeviceFacConfig.java | 38 +++ .../hnac/hzims/simulate/entity/DeviceField.java | 42 +++ .../hnac/hzims/simulate/entity/DeviceFieldGap.java | 30 ++ .../hnac/hzims/simulate/entity/DeviceRainGap.java | 33 ++ .../java/com/hnac/hzims/simulate/entity/Kvtq.java | 18 ++ .../com/hnac/hzims/simulate/entity/KvtqV4.java | 18 ++ .../simulate/mapper/DeviceFacConfigMapper.java | 19 ++ .../simulate/mapper/DeviceFacConfigMapper.xml | 13 + .../simulate/mapper/DeviceFieldGapMapper.java | 16 + .../hzims/simulate/mapper/DeviceFieldGapMapper.xml | 18 ++ .../hzims/simulate/mapper/DeviceFieldMapper.java | 19 ++ .../hzims/simulate/mapper/DeviceFieldMapper.xml | 34 ++ .../hnac/hzims/simulate/mapper/DeviceMapper.java | 15 + .../hnac/hzims/simulate/mapper/DeviceMapper.xml | 15 + .../hzims/simulate/mapper/DeviceRainGapMapper.java | 17 + .../hzims/simulate/mapper/DeviceRainGapMapper.xml | 9 + .../simulate/scheduled/WriteRealDataTask.java | 53 +++ .../simulate/service/DeviceFieldGapService.java | 11 + .../hzims/simulate/service/DeviceFieldService.java | 24 ++ .../hnac/hzims/simulate/service/DeviceService.java | 21 ++ .../hzims/simulate/service/SimulationService.java | 280 ++++++++++++++++ .../simulate/service/WriteRealDataService.java | 13 + .../service/impl/WriteRealDataServiceImpl.java | 304 ++++++++++++++++++ .../hnac/hzims/simulate/util/DataConstants.java | 357 +++++++++++++++++++++ .../hnac/hzims/simulate/util/ParseFacUtils.java | 105 ++++++ .../hzims/simulate/util/RealIdConvertUtils.java | 52 +++ .../hnac/hzims/simulate/util/TopicConstant.java | 18 ++ .../src/main/resources/application-dev.yml | 13 + .../src/main/resources/application-prod.yml | 6 + .../src/main/resources/application.yml | 15 + .../station/controller/HikVideoController.java | 4 +- .../controller/StationVideoTypeController.java | 4 +- .../station/service/IHikVideoService.java | 2 +- .../station/service/IStationVideoTypeService.java | 2 +- .../station/service/impl/HikVideoServiceImpl.java | 23 +- .../service/impl/StationVideoTypeServiceImpl.java | 4 +- hzims-service/pom.xml | 2 + hzims-service/spare/Dockerfile | 24 -- hzims-service/spare/pom.xml | 96 ------ .../com/hnac/hzims/spare/SpareApplication.java | 40 --- .../hnac/hzims/spare/config/DemoConfiguration.java | 37 --- .../hzims/spare/controller/DemoController.java | 58 ---- .../hzims/spare/controller/DynamicController.java | 67 ---- .../controller/HzimsSpChangeDetailController.java | 87 ----- .../controller/HzimsSpChangeRecController.java | 111 ------- .../spare/controller/HzimsSpFileController.java | 97 ------ .../controller/HzimsSpProviderController.java | 125 -------- .../controller/HzimsSpRelevanceFileController.java | 97 ------ .../spare/controller/HzimsSpTypeController.java | 151 --------- .../controller/HzimsSpWareRelatedController.java | 87 ----- .../controller/HzimsSpWarehouseController.java | 120 ------- .../controller/HzimsSparePartsController.java | 123 ------- .../hzims/spare/controller/NoticeController.java | 116 ------- .../hzims/spare/controller/UploadController.java | 41 --- .../hzims/spare/dto/HzimsSpChangeDetailDTO.java | 18 -- .../hnac/hzims/spare/dto/HzimsSpChangeRecDTO.java | 31 -- .../com/hnac/hzims/spare/dto/HzimsSpFileDTO.java | 18 -- .../hnac/hzims/spare/dto/HzimsSpProviderDTO.java | 18 -- .../hzims/spare/dto/HzimsSpRelevanceFileDTO.java | 18 -- .../com/hnac/hzims/spare/dto/HzimsSpTypeDTO.java | 62 ---- .../hzims/spare/dto/HzimsSpWareRelatedDTO.java | 18 -- .../hnac/hzims/spare/dto/HzimsSpWarehouseDTO.java | 18 -- .../hnac/hzims/spare/dto/HzimsSpareCountDTO.java | 61 ---- .../hnac/hzims/spare/dto/HzimsSparePartsDTO.java | 18 -- .../spare/entity/HzimsSpChangeDetailEntity.java | 89 ----- .../hzims/spare/entity/HzimsSpChangeRecEntity.java | 62 ---- .../hnac/hzims/spare/entity/HzimsSpFileEntity.java | 57 ---- .../hzims/spare/entity/HzimsSpProviderEntity.java | 77 ----- .../spare/entity/HzimsSpRelevanceFileEntity.java | 42 --- .../hnac/hzims/spare/entity/HzimsSpTypeEntity.java | 55 ---- .../spare/entity/HzimsSpWareRelatedEntity.java | 54 ---- .../hzims/spare/entity/HzimsSpWarehouseEntity.java | 57 ---- .../hzims/spare/entity/HzimsSparePartsEntity.java | 82 ----- .../hzims/spare/enumeration/ChangeStatusEnum.java | 70 ---- .../com/hnac/hzims/spare/feign/NoticeClient.java | 47 --- .../spare/mapper/HzimsSpChangeDetailMapper.java | 26 -- .../spare/mapper/HzimsSpChangeDetailMapper.xml | 42 --- .../hzims/spare/mapper/HzimsSpChangeRecMapper.java | 20 -- .../hzims/spare/mapper/HzimsSpChangeRecMapper.xml | 30 -- .../hnac/hzims/spare/mapper/HzimsSpFileMapper.java | 20 -- .../hnac/hzims/spare/mapper/HzimsSpFileMapper.xml | 22 -- .../hzims/spare/mapper/HzimsSpProviderMapper.java | 20 -- .../hzims/spare/mapper/HzimsSpProviderMapper.xml | 28 -- .../spare/mapper/HzimsSpRelevanceFileMapper.java | 21 -- .../spare/mapper/HzimsSpRelevanceFileMapper.xml | 22 -- .../hnac/hzims/spare/mapper/HzimsSpTypeMapper.java | 32 -- .../hnac/hzims/spare/mapper/HzimsSpTypeMapper.xml | 38 --- .../spare/mapper/HzimsSpWareRelatedMapper.java | 39 --- .../spare/mapper/HzimsSpWareRelatedMapper.xml | 59 ---- .../hzims/spare/mapper/HzimsSpWarehouseMapper.java | 20 -- .../hzims/spare/mapper/HzimsSpWarehouseMapper.xml | 28 -- .../hzims/spare/mapper/HzimsSparePartsMapper.java | 37 --- .../hzims/spare/mapper/HzimsSparePartsMapper.xml | 84 ----- .../com/hnac/hzims/spare/mapper/NoticeMapper.java | 48 --- .../com/hnac/hzims/spare/mapper/NoticeMapper.xml | 39 --- .../com/hnac/hzims/spare/props/DemoProperties.java | 18 -- .../hnac/hzims/spare/service/IDynamicService.java | 45 --- .../spare/service/IHzimsSpChangeDetailService.java | 22 -- .../spare/service/IHzimsSpChangeRecService.java | 42 --- .../hzims/spare/service/IHzimsSpFileService.java | 13 - .../spare/service/IHzimsSpProviderService.java | 20 -- .../service/IHzimsSpRelevanceFileService.java | 13 - .../hzims/spare/service/IHzimsSpTypeService.java | 41 --- .../spare/service/IHzimsSpWareRelatedService.java | 35 -- .../spare/service/IHzimsSpWarehouseService.java | 20 -- .../spare/service/IHzimsSparePartsService.java | 50 --- .../hnac/hzims/spare/service/INoticeService.java | 38 --- .../spare/service/impl/DynamicServiceImpl.java | 30 -- .../impl/HzimsSpChangeDetailServiceImpl.java | 35 -- .../service/impl/HzimsSpChangeRecServiceImpl.java | 216 ------------- .../spare/service/impl/HzimsSpFileServiceImpl.java | 17 - .../service/impl/HzimsSpProviderServiceImpl.java | 22 -- .../impl/HzimsSpRelevanceFileServiceImpl.java | 17 - .../spare/service/impl/HzimsSpTypeServiceImpl.java | 48 --- .../impl/HzimsSpWareRelatedServiceImpl.java | 47 --- .../service/impl/HzimsSpWarehouseServiceImpl.java | 22 -- .../service/impl/HzimsSparePartsServiceImpl.java | 100 ------ .../spare/service/impl/NoticeServiceImpl.java | 39 --- .../hzims/spare/utils/CodeDateRandomUtils.java | 68 ---- .../com/hnac/hzims/spare/utils/TreeObject.java | 29 -- .../java/com/hnac/hzims/spare/utils/TreeUtil.java | 200 ------------ .../java/com/hnac/hzims/spare/utils/UserUtils.java | 25 -- .../hnac/hzims/spare/vo/HzimsSpChangeDetailVO.java | 18 -- .../hnac/hzims/spare/vo/HzimsSpChangeRecVO.java | 18 -- .../com/hnac/hzims/spare/vo/HzimsSpFileVO.java | 18 -- .../com/hnac/hzims/spare/vo/HzimsSpProviderVO.java | 18 -- .../hzims/spare/vo/HzimsSpRelevanceFileVO.java | 18 -- .../com/hnac/hzims/spare/vo/HzimsSpTypeVO.java | 18 -- .../hnac/hzims/spare/vo/HzimsSpWareRelatedVO.java | 18 -- .../hnac/hzims/spare/vo/HzimsSpWarehouseVO.java | 18 -- .../com/hnac/hzims/spare/vo/HzimsSparePartsVO.java | 18 -- .../spare/wrapper/HzimsSpChangeDetailWrapper.java | 31 -- .../spare/wrapper/HzimsSpChangeRecWrapper.java | 31 -- .../hzims/spare/wrapper/HzimsSpFileWrapper.java | 31 -- .../spare/wrapper/HzimsSpProviderWrapper.java | 31 -- .../spare/wrapper/HzimsSpRelevanceFileWrapper.java | 31 -- .../hzims/spare/wrapper/HzimsSpTypeWrapper.java | 31 -- .../spare/wrapper/HzimsSpWareRelatedWrapper.java | 31 -- .../spare/wrapper/HzimsSpWarehouseWrapper.java | 31 -- .../spare/wrapper/HzimsSparePartsWrapper.java | 31 -- .../spare/src/test/java/BladeDemoTest.java | 31 -- .../java/launcher/DemoTestLauncherServiceImpl.java | 48 --- 164 files changed, 2362 insertions(+), 6261 deletions(-) create mode 100644 hzims-biz-common/src/main/java/com/hnac/hzims/common/enums/ExceptionEnum.java delete mode 100644 hzims-service-api/digital-twin-display-api/digital-twin-display-api.iml delete mode 100644 hzims-service-api/spare-api/pom.xml delete mode 100644 hzims-service-api/spare-api/spare-api.iml delete mode 100644 hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/entity/Notice.java delete mode 100644 hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/feign/INoticeClient.java delete mode 100644 hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/vo/NoticeVO.java delete mode 100644 hzims-service-api/video-image-api/video-image-api.iml delete mode 100644 hzims-service-api/water-quality-api/water-quality-api.iml delete mode 100644 hzims-service-api/water-rain-api/water-rain-api.iml create mode 100644 hzims-service/hzims-simulate/pom.xml create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/SimulateApplication.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/constants/WriteRealDataConstant.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/GageController.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/SimulationDataController.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataItem.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataModel.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Device.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceData.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceDataV4.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFacConfig.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceField.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFieldGap.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceRainGap.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Kvtq.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/KvtqV4.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.xml create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.xml create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.xml create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.xml create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.xml create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/scheduled/WriteRealDataTask.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldGapService.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldService.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceService.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/SimulationService.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/WriteRealDataService.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/impl/WriteRealDataServiceImpl.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/DataConstants.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/ParseFacUtils.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/RealIdConvertUtils.java create mode 100644 hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/TopicConstant.java create mode 100644 hzims-service/hzims-simulate/src/main/resources/application-dev.yml create mode 100644 hzims-service/hzims-simulate/src/main/resources/application-prod.yml create mode 100644 hzims-service/hzims-simulate/src/main/resources/application.yml delete mode 100644 hzims-service/spare/Dockerfile delete mode 100644 hzims-service/spare/pom.xml delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/SpareApplication.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/config/DemoConfiguration.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/DemoController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/DynamicController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpChangeDetailController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpChangeRecController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpFileController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpProviderController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpRelevanceFileController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpTypeController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpWareRelatedController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpWarehouseController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSparePartsController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/NoticeController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/UploadController.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpChangeDetailDTO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpChangeRecDTO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpFileDTO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpProviderDTO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpRelevanceFileDTO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpTypeDTO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpWareRelatedDTO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpWarehouseDTO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpareCountDTO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSparePartsDTO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpChangeDetailEntity.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpChangeRecEntity.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpFileEntity.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpProviderEntity.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpRelevanceFileEntity.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpTypeEntity.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpWareRelatedEntity.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpWarehouseEntity.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSparePartsEntity.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/enumeration/ChangeStatusEnum.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/feign/NoticeClient.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeDetailMapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeDetailMapper.xml delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeRecMapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeRecMapper.xml delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpFileMapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpFileMapper.xml delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpProviderMapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpProviderMapper.xml delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpRelevanceFileMapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpRelevanceFileMapper.xml delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpTypeMapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpTypeMapper.xml delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWareRelatedMapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWareRelatedMapper.xml delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWarehouseMapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWarehouseMapper.xml delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSparePartsMapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSparePartsMapper.xml delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/NoticeMapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/NoticeMapper.xml delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/props/DemoProperties.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IDynamicService.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpChangeDetailService.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpChangeRecService.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpFileService.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpProviderService.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpRelevanceFileService.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpTypeService.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpWareRelatedService.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpWarehouseService.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSparePartsService.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/INoticeService.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/DynamicServiceImpl.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpChangeDetailServiceImpl.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpChangeRecServiceImpl.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpFileServiceImpl.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpProviderServiceImpl.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpRelevanceFileServiceImpl.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpTypeServiceImpl.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpWareRelatedServiceImpl.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpWarehouseServiceImpl.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSparePartsServiceImpl.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/NoticeServiceImpl.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/CodeDateRandomUtils.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/TreeObject.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/TreeUtil.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/UserUtils.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpChangeDetailVO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpChangeRecVO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpFileVO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpProviderVO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpRelevanceFileVO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpTypeVO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpWareRelatedVO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpWarehouseVO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSparePartsVO.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpChangeDetailWrapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpChangeRecWrapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpFileWrapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpProviderWrapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpRelevanceFileWrapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpTypeWrapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpWareRelatedWrapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpWarehouseWrapper.java delete mode 100644 hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSparePartsWrapper.java delete mode 100644 hzims-service/spare/src/test/java/BladeDemoTest.java delete mode 100644 hzims-service/spare/src/test/java/launcher/DemoTestLauncherServiceImpl.java diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/enums/ExceptionEnum.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/enums/ExceptionEnum.java new file mode 100644 index 0000000..9bb7532 --- /dev/null +++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/enums/ExceptionEnum.java @@ -0,0 +1,102 @@ +package com.hnac.hzims.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.springblade.core.tool.api.IResultCode; + +import javax.servlet.http.HttpServletResponse; + +/** + * 异常码枚举类 + */ +@Getter +@AllArgsConstructor +public enum ExceptionEnum implements IResultCode { + + /** + * 操作成功 + */ + SUCCESS(HttpServletResponse.SC_OK, "操作成功"), + + /** + * 业务异常 + */ + FAILURE(HttpServletResponse.SC_BAD_REQUEST, "业务异常"), + + /** + * 请求未授权 + */ + UN_AUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "请求未授权"), + + /** + * 客户端请求未授权 + */ + CLIENT_UN_AUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "客户端请求未授权"), + + /** + * 404 没找到请求 + */ + NOT_FOUND(HttpServletResponse.SC_NOT_FOUND, "404 没找到请求"), + + /** + * 消息不能读取 + */ + MSG_NOT_READABLE(HttpServletResponse.SC_BAD_REQUEST, "消息不能读取"), + + /** + * 不支持当前请求方法 + */ + METHOD_NOT_SUPPORTED(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "不支持当前请求方法"), + + /** + * 不支持当前媒体类型 + */ + MEDIA_TYPE_NOT_SUPPORTED(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, "不支持当前媒体类型"), + + /** + * 请求被拒绝 + */ + REQ_REJECT(HttpServletResponse.SC_FORBIDDEN, "请求被拒绝"), + + /** + * 服务器异常 + */ + INTERNAL_SERVER_ERROR(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "服务器异常"), + + /** + * 缺少必要的请求参数 + */ + PARAM_MISS(HttpServletResponse.SC_BAD_REQUEST, "缺少必要的请求参数"), + + /** + * 请求参数类型错误 + */ + PARAM_TYPE_ERROR(HttpServletResponse.SC_BAD_REQUEST, "请求参数类型错误"), + + /** + * 请求参数绑定错误 + */ + PARAM_BIND_ERROR(HttpServletResponse.SC_BAD_REQUEST, "请求参数绑定错误"), + + /** + * 参数校验失败 + */ + PARAM_VALID_ERROR(HttpServletResponse.SC_BAD_REQUEST, "参数校验失败"), + + + /** + * 模拟数据失败 + */ + SIMULATE_ERROR(400, "模拟数据失败"), + + ; + + /** + * code编码 + */ + final int code; + /** + * 中文信息描述 + */ + final String message; +} \ No newline at end of file diff --git a/hzims-service-api/digital-twin-display-api/digital-twin-display-api.iml b/hzims-service-api/digital-twin-display-api/digital-twin-display-api.iml deleted file mode 100644 index 277c4cb..0000000 --- a/hzims-service-api/digital-twin-display-api/digital-twin-display-api.iml +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/pom.xml b/hzims-service-api/pom.xml index 9974fff..59661cf 100644 --- a/hzims-service-api/pom.xml +++ b/hzims-service-api/pom.xml @@ -16,7 +16,6 @@ assets-api - topvision-api equipment-api basic-api @@ -30,6 +29,7 @@ middle-api alarm-api big-model-api + suichang-api diff --git a/hzims-service-api/spare-api/pom.xml b/hzims-service-api/spare-api/pom.xml deleted file mode 100644 index b45831f..0000000 --- a/hzims-service-api/spare-api/pom.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - hzims-service-api - com.hnac.hzims - 4.0.0-SNAPSHOT - - 4.0.0 - - spare-api - ${project.artifactId} - jar - - diff --git a/hzims-service-api/spare-api/spare-api.iml b/hzims-service-api/spare-api/spare-api.iml deleted file mode 100644 index 660192e..0000000 --- a/hzims-service-api/spare-api/spare-api.iml +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/entity/Notice.java b/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/entity/Notice.java deleted file mode 100644 index 0c328ed..0000000 --- a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/entity/Notice.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; - -import java.util.Date; - -/** - * 实体类 - * - * @author Chill - */ -@Data -@TableName("blade_notice") -@EqualsAndHashCode(callSuper = true) -public class Notice extends BaseEntity { - - private static final long serialVersionUID = 1L; - - /** - * 标题 - */ - @ApiModelProperty(value = "标题") - private String title; - - /** - * 通知类型 - */ - @ApiModelProperty(value = "通知类型") - private Integer category; - - /** - * 发布日期 - */ - @ApiModelProperty(value = "发布日期") - private Date releaseTime; - - /** - * 内容 - */ - @ApiModelProperty(value = "内容") - private String content; - - -} diff --git a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/feign/INoticeClient.java b/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/feign/INoticeClient.java deleted file mode 100644 index ff3206f..0000000 --- a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/feign/INoticeClient.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare.feign; - -import org.springblade.core.launch.constant.AppConstant; -import org.springblade.core.tool.api.R; -import com.hnac.hzims.spare.entity.Notice; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestParam; - -import java.util.List; - -/** - * Notice Feign接口类 - * - * @author Chill - */ -@FeignClient( - value = AppConstant.APPLICATION_DESK_NAME -) -public interface INoticeClient { - - String API_PREFIX = "/client"; - String TOP = API_PREFIX + "/top"; - - /** - * 获取notice列表 - * - * @param number - * @return - */ - @GetMapping(TOP) - R> top(@RequestParam("number") Integer number); - -} diff --git a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/vo/NoticeVO.java b/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/vo/NoticeVO.java deleted file mode 100644 index e367a45..0000000 --- a/hzims-service-api/spare-api/src/main/java/com/hnac/hzims/spare/vo/NoticeVO.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hnac.hzims.spare.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.Notice; - -/** - * 通知公告视图类 - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class NoticeVO extends Notice { - - @ApiModelProperty(value = "通知类型名") - private String categoryName; - -} diff --git a/hzims-service-api/video-image-api/video-image-api.iml b/hzims-service-api/video-image-api/video-image-api.iml deleted file mode 100644 index 3e0824c..0000000 --- a/hzims-service-api/video-image-api/video-image-api.iml +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/water-quality-api/water-quality-api.iml b/hzims-service-api/water-quality-api/water-quality-api.iml deleted file mode 100644 index 3e0824c..0000000 --- a/hzims-service-api/water-quality-api/water-quality-api.iml +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service-api/water-rain-api/water-rain-api.iml b/hzims-service-api/water-rain-api/water-rain-api.iml deleted file mode 100644 index 3e0824c..0000000 --- a/hzims-service-api/water-rain-api/water-rain-api.iml +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java index 629d287..df732d1 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/schedule/InteractiveSchedule.java @@ -193,9 +193,9 @@ public class InteractiveSchedule { return ReturnT.SUCCESS; } - //@XxlJob(SYNCHRONOUS_FAULT_INSTRUCT) String params - @Scheduled(cron = "0/10 * * * * ?") - public ReturnT synchronousFaultInstruct() { + @XxlJob(SYNCHRONOUS_FAULT_INSTRUCT) + //@Scheduled(cron = "0/10 * * * * ?") + public ReturnT synchronousFaultInstruct(String params) { Map request = new HashMap<>(2); // 获取站点列表 R> stationsR = stationClient.list(new StationEntity()); diff --git a/hzims-service/hzims-simulate/pom.xml b/hzims-service/hzims-simulate/pom.xml new file mode 100644 index 0000000..72cbbb0 --- /dev/null +++ b/hzims-service/hzims-simulate/pom.xml @@ -0,0 +1,129 @@ + + + + com.hnac.hzims + hzims-service + 4.0.0-SNAPSHOT + + + 4.0.0 + hzims-simulate + jar + + + 8 + 8 + UTF-8 + + + + + + com.xuxueli + xxl-job-core + + + com.google.guava + failureaccess + 1.0.1 + + + org.springblade + blade-common + + + org.springblade + blade-core-boot + + + org.springblade + blade-core-cloud + + + + + org.springblade + blade-starter-http + + + org.springblade + blade-core-cloud + compile + + + + org.springblade + blade-starter-datascope + compile + + + org.projectlombok + lombok + + + + com.hnac.hzims + equipment-api + 4.0.0-SNAPSHOT + + + + com.hnac.hzims + weather-api + 4.0.0-SNAPSHOT + + + + com.hzinfo.framework + hnac-framework-mqtt-starters + + + + dom4j + dom4j + 1.6.1 + compile + + + org.springblade + blade-core-cloud + 5.1.1.RELEASE.fix.1 + compile + + + + + + + ${project.name}-${project.version} + + + src/main/java + + **/*.xml + + false + + + + + org.springframework.boot + spring-boot-maven-plugin + 2.6.6 + + + + repackage + + + exec + + + + + + + + \ No newline at end of file diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/SimulateApplication.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/SimulateApplication.java new file mode 100644 index 0000000..59981d0 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/SimulateApplication.java @@ -0,0 +1,28 @@ +package com.hnac.hzims.simulate; + +import org.mybatis.spring.annotation.MapperScan; +import org.springblade.core.cloud.feign.EnableBladeFeign; +import org.springblade.core.launch.BladeApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.cloud.client.SpringCloudApplication; + + +/** + * @author admin + */ +@EnableBladeFeign +@SpringCloudApplication +@MapperScan(basePackages={"com.hnac.hzims.**.mapper"}) +//@ComponentScan(basePackages = {"com.hnac.hzinfo.simulate"}) +public class SimulateApplication extends SpringBootServletInitializer { + static String APPLICATION_NAME="hzims-simulate"; + public static void main(String[] args) { + BladeApplication.run(APPLICATION_NAME, SimulateApplication.class, args); + } + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + return BladeApplication.createSpringApplicationBuilder(builder, APPLICATION_NAME, SimulateApplication.class); + } +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/constants/WriteRealDataConstant.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/constants/WriteRealDataConstant.java new file mode 100644 index 0000000..bd48066 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/constants/WriteRealDataConstant.java @@ -0,0 +1,43 @@ +package com.hnac.hzims.simulate.constants; + +/** + * @author ysj + * @describe 实时数据写入常量 + */ +public interface WriteRealDataConstant { + + String REAL_DATA_V3 = "3"; + + String REAL_DATA_V4 = "4"; + + String GATE_FLOW = "过闸流量(m³/s)"; + + String OPENING_DEGREE = "开度(m)"; + + String GATE_STATUS = "闸门状态"; + + String WRITE_REAL_GATE_DATA = "writeRealGateData"; + + String WRITE_REAL_RAIN_DATA = "writeRealRainData"; + + Long OPEN = 0L; + + Long CLOSE = 1L; + + String WRITE_GATE = "1"; + + String WRITE_RAIN = "2"; + + // 降雨站属性标识 + String ATTR_RAIN = "attr_rain"; + String ATTR_WIND360 = "wind360"; + String ATTR_WIND_SCALE = "wind_scale"; + String ATTR_WIND_SPEED = "wind_speed "; + String ATTR_HUMIDITY = "humidity"; + String ATTR_PRESSURE = "pressure"; + String ATTR_VIS = "vis"; + String ATTR_CLOUD = "cloud"; + String ATTR_DEW = "dew"; + String ATTR_FEELS_LIKE = "feels_like"; + String ATTR_TEMP = "temp"; +} \ No newline at end of file diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/GageController.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/GageController.java new file mode 100644 index 0000000..08ec0a8 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/GageController.java @@ -0,0 +1,31 @@ +package com.hnac.hzims.simulate.controller; + +import com.hnac.hzims.simulate.service.WriteRealDataService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author ysj + */ +@RestController +@AllArgsConstructor +@RequestMapping("/gate") +@Api(value = "闸门开关机模拟服务", tags = "闸门开关机模拟服务") +public class GageController { + + private final WriteRealDataService writeRealDataService; + + @GetMapping("/isOpen") + @ApiOperation(value = "枢纽天气情况") + public R weather(@RequestParam("deviceCode") String deviceCode, + @RequestParam("isOpen") Long isOpen){ + return R.data(writeRealDataService.isOpen(deviceCode,isOpen)); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/SimulationDataController.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/SimulationDataController.java new file mode 100644 index 0000000..8d6d85c --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/controller/SimulationDataController.java @@ -0,0 +1,195 @@ +package com.hnac.hzims.simulate.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.google.common.collect.Maps; +import com.hnac.hzims.common.enums.ExceptionEnum; +import com.hnac.hzims.simulate.entity.DataModel; +import com.hnac.hzims.simulate.entity.Device; +import com.hnac.hzims.simulate.entity.DeviceField; +import com.hnac.hzims.simulate.entity.DeviceFieldGap; +import com.hnac.hzims.simulate.service.DeviceFieldGapService; +import com.hnac.hzims.simulate.service.DeviceFieldService; +import com.hnac.hzims.simulate.service.SimulationService; +import com.hnac.hzims.simulate.util.ParseFacUtils; +import com.hnac.hzims.simulate.util.TopicConstant; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.jackson.JsonUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.mqtt.producer.IMqttSender; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.*; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@RestController +@RequestMapping("/simulationData") +@Api(value = "数据模拟服务", tags = "数据模拟服务") +@Slf4j +public class SimulationDataController { + + @Autowired + private SimulationService simulationService; + + @Autowired + private DeviceFieldService deviceFieldService; + + @Autowired + private DeviceFieldGapService deviceFieldGapService; + + @Autowired + private IMqttSender mqttSender; + + @Value("fac.path") + private String facPath; + + public static Map cacheMap = Maps.newHashMap(); + + @ApiOperation(value = "解析v3.0场信息文件", notes = "解析场信息文件") + @GetMapping("/readFac") + public R readFac() { + InputStream inputStream = null; + try { + inputStream = new FileInputStream(new File(facPath+File.separator+"factory.fac")); + List list = ParseFacUtils.parsePoint(inputStream); + list.forEach(entity -> { + mqttSender.sendToMqtt(TopicConstant.TOPIC_DEVICE_MODEL, JsonUtil.toJson(entity)); + }); + return R.success("解析场信息文件成功"); + } catch (Exception e) { + log.error(e.getMessage(), e); + return R.fail("解析场信息文件失败"); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + @ApiOperation(value = "分页范围配置", notes = "分页范围配置") + @GetMapping("/pageGap") + public R> pageGap(String stationId, Query query) { + List list=simulationService.getDeviceListByStationId(stationId); + List ids=list.stream().map(Device::getId).collect(Collectors.toList()); + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper(); + lambdaQueryWrapper.in(DeviceFieldGap::getFacDeviceId,ids); + IPage pageList=deviceFieldGapService.page(Condition.getPage(query),lambdaQueryWrapper); + return R.data(pageList); + } + + @ApiOperation(value = "更新设备属性范围配置", notes = "更新设备属性范围配置") + @PostMapping("/updateGap") + public R updateGap(@RequestBody DeviceFieldGap deviceFieldGap) { + deviceFieldGapService.updateById(deviceFieldGap); + return R.status(true); + } + + @ApiOperation(value = "第一次同步设备属性", notes = "第一次同步设备属性") + @GetMapping("/syncOneGap") + public R syncGap() { + //存在表 + int count=deviceFieldService.existGapTable(); + if(count<=0){//建表 + deviceFieldService.createGapTable(); + } + //同步 + List list=deviceFieldService.list(); + List gaps=list.stream().map(result -> new DeviceFieldGap(result.getId(), result.getFacDeviceId(), + result.getSignage(),result.getName(), BigDecimal.ZERO,BigDecimal.ZERO)) + .collect(Collectors.toList()); + deviceFieldGapService.saveOrUpdateBatch(gaps); + + return R.status(true); + } + + @ApiOperation(value = "第二次同步设备属性", notes = "第二次同步设备属性") + @GetMapping("/syncTwoGap") + public R syncTwoGap() { + //同步 + List list=deviceFieldService.queryNewInsert(); + if(list!=null && !list.isEmpty()) { + List gaps = list.stream().map(result -> new DeviceFieldGap(result.getId(), result.getFacDeviceId(), + result.getSignage(), result.getName(), BigDecimal.ZERO, BigDecimal.ZERO)) + .collect(Collectors.toList()); + deviceFieldGapService.saveBatch(gaps); + } + return R.status(true); + } + + + @ApiOperation(value = "模拟单站的数据(循环,每隔sleepTime时长发送一次整站数据)", notes = "模拟单站的数据") + @GetMapping("/simulationMultiple") + public R simulationMultipleV3(String stationId, Long sleepTime) { + String key = "simulation:" + stationId; + String hasExc = cacheMap.get(key); + if (Func.isNotBlank(hasExc)) { + return R.fail("该站已经在模拟数据了"); + } + try { + simulationService.simulationMultiple(stationId, sleepTime); + }catch (Exception e) { + throw new ServiceException(ExceptionEnum.SIMULATE_ERROR); + } + cacheMap.put(key, "true"); + return R.status(true); + + } + + @ApiOperation(value = "模拟单站的数据(循环,每隔sleepTime时长发送一次整站数据)", notes = "模拟单站的数据") + @GetMapping("/simulationMultipleV4") + public R simulationMultipleV4(String stationId, Long sleepTime) { + String key = "simulation:" + stationId; + String hasExc = cacheMap.get(key); + if (Func.isNotBlank(hasExc)) { + return R.fail("该站已经在模拟数据了"); + } + try { + simulationService.simulationMultipleV4(stationId, sleepTime); + }catch (Exception e) { + throw new ServiceException(ExceptionEnum.SIMULATE_ERROR); + } + cacheMap.put(key, "true"); + return R.status(true); + } + +// @ApiOperation(value = "模拟单站的数据(循环,每隔sleepTime时长发送一次整站数据)", notes = "模拟单站的数据") +// @GetMapping("/simulationMultipleFlow") +// public R simulationMultipleInFlow() { +// String key = "simulationMultipleInFlow"; +// String hasExc = cacheMap.get(key); +// if (Func.isNotBlank(hasExc)) { +// return R.fail("该站已经在模拟数据了"); +// } +// simulationService.simulationMultipleInFlow(); +// cacheMap.put(key, "true"); +// return R.status(true); +// } + + + @ApiOperation(value = "停止模拟", notes = "停止模拟") + @GetMapping("/stopStart") + public R stopStart() { + simulationService.stopStart(); + return R.status(true); + + } + +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataItem.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataItem.java new file mode 100644 index 0000000..633cbb8 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataItem.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.simulate.entity; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class DataItem { + + private String id; + private String signage;//hz3000定义的id + private String name; + private String type; + private String soeType; + private String eventType; +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataModel.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataModel.java new file mode 100644 index 0000000..7771e95 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DataModel.java @@ -0,0 +1,46 @@ +package com.hnac.hzims.simulate.entity; + +import lombok.Data; + +import java.util.List; + +/** + * { + * "station": "4543", + * "structType": "dataGroup", + * "id": "5016387599_0", + * "pid": "5016387585", + * "name": "温度传感器", + * "children": [{ + * "id": "5016387607", + * "name": "温度", + * "type": "YC" + * },{ + * "id": "5016387617", + * "name": "高度", + * "type": "YC" + * },{ + * "id": "5016387608", + * "name": "工作状态", + * "type": "YX" + * },{ + * "id": "5016387609", + * "name": "工作状态", + * "type": "SOE", + * "eventType": "" + * }] + * } + * 数据组 + * @author ninglong + */ +@Data +public class DataModel { + private String station; + private String structType; + private String id; + private String signage;//hz3000定义的id + private String pid; + private String name; + private List children; +} + diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Device.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Device.java new file mode 100644 index 0000000..b3ed590 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Device.java @@ -0,0 +1,66 @@ +package com.hnac.hzims.simulate.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * 数据组 + * + * @author ninglong + */ +@TableName(value = "hzinfo_fac_device") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Device implements Serializable { + + @ApiModelProperty(value = "id") + @TableId(type = IdType.INPUT) + private String id; + + @ApiModelProperty(value = "名称") + private String name; + + @ApiModelProperty(value = "0-云端cms,1-站端直传") + private Integer source; + + @ApiModelProperty("hz3000定义的id,如果定义的是大id则值与id字段值相同") + private String sid; + + @ApiModelProperty("version=v3,version=v4") + private String modelKind; + + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @ApiModelProperty("创建时间") + private Date createTime; + + @JsonSerialize( + using = ToStringSerializer.class + ) + + @ApiModelProperty("项目id") + private String projectId; + + + @ApiModelProperty("写入方式") + private String isWrite; +} \ No newline at end of file diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceData.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceData.java new file mode 100644 index 0000000..411609c --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceData.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.simulate.entity; + +import com.google.common.collect.Lists; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 设备数据 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class DeviceData { + private String station; + private String time; + private List children = Lists.newArrayList(); +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceDataV4.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceDataV4.java new file mode 100644 index 0000000..6b6023d --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceDataV4.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.simulate.entity; + +import com.google.common.collect.Lists; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class DeviceDataV4 { + private String stationId; + private String time; + private List children = Lists.newArrayList(); +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFacConfig.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFacConfig.java new file mode 100644 index 0000000..80c449e --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFacConfig.java @@ -0,0 +1,38 @@ +package com.hnac.hzims.simulate.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author ysj + */ +@TableName("hzinfo_fac_device_config") +@Data +public class DeviceFacConfig implements Serializable { + @ApiModelProperty("id") + @TableId(type = IdType.INPUT) + private String id; + + @ApiModelProperty("设备id") + private String deviceCode; + + @ApiModelProperty("字段标识") + private String facDeviceId; + + @ApiModelProperty("站点Id") + private String stationId; + + @ApiModelProperty("站点类型") + private String modelKind; + + @ApiModelProperty("sid") + private String sid; + + @ApiModelProperty("数据写入方式: 1-闸门,2-天气") + private String writeMethod; +} \ No newline at end of file diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceField.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceField.java new file mode 100644 index 0000000..c9660e2 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceField.java @@ -0,0 +1,42 @@ +package com.hnac.hzims.simulate.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@TableName("hzinfo_fac_device_attr") +@Data +public class DeviceField implements Serializable { + @ApiModelProperty("id") + @TableId(type = IdType.INPUT) + private String id; + @ApiModelProperty("设备id") + private String facDeviceId; + @ApiModelProperty("字段标识") + private String signage; + @ApiModelProperty("字段名称") + private String name; + @ApiModelProperty("最大值") + private String projectId; + + @DateTimeFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss" + ) + @ApiModelProperty("创建时间") + private Date createTime; + + private Long modelClassifyId; + private String alarmType; + + +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFieldGap.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFieldGap.java new file mode 100644 index 0000000..d3efad5 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceFieldGap.java @@ -0,0 +1,30 @@ +package com.hnac.hzims.simulate.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +@TableName("hzinfo_fac_device_attr_gap") +@Data +@AllArgsConstructor +public class DeviceFieldGap implements Serializable { + @ApiModelProperty("id") + @TableId(type = IdType.INPUT) + private String id; + @ApiModelProperty("设备id") + private String facDeviceId; + @ApiModelProperty("字段标识") + private String signage; + @ApiModelProperty("字段名称") + private String name; + @ApiModelProperty("最大值") + private BigDecimal maxVal; + @ApiModelProperty("最小值") + private BigDecimal minVal; +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceRainGap.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceRainGap.java new file mode 100644 index 0000000..5363edd --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/DeviceRainGap.java @@ -0,0 +1,33 @@ +package com.hnac.hzims.simulate.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author ysj + */ +@TableName("hzinfo_fac_device_rain_gap") +@Data +public class DeviceRainGap implements Serializable { + + @ApiModelProperty("id") + @TableId(type = IdType.INPUT) + private String id; + + @ApiModelProperty("设备id") + private String facDeviceId; + + @ApiModelProperty("属性标识名称") + private String name; + + @ApiModelProperty("属性标识") + private String attribute; + + @ApiModelProperty("字段标识") + private String signage; +} \ No newline at end of file diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Kvtq.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Kvtq.java new file mode 100644 index 0000000..4a6c839 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/Kvtq.java @@ -0,0 +1,18 @@ +package com.hnac.hzims.simulate.entity; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class Kvtq { + + private String k; + private String v; + private String t; + private Integer q; +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/KvtqV4.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/KvtqV4.java new file mode 100644 index 0000000..a5a8b0e --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/entity/KvtqV4.java @@ -0,0 +1,18 @@ +package com.hnac.hzims.simulate.entity; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class KvtqV4 { + private String sid; + private String k; + private String v; + private String t; + private Integer q; +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.java new file mode 100644 index 0000000..ad70ac9 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.simulate.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.simulate.entity.DeviceFacConfig; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author ysj + */ +@Mapper +public interface DeviceFacConfigMapper extends BaseMapper { + + List queryConfigDevice(@Param("method") String method); + + DeviceFacConfig configByDeviceCode(@Param("deviceCode") String deviceCode); +} \ No newline at end of file diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.xml b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.xml new file mode 100644 index 0000000..1dda78c --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFacConfigMapper.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.java new file mode 100644 index 0000000..d3e85d4 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.simulate.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.simulate.entity.DeviceFieldGap; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +@Mapper +public interface DeviceFieldGapMapper extends BaseMapper { + List queryDeviceLimits(@Param("signages") List signages); + + void updateLimitById(@Param("maxValue") BigDecimal maxValue, @Param("minValue") BigDecimal minValue,@Param("id") String id); +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.xml b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.xml new file mode 100644 index 0000000..7a4fff8 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldGapMapper.xml @@ -0,0 +1,18 @@ + + + + + + + UPDATE HZINFO_FAC_DEVICE_ATTR_GAP + SET max_val = #{maxValue}, + min_val = #{minValue} + WHERE id = #{id} + + diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.java new file mode 100644 index 0000000..e44fc5d --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.simulate.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.simulate.entity.DeviceField; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface DeviceFieldMapper extends BaseMapper { + int existGapTable(); + int createGapTable(); + List queryNewInsert(); + + List queryDeviceFields(@Param("devices") List devices); + + List querySignages(@Param("facDeviceId") String facDeviceId); +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.xml b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.xml new file mode 100644 index 0000000..477ff69 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceFieldMapper.xml @@ -0,0 +1,34 @@ + + + + + + CREATE TABLE hzinfo_device_field_gap ( + id varchar(64) COLLATE utf8mb4_bin NOT NULL COMMENT '字段类型', + fac_device_id varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '设备实例id', + signage varchar(25) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '字段标识', + name varchar(100) COLLATE utf8mb4_bin NOT NULL COMMENT '字段名称', + max_val decimal(9,3) DEFAULT NULL, + min_val decimal(9,3) DEFAULT NULL, + PRIMARY KEY (id) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='设备字段' + + + + + + + diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.java new file mode 100644 index 0000000..4edccd1 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.simulate.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.simulate.entity.Device; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +@Mapper +public interface DeviceMapper extends BaseMapper { + String getSid(@Param("stationId") String stationId); + +// List selectStcd(); +// +// int insertData(@Param("param") Map param); +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.xml b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.xml new file mode 100644 index 0000000..19587cf --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceMapper.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.java new file mode 100644 index 0000000..5438aca --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.simulate.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.simulate.entity.DeviceRainGap; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author ysj + */ +@Mapper +public interface DeviceRainGapMapper extends BaseMapper { + + List RainGapByFacDeviceId(@Param("facDeviceId") String facDeviceId); +} \ No newline at end of file diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.xml b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.xml new file mode 100644 index 0000000..95d531a --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/mapper/DeviceRainGapMapper.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/scheduled/WriteRealDataTask.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/scheduled/WriteRealDataTask.java new file mode 100644 index 0000000..3032379 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/scheduled/WriteRealDataTask.java @@ -0,0 +1,53 @@ +package com.hnac.hzims.simulate.scheduled; + +import com.hnac.hzims.simulate.constants.WriteRealDataConstant; +import com.hnac.hzims.simulate.service.WriteRealDataService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.Date; + + +/** + * @author ysj + * @describe 实时数据写入定时任务 + */ +@Slf4j +@Component +public class WriteRealDataTask { + + @Autowired + private WriteRealDataService writeRealDataService; + + /** + * 设备模型信息 + */ + @XxlJob(WriteRealDataConstant.WRITE_REAL_GATE_DATA) + //@Scheduled(cron = "0/40 * * * * ? ") + public ReturnT writeRealGateData(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + writeRealDataService.writeRealGateData(param); + return new ReturnT<>("SUCCESS"); + } + + /** + * 设备模型信息 + */ + @XxlJob(WriteRealDataConstant.WRITE_REAL_RAIN_DATA) + //@Scheduled(cron = "0/40 * * * * ? ") + public ReturnT writeRealRainData(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + writeRealDataService.writeRealRainData(param); + return new ReturnT<>("SUCCESS"); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldGapService.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldGapService.java new file mode 100644 index 0000000..99868bb --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldGapService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.simulate.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.simulate.entity.DeviceFieldGap; +import com.hnac.hzims.simulate.mapper.DeviceFieldGapMapper; +import org.springframework.stereotype.Service; + +@Service +public class DeviceFieldGapService extends ServiceImpl { + +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldService.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldService.java new file mode 100644 index 0000000..c97b7e9 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceFieldService.java @@ -0,0 +1,24 @@ +package com.hnac.hzims.simulate.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.simulate.entity.DeviceField; +import com.hnac.hzims.simulate.mapper.DeviceFieldMapper; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class DeviceFieldService extends ServiceImpl { + + public int existGapTable(){ + return this.baseMapper.existGapTable(); + } + + public int createGapTable(){ + return this.baseMapper.createGapTable(); + } + + public List queryNewInsert(){ + return this.baseMapper.queryNewInsert(); + } +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceService.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceService.java new file mode 100644 index 0000000..494b1e5 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/DeviceService.java @@ -0,0 +1,21 @@ +package com.hnac.hzims.simulate.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.simulate.entity.Device; +import com.hnac.hzims.simulate.mapper.DeviceMapper; +import org.springframework.stereotype.Service; + +@Service +public class DeviceService extends ServiceImpl { + public String getSid(String stationId){ + return this.baseMapper.getSid(stationId); + } + +// public List selectStcd(){ +// return this.baseMapper.selectStcd(); +// } +// +// public int insertData(Map param){ +// return this.baseMapper.insertData(param); +// } +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/SimulationService.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/SimulationService.java new file mode 100644 index 0000000..31903f9 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/SimulationService.java @@ -0,0 +1,280 @@ +package com.hnac.hzims.simulate.service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.hnac.hzims.simulate.entity.*; +import com.hnac.hzims.simulate.util.DataConstants; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.jackson.JsonUtil; +import org.springblade.core.tool.utils.DateTimeUtil; +import org.springblade.core.tool.utils.ThreadUtil; +import org.springblade.mqtt.producer.IMqttSender; +import com.hnac.hzims.simulate.util.TopicConstant; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +@Service +@Slf4j +public class SimulationService { + @Autowired + IMqttSender mqttSender; + + @Autowired + DeviceService deviceService; + + @Autowired + DeviceFieldService deviceFieldService; + + @Autowired + DeviceFieldGapService deviceFieldGapService; + + public List getDeviceListByStationId(String projectId){ + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper(); + lambdaQueryWrapper.eq(Device::getProjectId,projectId); + lambdaQueryWrapper.eq(Device::getIsWrite,"0"); + List list = deviceService.list(lambdaQueryWrapper); + return list; + } + + String getSid(String stationId){ + return deviceService.getSid(stationId); + } + + //模拟启停标识 + private volatile boolean flag=true; + + public void stopStart(){ + flag = !flag; + } + + @Async + public void simulationMultiple(String stationId, Long sleepTime) { + + List list = getDeviceListByStationId(stationId); + //查询所有属性 + List fieldList = deviceFieldService.list(); + List gapList = deviceFieldGapService.list(); + + log.info("本站{}有{}个设备实例,每{}毫秒发送{}条数据", stationId, list.size(), sleepTime, list.size()); + while (true) { + if (flag) {//启动或关闭模拟 + for (Device device : list) { + Map map = simulation(stationId, device,fieldList,gapList); +// log.info("map data: "+ JsonUtil.toJson(map)); + if (map.get("yc") != null && map.get("yc").getChildren().size() > 0) { + log.info("模拟推送遥测,主题:topic_hzinfo_props:{}", JsonUtil.toJson(map.get("yc"))); + mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_PROPS, JsonUtil.toJson(map.get("yc"))); + } +// if (map.get("dd") != null && map.get("dd").getChildren().size() > 0) { +// mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_DD, JsonUtil.toJson(map.get("dd"))); +// } + if (map.get("yx") != null && map.get("yx").getChildren().size() > 0) { + mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_YX, JsonUtil.toJson(map.get("yx"))); + } + } + //最小10毫秒 + if (sleepTime == null || sleepTime == 0) { + sleepTime = 10L; + } + ThreadUtil.sleep(sleepTime); + } + } + } + + +// @Async +// public void simulationMultipleInFlow(){ +// List list=deviceService.selectStcd(); +// while (true) { +// List> datas = simulationFlow(list); +// for(Map param:datas){ +// deviceService.insertData(param); +// } +// ThreadUtil.sleep(3600000); +// } +// } + + private List> simulationFlow(List list){ + List> datas =new ArrayList<>(); + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dt=sdf.format(new Date()); + for(String stcd:list){ + Map data=new HashMap<>(); + String value = getRandomRedPacketBetweenMinAndMax(new BigDecimal("0"), new BigDecimal("20")).toString(); + data.put("stcd",stcd); + data.put("dt",dt); + data.put("inflow",value); + datas.add(data); + } + return datas; + } + + + @Async + public void simulationMultipleV4(String stationId, Long sleepTime){ + String sid=getSid(stationId); + List list = getDeviceListByStationId(stationId); + //查询所有属性 + List fieldList = deviceFieldService.list(); + List gapList = deviceFieldGapService.list(); + + log.info("本站{}有{}个设备实例,每{}毫秒发送{}条数据", stationId, list.size(), sleepTime, list.size()); + while (true) { + if (flag) {//启动或关闭模拟 + for (Device device : list) { + Map map = simulationV4(stationId,sid, device,fieldList,gapList); + //log.info("map data: "+ JsonUtil.toJson(map)); + if (map.get("yc") != null && map.get("yc").getChildren().size() > 0) { + mqttSender.sendToMqtt("hzinfo_v4_yc", JsonUtil.toJson(map.get("yc"))); + } +// if (map.get("dd") != null && map.get("dd").getChildren().size() > 0) { +// mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_DD, JsonUtil.toJson(map.get("dd"))); +// } + if (map.get("yx") != null && map.get("yx").getChildren().size() > 0) { + mqttSender.sendToMqtt("hzinfo_v4_yx", JsonUtil.toJson(map.get("yx"))); + } + } + //最小10毫秒 + if (sleepTime == null || sleepTime == 0) { + sleepTime = 10L; + } + ThreadUtil.sleep(sleepTime); + } + } + } + + public static BigDecimal getRandomRedPacketBetweenMinAndMax(BigDecimal min, BigDecimal max){ + float minF = min.floatValue(); + float maxF = max.floatValue(); + //生成随机数 + BigDecimal db = new BigDecimal(Math.random() * (maxF - minF) + minF); + //返回保留两位小数的随机数。不进行四舍五入 + return db.setScale(3,BigDecimal.ROUND_DOWN); + } + + public static int getIntBetweenMinAndMax(int min, int max){ + //生成随机数 + int randomNum = min + (int)(Math.random() * ((max - min) + 1)); + //返回保留两位小数的随机数。不进行四舍五入 + return randomNum; + } + + /** + * 模拟一条数据 + */ + private Map simulation(String stationId, Device device,List fieldListAll,List gapListAll) { +// List fieldList = getListByDeviceId(device.getId()); +// List gapList = getListByDeviceGapId(device.getId()); + List fieldList =fieldListAll.stream().filter(e->e.getFacDeviceId().equals(device.getId())).collect(Collectors.toList()); + List gapList =gapListAll.stream().filter(e->e.getFacDeviceId().equals(device.getId())).collect(Collectors.toList()); +// log.info("fieldList data: "+ JsonUtil.toJson(fieldList)); +// log.info("gapList data: "+ JsonUtil.toJson(gapList)); + List ycList = Lists.newArrayList(); + List yxList = Lists.newArrayList(); + //List ddList = Lists.newArrayList(); + for (DeviceField field : fieldList) { + Optional gapOpt=gapList.stream().filter(e->e.getSignage().equals(field.getSignage())).findFirst(); + + if (DataConstants.DeviceDataType.YC.ordinal()== field.getModelClassifyId().intValue()) { + if(gapOpt!=null) { + DeviceFieldGap gap=gapOpt.get(); + String value = getRandomRedPacketBetweenMinAndMax(gap.getMinVal(), gap.getMaxVal()).toString(); + Kvtq kvtq = Kvtq.builder().k(field.getSignage()).v(value).t(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).q(0).build(); + ycList.add(kvtq); + } + } +// if (DataConstants.DeviceDataType.DD.name().equals(field.getType())) { +// String value = Func.random(1, RandomType.INT) + "." + Func.random(1, RandomType.INT); +// Kvtq kvtq = Kvtq.builder().k(field.getId()).v(value).t(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).q(0).build(); +// ddList.add(kvtq); +// } + if (DataConstants.DeviceDataType.YX.ordinal()== field.getModelClassifyId().intValue()) { + if(gapOpt!=null) { + DeviceFieldGap gap=gapOpt.get(); + int value = getIntBetweenMinAndMax(gap.getMinVal().intValue(), gap.getMaxVal().intValue()); + Kvtq kvtq = Kvtq.builder().k(field.getSignage()).v(String.valueOf(value)).t(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).q(0).build(); + yxList.add(kvtq); + } + } + } + Map map = Maps.newHashMap(); + if (ycList.size() > 0) { + map.put("yc", DeviceData.builder().station(stationId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(ycList).build()); + } +// if (ddList.size() > 0) { +// map.put("dd", DeviceData.builder().station(stationId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(ddList).build()); +// } + if (yxList.size() > 0) { + map.put("yx", DeviceData.builder().station(stationId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(yxList).build()); + } + return map; + } + + + private Map simulationV4(String stationId,String sid, Device device,List fieldListAll,List gapListAll) { + +// List fieldList = getListByDeviceId(device.getId()); +// List gapList = getListByDeviceGapId(device.getId()); + List fieldList =fieldListAll.stream().filter(e->e.getFacDeviceId().equals(device.getId())).collect(Collectors.toList()); + List gapList =gapListAll.stream().filter(e->e.getFacDeviceId().equals(device.getId())).collect(Collectors.toList()); +// log.info("fieldList data: "+ JsonUtil.toJson(fieldList)); +// log.info("gapList data: "+ JsonUtil.toJson(gapList)); + List ycList = Lists.newArrayList(); + List yxList = Lists.newArrayList(); + //List ddList = Lists.newArrayList(); + for (DeviceField field : fieldList) { + Optional gapOpt=gapList.stream().filter(e->e.getSignage().equals(field.getSignage())).findFirst(); + + if (DataConstants.DeviceDataType.YC.ordinal()== field.getModelClassifyId().intValue()) { + if(gapOpt!=null) { + DeviceFieldGap gap=gapOpt.get(); + String value = getRandomRedPacketBetweenMinAndMax(gap.getMinVal(), gap.getMaxVal()).toString(); + KvtqV4 kvtq = KvtqV4.builder().sid(sid).k(field.getSignage()).v(value).t(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).q(0).build(); + ycList.add(kvtq); + } + } +// if (DataConstants.DeviceDataType.DD.name().equals(field.getType())) { +// String value = Func.random(1, RandomType.INT) + "." + Func.random(1, RandomType.INT); +// Kvtq kvtq = Kvtq.builder().k(field.getId()).v(value).t(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).q(0).build(); +// ddList.add(kvtq); +// } + if (DataConstants.DeviceDataType.YX.ordinal()== field.getModelClassifyId().intValue()) { + if(gapOpt!=null) { + DeviceFieldGap gap=gapOpt.get(); + int value = getIntBetweenMinAndMax(gap.getMinVal().intValue(), gap.getMaxVal().intValue()); + KvtqV4 kvtq = KvtqV4.builder().sid(sid).k(field.getSignage()).v(String.valueOf(value)).t(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).q(0).build(); + yxList.add(kvtq); + } + } + } + Map map = Maps.newHashMap(); + if (ycList.size() > 0) { + map.put("yc", DeviceDataV4.builder().stationId(stationId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(ycList).build()); + } +// if (ddList.size() > 0) { +// map.put("dd", DeviceData.builder().station(stationId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(ddList).build()); +// } + if (yxList.size() > 0) { + map.put("yx", DeviceDataV4.builder().stationId(stationId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(yxList).build()); + } + return map; + } + + private List getListByDeviceId(String deviceId) { + return deviceFieldService.list(Wrappers.lambdaQuery().ne(DeviceField::getModelClassifyId, DataConstants.DeviceDataType.SOE.name()).eq(DeviceField::getFacDeviceId, deviceId)); + } + + private List getListByDeviceGapId(String deviceId){ + return deviceFieldGapService.list(Wrappers.lambdaQuery().eq(DeviceFieldGap::getFacDeviceId, deviceId)); + } + +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/WriteRealDataService.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/WriteRealDataService.java new file mode 100644 index 0000000..ed500f3 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/WriteRealDataService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.simulate.service; + +/** + * @author ysj + */ +public interface WriteRealDataService { + + void writeRealGateData(String param); + + void writeRealRainData(String param); + + Boolean isOpen(String deviceCode, Long isOpen); +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/impl/WriteRealDataServiceImpl.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/impl/WriteRealDataServiceImpl.java new file mode 100644 index 0000000..4a49938 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/service/impl/WriteRealDataServiceImpl.java @@ -0,0 +1,304 @@ +package com.hnac.hzims.simulate.service.impl; + +import com.hnac.hzims.equipment.entity.EmInfoEntity; +import com.hnac.hzims.equipment.feign.IEmInfoClient; +import com.hnac.hzims.hzimsweather.feign.IHeWeatherWeatherClient; +import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; +import com.hnac.hzims.simulate.constants.WriteRealDataConstant; +import com.hnac.hzims.simulate.entity.*; +import com.hnac.hzims.simulate.mapper.DeviceFacConfigMapper; +import com.hnac.hzims.simulate.mapper.DeviceFieldGapMapper; +import com.hnac.hzims.simulate.mapper.DeviceFieldMapper; +import com.hnac.hzims.simulate.mapper.DeviceRainGapMapper; +import com.hnac.hzims.simulate.service.WriteRealDataService; +import com.hnac.hzims.simulate.util.DataConstants; +import com.hnac.hzims.simulate.util.TopicConstant; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.jackson.JsonUtil; +import org.springblade.core.tool.utils.*; +import org.springblade.mqtt.producer.IMqttSender; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.time.LocalDateTime; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import static com.hnac.hzims.simulate.constants.WriteRealDataConstant.REAL_DATA_V3; +import static com.hnac.hzims.simulate.constants.WriteRealDataConstant.REAL_DATA_V4; + +/** + * @author ysj + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class WriteRealDataServiceImpl implements WriteRealDataService { + + private final IEmInfoClient deviceClient; + + private final IHeWeatherWeatherClient weatherClient; + + private final IMqttSender mqttSender; + + private final DeviceFieldMapper fieldMapper; + + private final DeviceFieldGapMapper limitMapper; + + private final DeviceFacConfigMapper configMapper; + + private final DeviceRainGapMapper deviceRainGapMapper; + + /** + * 实时数据写入 + * @param param + */ + @Override + public void writeRealGateData(String param) { + // 查询设备配置 + List configs = configMapper.queryConfigDevice(WriteRealDataConstant.WRITE_GATE); + if(CollectionUtil.isEmpty(configs)){ + return; + } + //#.000 表示三位小数 + DecimalFormat df = new DecimalFormat("#0.000"); + // 遍历发送mqtt实时数据 + configs.stream().collect(Collectors.groupingBy(DeviceFacConfig::getModelKind)).forEach((modeKind,groups)->{ + // 查询设备属性 + List fields = fieldMapper.queryDeviceFields(groups.stream().map(DeviceFacConfig::getFacDeviceId).collect(Collectors.toList())); + if(CollectionUtil.isEmpty(fields)){ + return; + } + // 查询设备限制 + List limits = limitMapper.queryDeviceLimits(fields.stream().map(DeviceField::getSignage).collect(Collectors.toList())); + if(CollectionUtil.isEmpty(limits)){ + return; + } + // v3 + if(REAL_DATA_V3.equals(modeKind)){ + fields.stream().collect(Collectors.groupingBy(DeviceField::getModelClassifyId)).forEach((key, models) -> models.stream().collect(Collectors.groupingBy(DeviceField::getProjectId)).forEach((projectId, value)-> { + // 遥测实时数据对象 + List ycs = value.stream().filter(o -> DataConstants.DeviceDataType.YC.ordinal() == o.getModelClassifyId()).map(field -> { + List limit = limits.stream().filter(e -> e.getSignage().equals(field.getSignage())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(limit)) { + return new Kvtq(); + } + Kvtq real = new Kvtq(); + double random = Math.random() * limit.get(0).getMaxVal().subtract(limit.get(0).getMinVal()).doubleValue() + limit.get(0).getMinVal().doubleValue(); + real.setK(field.getSignage()); + real.setV(df.format(random)); + real.setT(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS")); + real.setQ(0); + return real; + }).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(ycs)) { + log.error("yc_real_data_v3 : {}", JsonUtil.toJson(DeviceData.builder().station(projectId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(ycs).build())); + mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_PROPS, JsonUtil.toJson(DeviceData.builder().station(projectId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(ycs).build())); + } + // 遥信实时数据对象 + List yxs = value.stream().filter(o -> DataConstants.DeviceDataType.YX.ordinal() == o.getModelClassifyId()).map(field -> { + List limit = limits.stream().filter(e -> e.getSignage().equals(field.getSignage())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(limit)) { + return new Kvtq(); + } + Kvtq real = new Kvtq(); + double random = limit.get(0).getMaxVal().subtract(limit.get(0).getMinVal()).doubleValue() + limit.get(0).getMinVal().doubleValue(); + real.setK(field.getSignage()); + real.setV(df.format(random)); + real.setT(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS")); + real.setQ(0); + return real; + }).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(yxs)) { + log.error("yx_real_data_v3 : {}", JsonUtil.toJson(DeviceData.builder().station(projectId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(yxs).build())); + mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_YX, JsonUtil.toJson(DeviceData.builder().station(projectId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(yxs).build())); + } + })); + } + // v4 + if(REAL_DATA_V4.equals(modeKind)){ + fields.stream().collect(Collectors.groupingBy(DeviceField::getModelClassifyId)).forEach((key, models) -> models.stream().collect(Collectors.groupingBy(DeviceField::getProjectId)).forEach((projectId, value)->{ + // 遥测实时数据对象 + List ycs = value.stream().filter(o -> DataConstants.DeviceDataType.YC.ordinal() == o.getModelClassifyId()).map(field -> { + List limit = limits.stream().filter(e -> e.getSignage().equals(field.getSignage())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(limit)) { + return new KvtqV4(); + } + // 查找sid + Optional sid = groups.stream().filter(group->field.getFacDeviceId().equals(group.getFacDeviceId())).findFirst(); + if(!sid.isPresent()){ + return new KvtqV4(); + } + KvtqV4 real = new KvtqV4(); + double random = Math.random() * limit.get(0).getMaxVal().subtract(limit.get(0).getMinVal()).doubleValue() + limit.get(0).getMinVal().doubleValue(); + real.setSid(sid.get().getSid()); + real.setK(field.getSignage()); + real.setV(df.format(random)); + real.setT(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS")); + real.setQ(0); + return real; + }).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(ycs)) { + log.error("yc_real_data_v4 : {}",JsonUtil.toJson(DeviceDataV4.builder().stationId(projectId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(ycs).build())); + mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_V4_YC,JsonUtil.toJson(DeviceDataV4.builder().stationId(projectId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(ycs).build())); + } + // 遥信实时数据对象 + List yxs = value.stream().filter(o -> DataConstants.DeviceDataType.YX.ordinal() == o.getModelClassifyId()).map(field -> { + List limit = limits.stream().filter(e -> e.getSignage().equals(field.getSignage())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(limit)) { + return new KvtqV4(); + } + // 查找sid + Optional sid = groups.stream().filter(group->field.getFacDeviceId().equals(group.getFacDeviceId())).findFirst(); + if(!sid.isPresent()){ + return new KvtqV4(); + } + KvtqV4 real = new KvtqV4(); + double random = limit.get(0).getMaxVal().subtract(limit.get(0).getMinVal()).doubleValue() + limit.get(0).getMinVal().doubleValue(); + real.setSid(sid.get().getSid()); + real.setK(field.getSignage()); + real.setV(df.format(random)); + real.setT(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS")); + real.setQ(0); + return real; + }).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(yxs)) { + log.error("yx_real_data_v4 : {}",JsonUtil.toJson(DeviceDataV4.builder().stationId(projectId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(yxs).build())); + mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_V4_YX,JsonUtil.toJson(DeviceDataV4.builder().stationId(projectId).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(yxs).build())); + } + })); + } + }); + } + + /** + * 雨量站实时数据写入 + * @param param + */ + @Override + public void writeRealRainData(String param) { + // 查询设备配置 + List configs = configMapper.queryConfigDevice(WriteRealDataConstant.WRITE_RAIN); + if(CollectionUtil.isEmpty(configs)){ + return; + } + R> devices = deviceClient.getEmInfoByEmCodes(configs.stream().map(DeviceFacConfig::getDeviceCode).collect(Collectors.toList())); + if(!devices.isSuccess() || CollectionUtil.isEmpty(devices.getData())){ + return; + } + devices.getData().forEach(device->{ + if(ObjectUtil.isEmpty(device.getLgtd()) || ObjectUtil.isEmpty(device.getLttd())){ + return; + } + // 查询设备经纬度 + String location = device.getLgtd() + "," + device.getLttd(); + R weather = weatherClient.getWeatherNowWithCache(location); + if(!weather.isSuccess() || ObjectUtil.isEmpty(weather.getData()) || ObjectUtil.isEmpty(weather.getData().getNow())){ + return; + } + Optional optional = configs.stream().filter(o->o.getDeviceCode().equals(device.getNumber())).findFirst(); + if(!optional.isPresent()){ + return; + } + List deviceRainGap = deviceRainGapMapper.RainGapByFacDeviceId(optional.get().getFacDeviceId()); + if(CollectionUtil.isEmpty(deviceRainGap)){ + return; + } + List yxs = deviceRainGap.stream().map(o->{ + KvtqV4 real = new KvtqV4(); + real.setSid(optional.get().getSid()); + real.setK(o.getSignage()); + real.setT(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss.SSS")); + real.setQ(0); + if(WriteRealDataConstant.ATTR_RAIN.equals(o.getAttribute())){ + real.setV(weather.getData().getNow().getPrecip()); + }else if(WriteRealDataConstant.ATTR_WIND360.equals(o.getAttribute())){ + real.setV(weather.getData().getNow().getWind360()); + }else if(WriteRealDataConstant.ATTR_WIND_SCALE.equals(o.getAttribute())){ + real.setV(weather.getData().getNow().getWindScale()); + }else if(WriteRealDataConstant.ATTR_WIND_SPEED.equals(o.getAttribute())){ + real.setV(weather.getData().getNow().getWindSpeed()); + }else if(WriteRealDataConstant.ATTR_HUMIDITY.equals(o.getAttribute())){ + real.setV(weather.getData().getNow().getHumidity()); + }else if(WriteRealDataConstant.ATTR_PRESSURE.equals(o.getAttribute())){ + real.setV(weather.getData().getNow().getPressure()); + }else if(WriteRealDataConstant.ATTR_VIS.equals(o.getAttribute())){ + real.setV(weather.getData().getNow().getVis()); + }else if(WriteRealDataConstant.ATTR_CLOUD.equals(o.getAttribute())){ + real.setV(weather.getData().getNow().getCloud()); + }else if(WriteRealDataConstant.ATTR_DEW.equals(o.getAttribute())){ + real.setV(weather.getData().getNow().getDew()); + }else if(WriteRealDataConstant.ATTR_FEELS_LIKE.equals(o.getAttribute())){ + real.setV(weather.getData().getNow().getFeelsLike()); + }else if(WriteRealDataConstant.ATTR_TEMP.equals(o.getAttribute())){ + real.setV(weather.getData().getNow().getTemp()); + } + if(StringUtil.isEmpty(real.getV())){ + real.setV("0.0"); + } + return real; + }).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(yxs)) { + log.error("yx_real_data_v4 : {}",JsonUtil.toJson(DeviceDataV4.builder().stationId(optional.get().getStationId()).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(yxs).build())); + mqttSender.sendToMqtt(TopicConstant.TOPIC_HZINFO_V4_YX,JsonUtil.toJson(DeviceDataV4.builder().stationId(optional.get().getStationId()).time(DateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss.SSS")).children(yxs).build())); + } + }); + } + + /** + * 开启/关闭闸门数据 + * @param deviceCode + * @param isOpen + * @return + */ + @Override + public Boolean isOpen(String deviceCode, Long isOpen) { + // 查询写入设备配置 + DeviceFacConfig config = configMapper.configByDeviceCode(deviceCode); + if(ObjectUtil.isEmpty(config)){ + return false; + } + // 查询设备属性 + List fields = fieldMapper.querySignages(config.getFacDeviceId()); + if(CollectionUtil.isEmpty(fields)){ + return false; + } + // 查询属性限制 + List limits = limitMapper.queryDeviceLimits(fields.stream().map(DeviceField::getSignage).collect(Collectors.toList())); + if(CollectionUtil.isEmpty(limits)){ + return false; + } + limits.forEach(limit->{ + Optional optional = fields.stream().filter(o->o.getSignage().equals(limit.getSignage())).findFirst(); + if(!optional.isPresent()){ + return; + } + String signage = optional.get().getName(); + if(WriteRealDataConstant.GATE_STATUS.equals(signage)){ + if(WriteRealDataConstant.OPEN.equals(isOpen)){ + limitMapper.updateLimitById(BigDecimal.ONE,BigDecimal.ZERO,limit.getId()); + }else{ + limitMapper.updateLimitById(BigDecimal.ZERO,BigDecimal.ZERO,limit.getId()); + } + }else if(WriteRealDataConstant.GATE_FLOW.equals(signage)){ + if(WriteRealDataConstant.OPEN.equals(isOpen)){ + limitMapper.updateLimitById(BigDecimal.valueOf(3560.000),BigDecimal.valueOf(0.000),limit.getId()); + }else{ + limitMapper.updateLimitById(BigDecimal.ZERO,BigDecimal.ZERO,limit.getId()); + } + }else if(WriteRealDataConstant.OPENING_DEGREE.equals(signage)){ + if(WriteRealDataConstant.OPEN.equals(isOpen)){ + limitMapper.updateLimitById(BigDecimal.valueOf(10),BigDecimal.valueOf(0.000),limit.getId()); + }else{ + limitMapper.updateLimitById(BigDecimal.ZERO,BigDecimal.ZERO,limit.getId()); + } + } + }); + return true; + } +} \ No newline at end of file diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/DataConstants.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/DataConstants.java new file mode 100644 index 0000000..a4873df --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/DataConstants.java @@ -0,0 +1,357 @@ +package com.hnac.hzims.simulate.util; + +public interface DataConstants { + String REDIS_MESSAGE_TOPIC = "hzinfo_config_message_topic"; + String TIME_COLUMN = "ts"; + String VALUE_COLUMN = "val"; + String Q_COLUMN = "q"; + String REAL_ID_COLUMN = "realid"; + String TBNAME = "tbname"; + String YC_TABLE_PREFIX = "yc_"; + String YX_TABLE_PREFIX = "yx_"; + String SOE_TABLE_PREFIX = "soe_"; + String SOE_ALARM_TABLE_PREFIX = "soe_alarm_"; + String YC = "YC"; + String YX = "YX"; + String SOE = "SOE"; + String YK_RETURN_PREFIX = "ykfj:"; + String REALID_CALCULATE = "16777215"; + String DEVICE_SUPER_TABLE_PREFIX = "hz_"; + String DEVICE_TABLE_PREFIX = "d_"; + + public static enum DataStructTypeEnum { + struct, + dataGroup; + + private DataStructTypeEnum() { + } + } + + public static enum EYkRetStatus { + yrsSuccess, + yrsServerErr, + yrsChannelErr, + yrsModuleErr, + yrsDeviceTimeOut, + yrsDeviceFail, + yrsExpired; + + private EYkRetStatus() { + } + } + + public static enum SoeType { + skNone(0, "0", "默认"), + skSys(1, "1", "系统"), + skAlarm(2, "2", "报警"), + skAct(3, "3", "事故"), + skOperate(4, "4", "用户操作"), + skYcOut(5, "5,11,12", "遥测越限"), + skYxChange(6, "6,10", "遥信变位"), + skReg(7, "7", "注册信息"), + skHint(8, "8", "信息提示"), + skInspect(9, "9", "设备巡检"), + skMonitorOperate(10, "13,14", "遥控操作"), + skRDSYcOutOfLimitResume(11, "15", "遥测越限恢复"), + skUndefine(12, "16,17,18", "未定义"), + skNetworkAnomaly(13, "-1", "通讯异常"), + skCommunicateAnomaly(14, "-2", "数据异常"); + + private Integer index; + private String soeKind; + private String name; + + private SoeType(Integer index, String soeKind, String name) { + this.index = index; + this.soeKind = soeKind; + this.name = name; + } + + public static String getName(Integer id) { + SoeType[] values = values(); + + for (int i = 0; i < values.length; ++i) { + if (values[i].index.equals(id)) { + return values[i].getName(); + } + } + + return null; + } + + public static Integer getIndexBySoeKind(String soeType) { + SoeType[] values = values(); + SoeType[] var2 = values; + int var3 = values.length; + + for (int var4 = 0; var4 < var3; ++var4) { + SoeType type = var2[var4]; + if (type.getSoeKind().contains(soeType)) { + return type.getIndex(); + } + } + + return skUndefine.getIndex(); + } + + public static String getSoeKindByIndex(Integer index) { + SoeType[] values = values(); + SoeType[] var2 = values; + int var3 = values.length; + + for (int var4 = 0; var4 < var3; ++var4) { + SoeType type = var2[var4]; + if (type.getIndex().equals(index)) { + return type.getSoeKind(); + } + } + + return ""; + } + + public Integer getIndex() { + return this.index; + } + + public String getSoeKind() { + return this.soeKind; + } + + public String getName() { + return this.name; + } + } + + public static enum SoeKind { + skNone(0, "默认"), + skSys(1, "系统"), + skAlarm(2, "报警"), + skAct(3, "事故"), + skOperate(4, "操作"), + skYcOut(5, "遥测越限(告警)"), + skYxChange(6, "遥信变位(告警)"), + skReg(7, "注册信息"), + skHint(8, "信息提示"), + skInspect(9, "设备巡检"), + skRDSYxChange(10, "遥信变位(数据)"), + skRDSYcOutOfLimit(11, "遥测越上/下限(数据)"), + skRDSYcOutOfLimit2(12, "遥测越上上/下下限(数据)"), + skMonitorOperate(13, "操作记录(遥控)"), + skMonitorOperateII(14, "操作记录(写定值)"), + skRDSYcOutOfLimitResume(15, "越限恢复"), + bak_7(16, "备用7"), + bak_8(17, "备用8"), + skUndefine(18, "未定义"); + + private Integer index; + private String name; + + private SoeKind(Integer index, String name) { + this.index = index; + this.name = name; + } + + public static String getName(Integer id) { + SoeKind[] values = values(); + + for (int i = 0; i < values.length; ++i) { + if (values[i].index.equals(id)) { + return values[i].getName(); + } + } + + return null; + } + + public Integer getIndex() { + return this.index; + } + + public String getName() { + return this.name; + } + } + + public static enum DeviceDataType { + YC("遥测"), + YX("遥信"), + DD("电渡"), + YK("遥控"), + YT("遥调"), + SOE("事件"), + STR("字符串"), + OTHER("其它"); + + private String displayName; + + private DeviceDataType(String displayName) { + this.displayName = displayName; + } + + public static String getDisplayName(String name) { + DeviceDataType type = valueOf(name); + return type.getDisplayName(); + } + + public String getDisplayName() { + return this.displayName; + } + } + + public static enum YkDelayType { + none_store, + store, + delay_store; + + private YkDelayType() { + } + } + + public static enum RedisGroupMessageTypeEnum { + NOTICE_CLEAN_LOCAL_CACHE_DEVICE("clean.local.cache.device"), + NOTICE_CLEAN_LOCAL_CACHE_DEVICE_GROUP("clean.local.cache.group"), + NOTICE_CLEAN_LOCAL_CACHE_ALARM("clean.local.cache.alarm"), + NOTICE_CLEAN_LOCAL_CACHE_YK("clean.local.cache.yk"); + + private String value; + + private RedisGroupMessageTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return this.value; + } + } + + public static enum DataStatusEnum { + offline, + online; + + private DataStatusEnum() { + } + } + + public static enum StatisticsType { + avg("AVG"), + max("MAX"), + min("MIN"); + + private String computeStrategy; + + private StatisticsType(String fun) { + this.computeStrategy = fun; + } + + public static StatisticsType getStatisticsType(int index) { + StatisticsType[] values = values(); + StatisticsType[] var2 = values; + int var3 = values.length; + + for (int var4 = 0; var4 < var3; ++var4) { + StatisticsType value = var2[var4]; + if (index == value.ordinal()) { + return value; + } + } + + return null; + } + + public String getComputeStrategy() { + return this.computeStrategy; + } + + public void setComputeStrategy(final String computeStrategy) { + this.computeStrategy = computeStrategy; + } + } + + public static enum AnalyzeInstanceAlarmConfType { + changeAlarm("变化告警"), + supassAlarm("越限告警"); + + private String name; + + private AnalyzeInstanceAlarmConfType(String name) { + this.name = name; + } + + public String getName() { + return this.name; + } + } + + public static enum StatisticsAnalyEnum { + Hour("h"), + Day("d"), + Month("n"), + Year("h"); + + private String type; + + private StatisticsAnalyEnum(String fun) { + this.type = fun; + } + + public static StatisticsAnalyEnum getStatisticsAnalyEnum(int index) { + StatisticsAnalyEnum[] values = values(); + StatisticsAnalyEnum[] var2 = values; + int var3 = values.length; + + for (int var4 = 0; var4 < var3; ++var4) { + StatisticsAnalyEnum value = var2[var4]; + if (value.ordinal() == index) { + return value; + } + } + + return null; + } + + public String getType() { + return this.type; + } + } + + public static enum StationFromSouceEnum { + cloud, + station; + + private StationFromSouceEnum() { + } + } + + public static enum AnalyzeInstanceDataResoureEnum { + deviceUp("设备上报"), + hz3000Up("华自网关上报"); + + private String name; + + private AnalyzeInstanceDataResoureEnum(String name) { + this.name = name; + } + + public String getName() { + return this.name; + } + } + + public static enum ThresholdLevelEnum { + one, + two, + three; + + private ThresholdLevelEnum() { + } + } + + public static enum Hz3000VersionEnum { + v3, + v4; + + private Hz3000VersionEnum() { + } + } + +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/ParseFacUtils.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/ParseFacUtils.java new file mode 100644 index 0000000..34d7437 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/ParseFacUtils.java @@ -0,0 +1,105 @@ +package com.hnac.hzims.simulate.util; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.google.common.collect.Lists; +import com.hnac.hzims.simulate.entity.DataItem; +import com.hnac.hzims.simulate.entity.DataModel; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; +import org.xml.sax.SAXException; + +import java.io.InputStream; +import java.math.BigInteger; +import java.util.List; + +/** + * 解析厂信息工具类 + * @author ninglong + */ +public class ParseFacUtils { + + public static List parsePoint(InputStream inputStream) throws SAXException, DocumentException, JsonProcessingException { + SAXReader saxReader = new SAXReader(); + Document document = saxReader.read(inputStream); + List groupElements = document.selectNodes("/Factorys/Factory/Group"); + List list = parseDataGroup(groupElements); + List ycElements = document.selectNodes("/Factorys/Factory/Group/AIS/AI"); + list = pastePointElement(ycElements, DataConstants.DeviceDataType.YC.name(),list); + + List yxElements = document.selectNodes("/Factorys/Factory/Group/DIS/DI"); + list = pastePointElement(yxElements, DataConstants.DeviceDataType.YX.name(),list); + + List ddElements = document.selectNodes("/Factorys/Factory/Group/DDS/DD"); + list = pastePointElement(ddElements, DataConstants.DeviceDataType.DD.name(),list); + + List soeElements = document.selectNodes("/Factorys/Factory/Group/SOES/SOE"); + list = pastePointElement(soeElements, DataConstants.DeviceDataType.SOE.name(),list); + + List ykElements = document.selectNodes("/Factorys/Factory/Group/DOS/DO"); + list = pastePointElement(ykElements, DataConstants.DeviceDataType.YK.name(),list); + return list; + } + + /** + * 解析数据组 + */ + private static List parseDataGroup(List elements){ + List list = Lists.newArrayList(); + for (Element element : (List) elements) { + DataModel model = new DataModel(); + model.setStructType(DataConstants.DataStructTypeEnum.dataGroup.name()); + model.setId(element.attribute("ID").getValue()); + model.setSignage(bigId2SmallId(element.attribute("ID").getValue())); + model.setName(element.attribute("Name").getValue()); + String stationNumStr = element.getParent().attribute("StationNum").getValue(); + model.setStation(stationNumStr); + list.add(model); + } + return list; + } + + /** + * 将大id转换成小id + */ + public static String bigId2SmallId(String realId){ + BigInteger bigRealId = new BigInteger(realId); + return bigRealId.and(new BigInteger(DataConstants.REALID_CALCULATE)).toString(); + } + /** + * 解析数据点 + */ + private static List pastePointElement(List elements, String type, List list) throws JsonProcessingException { + for (Element element : (List) elements) { + String groupId = element.getParent().getParent().attribute("ID").getValue(); + for(DataModel dm:list){ + if(!groupId.equals(dm.getId())){ + continue; + } + DataItem dataItem = DataItem.builder() + .id(element.attribute("ID").getValue()) + .signage(bigId2SmallId(element.attribute("ID").getValue())) + .name(element.attribute("Name").getValue()) + .type(type) + .build(); + if(DataConstants.DeviceDataType.SOE.name().equals(type)){ + dataItem.setEventType(element.attribute("SOEAlarmType").getValue()); + dataItem.setSoeType(element.attribute("SOEType").getValue()); + } + if(DataConstants.DeviceDataType.YX.name().equals(type)){ + dataItem.setEventType(element.attribute("YXAlarmType").getValue()); + dataItem.setSoeType(element.attribute("SOEType").getValue()); + } + List childrens = dm.getChildren(); + if(childrens==null){ + childrens = Lists.newArrayList(); + } + childrens.add(dataItem); + dm.setChildren(childrens); + } + } + return list; + } +} + diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/RealIdConvertUtils.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/RealIdConvertUtils.java new file mode 100644 index 0000000..f5d3282 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/RealIdConvertUtils.java @@ -0,0 +1,52 @@ +package com.hnac.hzims.simulate.util; + + +import java.math.BigInteger; + +public class RealIdConvertUtils { + + private void demo() { + BigInteger ss = new BigInteger("16777215"); + BigInteger s = new BigInteger("15122982502953650999"); + BigInteger stationId = s.shiftRight(24); + System.out.println(stationId.toString()); + BigInteger realId = s.and(ss); + System.out.println(realId.toString()); + + BigInteger xxx = stationId.shiftLeft(24); + BigInteger yyy = xxx.or(realId); + System.out.println(s.toString()); + System.out.println(yyy.toString()); + } + + /** + * 将大id转换成小id + */ + public static String bigId2SmallId(String realId) { + BigInteger bigRealId = new BigInteger(realId); + return bigRealId.and(new BigInteger(DataConstants.REALID_CALCULATE)).toString(); + } + + /** + * 将小id转换成大id + */ + public static String smallId2BigId(String station, String realId) { + BigInteger stationId = new BigInteger(station); + BigInteger BigRealId = stationId.shiftLeft(24).or(new BigInteger(realId)); + return BigRealId.toString(); + } + +// public static void main(String[] args) { +// System.out.println(RealIdConvertUtils.getStationId("262952509021093892")); +// System.out.println(RealIdConvertUtils.bigId2SmallId("262952509021093892")); +// System.out.println(smallId2BigId("15673190893", "32")); +// } + + /** + * 获取站点id + */ + public static String getStationId(String realId) { + BigInteger bigRealId = new BigInteger(realId); + return bigRealId.shiftRight(24).toString(); + } +} diff --git a/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/TopicConstant.java b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/TopicConstant.java new file mode 100644 index 0000000..1d4a8ca --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/java/com/hnac/hzims/simulate/util/TopicConstant.java @@ -0,0 +1,18 @@ +package com.hnac.hzims.simulate.util; + +public interface TopicConstant { + String TOPIC_DEVICE_MODEL = "topic_device_model"; + String TOPIC_HZINFO_PROPS = "topic_hzinfo_props"; + String TOPIC_HZINFO_V4_YC = "hzinfo_v4_yc"; + + String TOPIC_HZINFO_V4_YX = "hzinfo_v4_yx"; + + String TOPIC_HZINFO_YX = "topic_hzinfo_yx"; + String TOPIC_HZINFO_DD = "topic_hzinfo_dd"; + String TOPIC_HZINFO_EVENTS = "topic_hzinfo_events"; + String TOPIC_HZINFO_EVENTS_ALARM = "topic_hzinfo_events_alarm"; + String TOPIC_HZINFO_CONTROL_RETURN = "topic_hzinfo_control_return"; + String TOPIC_HZINFO_HEART_BEAT = "topic_hzinfo_heart_beat"; + String TOPIC_HZINFO_BROADCAST = "topic_hzinfo_broadcast"; + String TOPIC_HZINFO_DATA = "topic_hzinfo_data"; +} diff --git a/hzims-service/hzims-simulate/src/main/resources/application-dev.yml b/hzims-service/hzims-simulate/src/main/resources/application-dev.yml new file mode 100644 index 0000000..0abb9d3 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/resources/application-dev.yml @@ -0,0 +1,13 @@ +#服务器端口 +server: + port: 8211 + +#数据源配置 +spring: + datasource: + url: ${blade.datasource.dev.url} + username: ${blade.datasource.dev.username} + password: ${blade.datasource.dev.password} + cloud: + inetutils: + preferred-networks: 192.168.65 diff --git a/hzims-service/hzims-simulate/src/main/resources/application-prod.yml b/hzims-service/hzims-simulate/src/main/resources/application-prod.yml new file mode 100644 index 0000000..a96da50 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/resources/application-prod.yml @@ -0,0 +1,6 @@ +#数据源配置 +spring: + datasource: + url: ${blade.datasource.prod.url} + username: ${blade.datasource.prod.username} + password: ${blade.datasource.prod.password} \ No newline at end of file diff --git a/hzims-service/hzims-simulate/src/main/resources/application.yml b/hzims-service/hzims-simulate/src/main/resources/application.yml new file mode 100644 index 0000000..61e8ff7 --- /dev/null +++ b/hzims-service/hzims-simulate/src/main/resources/application.yml @@ -0,0 +1,15 @@ +spring: + application: + name: lewa-simulate + +#mybatis-plus配置 +mybatis-plus: + mapper-locations: classpath:org/springbalde/**/mapper/*Mapper.xml,classpath:com/hnac/hzinfo/**/mapper/*Mapper.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: org.springbalde.**.entity,com.hnac.hzinfo.**.entity + +#swagger扫描路径配置 +swagger: + base-packages: + - org.springbalde + - com.hnac.hzinfo \ No newline at end of file diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/HikVideoController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/HikVideoController.java index 4dc814a..bba9770 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/HikVideoController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/HikVideoController.java @@ -28,8 +28,8 @@ public class HikVideoController extends BladeController { @ApiOperation("查询区域列表") @ApiOperationSupport(order = 1) @GetMapping("/nodesByParams") - public R> nodesByParams(@ApiParam("区域父级编号")@RequestParam(required = false) String parentIndexCode) { - return R.data(hikVideoService.nodesByParams(parentIndexCode)); + public R> nodesByParams(@RequestParam(value = "platformId",required = false) Long platformId,@ApiParam("区域父级编号")@RequestParam(value = "parentIndexCode",required = false) String parentIndexCode) { + return R.data(hikVideoService.nodesByParams(platformId,parentIndexCode)); } @ApiOperation("根据区域获取下级编码设备列表") diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java index e048147..3639cb9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java @@ -319,8 +319,8 @@ public class StationVideoTypeController extends BladeController { @GetMapping("/getHikVideoAreaTree") @ApiOperationSupport(order = 150) @ApiOperation(value = "获取海康区域树", notes = "获取海康区域树") - public R> getHikVideoAreaTree() { - return R.data(stationVideoTypeService.getHikVideoAreaTree()); + public R> getHikVideoAreaTree(@RequestParam(value = "platformId",required = false)Long platformId) { + return R.data(stationVideoTypeService.getHikVideoAreaTree(platformId)); } @GetMapping("/getVideoPointByRegion") diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IHikVideoService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IHikVideoService.java index 48d874b..e680dcd 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IHikVideoService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IHikVideoService.java @@ -15,7 +15,7 @@ public interface IHikVideoService { * 查询区域列表 * @return 区域列表 */ - List nodesByParams(String parentIndexCode); + List nodesByParams(Long platformId,String parentIndexCode); List subResources(String regionIndexCode); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java index 24da4a6..f008b57 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java @@ -77,7 +77,7 @@ public interface IStationVideoTypeService extends BaseService getWsUrlByPointCode(String pointCodes,String host,String appKey,String appSecret,Integer streamType); - List getHikVideoAreaTree(); + List getHikVideoAreaTree(Long platformId); Map getVideoPointByRegion(Long refDept,String regionCode); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/HikVideoServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/HikVideoServiceImpl.java index 3c8795f..f3fd0ea 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/HikVideoServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/HikVideoServiceImpl.java @@ -7,15 +7,20 @@ import com.hikvision.artemis.sdk.ArtemisHttpUtil; import com.hikvision.artemis.sdk.config.ArtemisConfig; import com.hnac.hzims.operational.station.service.IHikVideoService; import com.hnac.hzims.operational.station.vo.HikVideoAreaVO; +import com.hnac.hzims.operational.video.entity.VideoPlatformEntity; +import com.hnac.hzims.operational.video.service.IVideoPlatformService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.Assert; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -27,6 +32,8 @@ import static com.hnac.hzims.operational.station.constants.HikApiConstants.*; @Service public class HikVideoServiceImpl implements IHikVideoService { + private final IVideoPlatformService videoPlatformService; + @Value("${hzims.videoProperties.appKey}") private String videoAppKey; @@ -53,8 +60,20 @@ public class HikVideoServiceImpl implements IHikVideoService { } @Override - public List nodesByParams(String parentIndexCode) { - init(); + public List nodesByParams(Long platformId,String parentIndexCode) { + if(ObjectUtil.isEmpty(platformId)){ + init(); + }else{ + // 查询多平台配置 + VideoPlatformEntity platform = videoPlatformService.getById(platformId); + if(ObjectUtil.isEmpty(platform)){ + return new ArrayList<>(); + } + ArtemisConfig.host = platform.getVideoHost(); + ArtemisConfig.appKey = platform.getAppKey(); + ArtemisConfig.appSecret = platform.getAppSecret(); + } + Map path = new HashMap<>(); path.put("https://", ARTEMIS_PATH + NODE_BY_PARAMS); HashMap body = new HashMap() {{ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java index 1b96b23..94e544a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java @@ -235,8 +235,8 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl getHikVideoAreaTree() { - List hikVideoAreaList = hikVideoService.nodesByParams(null); + public List getHikVideoAreaTree(Long platformId) { + List hikVideoAreaList = hikVideoService.nodesByParams(platformId,null); Map> videoAreaMapByParent = hikVideoAreaList.stream().collect(Collectors.groupingBy(HikVideoAreaVO::getParentIndexCode)); List firstLevelArea = videoAreaMapByParent.get("-1"); List result = firstLevelArea.stream().map(area -> this.generateAreaTree(videoAreaMapByParent, area)).collect(Collectors.toList()); diff --git a/hzims-service/pom.xml b/hzims-service/pom.xml index 3bd858a..8c59a54 100644 --- a/hzims-service/pom.xml +++ b/hzims-service/pom.xml @@ -29,6 +29,8 @@ hzims-alarm hzims-basic hzims-big-model + suichang + hzims-simulate diff --git a/hzims-service/spare/Dockerfile b/hzims-service/spare/Dockerfile deleted file mode 100644 index 453af19..0000000 --- a/hzims-service/spare/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM adoptopenjdk/openjdk8-openj9:alpine-slim - -MAINTAINER smallchill@163.com - -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories - -RUN apk add -U tzdata \ - && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ - && echo "Asia/Shanghai" > /etc/timezone \ - && apk add --no-cache bash bash-doc bash-completion \ - && apk del tzdata \ - && rm -rf /var/cache/apk/* - -RUN mkdir -p /blade/desk - -WORKDIR /blade/desk - -EXPOSE 8105 - -ADD ./target/blade-demo.jar ./app.jar - -ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar - -CMD ["--spring.profiles.active=test"] diff --git a/hzims-service/spare/pom.xml b/hzims-service/spare/pom.xml deleted file mode 100644 index 88c1e6d..0000000 --- a/hzims-service/spare/pom.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - com.hnac.hzims - hzims-service - 4.0.0-SNAPSHOT - - - 4.0.0 - - spare - ${project.artifactId} - ${bladex.project.version} - jar - - - - org.springblade - blade-core-boot - - - org.springblade - blade-starter-swagger - - - org.springblade - blade-starter-oss-all - - - com.hnac.hzims - spare-api - ${hzims.project.version} - - - com.baomidou - dynamic-datasource-spring-boot-starter - 2.5.6 - - - org.springblade - blade-core-test - test - - - org.springblade - blade-core-auto - provided - - - - - - com.hnac.hzinfo - common-asm-api - 0.0.1-SNAPSHOT - - - com.github.miemiedev - mybatis-paginator - - - com.sun.media - jai-codec - - - - - - - - - com.spotify - dockerfile-maven-plugin - - ${docker.username} - ${docker.password} - ${docker.registry.url}/${docker.namespace}/${project.artifactId} - ${project.version} - true - - target/${project.build.finalName}.jar - - true - - - - org.apache.maven.plugins - maven-antrun-plugin - - - - - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/SpareApplication.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/SpareApplication.java deleted file mode 100644 index a506e43..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/SpareApplication.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare; - -import org.mybatis.spring.annotation.MapperScan; -import org.springblade.core.cloud.feign.EnableBladeFeign; -import org.springblade.core.launch.BladeApplication; -import org.springblade.core.launch.constant.AppConstant; -import org.springframework.cloud.client.SpringCloudApplication; - -/** - * Demo启动器 - * - * @author Chill - */ -@EnableBladeFeign -@SpringCloudApplication -@MapperScan("com.hnac.hzims.spare.**.mapper.**") -public class SpareApplication { - - public static void main(String[] args) { - BladeApplication.run("hzims-spare", SpareApplication.class, args); - } - -} - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/config/DemoConfiguration.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/config/DemoConfiguration.java deleted file mode 100644 index 8768e01..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/config/DemoConfiguration.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare.config; - - -import com.hnac.hzims.spare.props.DemoProperties; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.cloud.openfeign.EnableFeignClients; -import org.springframework.context.annotation.Configuration; - -/** - * 配置feign、mybatis包名、properties - * - * @author Chill - */ -@Configuration -@EnableFeignClients({"org.springblade", "com.example"}) -@MapperScan({"org.springblade.**.mapper.**", "com.example.**.mapper.**"}) -@EnableConfigurationProperties(DemoProperties.class) -public class DemoConfiguration { - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/DemoController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/DemoController.java deleted file mode 100644 index 46812d9..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/DemoController.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare.controller; - -import com.hnac.hzims.spare.props.DemoProperties; -import io.swagger.annotations.Api; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.cloud.context.config.annotation.RefreshScope; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * Demo控制器 - * - * @author Chill - */ -@RefreshScope -@RestController -@RequestMapping("demo") -@Api(value = "配置接口", tags = "即时刷新配置") -public class DemoController { - - @Value("${demo.name}") - private String name; - - private final DemoProperties properties; - - public DemoController(DemoProperties properties) { - this.properties = properties; - } - - - @GetMapping("name") - public String getName() { - return name; - } - - @GetMapping("name-by-props") - public String getNameByProps() { - return properties.getName(); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/DynamicController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/DynamicController.java deleted file mode 100644 index 2b7e8db..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/DynamicController.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare.controller; - -import com.hnac.hzims.spare.entity.Notice; -import com.hnac.hzims.spare.service.IDynamicService; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.AllArgsConstructor; -import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** - * 多数据源 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping("dynamic") -@Api(value = "多数据源接口", tags = "多数据源") -public class DynamicController { - - private final IDynamicService dynamicService; - - /** - * master列表 - */ - @GetMapping("/master-list") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "master列表", notes = "master列表") - public R> masterList() { - List list = dynamicService.masterList(); - return R.data(list); - } - - /** - * slave列表 - */ - @GetMapping("/slave-list") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "slave列表", notes = "slave列表") - public R> slaveList() { - List list = dynamicService.slaveList(); - return R.data(list); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpChangeDetailController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpChangeDetailController.java deleted file mode 100644 index c159e2a..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpChangeDetailController.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.hnac.hzims.spare.controller; - -import com.hnac.hzims.spare.service.IHzimsSpChangeDetailService; -import io.swagger.annotations.Api; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - - -/** - * 备品备件出入库详情 控制器 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping("/hzims-spare/spChangeDetail") -@Api(value = "备品备件出入库详情", tags = "备品备件出入库详情") -public class HzimsSpChangeDetailController extends BladeController { - - private final IHzimsSpChangeDetailService spChangeDetailService; -/* - *//** - * 详情 - *//* - @GetMapping("/detail") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "详情", notes = "传入spChangeDetail") - public R detail(HzimsSpChangeDetailEntity spChangeDetail) { - HzimsSpChangeDetailEntity detail = spChangeDetailService.getOne(Condition.getQueryWrapper(spChangeDetail)); - return R.data(detail); - } - - *//** - * 分页 代码自定义代号 - *//* - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @ApiOperation(value = "分页", notes = "传入spChangeDetail") - public R> list(HzimsSpChangeDetailEntity spChangeDetail, Query query) { - IPage pages = spChangeDetailService.page(Condition.getPage(query), Condition.getQueryWrapper(spChangeDetail)); - return R.data(pages); - } - - *//** - * 新增 代码自定义代号 - *//* - @PostMapping("/save") - @ApiOperationSupport(order = 4) - @ApiOperation(value = "新增", notes = "传入spChangeDetail") - public R save(@Valid @RequestBody HzimsSpChangeDetailEntity spChangeDetail) { - return R.status(spChangeDetailService.save(spChangeDetail)); - } - - *//** - * 修改 代码自定义代号 - *//* - @PostMapping("/update") - @ApiOperationSupport(order = 5) - @ApiOperation(value = "修改", notes = "传入spChangeDetail") - public R update(@Valid @RequestBody HzimsSpChangeDetailEntity spChangeDetail) { - return R.status(spChangeDetailService.updateById(spChangeDetail)); - } - - *//** - * 新增或修改 代码自定义代号 - *//* - @PostMapping("/submit") - @ApiOperationSupport(order = 6) - @ApiOperation(value = "新增或修改", notes = "传入spChangeDetail") - public R submit(@Valid @RequestBody HzimsSpChangeDetailEntity spChangeDetail) { - return R.status(spChangeDetailService.saveOrUpdate(spChangeDetail)); - } - - - *//** - * 删除 代码自定义代号 - *//* - @PostMapping("/remove") - @ApiOperationSupport(order = 7) - @ApiOperation(value = "逻辑删除", notes = "传入ids") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(spChangeDetailService.deleteLogic(Func.toLongList(ids))); - }*/ - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpChangeRecController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpChangeRecController.java deleted file mode 100644 index 7116021..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpChangeRecController.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.hnac.hzims.spare.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.github.xiaoymin.knife4j.annotations.ApiSort; -import com.hnac.hzims.spare.entity.HzimsSpChangeRecEntity; -import com.hnac.hzims.spare.service.IHzimsSpChangeRecService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - - -/** - * 备品备件出入库 控制器 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping("/spare/spChangeRec") -@ApiSort(value = 4) -@Api(value = "备品备件出入库", tags = "备品备件出入库") -public class HzimsSpChangeRecController extends BladeController { - - private final IHzimsSpChangeRecService spChangeRecService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 3) - @ApiOperation(value = "详情", notes = "传入spChangeRec") - public R detail(HzimsSpChangeRecEntity spChangeRec) { - HzimsSpChangeRecEntity detail = spChangeRecService.getOne(Condition.getQueryWrapper(spChangeRec)); - return R.data(detail); - } - - /** - * 分页 代码自定义代号 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @ApiOperation(value = "分页", notes = "传入spChangeRec") - public R> list(HzimsSpChangeRecEntity spChangeRec, Query query) { - IPage pages = spChangeRecService.page(Condition.getPage(query), Condition.getQueryWrapper(spChangeRec)); - return R.data(pages); - } - - /** - * 新增 代码自定义代号 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "新增", notes = "传入spChangeRec") - public R save(@Valid @RequestBody HzimsSpChangeRecEntity spChangeRec) { - return R.status(spChangeRecService.save(spChangeRec)); - } - - /** - * 修改 代码自定义代号 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 11) - @ApiOperation(value = "修改", notes = "传入spChangeRec") - public R update(@Valid @RequestBody HzimsSpChangeRecEntity spChangeRec) { - return R.status(spChangeRecService.updateById(spChangeRec)); - } - - /** - * 新增或修改 代码自定义代号 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "新增或修改", notes = "传入spChangeRec") - public R submit(@Valid @RequestBody HzimsSpChangeRecEntity spChangeRec) { - return R.status(spChangeRecService.saveOrUpdate(spChangeRec)); - } - - - /** - * 删除 代码自定义代号 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 12) - @ApiOperation(value = "逻辑删除", notes = "传入ids") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(spChangeRecService.deleteLogic(Func.toLongList(ids))); - } - - - - /** - * 删除 (物理删除) - */ - @PostMapping("/removeById") - @ApiOperationSupport(order = 4) - @ApiOperation(value = "物理删除", notes = "传入id") - public R removeById(@ApiParam(value = "主键", required = true) @RequestParam Long id) { - return R.status(spChangeRecService.removeById(id)); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpFileController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpFileController.java deleted file mode 100644 index f909dff..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpFileController.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.hnac.hzims.spare.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.spare.entity.HzimsSpFileEntity; -import com.hnac.hzims.spare.service.IHzimsSpFileService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - - -/** - * 备品备件文件表 控制器 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping("/hzims-spare/spFile") -@Api(value = "备品备件文件表", tags = "备品备件文件表") -public class HzimsSpFileController extends BladeController { - - private final IHzimsSpFileService spFileService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "详情", notes = "传入spFile") - public R detail(HzimsSpFileEntity spFile) { - HzimsSpFileEntity detail = spFileService.getOne(Condition.getQueryWrapper(spFile)); - return R.data(detail); - } - - /** - * 分页 代码自定义代号 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @ApiOperation(value = "分页", notes = "传入spFile") - public R> list(HzimsSpFileEntity spFile, Query query) { - IPage pages = spFileService.page(Condition.getPage(query), Condition.getQueryWrapper(spFile)); - return R.data(pages); - } - - /** - * 新增 代码自定义代号 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 4) - @ApiOperation(value = "新增", notes = "传入spFile") - public R save(@Valid @RequestBody HzimsSpFileEntity spFile) { - return R.status(spFileService.save(spFile)); - } - - /** - * 修改 代码自定义代号 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 5) - @ApiOperation(value = "修改", notes = "传入spFile") - public R update(@Valid @RequestBody HzimsSpFileEntity spFile) { - return R.status(spFileService.updateById(spFile)); - } - - /** - * 新增或修改 代码自定义代号 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 6) - @ApiOperation(value = "新增或修改", notes = "传入spFile") - public R submit(@Valid @RequestBody HzimsSpFileEntity spFile) { - return R.status(spFileService.saveOrUpdate(spFile)); - } - - - /** - * 删除 代码自定义代号 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 7) - @ApiOperation(value = "逻辑删除", notes = "传入ids") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(spFileService.deleteLogic(Func.toLongList(ids))); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpProviderController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpProviderController.java deleted file mode 100644 index e06866e..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpProviderController.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.hnac.hzims.spare.controller; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.github.xiaoymin.knife4j.annotations.ApiSort; -import com.hnac.hzims.spare.entity.HzimsSpProviderEntity; -import com.hnac.hzims.spare.service.IHzimsSpProviderService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - - -/** - * 备品备件供应商 控制器 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping("/spare/spProvider") -@ApiSort(value = 3) -@Api(value = "备品备件供应商", tags = "备品备件供应商") -public class HzimsSpProviderController extends BladeController { - - private final IHzimsSpProviderService spProviderService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 3) - @ApiOperation(value = "详情", notes = "传入spProvider") - public R detail(HzimsSpProviderEntity spProvider) { - HzimsSpProviderEntity detail = spProviderService.getOne(Condition.getQueryWrapper(spProvider)); - return R.data(detail); - } - - /** - * 分页 代码自定义代号 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @ApiOperation(value = "分页", notes = "传入spProvider") - public R> list(HzimsSpProviderEntity spProvider, Query query) { - String name = spProvider.getName(); - String legalPerson = spProvider.getLegalPerson(); - spProvider.setName(null); - spProvider.setLegalPerson(null); - QueryWrapper queryWrapper = Condition.getQueryWrapper(spProvider); - if(StringUtils.isNotBlank(name)){ - queryWrapper.like("NAME",name); - } - if(StringUtils.isNotBlank(legalPerson)){ - queryWrapper.like("LEGAL_PERSON",legalPerson); - } - - IPage pages = spProviderService.page(Condition.getPage(query), queryWrapper); - return R.data(pages); - } - - /** - * 新增 代码自定义代号 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "新增", notes = "传入spProvider") - public R save(@Valid @RequestBody HzimsSpProviderEntity spProvider) { - return R.status(spProviderService.save(spProvider)); - } - - /** - * 修改 代码自定义代号 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 11) - @ApiOperation(value = "修改", notes = "传入spProvider") - public R update(@Valid @RequestBody HzimsSpProviderEntity spProvider) { - return R.status(spProviderService.updateById(spProvider)); - } - - /** - * 新增或修改 代码自定义代号 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "新增或修改", notes = "传入spProvider") - public R submit(@Valid @RequestBody HzimsSpProviderEntity spProvider) { - return R.status(spProviderService.saveOrUpdate(spProvider)); - } - - - /** - * 删除 代码自定义代号 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 12) - @ApiOperation(value = "逻辑删除", notes = "传入ids") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(spProviderService.deleteLogic(Func.toLongList(ids))); - } - - - - /** - * 删除 (物理删除) - */ - @PostMapping("/removeById") - @ApiOperationSupport(order = 4) - @ApiOperation(value = "物理删除", notes = "传入id") - public R removeById(@ApiParam(value = "主键", required = true) @RequestParam Long id) { - return R.status(spProviderService.removeById(id)); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpRelevanceFileController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpRelevanceFileController.java deleted file mode 100644 index 6bdb69a..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpRelevanceFileController.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.hnac.hzims.spare.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.hnac.hzims.spare.entity.HzimsSpRelevanceFileEntity; -import com.hnac.hzims.spare.service.IHzimsSpRelevanceFileService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - - -/** - * 备品备件文件关联 控制器 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping("/hzims-spare/spRelevanceFile") -@Api(value = "备品备件文件关联", tags = "备品备件文件关联") -public class HzimsSpRelevanceFileController extends BladeController { - - private final IHzimsSpRelevanceFileService spRelevanceFileService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "详情", notes = "传入spRelevanceFile") - public R detail(HzimsSpRelevanceFileEntity spRelevanceFile) { - HzimsSpRelevanceFileEntity detail = spRelevanceFileService.getOne(Condition.getQueryWrapper(spRelevanceFile)); - return R.data(detail); - } - - /** - * 分页 代码自定义代号 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @ApiOperation(value = "分页", notes = "传入spRelevanceFile") - public R> list(HzimsSpRelevanceFileEntity spRelevanceFile, Query query) { - IPage pages = spRelevanceFileService.page(Condition.getPage(query), Condition.getQueryWrapper(spRelevanceFile)); - return R.data(pages); - } - - /** - * 新增 代码自定义代号 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 4) - @ApiOperation(value = "新增", notes = "传入spRelevanceFile") - public R save(@Valid @RequestBody HzimsSpRelevanceFileEntity spRelevanceFile) { - return R.status(spRelevanceFileService.save(spRelevanceFile)); - } - - /** - * 修改 代码自定义代号 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 5) - @ApiOperation(value = "修改", notes = "传入spRelevanceFile") - public R update(@Valid @RequestBody HzimsSpRelevanceFileEntity spRelevanceFile) { - return R.status(spRelevanceFileService.updateById(spRelevanceFile)); - } - - /** - * 新增或修改 代码自定义代号 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 6) - @ApiOperation(value = "新增或修改", notes = "传入spRelevanceFile") - public R submit(@Valid @RequestBody HzimsSpRelevanceFileEntity spRelevanceFile) { - return R.status(spRelevanceFileService.saveOrUpdate(spRelevanceFile)); - } - - - /** - * 删除 代码自定义代号 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 7) - @ApiOperation(value = "逻辑删除", notes = "传入ids") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(spRelevanceFileService.deleteLogic(Func.toLongList(ids))); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpTypeController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpTypeController.java deleted file mode 100644 index e56573e..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpTypeController.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.hnac.hzims.spare.controller; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.github.xiaoymin.knife4j.annotations.ApiSort; -import com.hnac.hzims.spare.entity.HzimsSpTypeEntity; -import com.hnac.hzims.spare.service.IHzimsSpTypeService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - - -/** - * 备品备件类型 控制器 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping("/spare/spType") -@ApiSort(value = 1) -@Api(value = "备品备件类型", tags = "备品备件类型") -public class HzimsSpTypeController extends BladeController { - - @Autowired - private IHzimsSpTypeService spTypeService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 3) - @ApiOperation(value = "详情", notes = "传入spType") - public R detail(@ApiParam(value = "主键", required = true) @RequestParam Long id) { - HzimsSpTypeEntity spType = new HzimsSpTypeEntity(); - spType.setId(id); - HzimsSpTypeEntity detail = spTypeService.getOne(Condition.getQueryWrapper(spType)); - return R.data(detail); - } - - /** - * 分页 代码自定义代号 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @ApiOperation(value = "分页", notes = "传入spType") - public R> list(HzimsSpTypeEntity spType, Query query) { - /*QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.like("NAME",spType.getName()); - IPage pages = spTypeService.page(Condition.getPage(query), queryWrapper);*/ - String name = spType.getName(); - spType.setName(null); - QueryWrapper queryWrapper = Condition.getQueryWrapper(spType); - if(StringUtils.isNotBlank(name)){ - queryWrapper.like("NAME",name); - } - - IPage pages = spTypeService.page(Condition.getPage(query), queryWrapper); - return R.data(pages); - } - - /** - * 新增 代码自定义代号 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "新增", notes = "传入spType") - public R save(@Valid @RequestBody HzimsSpTypeEntity spType) { - return R.status(spTypeService.save(spType)); - } - - /** - * 修改 代码自定义代号 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 11) - @ApiOperation(value = "修改", notes = "传入spType") - public R update(@Valid @RequestBody HzimsSpTypeEntity spType) { - return R.status(spTypeService.updateById(spType)); - } - - /** - * 新增或修改 代码自定义代号 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "新增或修改", notes = "传入spType") - public R submit(@Valid @RequestBody HzimsSpTypeEntity spType) { - return R.status(spTypeService.saveOrUpdate(spType)); - } - - - /** - * 删除 代码自定义代号 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 12) - @ApiOperation(value = "逻辑删除", notes = "传入ids") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(spTypeService.deleteLogic(Func.toLongList(ids))); - } - - - - /** - * 删除 (物理删除) - */ - @PostMapping("/removeById") - @ApiOperationSupport(order = 4) - @ApiOperation(value = "物理删除", notes = "传入id") - public R removeById(@ApiParam(value = "主键", required = true) @RequestParam Long id) { - return R.status(spTypeService.removeById(id)); - } - - /** - * 获取所有备品备件树 - */ - @ApiOperation(value = "获取所有备品备件树", httpMethod = "GET") - @GetMapping("/getAllSpTypeTree") - @ApiOperationSupport(order = 5) - @ResponseBody - public R getEquipmentTypeTree(){ - return R.data(spTypeService.getSpTypeTree()); - } - - /** - * 获取所有备品类型(不分页) - */ - @ApiOperation(value = "获取所有备品备件(不分页)", httpMethod = "GET") - @GetMapping("/getList") - @ApiOperationSupport(order = 6) - @ResponseBody - public R> getList(){ - List list = spTypeService.getList(); - return R.data(list); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpWareRelatedController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpWareRelatedController.java deleted file mode 100644 index 3c6e9e1..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpWareRelatedController.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.hnac.hzims.spare.controller; - -import com.hnac.hzims.spare.service.IHzimsSpWareRelatedService; -import io.swagger.annotations.Api; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - - -/** - * 备品备件仓库备件关联表 控制器 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping("/hzims-spare/spWareRelated") -@Api(value = "备品备件仓库备件关联表", tags = "备品备件仓库备件关联表") -public class HzimsSpWareRelatedController extends BladeController { - - private final IHzimsSpWareRelatedService spWareRelatedService; -/* - *//** - * 详情 - *//* - @GetMapping("/detail") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "详情", notes = "传入spWareRelated") - public R detail(HzimsSpWareRelatedEntity spWareRelated) { - HzimsSpWareRelatedEntity detail = spWareRelatedService.getOne(Condition.getQueryWrapper(spWareRelated)); - return R.data(detail); - } - - *//** - * 分页 代码自定义代号 - *//* - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @ApiOperation(value = "分页", notes = "传入spWareRelated") - public R> list(HzimsSpWareRelatedEntity spWareRelated, Query query) { - IPage pages = spWareRelatedService.page(Condition.getPage(query), Condition.getQueryWrapper(spWareRelated)); - return R.data(pages); - } - - *//** - * 新增 代码自定义代号 - *//* - @PostMapping("/save") - @ApiOperationSupport(order = 4) - @ApiOperation(value = "新增", notes = "传入spWareRelated") - public R save(@Valid @RequestBody HzimsSpWareRelatedEntity spWareRelated) { - return R.status(spWareRelatedService.save(spWareRelated)); - } - - *//** - * 修改 代码自定义代号 - *//* - @PostMapping("/update") - @ApiOperationSupport(order = 5) - @ApiOperation(value = "修改", notes = "传入spWareRelated") - public R update(@Valid @RequestBody HzimsSpWareRelatedEntity spWareRelated) { - return R.status(spWareRelatedService.updateById(spWareRelated)); - } - - *//** - * 新增或修改 代码自定义代号 - *//* - @PostMapping("/submit") - @ApiOperationSupport(order = 6) - @ApiOperation(value = "新增或修改", notes = "传入spWareRelated") - public R submit(@Valid @RequestBody HzimsSpWareRelatedEntity spWareRelated) { - return R.status(spWareRelatedService.saveOrUpdate(spWareRelated)); - } - - - *//** - * 删除 代码自定义代号 - *//* - @PostMapping("/remove") - @ApiOperationSupport(order = 7) - @ApiOperation(value = "逻辑删除", notes = "传入ids") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(spWareRelatedService.deleteLogic(Func.toLongList(ids))); - }*/ - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpWarehouseController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpWarehouseController.java deleted file mode 100644 index d5632e2..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSpWarehouseController.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.hnac.hzims.spare.controller; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.github.xiaoymin.knife4j.annotations.ApiSort; -import com.hnac.hzims.spare.entity.HzimsSpWarehouseEntity; -import com.hnac.hzims.spare.service.IHzimsSpWarehouseService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.apache.commons.lang3.StringUtils; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - - -/** - * 备品备件仓库 控制器 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping("/spare/spWarehouse") -@ApiSort(value = 4) -@Api(value = "备品备件仓库", tags = "备品备件仓库") -public class HzimsSpWarehouseController extends BladeController { - - private final IHzimsSpWarehouseService spWarehouseService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 3) - @ApiOperation(value = "详情", notes = "传入spWarehouse") - public R detail(HzimsSpWarehouseEntity spWarehouse) { - HzimsSpWarehouseEntity detail = spWarehouseService.getOne(Condition.getQueryWrapper(spWarehouse)); - return R.data(detail); - } - - /** - * 分页 代码自定义代号 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @ApiOperation(value = "分页", notes = "传入spWarehouse") - public R> list(HzimsSpWarehouseEntity spWarehouse, Query query) { - String name = spWarehouse.getName(); - spWarehouse.setName(null); - QueryWrapper queryWrapper = Condition.getQueryWrapper(spWarehouse); - if(StringUtils.isNotBlank(name)){ - queryWrapper.like("NAME",name); - } - - IPage pages = spWarehouseService.page(Condition.getPage(query), queryWrapper); - return R.data(pages); - } - - /** - * 新增 代码自定义代号 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "新增", notes = "传入spWarehouse") - public R save(@Valid @RequestBody HzimsSpWarehouseEntity spWarehouse) { - return R.status(spWarehouseService.save(spWarehouse)); - } - - /** - * 修改 代码自定义代号 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 11) - @ApiOperation(value = "修改", notes = "传入spWarehouse") - public R update(@Valid @RequestBody HzimsSpWarehouseEntity spWarehouse) { - return R.status(spWarehouseService.updateById(spWarehouse)); - } - - /** - * 新增或修改 代码自定义代号 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "新增或修改", notes = "传入spWarehouse") - public R submit(@Valid @RequestBody HzimsSpWarehouseEntity spWarehouse) { - return R.status(spWarehouseService.saveOrUpdate(spWarehouse)); - } - - - /** - * 删除 代码自定义代号 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 12) - @ApiOperation(value = "逻辑删除", notes = "传入ids") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(spWarehouseService.deleteLogic(Func.toLongList(ids))); - } - - - - /** - * 删除 (物理删除) - */ - @PostMapping("/removeById") - @ApiOperationSupport(order = 4) - @ApiOperation(value = "物理删除", notes = "传入id") - public R removeById(@ApiParam(value = "主键", required = true) @RequestParam Long id) { - return R.status(spWarehouseService.removeById(id)); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSparePartsController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSparePartsController.java deleted file mode 100644 index 28e6bd0..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/HzimsSparePartsController.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.hnac.hzims.spare.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import com.github.xiaoymin.knife4j.annotations.ApiSort; -import com.hnac.hzims.spare.dto.HzimsSpareCountDTO; -import com.hnac.hzims.spare.entity.HzimsSparePartsEntity; -import com.hnac.hzims.spare.service.IHzimsSparePartsService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import lombok.AllArgsConstructor; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - - -/** - * 备品备件 控制器 - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping("/spare/spareParts") -@ApiSort(value = 2) -@Api(value = "备品备件", tags = "备品备件") -public class HzimsSparePartsController extends BladeController { - - private final IHzimsSparePartsService sparePartsService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 3) - @ApiOperation(value = "详情", notes = "传入spareParts") - public R detail(HzimsSparePartsEntity spareParts) { - HzimsSparePartsEntity detail = sparePartsService.getOne(Condition.getQueryWrapper(spareParts)); - return R.data(detail); - } - - /** - * 分页 代码自定义代号 - */ - @GetMapping("/list") - @ApiOperationSupport(order = 2) - @ApiOperation(value = "分页", notes = "传入spareParts") - public R> list(HzimsSparePartsEntity spareParts, Query query) { - IPage pages = sparePartsService.page(Condition.getPage(query), Condition.getQueryWrapper(spareParts)); - return R.data(pages); - } - - /** - * 新增 代码自定义代号 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 10) - @ApiOperation(value = "新增", notes = "传入spareParts") - public R save(@Valid @RequestBody HzimsSparePartsEntity spareParts) { - return R.status(sparePartsService.save(spareParts)); - } - - /** - * 修改 代码自定义代号 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 11) - @ApiOperation(value = "修改", notes = "传入spareParts") - public R update(@Valid @RequestBody HzimsSparePartsEntity spareParts) { - return R.status(sparePartsService.updateById(spareParts)); - } - - /** - * 新增或修改 代码自定义代号 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "新增或修改", notes = "传入spareParts") - public R submit(@Valid @RequestBody HzimsSparePartsEntity spareParts) { - return R.status(sparePartsService.saveOrUpdate(spareParts)); - } - - /** - * 删除 代码自定义代号 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 12) - @ApiOperation(value = "逻辑删除", notes = "传入ids") - public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { - return R.status(sparePartsService.deleteLogic(Func.toLongList(ids))); - } - - - - /** - * 删除 (物理删除) - */ - @PostMapping("/removeById") - @ApiOperationSupport(order = 4) - @ApiOperation(value = "物理删除", notes = "传入id") - public R removeById(@ApiParam(value = "主键", required = true) @RequestParam Long id) { - return R.status(sparePartsService.removeById(id)); - } - - /** - * 查询备件统计信息 - */ - @GetMapping("/selectSpareParts") - @ApiOperationSupport(order = 5) - @ApiOperation(value = "查询备件统计信息", notes = "传入spareParts") - public R> selectSpareParts(Query query,HzimsSparePartsEntity spareParts,String date) { - R> pages = sparePartsService.pageDTO(spareParts, query,date); - //List list = sparePartsService.selectSpareParts(typeId,date); - return pages; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/NoticeController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/NoticeController.java deleted file mode 100644 index b4f39e3..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/NoticeController.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.spare.entity.Notice; -import com.hnac.hzims.spare.service.INoticeService; -import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; -import io.swagger.annotations.*; -import lombok.AllArgsConstructor; -import com.hnac.hzims.common.cache.CacheNames; -import org.springblade.core.boot.ctrl.BladeController; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springblade.core.tool.utils.Func; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import java.util.Map; - -/** - * 控制器 - * - * @author Chill - */ -@RestController -@RequestMapping("notice") -@AllArgsConstructor -@Api(value = "用户博客", tags = "博客接口") -public class NoticeController extends BladeController implements CacheNames { - - private final INoticeService noticeService; - - /** - * 详情 - */ - @GetMapping("/detail") - @ApiOperationSupport(order = 1) - @ApiOperation(value = "详情", notes = "传入notice") - public R detail(Notice notice) { - Notice detail = noticeService.getOne(Condition.getQueryWrapper(notice)); - return R.data(detail); - } - - /** - * 分页 - */ - @GetMapping("/list") - @ApiImplicitParams({ - @ApiImplicitParam(name = "category", value = "公告类型", paramType = "query", dataType = "integer"), - @ApiImplicitParam(name = "title", value = "公告标题", paramType = "query", dataType = "string") - }) - @ApiOperationSupport(order = 2) - @ApiOperation(value = "分页", notes = "传入notice") - public R> list(@ApiIgnore @RequestParam Map notice, Query query) { - IPage pages = noticeService.page(Condition.getPage(query), Condition.getQueryWrapper(notice, Notice.class)); - return R.data(pages); - } - - /** - * 新增 - */ - @PostMapping("/save") - @ApiOperationSupport(order = 3) - @ApiOperation(value = "新增", notes = "传入notice") - public R save(@RequestBody Notice notice) { - return R.status(noticeService.save(notice)); - } - - /** - * 修改 - */ - @PostMapping("/update") - @ApiOperationSupport(order = 4) - @ApiOperation(value = "修改", notes = "传入notice") - public R update(@RequestBody Notice notice) { - return R.status(noticeService.updateById(notice)); - } - - /** - * 新增或修改 - */ - @PostMapping("/submit") - @ApiOperationSupport(order = 5) - @ApiOperation(value = "新增或修改", notes = "传入notice") - public R submit(@RequestBody Notice notice) { - return R.status(noticeService.saveOrUpdate(notice)); - } - - /** - * 删除 - */ - @PostMapping("/remove") - @ApiOperationSupport(order = 6) - @ApiOperation(value = "逻辑删除", notes = "传入notice") - public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { - boolean temp = noticeService.deleteLogic(Func.toLongList(ids)); - return R.status(temp); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/UploadController.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/UploadController.java deleted file mode 100644 index 270098f..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/controller/UploadController.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.hnac.hzims.spare.controller; - -import io.swagger.annotations.Api; -import lombok.AllArgsConstructor; -import lombok.SneakyThrows; -import org.springblade.core.oss.minio.MinioTemplate; -import org.springblade.core.oss.model.BladeFile; -import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; - -/** - * UploadController - * - * @author Chill - */ -@RestController -@AllArgsConstructor -@RequestMapping("/notice/upload") -@Api(value = "对象存储接口", tags = "oss上传测试") -public class UploadController { - - private final MinioTemplate minioTemplate; - - /** - * minio上传demo - * - * @param file 上传文件 - * @return String - */ - @SneakyThrows - @PostMapping("put-object") - public R putMinioObject(@RequestParam MultipartFile file) { - BladeFile bladeFile = minioTemplate.putFile(file); - return R.data(bladeFile); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpChangeDetailDTO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpChangeDetailDTO.java deleted file mode 100644 index 4b47375..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpChangeDetailDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.dto; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpChangeDetailEntity; - -/** - * 备品备件出入库详情 模型DTO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpChangeDetailDTO extends HzimsSpChangeDetailEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpChangeRecDTO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpChangeRecDTO.java deleted file mode 100644 index f377c6b..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpChangeRecDTO.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.spare.dto; - -import com.hnac.hzims.spare.entity.HzimsSpChangeDetailEntity; -import com.hnac.hzims.spare.entity.HzimsSpChangeRecEntity; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.List; - -/** - * 备品备件出入库 模型DTO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpChangeRecDTO extends HzimsSpChangeRecEntity { - - private static final long serialVersionUID = 1L; - - /** - * 变更详情(要变更的备件名称、数量、单价等) - */ - @ApiModelProperty(value = "变更详情(要变更的备件名称、数量、单价等)") - private List details; - - @ApiModelProperty(value = "审核通过标识") - private boolean checkFlag; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpFileDTO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpFileDTO.java deleted file mode 100644 index ed1a6b8..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpFileDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.dto; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpFileEntity; - -/** - * 备品备件文件表 模型DTO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpFileDTO extends HzimsSpFileEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpProviderDTO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpProviderDTO.java deleted file mode 100644 index 8067fea..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpProviderDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.dto; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpProviderEntity; - -/** - * 备品备件供应商 模型DTO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpProviderDTO extends HzimsSpProviderEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpRelevanceFileDTO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpRelevanceFileDTO.java deleted file mode 100644 index 4b49132..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpRelevanceFileDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.dto; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpRelevanceFileEntity; - -/** - * 备品备件文件关联 模型DTO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpRelevanceFileDTO extends HzimsSpRelevanceFileEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpTypeDTO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpTypeDTO.java deleted file mode 100644 index 775a2e0..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpTypeDTO.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.hnac.hzims.spare.dto; - -import com.hnac.hzims.spare.entity.HzimsSpTypeEntity; -import com.hnac.hzims.spare.utils.TreeObject; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.util.List; - -/** - * 备品备件类型 模型DTO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpTypeDTO extends HzimsSpTypeEntity implements Serializable, TreeObject { - - private static final long serialVersionUID = 1L; - - private List children; - - /*@Override - public Long getId(){ - return super.getId(); - } - - @Override - public void setId(Long id) { - super.setId(id); - } - - @Override - public Long getParentId() { - return super.getParentId(); - } - - @Override - public void setParentId(Long parentId) { - super.setParentId(parentId); - } - - @Override - public String getName() { - return super.getName(); - } - - @Override - public void setName(String name) { - super.setName(name); - }*/ - - public List getChildren() { - return this.children; - } - - public void setChildren(List children) { - this.children = children; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpWareRelatedDTO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpWareRelatedDTO.java deleted file mode 100644 index 49d7c02..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpWareRelatedDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.dto; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpWareRelatedEntity; - -/** - * 备品备件仓库备件关联表 模型DTO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpWareRelatedDTO extends HzimsSpWareRelatedEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpWarehouseDTO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpWarehouseDTO.java deleted file mode 100644 index 04926b8..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpWarehouseDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.dto; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpWarehouseEntity; - -/** - * 备品备件仓库 模型DTO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpWarehouseDTO extends HzimsSpWarehouseEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpareCountDTO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpareCountDTO.java deleted file mode 100644 index 746393f..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSpareCountDTO.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.hnac.hzims.spare.dto; - -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * 设备统计DTO - */ -@Data -public class HzimsSpareCountDTO implements Serializable { - private static final long serialVersionUID = -5172898121198875607L; - - private Long id; - /** - * 备件编号 - */ - private String code; - /** - * 备件名称 - */ - private String name; - /** - * 规格型号 - */ - private String specification; - /** - * 类型ID - */ - private Long typeId; - /** - * 类型名称 - */ - private String typeName; - /** - * 单位 - */ - private String unit; - - /** - * 仓库名称 - */ - private String warehouseName; - /** - * 入库数量 - */ - private Long inQuantity; - /** - * 出库数量 - */ - private Long outQuantity; - /** - * 入库总价 - */ - private BigDecimal inPrice; - /** - * 出库总价 - */ - private BigDecimal outPrice; -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSparePartsDTO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSparePartsDTO.java deleted file mode 100644 index aa1cf78..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/dto/HzimsSparePartsDTO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.dto; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSparePartsEntity; - -/** - * 备品备件 模型DTO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSparePartsDTO extends HzimsSparePartsEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpChangeDetailEntity.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpChangeDetailEntity.java deleted file mode 100644 index e09275d..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpChangeDetailEntity.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.hnac.hzims.spare.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; - - -/** - * 备品备件出入库详情 实体类 - * - * @author Chill - */ -@Data -@TableName("hz_ims_sp_change_detail") -@ApiModel(value = "HzimsSpChangeDetail对象", description = "备品备件出入库详情") -public class HzimsSpChangeDetailEntity { - - private static final long serialVersionUID = 1L; - - /** - * 变更记录ID - */ - @ApiModelProperty(value = "变更记录ID") - private Long changeId; - /** - * 仓库ID - */ - @ApiModelProperty(value = "仓库ID") - private Long warehouseId; - /** - * 供应商 - */ - @ApiModelProperty(value = "供应商") - private Long provider; - /** - * 备品备件ID - */ - @ApiModelProperty(value = "备品备件ID") - private Long spId; - /** - * 备件编号 - */ - @ApiModelProperty(value = "备件编号") - private String code; - /** - * 备件名称 - */ - @ApiModelProperty(value = "备件名称") - private String name; - /** - * 规格型号 - */ - @ApiModelProperty(value = "规格型号") - private String specification; - /** - * 类型ID - */ - @ApiModelProperty(value = "类型ID") - private Long typeId; - /** - * 数量 - */ - @ApiModelProperty(value = "数量") - private Long quantity; - /** - * 单价 - */ - @ApiModelProperty(value = "单价") - private BigDecimal price; - /** - * 备注 - */ - @ApiModelProperty(value = "备注") - private String remark; - /** - * 最低储备量 - */ - @ApiModelProperty(value = "最低储备量") - private Long minStock; - /** - * 最高储备量 - */ - @ApiModelProperty(value = "最高储备量") - private Long maxStock; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpChangeRecEntity.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpChangeRecEntity.java deleted file mode 100644 index 55f143b..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpChangeRecEntity.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.hnac.hzims.spare.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import org.springblade.core.mp.base.BaseEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.Date; -import java.time.LocalDateTime; - - -/** - * 备品备件出入库 实体类 - * - * @author Chill - */ -@Data -@TableName("hz_ims_sp_change_rec") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "HzimsSpChangeRec对象", description = "备品备件出入库") -public class HzimsSpChangeRecEntity extends BaseEntity { - - private static final long serialVersionUID = 1L; - - /** - * 流程实例ID - */ - @ApiModelProperty(value = "流程实例ID") - private String flowId; - /** - * 编号 - */ - @ApiModelProperty(value = "编号") - private String code; - /** - * 变更类型(1采购,2入库,3出库...) - */ - @ApiModelProperty(value = "变更类型(1采购,2入库,3出库...)") - private Integer changeType; - /** - * 变更时间 - */ - @ApiModelProperty(value = "变更时间") - private String changeTime; - /** - * 办理意见 - */ - @ApiModelProperty(value = "办理意见") - private Long handleOpinions; - /** - * 相关单据 - */ - @ApiModelProperty(value = "相关单据") - private String relatedCode; - /** - * 备注(用途) - */ - @ApiModelProperty(value = "备注(用途)") - private String remark; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpFileEntity.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpFileEntity.java deleted file mode 100644 index 990e96a..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpFileEntity.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.hnac.hzims.spare.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import org.springblade.core.mp.base.BaseEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.Date; -import java.time.LocalDateTime; - - -/** - * 备品备件文件表 实体类 - * - * @author Chill - */ -@Data -@TableName("hz_ims_sp_file") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "HzimsSpFile对象", description = "备品备件文件表") -public class HzimsSpFileEntity extends BaseEntity { - - private static final long serialVersionUID = 1L; - - /** - * 文件类型 1:图片类型 2:视频类型 3:其他 - */ - @ApiModelProperty(value = "文件类型 1:图片类型 2:视频类型 3:其他") - private String type; - /** - * 文件名称 - */ - @ApiModelProperty(value = "文件名称") - private String name; - /** - * 文件大小 - */ - @ApiModelProperty(value = "文件大小") - private Double size; - /** - * 文件工作空间 - */ - @ApiModelProperty(value = "文件工作空间") - private String workspace; - /** - * 文件源文件 - */ - @ApiModelProperty(value = "文件源文件") - private String fileSource; - /** - * 文件缩略图 - */ - @ApiModelProperty(value = "文件缩略图") - private String fileThumbnail; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpProviderEntity.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpProviderEntity.java deleted file mode 100644 index 17ad25a..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpProviderEntity.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.hnac.hzims.spare.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import org.springblade.core.mp.base.BaseEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.Date; -import java.time.LocalDateTime; - - -/** - * 备品备件供应商 实体类 - * - * @author Chill - */ -@Data -@TableName("hz_ims_sp_provider") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "HzimsSpProvider对象", description = "备品备件供应商") -public class HzimsSpProviderEntity extends BaseEntity { - - private static final long serialVersionUID = 1L; - - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - private String name; - /** - * 名称缩写 - */ - @ApiModelProperty(value = "名称缩写") - private String logogram; - /** - * 业务联系人 - */ - @ApiModelProperty(value = "业务联系人") - private String salesman; - /** - * 法人代表 - */ - @ApiModelProperty(value = "法人代表") - private String legalPerson; - /** - * 电话 - */ - @ApiModelProperty(value = "电话") - private String phone; - /** - * 手机 - */ - @ApiModelProperty(value = "手机") - private String mobilePhone; - /** - * 网址 - */ - @ApiModelProperty(value = "网址") - private String website; - /** - * 地址 - */ - @ApiModelProperty(value = "地址") - private String address; - /** - * 是否合格(0:否,1:是) - */ - @ApiModelProperty(value = "是否合格(0:否,1:是)") - private Integer qualifiedFlag; - /** - * 备注 - */ - @ApiModelProperty(value = "备注") - private String remark; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpRelevanceFileEntity.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpRelevanceFileEntity.java deleted file mode 100644 index 21ac13d..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpRelevanceFileEntity.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.hnac.hzims.spare.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import org.springblade.core.mp.base.BaseEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.Date; -import java.time.LocalDateTime; - - -/** - * 备品备件文件关联 实体类 - * - * @author Chill - */ -@Data -@TableName("hz_ims_sp_relevance_file") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "HzimsSpRelevanceFile对象", description = "备品备件文件关联") -public class HzimsSpRelevanceFileEntity extends BaseEntity { - - private static final long serialVersionUID = 1L; - - /** - * 业务ID - */ - @ApiModelProperty(value = "业务ID") - private Long businessId; - /** - * 文件ID - */ - @ApiModelProperty(value = "文件ID") - private Long fileId; - /** - * 类型 - */ - @ApiModelProperty(value = "类型") - private String type; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpTypeEntity.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpTypeEntity.java deleted file mode 100644 index 8b1b550..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpTypeEntity.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.hnac.hzims.spare.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; - - -/** - * 备品备件类型 实体类 - * - * @author Chill - */ -@Data -@TableName("hz_ims_sp_type") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "HzimsSpType对象", description = "备品备件类型") -public class HzimsSpTypeEntity extends BaseEntity { - - private static final long serialVersionUID = 1L; - - /** - * 编码 - */ - @ApiModelProperty(value = "编码") - private String code; - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - private String name; - /** - * 单位 - */ - @ApiModelProperty(value = "单位") - private String unit; - /** - * 所属父级 - */ - @ApiModelProperty(value = "所属父级") - private Long parentId; - /** - * 排序 - */ - @ApiModelProperty(value = "排序") - private Integer sort; - /** - * 备注 - */ - @ApiModelProperty(value = "备注") - private String remark; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpWareRelatedEntity.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpWareRelatedEntity.java deleted file mode 100644 index 3b44e35..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpWareRelatedEntity.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.hnac.hzims.spare.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.math.BigDecimal; - - -/** - * 备品备件仓库备件关联表 实体类 - * - * @author Chill - */ -@Data -@TableName("hz_ims_sp_ware_related") -@ApiModel(value = "HzimsSpWareRelated对象", description = "备品备件仓库备件关联表") -public class HzimsSpWareRelatedEntity { - - private static final long serialVersionUID = 1L; - - /** - * 仓库ID - */ - @ApiModelProperty(value = "仓库ID") - private Long warehouseId; - /** - * 备品备件ID - */ - @ApiModelProperty(value = "备品备件ID") - private Long spId; - /** - * 库存 - */ - @ApiModelProperty(value = "库存") - private Long stock; - /** - * 最新入库单价 - */ - @ApiModelProperty(value = "最新入库单价") - private BigDecimal inPrice; - /** - * 最新出库单价 - */ - @ApiModelProperty(value = "最新出库单价") - private BigDecimal outPrice; - /** - * 出库暂存 - */ - @ApiModelProperty(value = "出库暂存") - private Long outStock; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpWarehouseEntity.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpWarehouseEntity.java deleted file mode 100644 index e67d65f..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSpWarehouseEntity.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.hnac.hzims.spare.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import org.springblade.core.mp.base.BaseEntity; -import lombok.Data; -import lombok.EqualsAndHashCode; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.util.Date; -import java.time.LocalDateTime; - - -/** - * 备品备件仓库 实体类 - * - * @author Chill - */ -@Data -@TableName("hz_ims_sp_warehouse") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "HzimsSpWarehouse对象", description = "备品备件仓库") -public class HzimsSpWarehouseEntity extends BaseEntity { - - private static final long serialVersionUID = 1L; - - /** - * 编码 - */ - @ApiModelProperty(value = "编码") - private String code; - /** - * 名称 - */ - @ApiModelProperty(value = "名称") - private String name; - /** - * 负责人 - */ - @ApiModelProperty(value = "负责人") - private Long manager; - /** - * 地址 - */ - @ApiModelProperty(value = "地址") - private String address; - /** - * 备注 - */ - @ApiModelProperty(value = "备注") - private String remark; - /** - * 最大存储量 - */ - @ApiModelProperty(value = "最大存储量") - private Long maxStock; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSparePartsEntity.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSparePartsEntity.java deleted file mode 100644 index f6180da..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/entity/HzimsSparePartsEntity.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.hnac.hzims.spare.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springblade.core.mp.base.BaseEntity; - -import java.math.BigDecimal; - - -/** - * 备品备件 实体类 - * - * @author Chill - */ -@Data -@TableName("hz_ims_spare_parts") -@EqualsAndHashCode(callSuper = true) -@ApiModel(value = "HzimsSpareParts对象", description = "备品备件") -public class HzimsSparePartsEntity extends BaseEntity { - - private static final long serialVersionUID = 1L; - - /** - * 备件编号 - */ - @ApiModelProperty(value = "备件编号") - private String code; - /** - * 备件名称 - */ - @ApiModelProperty(value = "备件名称") - private String name; - /** - * 规格型号 - */ - @ApiModelProperty(value = "规格型号") - private String specification; - /** - * 类型ID - */ - @ApiModelProperty(value = "类型ID") - private Long typeId; - /** - * 备注 - */ - @ApiModelProperty(value = "备注") - private String remark; - /** - * 最低储备量 - */ - @ApiModelProperty(value = "最低储备量") - private Long minStock; - /** - * 最高储备量 - */ - @ApiModelProperty(value = "最高储备量") - private Long maxStock; - /** - * 库存 - */ - @ApiModelProperty(value = "库存") - private Long stock; - /** - * 最新入库单价 - */ - @ApiModelProperty(value = "最新入库单价") - private BigDecimal inPrice; - /** - * 最新出库单价 - */ - @ApiModelProperty(value = "最新出库单价") - private BigDecimal outPrice; - /** - * 出库暂存 - */ - @ApiModelProperty(value = "出库暂存") - private Long outStock; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/enumeration/ChangeStatusEnum.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/enumeration/ChangeStatusEnum.java deleted file mode 100644 index 2037403..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/enumeration/ChangeStatusEnum.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.hnac.hzims.spare.enumeration; - -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * @author Huj - * created in 2020/03/16 9:21 - * @description - **/ -public enum ChangeStatusEnum { - - SUBMIT_PENDING(1, "待提交"), - CHECK_PENDING(2, "待审核"), - REJECT_SUBMIT_PENDING(3, "驳回待提交"), - COMPLETED(4, "已完成"); - - private static final Map DICT = Stream.of(values()) - .collect(Collectors.toMap(ChangeStatusEnum::getCode, t -> t)); - - private final Integer code; - - private final String description; - - private ChangeStatusEnum(Integer code, String description) { - this.code = code; - this.description = description; - } - - /** - * 返回编码对应的枚举实例 - * @param code - * @return - */ - public static Optional getInstance(String code) { - return Optional.ofNullable(DICT.get(Integer.parseInt(code))); - } - - public Integer getCode() { - return code; - } - - public String getDescription() { - return description; - } - - public static ChangeStatusEnum getEnumByCode(Integer code){ - for(ChangeStatusEnum thisEnum : ChangeStatusEnum.values()){ - if(thisEnum.getCode().equals(code)){ - return thisEnum; - } - } - return null; - } - - public static List> getKeyValueList(){ - List> types = new ArrayList(); - ChangeStatusEnum[] enums = values(); - Map thisMap; - for (ChangeStatusEnum thisEnum:enums){ - thisMap = new HashMap<>(); - thisMap.put("value",thisEnum.getCode()); - thisMap.put("name",thisEnum.getDescription()); - types.add(thisMap); - } - return types; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/feign/NoticeClient.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/feign/NoticeClient.java deleted file mode 100644 index 707ccd4..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/feign/NoticeClient.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare.feign; - -import com.hnac.hzims.spare.entity.Notice; -import com.hnac.hzims.spare.mapper.NoticeMapper; -import lombok.AllArgsConstructor; -import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; -import springfox.documentation.annotations.ApiIgnore; - -import java.util.List; - -/** - * Notice Feign - * - * @author Chill - */ -@ApiIgnore() -@RestController -@AllArgsConstructor -public class NoticeClient implements INoticeClient { - - private final NoticeMapper mapper; - - @Override - @GetMapping(TOP) - public R> top(Integer number) { - return R.data(mapper.topList(number)); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeDetailMapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeDetailMapper.java deleted file mode 100644 index 7f504e0..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeDetailMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hnac.hzims.spare.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.spare.entity.HzimsSpChangeDetailEntity; -import com.hnac.hzinfo.core.annotation.CommonDao; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 备品备件出入库详情 Mapper 接口 - * - * @author Chill - */ -@CommonDao -public interface HzimsSpChangeDetailMapper extends BaseMapper { - /** - * 根据变更ID 物理删除 - * @param changeId - * @return - */ - int deleteByChangeId(@Param("changeId") Long changeId); - - int insertBatch(@Param("records") List records); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeDetailMapper.xml b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeDetailMapper.xml deleted file mode 100644 index fcfcf53..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeDetailMapper.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - delete from hz_ims_sp_change_detail - where CHANGE_ID = #{changeId,jdbcType=BIGINT} - - - - insert into hz_ims_sp_change_detail (CHANGE_ID, WAREHOUSE_ID, PROVIDER, SP_ID, CODE, NAME, SPECIFICATION, TYPE_ID, - QUANTITY, PRICE, REMARK, MIN_STOCK, MAX_STOCK - ) - values - - (#{item.changeId,jdbcType=BIGINT}, #{item.warehouseId,jdbcType=BIGINT}, #{item.provider,jdbcType=BIGINT}, - #{item.spId,jdbcType=BIGINT}, #{item.code,jdbcType=VARCHAR},#{item.name,jdbcType=VARCHAR}, - #{item.specification,jdbcType=VARCHAR}, #{item.typeId,jdbcType=BIGINT}, #{item.quantity,jdbcType=BIGINT}, - #{item.price,jdbcType=DECIMAL}, - #{item.remark,jdbcType=VARCHAR}, #{item.minStock,jdbcType=BIGINT}, #{item.maxStock,jdbcType=BIGINT} - ) - - - - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeRecMapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeRecMapper.java deleted file mode 100644 index 7608daa..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeRecMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hnac.hzims.spare.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.spare.entity.HzimsSpChangeRecEntity; -import org.apache.ibatis.annotations.Param; - -/** - * 备品备件出入库 Mapper 接口 - * - * @author Chill - */ -public interface HzimsSpChangeRecMapper extends BaseMapper { - /** - * 物理删除 - * @param id - * @return - */ - int deleteByPrimaryKey(@Param("id") Long id); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeRecMapper.xml b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeRecMapper.xml deleted file mode 100644 index d3d6a99..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpChangeRecMapper.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - delete from hz_ims_sp_change_rec - where ID = #{id,jdbcType=BIGINT} - - - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpFileMapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpFileMapper.java deleted file mode 100644 index bff2ff5..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpFileMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hnac.hzims.spare.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.spare.entity.HzimsSpFileEntity; -import org.apache.ibatis.annotations.Param; - -/** - * 备品备件文件表 Mapper 接口 - * - * @author Chill - */ -public interface HzimsSpFileMapper extends BaseMapper { - /** - * 物理删除 - * @param id - * @return - */ - int deleteByPrimaryKey(@Param("id") Long id); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpFileMapper.xml b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpFileMapper.xml deleted file mode 100644 index 095aca5..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpFileMapper.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - delete from hz_ims_sp_file - where ID = #{id,jdbcType=BIGINT} - - - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpProviderMapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpProviderMapper.java deleted file mode 100644 index dbcc229..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpProviderMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hnac.hzims.spare.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.spare.entity.HzimsSpProviderEntity; -import org.apache.ibatis.annotations.Param; - -/** - * 备品备件供应商 Mapper 接口 - * - * @author Chill - */ -public interface HzimsSpProviderMapper extends BaseMapper { - /** - * 物理删除 - * @param id - * @return - */ - int deleteByPrimaryKey(@Param("id") Long id); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpProviderMapper.xml b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpProviderMapper.xml deleted file mode 100644 index 94b4c2c..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpProviderMapper.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - delete from hz_ims_sp_provider - where ID = #{id,jdbcType=BIGINT} - - - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpRelevanceFileMapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpRelevanceFileMapper.java deleted file mode 100644 index 13f6c15..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpRelevanceFileMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.hnac.hzims.spare.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.spare.entity.HzimsSpRelevanceFileEntity; -import org.apache.ibatis.annotations.Param; - -/** - * 备品备件文件关联 Mapper 接口 - * - * @author Chill - */ -public interface HzimsSpRelevanceFileMapper extends BaseMapper { - /** - * 物理删除 - * @param fileId - * @return - */ - int deleteByFileId(@Param("fileId") Long fileId); - int deleteByBusinessId(@Param("businessId") Long businessId); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpRelevanceFileMapper.xml b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpRelevanceFileMapper.xml deleted file mode 100644 index b0e05c10..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpRelevanceFileMapper.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - delete from hz_ims_sp_relevance_file - where FILE_ID = #{fileId,jdbcType=BIGINT} - - - - delete from hz_ims_sp_relevance_file - where BUSINESS_ID = #{businessId,jdbcType=BIGINT} - - - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpTypeMapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpTypeMapper.java deleted file mode 100644 index af3125c..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpTypeMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.hnac.hzims.spare.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.spare.dto.HzimsSpTypeDTO; -import com.hnac.hzims.spare.entity.HzimsSpTypeEntity; -import com.hnac.hzinfo.core.annotation.CommonDao; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 备品备件类型 Mapper 接口 - * - * @author Chill - */ -@CommonDao -public interface HzimsSpTypeMapper extends BaseMapper { - /** - * 物理删除 - * @param id - * @return - */ - int deleteByPrimaryKey(@Param("id") Long id); - - List selectAllSpTypeList() ; - - /** - * 获取所有备件类型(不分页) - * @return - */ - List getList(); -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpTypeMapper.xml b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpTypeMapper.xml deleted file mode 100644 index abc1d7d..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpTypeMapper.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - delete from hz_ims_sp_type - where ID = #{id,jdbcType=BIGINT} - - - - - - - - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWareRelatedMapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWareRelatedMapper.java deleted file mode 100644 index 2368c05..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWareRelatedMapper.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.hnac.hzims.spare.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.spare.entity.HzimsSpWareRelatedEntity; -import com.hnac.hzinfo.core.annotation.CommonDao; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 备品备件仓库备件关联表 Mapper 接口 - * - * @author Chill - */ -@CommonDao -public interface HzimsSpWareRelatedMapper extends BaseMapper { - /** - * 物理删除 - * @param warehouseId - * @return - */ - int deleteByWarehouseId(@Param("warehouseId") Long warehouseId); - - int insertBatch(@Param("records") List records); - - /** - * 选择性更新 入库(注:库存的更新SQL中是累加) - * @param record - * @return - */ - int updateSelectiveInStock(HzimsSpWareRelatedEntity record); - /** - * 选择性更新 出库(注:出库暂存的更新SQL中是相减) - * @param record - * @return - */ - int updateSelectiveOutStock(HzimsSpWareRelatedEntity record); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWareRelatedMapper.xml b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWareRelatedMapper.xml deleted file mode 100644 index 66b6cfc..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWareRelatedMapper.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - delete from hz_ims_sp_ware_related - where WAREHOUSE_ID = #{warehouseId,jdbcType=BIGINT} - - - - insert into hz_ims_sp_ware_related (WAREHOUSE_ID, SP_ID, STOCK, IN_PRICE, OUT_PRICE, OUT_STOCK - ) - values - - (#{item.warehouseId,jdbcType=BIGINT}, #{item.spId,jdbcType=BIGINT}, #{item.stock,jdbcType=BIGINT}, - #{item.inPrice,jdbcType=DECIMAL}, #{item.outPrice,jdbcType=DECIMAL},#{item.outStock,jdbcType=BIGINT} - ) - - - - - update hz_ims_sp_ware_related - - - STOCK = STOCK + #{stock,jdbcType=BIGINT}, - - - IN_PRICE = #{inPrice,jdbcType=DECIMAL}, - - - where WAREHOUSE_ID = #{warehouseId,jdbcType=BIGINT} - and SP_ID = #{spId,jdbcType=BIGINT} - - - - update hz_ims_sp_ware_related - - - OUT_PRICE = #{outPrice,jdbcType=DECIMAL}, - - - OUT_STOCK = OUT_STOCK - #{outStock,jdbcType=BIGINT}, - - - where WAREHOUSE_ID = #{warehouseId,jdbcType=BIGINT} - and SP_ID = #{spId,jdbcType=BIGINT} - - - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWarehouseMapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWarehouseMapper.java deleted file mode 100644 index 4b2b386..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWarehouseMapper.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hnac.hzims.spare.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.spare.entity.HzimsSpWarehouseEntity; -import org.apache.ibatis.annotations.Param; - -/** - * 备品备件仓库 Mapper 接口 - * - * @author Chill - */ -public interface HzimsSpWarehouseMapper extends BaseMapper { - /** - * 物理删除 - * @param id - * @return - */ - int deleteByPrimaryKey(@Param("id") Long id); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWarehouseMapper.xml b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWarehouseMapper.xml deleted file mode 100644 index 02f48c0..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSpWarehouseMapper.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - delete from hz_ims_sp_warehouse - where ID = #{id,jdbcType=BIGINT} - - - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSparePartsMapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSparePartsMapper.java deleted file mode 100644 index 8bc90ca..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSparePartsMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.hnac.hzims.spare.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.spare.dto.HzimsSpareCountDTO; -import com.hnac.hzims.spare.entity.HzimsSparePartsEntity; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -/** - * 备品备件 Mapper 接口 - * - * @author Chill - */ -public interface HzimsSparePartsMapper extends BaseMapper { - /** - * 物理删除 - * @param id - * @return - */ - int deleteByPrimaryKey(@Param("id") Long id); - - /** - * 查询备件统计基本信息 - * @param params - * @return - */ - List selectSparePartsBasic(Map params); - - /** - * 查询备件统计出入库数量和价格信息 - * @param params - * @return - */ - List selectSparePartsCount(Map params); -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSparePartsMapper.xml b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSparePartsMapper.xml deleted file mode 100644 index deb33aa..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/HzimsSparePartsMapper.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - delete from hz_ims_spare_parts - where ID = #{id,jdbcType=BIGINT} - - - - - - - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/NoticeMapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/NoticeMapper.java deleted file mode 100644 index 71f93e9..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/NoticeMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.spare.entity.Notice; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** - * Mapper 接口 - * - * @author Chill - */ -public interface NoticeMapper extends BaseMapper { - - /** - * 前N条数据 - * @param number - * @return - */ - List topList(Integer number); - - /** - * 自定义分页 - * @param page - * @param notice - * @return - */ - List selectNoticePage(IPage page, Notice notice); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/NoticeMapper.xml b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/NoticeMapper.xml deleted file mode 100644 index 58d53f3..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/mapper/NoticeMapper.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - select id, - create_user AS createUser, - create_time AS createTime, - update_user AS updateUser, - update_time AS updateTime, - status, - is_deleted AS isDeleted, - title, content - - - - - - - diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/props/DemoProperties.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/props/DemoProperties.java deleted file mode 100644 index b5af15f..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/props/DemoProperties.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.props; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; - -/** - * DemoProperties - * - * @author Chill - */ -@Data -@ConfigurationProperties(prefix = "demo") -public class DemoProperties { - /** - * 名称 - */ - private String name; -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IDynamicService.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IDynamicService.java deleted file mode 100644 index cf74947..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IDynamicService.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare.service; - -import com.hnac.hzims.spare.entity.Notice; -import org.springblade.core.mp.base.BaseService; - -import java.util.List; - -/** - * 服务类 - * - * @author Chill - */ -public interface IDynamicService extends BaseService { - - /** - * master数据源的列表 - * - * @return - */ - List masterList(); - - /** - * slave数据源的列表 - * - * @return - */ - List slaveList(); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpChangeDetailService.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpChangeDetailService.java deleted file mode 100644 index c74fa8a..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpChangeDetailService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hnac.hzims.spare.service; - -import com.hnac.hzims.spare.entity.HzimsSpChangeDetailEntity; - -import java.util.List; - -/** - * 备品备件出入库详情 服务类 - * - * @author Chill - */ -public interface IHzimsSpChangeDetailService { - - int saveBatch(List entitys) ; - - /** - * 物理删除 - * @param changeId - * @return - */ - boolean removeByChangeId(Long changeId); -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpChangeRecService.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpChangeRecService.java deleted file mode 100644 index e749905..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpChangeRecService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.hnac.hzims.spare.service; - -import com.hnac.hzims.spare.dto.HzimsSpChangeRecDTO; -import com.hnac.hzims.spare.entity.HzimsSpChangeRecEntity; -import org.springblade.core.mp.base.BaseService; - -/** - * 备品备件出入库 服务类 - * - * @author Chill - */ -public interface IHzimsSpChangeRecService extends BaseService { - - /** - * 物理删除 - * @param id - * @return - */ - boolean removeById(Long id); - - /** - * 变更暂存 - * @param dto - * @return - */ - boolean saveOrUpdate(HzimsSpChangeRecDTO dto); - - /** - * 变更提交审核 - * @param dto - * @return - */ - boolean saveAndSubmit(HzimsSpChangeRecDTO dto); - - /** - * 变更 审核 - * @param dto - * @return - */ - boolean doCheck(HzimsSpChangeRecDTO dto); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpFileService.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpFileService.java deleted file mode 100644 index 8043a22..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpFileService.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hnac.hzims.spare.service; - -import org.springblade.core.mp.base.BaseService; -import com.hnac.hzims.spare.entity.HzimsSpFileEntity; - -/** - * 备品备件文件表 服务类 - * - * @author Chill - */ -public interface IHzimsSpFileService extends BaseService { - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpProviderService.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpProviderService.java deleted file mode 100644 index 8685216..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpProviderService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hnac.hzims.spare.service; - -import org.springblade.core.mp.base.BaseService; -import com.hnac.hzims.spare.entity.HzimsSpProviderEntity; - -/** - * 备品备件供应商 服务类 - * - * @author Chill - */ -public interface IHzimsSpProviderService extends BaseService { - - /** - * 物理删除 - * @param id - * @return - */ - boolean removeById(Long id); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpRelevanceFileService.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpRelevanceFileService.java deleted file mode 100644 index d5b1300..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpRelevanceFileService.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hnac.hzims.spare.service; - -import org.springblade.core.mp.base.BaseService; -import com.hnac.hzims.spare.entity.HzimsSpRelevanceFileEntity; - -/** - * 备品备件文件关联 服务类 - * - * @author Chill - */ -public interface IHzimsSpRelevanceFileService extends BaseService { - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpTypeService.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpTypeService.java deleted file mode 100644 index 7a4322f..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpTypeService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.hnac.hzims.spare.service; - -import com.hnac.hzims.spare.dto.HzimsSpTypeDTO; -import com.hnac.hzims.spare.entity.HzimsSpTypeEntity; -import org.springblade.core.mp.base.BaseService; - -import java.util.List; - -/** - * 备品备件类型 服务类 - * - * @author Chill - */ -public interface IHzimsSpTypeService extends BaseService { - - /** - * 重写新增或者修改接口,增加code为空,设置编码 - * @param entity - * @return - */ - boolean saveOrUpdate(HzimsSpTypeEntity entity); - - /** - * 物理删除 - * @param id - * @return - */ - boolean removeById(Long id); - - /** - * 获取类型树 - * @return - */ - List getSpTypeTree() ; - - /** - * 查询所有备件类型(不分页) - * @return - */ - List getList(); -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpWareRelatedService.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpWareRelatedService.java deleted file mode 100644 index be58788..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpWareRelatedService.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.hnac.hzims.spare.service; - -import com.hnac.hzims.spare.entity.HzimsSpWareRelatedEntity; - -import java.util.List; - -/** - * 备品备件仓库备件关联表 服务类 - * - * @author Chill - */ -public interface IHzimsSpWareRelatedService { - - int saveBatch(List entitys) ; - - /** - * 物理删除 - * @param warehouseId - * @return - */ - boolean deleteByWarehouseId(Long warehouseId); - - /** - * 选择性更新 入库(注:库存的更新SQL中是累加) - * @param record - * @return - */ - int updateSelectiveInStock(HzimsSpWareRelatedEntity record); - /** - * 选择性更新 出库(注:出库暂存的更新SQL中是相减) - * @param record - * @return - */ - int updateSelectiveOutStock(HzimsSpWareRelatedEntity record); -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpWarehouseService.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpWarehouseService.java deleted file mode 100644 index 79b56f1..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSpWarehouseService.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hnac.hzims.spare.service; - -import org.springblade.core.mp.base.BaseService; -import com.hnac.hzims.spare.entity.HzimsSpWarehouseEntity; - -/** - * 备品备件仓库 服务类 - * - * @author Chill - */ -public interface IHzimsSpWarehouseService extends BaseService { - - /** - * 物理删除 - * @param id - * @return - */ - boolean removeById(Long id); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSparePartsService.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSparePartsService.java deleted file mode 100644 index 7e9ba59..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/IHzimsSparePartsService.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.hnac.hzims.spare.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.spare.dto.HzimsSpareCountDTO; -import com.hnac.hzims.spare.entity.HzimsSparePartsEntity; -import org.springblade.core.mp.base.BaseService; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; - -import java.util.List; - -/** - * 备品备件 服务类 - * - * @author Chill - */ -public interface IHzimsSparePartsService extends BaseService { - - /** - * 重写新增或者修改接口,增加code为空,设置编码 - * @param entity - * @return - */ - boolean saveOrUpdate(HzimsSparePartsEntity entity); - - /** - * 物理删除 - * @param id - * @return - */ - boolean removeById(Long id); - - - /** - * 查询备件统计信息分页 - * @param sparePartsEntity - * @param query - * @return - */ - R> pageDTO(HzimsSparePartsEntity sparePartsEntity, Query query,String date); - - /** - * 查询备件统计信息 - * @param - * @return - */ - List selectSpareParts(Long typeId,String date); - - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/INoticeService.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/INoticeService.java deleted file mode 100644 index 34023fa..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/INoticeService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.spare.entity.Notice; -import org.springblade.core.mp.base.BaseService; - -/** - * 服务类 - * - * @author Chill - */ -public interface INoticeService extends BaseService { - - /** - * 自定义分页 - * @param page - * @param notice - * @return - */ - IPage selectNoticePage(IPage page, Notice notice); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/DynamicServiceImpl.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/DynamicServiceImpl.java deleted file mode 100644 index a49af22..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/DynamicServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.hnac.hzims.spare.service.impl; - -import com.baomidou.dynamic.datasource.annotation.DS; -import com.hnac.hzims.spare.entity.Notice; -import com.hnac.hzims.spare.mapper.NoticeMapper; -import com.hnac.hzims.spare.service.IDynamicService; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * DynamicServiceImpl - * - * @author Chill - */ -@Service -public class DynamicServiceImpl extends BaseServiceImpl implements IDynamicService { - - @Override - public List masterList() { - return this.list(); - } - - @Override - @DS("slave") - public List slaveList() { - return this.list(); - } -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpChangeDetailServiceImpl.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpChangeDetailServiceImpl.java deleted file mode 100644 index c78a2d8..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpChangeDetailServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.hnac.hzims.spare.service.impl; - -import com.hnac.hzims.spare.entity.HzimsSpChangeDetailEntity; -import com.hnac.hzims.spare.mapper.HzimsSpChangeDetailMapper; -import com.hnac.hzims.spare.service.IHzimsSpChangeDetailService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 备品备件出入库详情 服务实现类 - * - * @author Chill - */ -@Service -public class HzimsSpChangeDetailServiceImpl implements IHzimsSpChangeDetailService { - - private HzimsSpChangeDetailMapper detailMapper; - - @Override - public int saveBatch(List entitys){ - int result = 0; - - if(entitys == null || entitys.size() == 0){ - return result; - } - result = this.detailMapper.insertBatch(entitys); - return result; - } - - @Override - public boolean removeByChangeId(Long changeId){ - return detailMapper.deleteByChangeId(changeId) > 0; - } -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpChangeRecServiceImpl.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpChangeRecServiceImpl.java deleted file mode 100644 index 7d035a9..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpChangeRecServiceImpl.java +++ /dev/null @@ -1,216 +0,0 @@ -package com.hnac.hzims.spare.service.impl; - -import com.hnac.hzims.spare.dto.HzimsSpChangeRecDTO; -import com.hnac.hzims.spare.entity.HzimsSpChangeDetailEntity; -import com.hnac.hzims.spare.entity.HzimsSpChangeRecEntity; -import com.hnac.hzims.spare.entity.HzimsSpWareRelatedEntity; -import com.hnac.hzims.spare.entity.HzimsSparePartsEntity; -import com.hnac.hzims.spare.enumeration.ChangeStatusEnum; -import com.hnac.hzims.spare.mapper.HzimsSpChangeRecMapper; -import com.hnac.hzims.spare.service.IHzimsSpChangeDetailService; -import com.hnac.hzims.spare.service.IHzimsSpChangeRecService; -import com.hnac.hzims.spare.service.IHzimsSpWareRelatedService; -import com.hnac.hzims.spare.service.IHzimsSparePartsService; -import com.hnac.hzims.spare.utils.CodeDateRandomUtils; -import com.hnac.hzinfo.common.utils.StringUtils; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * 备品备件出入库 服务实现类 - * - * @author Chill - */ -@Service -public class HzimsSpChangeRecServiceImpl extends BaseServiceImpl implements IHzimsSpChangeRecService { - private static final String PURC_PREFIX_CODE = "PURC"; - private static final String IN_PREFIX_CODE = "IN"; - private static final String OUT_PREFIX_CODE = "OUT"; - - @Autowired - private IHzimsSpChangeDetailService detailservice; - @Autowired - private IHzimsSparePartsService spService; - @Autowired - private IHzimsSpWareRelatedService wareRelatedService; - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean saveOrUpdate(HzimsSpChangeRecDTO dto){ - boolean result = false; - HzimsSpChangeRecEntity entity = new HzimsSpChangeRecEntity(); - BeanUtils.copyProperties(dto,entity); - - entity.setUpdateTime(new Date()); - // 根据变更类型配置编码前缀 - String prefix = "OTHER"; - switch (entity.getChangeType()){ - case 1: prefix = PURC_PREFIX_CODE;break; - case 2: prefix = IN_PREFIX_CODE;break; - case 3: prefix = OUT_PREFIX_CODE;break; - } - entity.setCode(StringUtils.isNotBlank(entity.getCode())?entity.getCode(): CodeDateRandomUtils.generateCode(prefix)); - entity.setStatus(entity.getStatus()==null? ChangeStatusEnum.SUBMIT_PENDING.getCode() :entity.getStatus()); // 待提交 - - if(dto.getId() != null){ - detailservice.removeByChangeId(dto.getId()); - } - - result = super.saveOrUpdate(entity); - dto.setId(entity.getId()); - - if(dto.getDetails() != null && dto.getDetails().size() > 0){ - dto.getDetails().stream().forEach(item -> item.setChangeId(dto.getId())); - detailservice.saveBatch(dto.getDetails()); - } - return result; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean saveAndSubmit(HzimsSpChangeRecDTO dto){ - boolean result = false; - HzimsSpChangeRecEntity entity = new HzimsSpChangeRecEntity(); - BeanUtils.copyProperties(dto,entity); - - entity.setUpdateTime(new Date()); - entity.setStatus(ChangeStatusEnum.CHECK_PENDING.getCode()); // 待审核 - - if(StringUtils.isBlank(dto.getFlowId())) { // 驳回待提交,已经启动工作流 - // TODO 启动工作流,获取到工作流ID - entity.setFlowId(""); - } - - if(dto.getId()==null){ - // 根据变更类型配置编码前缀 - String prefix = "OTHER"; - switch (entity.getChangeType()){ - case 1: prefix = PURC_PREFIX_CODE;break; - case 2: prefix = IN_PREFIX_CODE;break; - case 3: prefix = OUT_PREFIX_CODE;break; - } - entity.setCode(StringUtils.isNotBlank(entity.getCode())?entity.getCode(): CodeDateRandomUtils.generateCode(prefix)); - - result = super.save(entity); - dto.setId(entity.getId()); - }else { - detailservice.removeByChangeId(dto.getId()); - result = super.updateById(entity); - } - - if(dto.getDetails() != null && dto.getDetails().size() > 0){ - dto.getDetails().stream().forEach(item -> item.setChangeId(dto.getId())); - detailservice.saveBatch(dto.getDetails()); - } - - // TODO 如果是出库,查询库存,并减库存,增加出库暂存 - - - return result; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean doCheck(HzimsSpChangeRecDTO dto){ - HzimsSpChangeRecEntity entity = new HzimsSpChangeRecEntity(); - BeanUtils.copyProperties(dto,entity); - - entity.setUpdateTime(new Date()); - entity.setStatus(dto.isCheckFlag()? ChangeStatusEnum.COMPLETED.getCode() :ChangeStatusEnum.REJECT_SUBMIT_PENDING.getCode()); // 已完成/审核驳回 - - // 各种类型变更完成调用不同的操作 - switch (dto.getChangeType()){ - case 1: this.toCompletePurchase(dto.getDetails());break; - case 2: this.toCompleteInHouse(dto.getDetails());break; - case 3: this.toCompleteOutHouse(dto.getDetails());break; - } - - return super.updateById(entity); - } - - /** - * 采购完成 - * @return - */ - private boolean toCompletePurchase(List details){ - boolean result = true; - if(details == null || details.size()<1){ - return result; - } - List spEntities = new ArrayList<>(); - HzimsSparePartsEntity spEntity ; - for(HzimsSpChangeDetailEntity detail:details){ - spEntity = new HzimsSparePartsEntity(); - BeanUtils.copyProperties(detail,spEntity); - spEntity.setId(detail.getSpId()); - spEntity.setInPrice(detail.getPrice()); //到入库时更新 -// spEntity.setStock(detail.getQuantity()); //到入库时更新 - spEntities.add(spEntity); - } - result = this.spService.saveOrUpdateBatch(spEntities); - return result; - } - - /** - * 入库完成 - * @return - */ - private boolean toCompleteInHouse(List details){ - boolean result = true; - if(details == null || details.size()<1){ - return result; - } - List insertEntities = new ArrayList<>(); - HzimsSpWareRelatedEntity wareRelatedEntity ; - for(HzimsSpChangeDetailEntity detail:details){ - wareRelatedEntity = new HzimsSpWareRelatedEntity(); - wareRelatedEntity.setWarehouseId(detail.getWarehouseId()); - wareRelatedEntity.setSpId(detail.getSpId()); - wareRelatedEntity.setInPrice(detail.getPrice()); - wareRelatedEntity.setStock(detail.getQuantity()); - if(this.wareRelatedService.updateSelectiveInStock(wareRelatedEntity)==0){ - insertEntities.add(wareRelatedEntity); - } - } - this.wareRelatedService.saveBatch(insertEntities); - // TODO 后面考虑是否需要更新备品备件表中的库存等信息(不更新,库存就从hz_ims_sp_ware_related中取) - return result; - } - - /** - * 出库完成 - * @return - */ - private boolean toCompleteOutHouse(List details){ - boolean result = true; - if(details == null || details.size()<1){ - return result; - } - HzimsSpWareRelatedEntity wareRelatedEntity ; - for(HzimsSpChangeDetailEntity detail:details){ - wareRelatedEntity = new HzimsSpWareRelatedEntity(); - wareRelatedEntity.setWarehouseId(detail.getWarehouseId()); - wareRelatedEntity.setSpId(detail.getSpId()); - wareRelatedEntity.setOutPrice(detail.getPrice()); - wareRelatedEntity.setOutStock(detail.getQuantity()); - this.wareRelatedService.updateSelectiveOutStock(wareRelatedEntity); - // TODO 考虑是否新增批量更新接口 - } - // TODO 后面考虑是否需要更新备品备件表中的库存等信息(不更新,库存就从hz_ims_sp_ware_related中取) - return result; - } - - - @Override - public boolean removeById(Long id){ - return baseMapper.deleteByPrimaryKey(id) > 0; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpFileServiceImpl.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpFileServiceImpl.java deleted file mode 100644 index 5c557f9..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpFileServiceImpl.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hnac.hzims.spare.service.impl; - -import org.springblade.core.mp.base.BaseServiceImpl; -import com.hnac.hzims.spare.entity.HzimsSpFileEntity; -import com.hnac.hzims.spare.mapper.HzimsSpFileMapper; -import com.hnac.hzims.spare.service.IHzimsSpFileService; -import org.springframework.stereotype.Service; - -/** - * 备品备件文件表 服务实现类 - * - * @author Chill - */ -@Service -public class HzimsSpFileServiceImpl extends BaseServiceImpl implements IHzimsSpFileService { - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpProviderServiceImpl.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpProviderServiceImpl.java deleted file mode 100644 index 2497c5e..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpProviderServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hnac.hzims.spare.service.impl; - -import org.springblade.core.mp.base.BaseServiceImpl; -import com.hnac.hzims.spare.entity.HzimsSpProviderEntity; -import com.hnac.hzims.spare.mapper.HzimsSpProviderMapper; -import com.hnac.hzims.spare.service.IHzimsSpProviderService; -import org.springframework.stereotype.Service; - -/** - * 备品备件供应商 服务实现类 - * - * @author Chill - */ -@Service -public class HzimsSpProviderServiceImpl extends BaseServiceImpl implements IHzimsSpProviderService { - - @Override - public boolean removeById(Long id){ - return baseMapper.deleteByPrimaryKey(id) > 0; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpRelevanceFileServiceImpl.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpRelevanceFileServiceImpl.java deleted file mode 100644 index c04672b..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpRelevanceFileServiceImpl.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hnac.hzims.spare.service.impl; - -import org.springblade.core.mp.base.BaseServiceImpl; -import com.hnac.hzims.spare.entity.HzimsSpRelevanceFileEntity; -import com.hnac.hzims.spare.mapper.HzimsSpRelevanceFileMapper; -import com.hnac.hzims.spare.service.IHzimsSpRelevanceFileService; -import org.springframework.stereotype.Service; - -/** - * 备品备件文件关联 服务实现类 - * - * @author Chill - */ -@Service -public class HzimsSpRelevanceFileServiceImpl extends BaseServiceImpl implements IHzimsSpRelevanceFileService { - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpTypeServiceImpl.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpTypeServiceImpl.java deleted file mode 100644 index 90538fc..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpTypeServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.hnac.hzims.spare.service.impl; - -import com.hnac.hzims.spare.dto.HzimsSpTypeDTO; -import com.hnac.hzims.spare.entity.HzimsSpTypeEntity; -import com.hnac.hzims.spare.mapper.HzimsSpTypeMapper; -import com.hnac.hzims.spare.service.IHzimsSpTypeService; -import com.hnac.hzims.spare.utils.CodeDateRandomUtils; -import com.hnac.hzims.spare.utils.TreeUtil; -import com.hnac.hzinfo.common.utils.StringUtils; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springframework.stereotype.Service; - -import java.util.Date; -import java.util.List; - -/** - * 备品备件类型 服务实现类 - * - * @author Chill - */ -@Service -public class HzimsSpTypeServiceImpl extends BaseServiceImpl implements IHzimsSpTypeService { - private static final String PREFIX_CODE = "SPTYPE"; - - @Override - public boolean saveOrUpdate(HzimsSpTypeEntity entity){ - entity.setUpdateTime(new Date()); - entity.setCode(StringUtils.isNotBlank(entity.getCode())?entity.getCode(): CodeDateRandomUtils.generateCode(PREFIX_CODE)); - return super.saveOrUpdate(entity); - } - - @Override - public boolean removeById(Long id){ - return baseMapper.deleteByPrimaryKey(id) > 0; - } - - @Override - public List getSpTypeTree(){ - List stList = baseMapper.selectAllSpTypeList(); - TreeUtil treeUtil = new TreeUtil(); - return treeUtil.getChildTreeObjects(stList,new Long(0)); - } - - @Override - public List getList() { - return baseMapper.getList(); - } -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpWareRelatedServiceImpl.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpWareRelatedServiceImpl.java deleted file mode 100644 index b77c5d9..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpWareRelatedServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.hnac.hzims.spare.service.impl; - -import com.hnac.hzims.spare.entity.HzimsSpWareRelatedEntity; -import com.hnac.hzims.spare.mapper.HzimsSpWareRelatedMapper; -import com.hnac.hzims.spare.service.IHzimsSpWareRelatedService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 备品备件仓库备件关联表 服务实现类 - * - * @author Chill - */ -@Service -public class HzimsSpWareRelatedServiceImpl implements IHzimsSpWareRelatedService { - - @Autowired - private HzimsSpWareRelatedMapper wareRelatedMapper; - - @Override - public int saveBatch(List entitys){ - int result = 0; - - if(entitys == null || entitys.size() == 0){ - return result; - } - result = this.wareRelatedMapper.insertBatch(entitys); - return result; - } - - @Override - public boolean deleteByWarehouseId(Long warehouseId){ - return wareRelatedMapper.deleteByWarehouseId(warehouseId) > 0; - } - - @Override - public int updateSelectiveInStock(HzimsSpWareRelatedEntity record){ - return this.wareRelatedMapper.updateSelectiveInStock(record); - } - @Override - public int updateSelectiveOutStock(HzimsSpWareRelatedEntity record){ - return this.wareRelatedMapper.updateSelectiveOutStock(record); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpWarehouseServiceImpl.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpWarehouseServiceImpl.java deleted file mode 100644 index 7b210b3..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSpWarehouseServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hnac.hzims.spare.service.impl; - -import org.springblade.core.mp.base.BaseServiceImpl; -import com.hnac.hzims.spare.entity.HzimsSpWarehouseEntity; -import com.hnac.hzims.spare.mapper.HzimsSpWarehouseMapper; -import com.hnac.hzims.spare.service.IHzimsSpWarehouseService; -import org.springframework.stereotype.Service; - -/** - * 备品备件仓库 服务实现类 - * - * @author Chill - */ -@Service -public class HzimsSpWarehouseServiceImpl extends BaseServiceImpl implements IHzimsSpWarehouseService { - - @Override - public boolean removeById(Long id){ - return baseMapper.deleteByPrimaryKey(id) > 0; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSparePartsServiceImpl.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSparePartsServiceImpl.java deleted file mode 100644 index 294b035..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/HzimsSparePartsServiceImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.hnac.hzims.spare.service.impl; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.hnac.hzims.spare.dto.HzimsSpareCountDTO; -import com.hnac.hzims.spare.entity.HzimsSparePartsEntity; -import com.hnac.hzims.spare.mapper.HzimsSparePartsMapper; -import com.hnac.hzims.spare.service.IHzimsSparePartsService; -import com.hnac.hzims.spare.utils.CodeDateRandomUtils; -import com.hnac.hzinfo.common.utils.StringUtils; -import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.mp.support.Condition; -import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; -import org.springframework.stereotype.Service; - -import java.math.BigDecimal; -import java.text.SimpleDateFormat; -import java.util.*; - -/** - * 备品备件 服务实现类 - * - * @author Chill - */ -@Service -public class HzimsSparePartsServiceImpl extends BaseServiceImpl implements IHzimsSparePartsService { - private static final String PREFIX_CODE = "SP"; - - @Override - public boolean saveOrUpdate(HzimsSparePartsEntity entity){ - entity.setUpdateTime(new Date()); - entity.setCode(StringUtils.isNotBlank(entity.getCode())?entity.getCode(): CodeDateRandomUtils.generateCode(PREFIX_CODE)); - return super.saveOrUpdate(entity); - } - - @Override - public boolean removeById(Long id){ - return baseMapper.deleteByPrimaryKey(id) > 0; - } - - @Override - public R> pageDTO(HzimsSparePartsEntity sparePartsEntity, Query query,String date) { - IPage pages = super.page(Condition.getPage(query), Condition.getQueryWrapper(sparePartsEntity)); - IPage dtoPages = new Page<>(); - List dtoList = new ArrayList<>(); - for (int i = 0; i < pages.getRecords().size(); i++) { - List list = this.selectSpareParts(pages.getRecords().get(i).getTypeId(),date); - dtoList.add(list.get(0)); - } - dtoPages.setRecords(dtoList); - dtoPages.setTotal(pages.getTotal()); - dtoPages.setCurrent(pages.getCurrent()); - dtoPages.setPages(pages.getPages()); - dtoPages.setSize(pages.getSize()); - return R.data(dtoPages); - } - - - @Override - public List selectSpareParts(Long typeId,String date) { - Map params = new HashMap<>(); - params.put("typeId",typeId); - List list = baseMapper.selectSparePartsBasic(params); - List resultList = new ArrayList<>(); - Map map = new HashMap<>(); - if(StringUtils.isNotEmpty(date)){ - map.put("date",date); - }else{ - map.put("date",new SimpleDateFormat("yyyy-MM").format(new Date())); - } - for (int i = 0; i < list.size(); i++) { - HzimsSpareCountDTO spareCountDTO = list.get(i); - map.put("spId",list.get(i).getId()); - map.put("changeType",2); - //查询入库数量和价格 - List inList = baseMapper.selectSparePartsCount(map); - if(inList.size()>0 && null !=inList.get(0)){ - spareCountDTO.setInQuantity(inList.get(0).getInQuantity()); - spareCountDTO.setInPrice(inList.get(0).getInPrice()); - }else{ - spareCountDTO.setInQuantity(0L); - spareCountDTO.setInPrice(new BigDecimal(0)); - } - //查询出库数量和价格 - map.put("changeType",3); - List outList = baseMapper.selectSparePartsCount(map); - if(outList.size()>0 && null !=outList.get(0)){ - spareCountDTO.setOutQuantity(outList.get(0).getInQuantity()); - spareCountDTO.setOutPrice(outList.get(0).getInPrice()); - }else{ - spareCountDTO.setOutQuantity(0L); - spareCountDTO.setOutPrice(new BigDecimal(0)); - } - resultList.add(spareCountDTO); - } - return resultList; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/NoticeServiceImpl.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/NoticeServiceImpl.java deleted file mode 100644 index a3846b3..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/service/impl/NoticeServiceImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package com.hnac.hzims.spare.service.impl; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.spare.mapper.NoticeMapper; -import com.hnac.hzims.spare.service.INoticeService; -import org.springblade.core.mp.base.BaseServiceImpl; -import com.hnac.hzims.spare.entity.Notice; -import org.springframework.stereotype.Service; - -/** - * 服务实现类 - * - * @author Chill - */ -@Service -public class NoticeServiceImpl extends BaseServiceImpl implements INoticeService { - - @Override - public IPage selectNoticePage(IPage page, Notice notice) { - return page.setRecords(baseMapper.selectNoticePage(page, notice)); - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/CodeDateRandomUtils.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/CodeDateRandomUtils.java deleted file mode 100644 index 4836e87..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/CodeDateRandomUtils.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.hnac.hzims.spare.utils; - -import org.apache.commons.lang.StringUtils; - -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * @author Huj - * created in 2020/2/20 17:20 - * modified By: - * @description - **/ -public class CodeDateRandomUtils { - - /** - * 产生编码 - * @param prefix 前缀 - * @param interval 连接符 - * @return - */ - public static String generateCode(String prefix,String interval){ - interval = StringUtils.isNotBlank(interval)?interval.trim():""; - String code = ""; - SimpleDateFormat f = new - SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式 - String date = f.format(new Date(System.currentTimeMillis())); - - if(StringUtils.isNotBlank(prefix)){ - code = code + prefix + interval; - } - - /*int random = (int)(Math.random()*9000)+1000; - code = code + random + interval ;*/ - code = code + date; - return code; - } - public static String generateCode(String prefix){ - return generateCode(prefix,null); - } - - - - /** - * 产生编码 - * @param prefix 前缀 - * @param interval 连接符 - * @return - */ - public static String generateCodeRandom(String prefix,String interval,Integer value){ - interval = StringUtils.isNotBlank(interval)?interval.trim():""; - String code = ""; - SimpleDateFormat f = new - SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式 - String date = f.format(new Date(System.currentTimeMillis())); - - if(StringUtils.isNotBlank(prefix)){ - code = code + prefix + interval; - } - - value = value == null ? 1000:value; - int random = (int)(Math.random()*value)+1000; - code = code + random + interval ; - code = code + date; - return code; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/TreeObject.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/TreeObject.java deleted file mode 100644 index 4eef364..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/TreeObject.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.hnac.hzims.spare.utils; - -import java.util.List; - -/** - * @author Huj - * created in 2019/11/12 - * modified By: - * 列表树形式显示的接口 - */ -public interface TreeObject { - - Long getId(); - - void setId(Long id); - - Long getParentId(); - - void setParentId(Long parentId); - - String getName(); - - void setName(String name); - - List getChildren(); - - void setChildren(List children); - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/TreeUtil.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/TreeUtil.java deleted file mode 100644 index cb0a47c..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/TreeUtil.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.hnac.hzims.spare.utils; - -import org.springframework.util.StringUtils; - -import java.util.*; - - -/** - * @author Huj - * created in 2019/11/12 13:39 - * modified By: - * @description 把一个list集合,里面的bean含有 parentId 转为树形式 - **/ -public class TreeUtil { - - /** - * 判断两个父ID是否相同 - * @param p1 - * @param p2 - * @return - */ - private boolean isEqualsParentId(Object p1,Object p2){ - if(p1!=null && p2!=null){ - return p1.equals(p2); - }else if(p1==null && p2 == null) { - return true; - }else if(p1==null && p2 != null) { - if("".equals(p2.toString())){ - return true; - }else{ - return false; - } - }else if(p1!=null && p2 == null) { - if("".equals(p1.toString())){ - return true; - }else{ - return false; - } - }else{ - return false; - } - } - - /** - * 根据父节点的ID获取所有子节点,该方法顶级节点必须为空 - * @param list 分类表 - * @param parentId 传入的父节点ID - * @return String - */ - public List getChildTreeObjects(List list,Object parentId) { - List returnList = new ArrayList(); - if(list!=null&&list.size()>0) { - for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { - TreeObject t = (TreeObject) iterator.next(); - // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点(传过来的parentId类型必须要和t.getParentId()一样) - if (isEqualsParentId(t.getParentId(), parentId)) { - recursionFn(list, t); - returnList.add(t); - } - } - } - return returnList; - } - - /** - * 根据父节点的ID获取所有子节点,该方法顶级节点可以不为空,非树直接返回 - * @param list 分类表 - * @return String - */ - public List getChildTreeObjects(List list) { - if(list!=null&&list.size()>0) { - List topList=new ArrayList<>(); - List subList=new ArrayList<>(); - - Map idMap=new HashMap<>(); - - for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { - //归并所有list的id集合 - TreeObject t = (TreeObject) iterator.next(); - idMap.put(t.getId().toString(), t.getId().toString()); - } - - for (Iterator iterator = list.iterator(); iterator.hasNext(); ) { - //获取最顶级的list - TreeObject t = (TreeObject) iterator.next(); - if(t.getParentId()==null|| StringUtils.isEmpty(t.getParentId().toString())){ - topList.add(t); - }else{ - String id=idMap.get(t.getParentId().toString()); - if(StringUtils.isEmpty(id)){ - topList.add(t); - }else{ - subList.add(t); - } - } - } - if(topList!=null&&topList.size()>0&&subList!=null&&subList.size()>0){ - List resultList=new ArrayList<>(); - for (TreeObject t:topList) { - //将儿子级别的list归并到顶级中 - List subOneList=new ArrayList<>(); - - for (TreeObject sub:subList) { - // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点 - if (isEqualsParentId(sub.getParentId(), t.getId())) { - recursionFn(subList, sub); - subOneList.add(sub); - } - } - t.setChildren(subOneList); - - - resultList.add(t); - } - return resultList; - }else{ - return list; - } - } - return list; - } - - - /** - * 递归列表 - * @param list - * @param t - */ - private void recursionFn(List list, TreeObject t) { - List childList = getChildList(list, t);// 得到子节点列表 - t.setChildren(childList); - for (TreeObject tChild : childList) { - if (hasChild(list, tChild)) {// 判断是否有子节点 - //returnList.add(TreeObject); - Iterator it = childList.iterator(); - while (it.hasNext()) { - TreeObject n = (TreeObject) it.next(); - recursionFn(list, n); - } - } - } - } - - // 得到子节点列表 - private List getChildList(List list, TreeObject t) { - - List tlist = new ArrayList(); - Iterator it = list.iterator(); - while (it.hasNext()) { - TreeObject n = (TreeObject) it.next(); - if (isEqualsParentId(n.getParentId(),t.getId())) { - tlist.add(n); - } - } - return tlist; - } - List returnList = new ArrayList(); - /** - * 根据父节点的ID获取所有子节点 - * @param list 分类表 - * @param parentId 传入的父节点ID - * @param prefix 子节点前缀 - */ - public List getChildTreeObjects(List list, Object parentId,String prefix){ - if(list == null) return null; - for (Iterator iterator = list.iterator(); iterator.hasNext();) { - TreeObject node = (TreeObject) iterator.next(); - // 一、根据传入的某个父节点ID,遍历该父节点的所有子节点 - if (isEqualsParentId(node.getParentId(),parentId)) { - recursionFn(list, node,prefix); - } - // 二、遍历所有的父节点下的所有子节点 - /*if (node.getParentId()==0) { - recursionFn(list, node); - }*/ - } - return returnList; - } - - private void recursionFn(List list, TreeObject node,String p) { - List childList = getChildList(list, node);// 得到子节点列表 - if (hasChild(list, node)) {// 判断是否有子节点 - returnList.add(node); - Iterator it = childList.iterator(); - while (it.hasNext()) { - TreeObject n = (TreeObject) it.next(); - n.setName(p+n.getName()); - recursionFn(list, n,p+p); - } - } else { - returnList.add(node); - } - } - - // 判断是否有子节点 - private boolean hasChild(List list, TreeObject t) { - return getChildList(list, t).size() > 0 ? true : false; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/UserUtils.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/UserUtils.java deleted file mode 100644 index c499fcc..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/utils/UserUtils.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.hnac.hzims.spare.utils; - -import com.hnac.hzinfo.common.utils.SessionUtils; -import com.hnac.hzinfo.modules.sys.entity.User; - -import javax.servlet.http.HttpServletRequest; - -/** - * @author Huj - * created in 2020/2/20 17:20 - * modified By: - * @description - **/ -public class UserUtils { - - public static User getCurrentUser(HttpServletRequest request){ - User user; - if(request != null){ - user = SessionUtils.getCurrentUser(request); - }else { - user = new User(); - } - return user; - } -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpChangeDetailVO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpChangeDetailVO.java deleted file mode 100644 index 20ce7c6..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpChangeDetailVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.vo; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpChangeDetailEntity; - -/** - * 备品备件出入库详情 模型VO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpChangeDetailVO extends HzimsSpChangeDetailEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpChangeRecVO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpChangeRecVO.java deleted file mode 100644 index 813a127..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpChangeRecVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.vo; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpChangeRecEntity; - -/** - * 备品备件出入库 模型VO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpChangeRecVO extends HzimsSpChangeRecEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpFileVO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpFileVO.java deleted file mode 100644 index e178592..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpFileVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.vo; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpFileEntity; - -/** - * 备品备件文件表 模型VO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpFileVO extends HzimsSpFileEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpProviderVO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpProviderVO.java deleted file mode 100644 index c49ae0f..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpProviderVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.vo; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpProviderEntity; - -/** - * 备品备件供应商 模型VO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpProviderVO extends HzimsSpProviderEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpRelevanceFileVO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpRelevanceFileVO.java deleted file mode 100644 index 1879131..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpRelevanceFileVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.vo; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpRelevanceFileEntity; - -/** - * 备品备件文件关联 模型VO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpRelevanceFileVO extends HzimsSpRelevanceFileEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpTypeVO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpTypeVO.java deleted file mode 100644 index b8523dd..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpTypeVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.vo; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpTypeEntity; - -/** - * 备品备件类型 模型VO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpTypeVO extends HzimsSpTypeEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpWareRelatedVO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpWareRelatedVO.java deleted file mode 100644 index b8f7653..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpWareRelatedVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.vo; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpWareRelatedEntity; - -/** - * 备品备件仓库备件关联表 模型VO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpWareRelatedVO extends HzimsSpWareRelatedEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpWarehouseVO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpWarehouseVO.java deleted file mode 100644 index 1cfab00..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSpWarehouseVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.vo; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSpWarehouseEntity; - -/** - * 备品备件仓库 模型VO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSpWarehouseVO extends HzimsSpWarehouseEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSparePartsVO.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSparePartsVO.java deleted file mode 100644 index defd19f..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/vo/HzimsSparePartsVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hnac.hzims.spare.vo; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.hnac.hzims.spare.entity.HzimsSparePartsEntity; - -/** - * 备品备件 模型VO - * - * @author Chill - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class HzimsSparePartsVO extends HzimsSparePartsEntity { - - private static final long serialVersionUID = 1L; - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpChangeDetailWrapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpChangeDetailWrapper.java deleted file mode 100644 index 6dbaef3..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpChangeDetailWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.spare.wrapper; - -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import com.hnac.hzims.spare.entity.HzimsSpChangeDetailEntity; -import com.hnac.hzims.spare.vo.HzimsSpChangeDetailVO; - -/** - * 备品备件出入库详情 包装类,返回视图层所需的字段 - * - * @author Chill - */ -public class HzimsSpChangeDetailWrapper extends BaseEntityWrapper { - - public static HzimsSpChangeDetailWrapper build() { - return new HzimsSpChangeDetailWrapper(); - } - - @Override - public HzimsSpChangeDetailVO entityVO(HzimsSpChangeDetailEntity spChangeDetail) { - HzimsSpChangeDetailVO spChangeDetailVO = BeanUtil.copy(spChangeDetail, HzimsSpChangeDetailVO.class); - - //User createUser = UserCache.getUser(spChangeDetail.getCreateUser()); - //User updateUser = UserCache.getUser(spChangeDetail.getUpdateUser()); - //spChangeDetailVO.setCreateUserName(createUser.getName()); - //spChangeDetailVO.setUpdateUserName(updateUser.getName()); - - return spChangeDetailVO; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpChangeRecWrapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpChangeRecWrapper.java deleted file mode 100644 index e08472c..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpChangeRecWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.spare.wrapper; - -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import com.hnac.hzims.spare.entity.HzimsSpChangeRecEntity; -import com.hnac.hzims.spare.vo.HzimsSpChangeRecVO; - -/** - * 备品备件出入库 包装类,返回视图层所需的字段 - * - * @author Chill - */ -public class HzimsSpChangeRecWrapper extends BaseEntityWrapper { - - public static HzimsSpChangeRecWrapper build() { - return new HzimsSpChangeRecWrapper(); - } - - @Override - public HzimsSpChangeRecVO entityVO(HzimsSpChangeRecEntity spChangeRec) { - HzimsSpChangeRecVO spChangeRecVO = BeanUtil.copy(spChangeRec, HzimsSpChangeRecVO.class); - - //User createUser = UserCache.getUser(spChangeRec.getCreateUser()); - //User updateUser = UserCache.getUser(spChangeRec.getUpdateUser()); - //spChangeRecVO.setCreateUserName(createUser.getName()); - //spChangeRecVO.setUpdateUserName(updateUser.getName()); - - return spChangeRecVO; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpFileWrapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpFileWrapper.java deleted file mode 100644 index a510e5a..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpFileWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.spare.wrapper; - -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import com.hnac.hzims.spare.entity.HzimsSpFileEntity; -import com.hnac.hzims.spare.vo.HzimsSpFileVO; - -/** - * 备品备件文件表 包装类,返回视图层所需的字段 - * - * @author Chill - */ -public class HzimsSpFileWrapper extends BaseEntityWrapper { - - public static HzimsSpFileWrapper build() { - return new HzimsSpFileWrapper(); - } - - @Override - public HzimsSpFileVO entityVO(HzimsSpFileEntity spFile) { - HzimsSpFileVO spFileVO = BeanUtil.copy(spFile, HzimsSpFileVO.class); - - //User createUser = UserCache.getUser(spFile.getCreateUser()); - //User updateUser = UserCache.getUser(spFile.getUpdateUser()); - //spFileVO.setCreateUserName(createUser.getName()); - //spFileVO.setUpdateUserName(updateUser.getName()); - - return spFileVO; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpProviderWrapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpProviderWrapper.java deleted file mode 100644 index 4127513..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpProviderWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.spare.wrapper; - -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import com.hnac.hzims.spare.entity.HzimsSpProviderEntity; -import com.hnac.hzims.spare.vo.HzimsSpProviderVO; - -/** - * 备品备件供应商 包装类,返回视图层所需的字段 - * - * @author Chill - */ -public class HzimsSpProviderWrapper extends BaseEntityWrapper { - - public static HzimsSpProviderWrapper build() { - return new HzimsSpProviderWrapper(); - } - - @Override - public HzimsSpProviderVO entityVO(HzimsSpProviderEntity spProvider) { - HzimsSpProviderVO spProviderVO = BeanUtil.copy(spProvider, HzimsSpProviderVO.class); - - //User createUser = UserCache.getUser(spProvider.getCreateUser()); - //User updateUser = UserCache.getUser(spProvider.getUpdateUser()); - //spProviderVO.setCreateUserName(createUser.getName()); - //spProviderVO.setUpdateUserName(updateUser.getName()); - - return spProviderVO; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpRelevanceFileWrapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpRelevanceFileWrapper.java deleted file mode 100644 index 4ab5313..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpRelevanceFileWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.spare.wrapper; - -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import com.hnac.hzims.spare.entity.HzimsSpRelevanceFileEntity; -import com.hnac.hzims.spare.vo.HzimsSpRelevanceFileVO; - -/** - * 备品备件文件关联 包装类,返回视图层所需的字段 - * - * @author Chill - */ -public class HzimsSpRelevanceFileWrapper extends BaseEntityWrapper { - - public static HzimsSpRelevanceFileWrapper build() { - return new HzimsSpRelevanceFileWrapper(); - } - - @Override - public HzimsSpRelevanceFileVO entityVO(HzimsSpRelevanceFileEntity spRelevanceFile) { - HzimsSpRelevanceFileVO spRelevanceFileVO = BeanUtil.copy(spRelevanceFile, HzimsSpRelevanceFileVO.class); - - //User createUser = UserCache.getUser(spRelevanceFile.getCreateUser()); - //User updateUser = UserCache.getUser(spRelevanceFile.getUpdateUser()); - //spRelevanceFileVO.setCreateUserName(createUser.getName()); - //spRelevanceFileVO.setUpdateUserName(updateUser.getName()); - - return spRelevanceFileVO; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpTypeWrapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpTypeWrapper.java deleted file mode 100644 index 04dc5e5..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpTypeWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.spare.wrapper; - -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import com.hnac.hzims.spare.entity.HzimsSpTypeEntity; -import com.hnac.hzims.spare.vo.HzimsSpTypeVO; - -/** - * 备品备件类型 包装类,返回视图层所需的字段 - * - * @author Chill - */ -public class HzimsSpTypeWrapper extends BaseEntityWrapper { - - public static HzimsSpTypeWrapper build() { - return new HzimsSpTypeWrapper(); - } - - @Override - public HzimsSpTypeVO entityVO(HzimsSpTypeEntity spType) { - HzimsSpTypeVO spTypeVO = BeanUtil.copy(spType, HzimsSpTypeVO.class); - - //User createUser = UserCache.getUser(spType.getCreateUser()); - //User updateUser = UserCache.getUser(spType.getUpdateUser()); - //spTypeVO.setCreateUserName(createUser.getName()); - //spTypeVO.setUpdateUserName(updateUser.getName()); - - return spTypeVO; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpWareRelatedWrapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpWareRelatedWrapper.java deleted file mode 100644 index a86dadb..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpWareRelatedWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.spare.wrapper; - -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import com.hnac.hzims.spare.entity.HzimsSpWareRelatedEntity; -import com.hnac.hzims.spare.vo.HzimsSpWareRelatedVO; - -/** - * 备品备件仓库备件关联表 包装类,返回视图层所需的字段 - * - * @author Chill - */ -public class HzimsSpWareRelatedWrapper extends BaseEntityWrapper { - - public static HzimsSpWareRelatedWrapper build() { - return new HzimsSpWareRelatedWrapper(); - } - - @Override - public HzimsSpWareRelatedVO entityVO(HzimsSpWareRelatedEntity spWareRelated) { - HzimsSpWareRelatedVO spWareRelatedVO = BeanUtil.copy(spWareRelated, HzimsSpWareRelatedVO.class); - - //User createUser = UserCache.getUser(spWareRelated.getCreateUser()); - //User updateUser = UserCache.getUser(spWareRelated.getUpdateUser()); - //spWareRelatedVO.setCreateUserName(createUser.getName()); - //spWareRelatedVO.setUpdateUserName(updateUser.getName()); - - return spWareRelatedVO; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpWarehouseWrapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpWarehouseWrapper.java deleted file mode 100644 index 31a9ac1..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSpWarehouseWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.spare.wrapper; - -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import com.hnac.hzims.spare.entity.HzimsSpWarehouseEntity; -import com.hnac.hzims.spare.vo.HzimsSpWarehouseVO; - -/** - * 备品备件仓库 包装类,返回视图层所需的字段 - * - * @author Chill - */ -public class HzimsSpWarehouseWrapper extends BaseEntityWrapper { - - public static HzimsSpWarehouseWrapper build() { - return new HzimsSpWarehouseWrapper(); - } - - @Override - public HzimsSpWarehouseVO entityVO(HzimsSpWarehouseEntity spWarehouse) { - HzimsSpWarehouseVO spWarehouseVO = BeanUtil.copy(spWarehouse, HzimsSpWarehouseVO.class); - - //User createUser = UserCache.getUser(spWarehouse.getCreateUser()); - //User updateUser = UserCache.getUser(spWarehouse.getUpdateUser()); - //spWarehouseVO.setCreateUserName(createUser.getName()); - //spWarehouseVO.setUpdateUserName(updateUser.getName()); - - return spWarehouseVO; - } - -} diff --git a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSparePartsWrapper.java b/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSparePartsWrapper.java deleted file mode 100644 index fec9bb4..0000000 --- a/hzims-service/spare/src/main/java/com/hnac/hzims/spare/wrapper/HzimsSparePartsWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.hnac.hzims.spare.wrapper; - -import org.springblade.core.mp.support.BaseEntityWrapper; -import org.springblade.core.tool.utils.BeanUtil; -import com.hnac.hzims.spare.entity.HzimsSparePartsEntity; -import com.hnac.hzims.spare.vo.HzimsSparePartsVO; - -/** - * 备品备件 包装类,返回视图层所需的字段 - * - * @author Chill - */ -public class HzimsSparePartsWrapper extends BaseEntityWrapper { - - public static HzimsSparePartsWrapper build() { - return new HzimsSparePartsWrapper(); - } - - @Override - public HzimsSparePartsVO entityVO(HzimsSparePartsEntity spareParts) { - HzimsSparePartsVO sparePartsVO = BeanUtil.copy(spareParts, HzimsSparePartsVO.class); - - //User createUser = UserCache.getUser(spareParts.getCreateUser()); - //User updateUser = UserCache.getUser(spareParts.getUpdateUser()); - //sparePartsVO.setCreateUserName(createUser.getName()); - //sparePartsVO.setUpdateUserName(updateUser.getName()); - - return sparePartsVO; - } - -} diff --git a/hzims-service/spare/src/test/java/BladeDemoTest.java b/hzims-service/spare/src/test/java/BladeDemoTest.java deleted file mode 100644 index 22eccde..0000000 --- a/hzims-service/spare/src/test/java/BladeDemoTest.java +++ /dev/null @@ -1,31 +0,0 @@ -import com.hnac.hzims.spare.SpareApplication; -import com.hnac.hzims.spare.service.INoticeService; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springblade.core.test.BladeBootTest; -import org.springblade.core.test.BladeSpringRunner; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; - -/** - * Blade单元测试 - * - * @author Chill - */ -@Ignore -@RunWith(BladeSpringRunner.class) -@SpringBootTest(classes = SpareApplication.class) -@BladeBootTest(appName = "blade-demo", profile = "test", enableLoader = true) -public class BladeDemoTest { - - @Autowired - private INoticeService noticeService; - - @Test - public void contextLoads() { - int count = noticeService.count(); - System.out.println("notice数量:[" + count + "] 个"); - } - -} diff --git a/hzims-service/spare/src/test/java/launcher/DemoTestLauncherServiceImpl.java b/hzims-service/spare/src/test/java/launcher/DemoTestLauncherServiceImpl.java deleted file mode 100644 index 2cdf29f..0000000 --- a/hzims-service/spare/src/test/java/launcher/DemoTestLauncherServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the dreamlu.net developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: Chill 庄骞 (smallchill@163.com) - */ -package launcher; - -import com.hnac.hzims.common.constant.LauncherConstant; -import org.junit.Ignore; -import org.springblade.core.auto.service.AutoService; -import org.springblade.core.launch.service.LauncherService; -import org.springframework.boot.builder.SpringApplicationBuilder; - -import java.util.Properties; - -/** - * 启动参数拓展 - * - * @author Chill - */ -@AutoService(LauncherService.class) -@Ignore -public class DemoTestLauncherServiceImpl implements LauncherService { - - @Override - public void launcher(SpringApplicationBuilder builder, String appName, String profile, boolean isLocalDev) { - Properties props = System.getProperties(); - props.setProperty("spring.cloud.nacos.discovery.server-addr", LauncherConstant.NACOS_DEV_ADDR); - props.setProperty("spring.cloud.nacos.config.server-addr", LauncherConstant.NACOS_DEV_ADDR); - props.setProperty("spring.cloud.sentinel.transport.dashboard", LauncherConstant.SENTINEL_DEV_ADDR); - } - - @Override - public int getOrder() { - return 10; - } -} From af7529a008590eccbae62c3d337293a848cbfaf0 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Fri, 17 May 2024 16:28:29 +0800 Subject: [PATCH 16/35] =?UTF-8?q?fix:=E5=B7=A5=E4=BD=9C=E7=A5=A8=E9=99=84?= =?UTF-8?q?=E8=A1=A8=E9=A2=84=E8=A7=88=E8=A1=A5=E5=85=85=E5=8D=B1=E9=99=A9?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../twoTicket/service/impl/FirstWorkTicketServiceImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java index 4ff1b08..ca1e8fb 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java @@ -24,9 +24,12 @@ import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.constants.WorkTicketConstants; import com.hnac.hzims.ticket.twoTicket.constant.TicketConstant; +import com.hnac.hzims.ticket.twoTicket.entity.TicketInfoDanger; import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; +import com.hnac.hzims.ticket.twoTicket.mapper.TicketInfoDangerMapper; import com.hnac.hzims.ticket.twoTicket.service.IFirstWorkTicketService; import com.hnac.hzims.ticket.twoTicket.service.IWorkTicketFinishService; +import com.hnac.hzims.ticket.twoTicket.service.TicketInfoDangerService; import com.hnac.hzims.ticket.utils.*; import com.hnac.hzims.ticket.workTicket.dto.*; import com.hnac.hzims.ticket.workTicket.entity.*; @@ -103,6 +106,7 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl qw = Wrappers.lambdaQuery().eq(TicketInfoDanger::getTicketId, ticketId); + List ticketInfoDangerList = dangerService.list(qw); + List dangerList = IntStream.iterate(0, index -> index + 1).limit(ticketInfoDangerList.size()).mapToObj(index -> { + Map result = ObjectUtils.obj2Map(ticketInfoDangerList.get(index)); + result.put("index",index + 1); + return result; + }).collect(Collectors.toList()); + params.put("ticketInfoDangers", dangerList); params.put("isSafety",workTicketInfoEntity.getIsSafety() ? "☑" : "□"); params.put("isHazard",workTicketInfoEntity.getIsHazard() ? "☑" : "□"); params.put("isRailway",workTicketInfoEntity.getIsRailway() ? "☑" : "□"); From 5ad63934bee434fe8866461f9ffc16964e10cd2f Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 21 May 2024 11:51:23 +0800 Subject: [PATCH 17/35] =?UTF-8?q?add:=E9=81=A5=E6=8E=A7=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interactive/constants/FunctionConstants.java | 5 ++- hzims-service-api/pom.xml | 1 - .../interactive/constants/FuncRouteEnum.java | 17 ++++++---- .../service/impl/ExtraResolveStrategyService.java | 25 ++++++++++++++ .../bigmodel/interactive/vo/RemoteParamVO.java | 39 ++++++++++++++++++++++ .../bigmodel/interactive/vo/SessionContentVO.java | 19 +++++++++++ .../websocket/constants/RedisKeyConstants.java | 13 ++++++++ .../websocket/handler/InteractiveHandler.java | 9 +++++ .../controller/StationVideoTypeController.java | 6 ++++ .../station/service/IStationVideoTypeService.java | 3 ++ .../station/service/impl/StationServiceImpl.java | 8 +++++ .../service/impl/StationVideoTypeServiceImpl.java | 8 +++++ hzims-service/pom.xml | 1 - pom.xml | 2 +- 14 files changed, 145 insertions(+), 11 deletions(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteParamVO.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/SessionContentVO.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/constants/RedisKeyConstants.java diff --git a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FunctionConstants.java b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FunctionConstants.java index 7114de1..6a2d62d 100644 --- a/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FunctionConstants.java +++ b/hzims-service-api/big-model-api/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FunctionConstants.java @@ -20,7 +20,10 @@ public interface FunctionConstants { LINK("2"), /**参数**/ PARAMS("3"), - CHOOSE("4") + /**选项**/ + CHOOSE("4"), + /**确认**/ + CONFIRM("5") ; @Getter private String type; diff --git a/hzims-service-api/pom.xml b/hzims-service-api/pom.xml index 59661cf..e19eb31 100644 --- a/hzims-service-api/pom.xml +++ b/hzims-service-api/pom.xml @@ -29,7 +29,6 @@ middle-api alarm-api big-model-api - suichang-api diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java index 3dd1caf..174df24 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java @@ -12,18 +12,21 @@ import java.util.Optional; */ @AllArgsConstructor public enum FuncRouteEnum { - OPEN_CANVAS("open_canvas","打开实时画面"), - OPEN_VIDEO("open_video","打开视频监控"), - DIAGNOSE("diagnose","智能诊断"), - CHOOSE_STATION("choose_station","选择站点"), - CHOOSE_VIDEO("choose_video","选择视频"), - CHOOSE_CANVAS("choose_canvas","选择画面"), - CHOOSE_FAULT("choose_fault","选择故障"), + OPEN_CANVAS("open_canvas","打开实时画面",null), + OPEN_VIDEO("open_video","打开视频监控",null), + DIAGNOSE("diagnose","智能诊断",null), + CHOOSE_STATION("choose_station","选择站点",null), + CHOOSE_VIDEO("choose_video","选择视频",null), + CHOOSE_CANVAS("choose_canvas","选择画面",null), + CHOOSE_FAULT("choose_fault","选择故障",null), + CONFIRM_YK("confirm_yk","遥控确认", FunctionConstants.TypeEnum.CONFIRM), ; @Getter private String funcCode; @Getter private String funcName; + @Getter + private FunctionConstants.TypeEnum type; public static FuncRouteEnum getEnumByFuncCode(String funcCode) { Optional FuncRoute = Arrays.stream(FuncRouteEnum.class.getEnumConstants()).filter(e -> funcCode.equals(e.getFuncCode())).findFirst(); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java index c1895b9..c464e05 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java @@ -6,16 +6,22 @@ import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; import com.hnac.hzims.bigmodel.interactive.constants.FunctionConstants; import com.hnac.hzims.bigmodel.interactive.vo.*; +import com.hnac.hzims.bigmodel.websocket.constants.RedisKeyConstants; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationVideoTypeEntity; import com.hnac.hzims.operational.station.feign.IStationClient; import com.hnac.hzims.operational.station.feign.IStationVideoTypeClient; +import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; +import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceFuncVO; import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.log.XxlJobLogger; import lombok.AllArgsConstructor; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.dto.ControlDTO; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -35,6 +41,8 @@ public class ExtraResolveStrategyService { private final IStationClient stationClient; private final IStationVideoTypeClient videoTypeClient; private final JumpRouteJoinStrategy jumpRouteJoinStrategy; + private final DeviceClient deviceClient; + private final RedisTemplate redisTemplate; /** * 解析DFP返回extra @@ -59,6 +67,8 @@ public class ExtraResolveStrategyService { return this.resolveChooseScada(extra); case CHOOSE_FAULT: return this.resolveChooseFault(extra); + case CONFIRM_YK: + return this.resolveConfirmRemote(extra); default: break; } @@ -67,6 +77,21 @@ public class ExtraResolveStrategyService { return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class); } + private ExtraVO resolveConfirmRemote(Map extra) { + ExtraVO result = new ExtraVO(); + RemoteParamVO remoteParam = JSONObject.parseObject(JSON.toJSONString(extra.get("data")), RemoteParamVO.class); + result.setFuncCode(FuncRouteEnum.CONFIRM_YK.getFuncCode()); + result.setType(FunctionConstants.TypeEnum.CONFIRM.getType()); + R funcVOR = deviceClient.getFuncById(remoteParam.getFuncId()); + if(funcVOR.isSuccess()) { + Map param = new HashMap(1); + param.put("control",funcVOR.getData()); + param.put("value",remoteParam.getValue()); + result.setParams(param); + } + return result; + } + private ExtraVO resolveChooseFault(Map extra) { ExtraVO result = new ExtraVO(); JSONObject data = JSONObject.parseObject(JSON.toJSONString(extra.get("data"))); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteParamVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteParamVO.java new file mode 100644 index 0000000..3bcf351 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteParamVO.java @@ -0,0 +1,39 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/20 14:46 + */ +@Data +@EqualsAndHashCode +public class RemoteParamVO implements Serializable { + + @JSONField(name = "id") + private String funcId; + + @JSONField(name = "yk_name") + private String remoteName; + + @JSONField(name = "device_id") + private String deviceCode; + + @JSONField(name = "device_name") + private String deviceName; + + @JSONField(name = "station_id") + private String projectId; + + @JSONField(name = "station_name") + private String projectName; + + private String signage; + + private String value; + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/SessionContentVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/SessionContentVO.java new file mode 100644 index 0000000..1de0532 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/SessionContentVO.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/20 19:31 + */ +@Data +@EqualsAndHashCode +public class SessionContentVO implements Serializable { + + /**机器码**/ + private String machineCode; + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/constants/RedisKeyConstants.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/constants/RedisKeyConstants.java new file mode 100644 index 0000000..3cd0e30 --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/constants/RedisKeyConstants.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.bigmodel.websocket.constants; + +import com.hnac.hzims.common.constant.CommonConstant; + +/** + * @Author: huangxing + * @Date: 2024/05/20 19:11 + */ +public interface RedisKeyConstants { + + String SESSION_CONTENT_KEY = CommonConstant.TENANT_ID + ":hzims:bigModel:session:content"; + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java index 96dfc4e..c1b9976 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java @@ -9,12 +9,14 @@ import com.hnac.hzims.bigmodel.interactive.service.impl.JumpRouteJoinStrategy; import com.hnac.hzims.bigmodel.interactive.service.impl.ParamStrategy; import com.hnac.hzims.bigmodel.interactive.vo.*; import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService; +import com.hnac.hzims.bigmodel.websocket.constants.RedisKeyConstants; import com.hnac.hzims.bigmodel.websocket.service.InteractiveWsService; import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.SpringUtil; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; @@ -23,6 +25,7 @@ import org.springframework.web.socket.handler.TextWebSocketHandler; import java.io.IOException; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.TimeUnit; import java.util.function.Function; /** @@ -64,6 +67,12 @@ public class InteractiveHandler extends TextWebSocketHandler { } }else { String sessionId = InteractiveSessionManager.getEntryBySession(session).getKey(); + if(Func.isNotEmpty(messageJSON.containsKey("content"))) { + // 将发送参数存入redis + RedisTemplate redisTemplate = SpringUtil.getBean(RedisTemplate.class); + redisTemplate.expire(RedisKeyConstants.SESSION_CONTENT_KEY,30, TimeUnit.MINUTES); + redisTemplate.opsForHash().put(RedisKeyConstants.SESSION_CONTENT_KEY,sessionId,messageJSON.getObject("content", SessionContentVO.class)); + } this.handleMessage(messageJSON,sessionId); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java index 3639cb9..f69936d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationVideoTypeController.java @@ -354,4 +354,10 @@ public class StationVideoTypeController extends BladeController { return R.data(false); } + @GetMapping ("/getVideoByPointCodes") + @ApiOperationSupport(order = 190) + @ApiOperation(value = "通过视频编号获取视频") + public R> getVideoByPointCodes(@RequestParam @ApiParam("视频设备编号") String pointCodes) { + return R.data(stationVideoTypeService.getVideoByPointCodes(pointCodes)); + } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java index f008b57..bd5a5b1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationVideoTypeService.java @@ -10,6 +10,7 @@ import com.hnac.hzims.operational.station.response.HikMonitorResp; import com.hnac.hzims.operational.station.vo.HikVideoAreaTreeVO; import com.hnac.hzims.operational.station.vo.StationVideoTypeVO; import com.hnac.hzims.operational.station.vo.VideoMonitorVO; +import io.swagger.annotations.ApiParam; import org.apache.ibatis.annotations.Param; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; @@ -83,4 +84,6 @@ public interface IStationVideoTypeService extends BaseService getVideoByPointCodes(String pointCodes); + } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java index 7976d98..aa58a0f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java @@ -690,6 +690,14 @@ public class StationServiceImpl extends BaseServiceImpl wq = Wrappers.lambdaQuery().eq(StationEntity::getCode, entity.getCode()); + List stations = this.getBaseMapper().listWithOutAuth(wq); + Assert.isTrue(CollectionUtil.isEmpty(stations),() -> { + throw new ServiceException("站点编号平台已存在,请检查后重新填入!"); + }); + } Integer maxSort = this.baseMapper.getMaxSort(); entity.setSort(Optional.ofNullable(maxSort).map(sort -> sort + 1).orElse(1)); // 创建站点机构 diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java index 94e544a..671e71f 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationVideoTypeServiceImpl.java @@ -279,6 +279,14 @@ public class StationVideoTypeServiceImpl extends BaseServiceImpl getVideoByPointCodes(String pointCodes) { + List pointCodeList = Func.toStrList(",", pointCodes); + LambdaQueryWrapper qw = Wrappers.lambdaQuery().in(StationVideoTypeEntity::getPointCode, pointCodeList); + List videoList = this.list(qw); + return videoList; + } + private HikVideoAreaTreeVO generateAreaTree(Map> videoAreaMapByParent,HikVideoAreaVO area) { HikVideoAreaTreeVO parentTree = BeanUtil.copy(area,HikVideoAreaTreeVO.class); if(CollectionUtil.isNotEmpty(videoAreaMapByParent.get(area.getIndexCode()))) { diff --git a/hzims-service/pom.xml b/hzims-service/pom.xml index 8c59a54..8812762 100644 --- a/hzims-service/pom.xml +++ b/hzims-service/pom.xml @@ -29,7 +29,6 @@ hzims-alarm hzims-basic hzims-big-model - suichang hzims-simulate diff --git a/pom.xml b/pom.xml index 47b1aaa..e3c6ea9 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,7 @@ com.hnac.hzinfo.data hzinfo-data-sdk - 5.1.1.RELEASE.fix.4 + 5.1.1.RELEASE.fix.5 com.xuxueli From 89ec1c4bf6832a4934b0f6598437e26632835e68 Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 21 May 2024 11:52:19 +0800 Subject: [PATCH 18/35] =?UTF-8?q?update:=20=E6=99=BA=E8=83=BD=E9=97=AE?= =?UTF-8?q?=E7=AD=94=E5=A2=9E=E5=8A=A0=E8=B0=83=E7=94=A8=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E5=BA=93=E9=97=AE=E7=AD=94=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigmodel/configuration/BigModelInvokeUrl.java | 1 + .../interactive/service/IInteractiveService.java | 13 ++++++++--- .../service/impl/InteractiveServiceImpl.java | 25 ++++++++++++++++++++++ .../websocket/handler/InteractiveHandler.java | 18 ++++++++++------ 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java index 7f8d6d5..8179cba 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/configuration/BigModelInvokeUrl.java @@ -27,4 +27,5 @@ public class BigModelInvokeUrl { private String updateCanvas; + private String assistantKnowledgeAsk; } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java index 40b06ea..241a25b 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java @@ -2,11 +2,8 @@ package com.hnac.hzims.bigmodel.interactive.service; import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO; -import io.swagger.annotations.ApiParam; import org.springblade.core.tool.api.R; -import org.springframework.web.bind.annotation.RequestParam; -import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Map; @@ -33,4 +30,14 @@ public interface IInteractiveService { Boolean authentication(String stationId, String userId, String func); Boolean removeSessionId(String sessionId); + + /** + * 发起知识库问答 + * @param question 问题 + * @param sessionId 会话id + * @param userId 用户id + * @param knowledge 知识库名称 + * @return 发起结果 + */ + R knowledgeAsk(String question, String sessionId, String userId, String knowledge); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index 4e835a0..f150638 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -246,6 +246,31 @@ public class InteractiveServiceImpl implements IInteractiveService { return true; } + /** + * 发起知识库问答 + */ + @Override + public R knowledgeAsk(String question, String sessionId, String userId, String knowledge) { + Map params = new HashMap<>(); + params.put("id", sessionId); + params.put("userid", userId); + params.put("query", question); + params.put("knowledge", knowledge); + params.put("stationids", this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId) + .filter(StringUtil::isNotBlank).filter(Func::isNotEmpty).toArray()); + params.put("projectids", this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getDeptId) + .filter(Func::isNotEmpty).map(String::valueOf).toArray()); + HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getAssistantKnowledgeAsk()) + .body(JSON.toJSONString(params)).execute(); + logger.info("interactive:knowledgeAsk", "知识库问答传参为:" + JSON.toJSONString(params) + " 结果为:" + response.body()); + if (response.getStatus() != HttpServletResponse.SC_OK) { + log.error("远程调用大模型【发起知识库问答】接口失败!"); + return R.fail("远程调用大模型【发起知识库问答】接口失败!"); + } + this.addQuestionSessionId(sessionId); + return R.success("消息发送成功"); + } + private List getStationPermissionsById(String userId) { R> deptSattionR = deptClient.getStationPermissionsById(Long.valueOf(userId)); Assert.isTrue(deptSattionR.isSuccess() && CollectionUtil.isNotEmpty(deptSattionR.getData()),() -> { diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java index 96dfc4e..585b15e 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java @@ -62,20 +62,26 @@ public class InteractiveHandler extends TextWebSocketHandler { } catch (IOException e) { throw new RuntimeException(e); } - }else { + } else { String sessionId = InteractiveSessionManager.getEntryBySession(session).getKey(); - this.handleMessage(messageJSON,sessionId); + this.handleMessage(messageJSON, sessionId); } } - private void handleMessage(JSONObject messageContext,String sessionId) { + private void handleMessage(JSONObject messageContext, String sessionId) { Boolean isSpecial = messageContext.getBoolean("isSpecial"); - if(Func.isEmpty(isSpecial) || !isSpecial) { + if (Func.isEmpty(isSpecial) || !isSpecial) { String context = messageContext.getString("context"); String userId = messageContext.getString("userId"); + String knowledge = messageContext.getString("knowledge"); IInteractiveService interactiveService = SpringUtil.getBean(IInteractiveService.class); - R askResult = interactiveService.ask(context, sessionId, userId); - log.info("返回结果为:"+ JSON.toJSONString(askResult)); + if (knowledge != null) { + R askResult = interactiveService.knowledgeAsk(context, sessionId, userId, knowledge); + log.info("知识库问答返回结果:" + JSON.toJSONString(askResult)); + } else { + R askResult = interactiveService.ask(context, sessionId, userId); + log.info("返回结果为:"+ JSON.toJSONString(askResult)); + } } else { String funcCode = messageContext.getString("funcCode"); From 8a172849bead5048a686b01e6b6f9c6862148807 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 21 May 2024 15:25:26 +0800 Subject: [PATCH 19/35] =?UTF-8?q?add:=E9=81=A5=E6=8E=A7=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/bigmodel/interactive/constants/FuncRouteEnum.java | 2 +- .../service/impl/ExtraResolveStrategyService.java | 2 +- .../bigmodel/websocket/handler/InteractiveHandler.java | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java index 174df24..46887e8 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java @@ -19,7 +19,7 @@ public enum FuncRouteEnum { CHOOSE_VIDEO("choose_video","选择视频",null), CHOOSE_CANVAS("choose_canvas","选择画面",null), CHOOSE_FAULT("choose_fault","选择故障",null), - CONFIRM_YK("confirm_yk","遥控确认", FunctionConstants.TypeEnum.CONFIRM), + CONFIRM_YK("confirm_yk","遥控确认", FunctionConstants.TypeEnum.PARAMS), ; @Getter private String funcCode; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java index c464e05..a9c63a6 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java @@ -81,7 +81,7 @@ public class ExtraResolveStrategyService { ExtraVO result = new ExtraVO(); RemoteParamVO remoteParam = JSONObject.parseObject(JSON.toJSONString(extra.get("data")), RemoteParamVO.class); result.setFuncCode(FuncRouteEnum.CONFIRM_YK.getFuncCode()); - result.setType(FunctionConstants.TypeEnum.CONFIRM.getType()); + result.setType(FuncRouteEnum.CONFIRM_YK.getType().getType()); R funcVOR = deviceClient.getFuncById(remoteParam.getFuncId()); if(funcVOR.isSuccess()) { Map param = new HashMap(1); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java index 0f3d200..23b8d2e 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java @@ -12,11 +12,16 @@ import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService; import com.hnac.hzims.bigmodel.websocket.constants.RedisKeyConstants; import com.hnac.hzims.bigmodel.websocket.service.InteractiveWsService; import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.SpringUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; @@ -33,7 +38,12 @@ import java.util.function.Function; * @Date: 2024/04/28 13:45 */ @Slf4j +@Component public class InteractiveHandler extends TextWebSocketHandler { + + @Autowired + private RedisTemplate redisTemplate; + @Override public void afterConnectionEstablished(WebSocketSession session) { String[] split = session.getUri().toString().split("/"); @@ -67,9 +77,8 @@ public class InteractiveHandler extends TextWebSocketHandler { } } else { String sessionId = InteractiveSessionManager.getEntryBySession(session).getKey(); - if(Func.isNotEmpty(messageJSON.containsKey("content"))) { + if(messageJSON.containsKey("content")) { // 将发送参数存入redis - RedisTemplate redisTemplate = SpringUtil.getBean(RedisTemplate.class); redisTemplate.expire(RedisKeyConstants.SESSION_CONTENT_KEY,30, TimeUnit.MINUTES); redisTemplate.opsForHash().put(RedisKeyConstants.SESSION_CONTENT_KEY,sessionId,messageJSON.getObject("content", SessionContentVO.class)); } From bea6be45135924d9218553fdb9f366caabfb9659 Mon Sep 17 00:00:00 2001 From: RnhaiWang <393727820@qq.com> Date: Tue, 21 May 2024 15:27:56 +0800 Subject: [PATCH 20/35] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=B7=AF=E7=BA=BF=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java index df18dbe..6cd2907 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/task/entity/TaskEntity.java @@ -48,6 +48,14 @@ public class TaskEntity extends TenantEntity { @ApiModelProperty(value = "计划名称") @QueryField(condition = SqlCondition.LIKE) private String planName; + + /** + * 路线名称 + */ + @ApiModelProperty(value = "路线名称") + @QueryField(condition = SqlCondition.LIKE) + private String routeName; + /** * 任务批次号 */ From c7a3b8bf7332ad426561bb130b33f0965f7225c2 Mon Sep 17 00:00:00 2001 From: RnhaiWang <393727820@qq.com> Date: Tue, 21 May 2024 17:24:23 +0800 Subject: [PATCH 21/35] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=B7=AF=E7=BA=BF=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzinfo/inspect/ai/service/impl/RobotTaskServiceImpl.java | 1 + .../java/com/hnac/hzinfo/inspect/ai/vo/robot/RobotTaskTransParam.java | 4 ++++ .../java/com/hnac/hzinfo/inspect/task/job/service/TaskJobService.java | 1 + 3 files changed, 6 insertions(+) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotTaskServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotTaskServiceImpl.java index e2912b5..1ec39a8 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotTaskServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/ai/service/impl/RobotTaskServiceImpl.java @@ -236,6 +236,7 @@ public class RobotTaskServiceImpl extends BaseServiceImpl Date: Tue, 21 May 2024 19:17:12 +0800 Subject: [PATCH 22/35] =?UTF-8?q?add:=E9=81=A5=E6=8E=A7=E9=89=B4=E6=9D=83?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constants/ProjectRemoteTypeEnum.java | 22 +++++ .../service/impl/AuthenticationService.java | 100 +++++++++++++++++++++ .../service/impl/InteractiveServiceImpl.java | 43 +++------ 3 files changed, 136 insertions(+), 29 deletions(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/ProjectRemoteTypeEnum.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/ProjectRemoteTypeEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/ProjectRemoteTypeEnum.java new file mode 100644 index 0000000..069572a --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/ProjectRemoteTypeEnum.java @@ -0,0 +1,22 @@ +package com.hnac.hzims.bigmodel.interactive.constants; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * @Author: huangxing + * @Date: 2024/05/21 16:34 + */ +@AllArgsConstructor +public enum ProjectRemoteTypeEnum { + /**不允许发送遥控**/ + NOT_ALLOW(0), + /**运行发送遥控并且需要校验权限**/ + VALID(1), + /**运行发送遥控并免校验权限**/ + ALLOW(2), + ; + @Getter + private Integer ctrlType; + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java new file mode 100644 index 0000000..f5b9d5b --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java @@ -0,0 +1,100 @@ +package com.hnac.hzims.bigmodel.interactive.service.impl; + +import com.hnac.hzims.bigmodel.entity.FunctionEntity; +import com.hnac.hzims.bigmodel.function.service.IFunctionService; +import com.hnac.hzims.bigmodel.interactive.constants.ProjectRemoteTypeEnum; +import com.hnac.hzinfo.sdk.core.response.Result; +import com.hnac.hzinfo.sdk.v5.project.ProjectClient; +import com.hnac.hzinfo.sdk.v5.project.vo.ProjectVO; +import lombok.AllArgsConstructor; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.dto.DeptStationDTO; +import org.springblade.system.feign.IDeptClient; +import org.springblade.system.feign.IRemoteClient; +import org.springblade.system.user.feign.IUserClient; +import org.springframework.stereotype.Service; +import org.springframework.util.Assert; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @Author: huangxing + * @Date: 2024/05/21 16:10 + */ +@Service +@AllArgsConstructor +public class AuthenticationService { + + private final IDeptClient deptClient; + private final IFunctionService functionService; + private final IUserClient userClient; + private final ProjectClient projectClient; + private final IRemoteClient remoteClient; + + /** + * 站点鉴权 + * @param stationId 站点ID + * @param userId 用户ID + */ + public void stationAuthentication(String stationId, String userId) { + List stations = this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId) + .filter(StringUtil::isNotBlank).filter(Func::isNotEmpty).collect(Collectors.toList()); + Assert.isTrue(stations.contains(stationId),() -> { + throw new ServiceException("人员站点鉴权失败!"); + }); + } + + /** + * 菜单鉴权 + * @param stationId 站点ID + * @param userId 用户ID + * @param func 函数编号 + */ + public void menuAuthentication(String stationId, String userId, String func) { + FunctionEntity function = functionService.getFunctionByCode(func); + if(Func.isNotEmpty(function) && Func.isNotEmpty(function.getRoute()) && StringUtil.isNotBlank(function.getRoute())) { + R authenticationR = userClient.permissionMenuById(Long.valueOf(userId), function.getRoute()); + Assert.isTrue(authenticationR.isSuccess() && authenticationR.getData(), () -> { + throw new ServiceException("人员菜单鉴权失败!"); + }); + } + } + + /** + * 遥控鉴权 + * @param stationId 站点ID + * @param userId 用户ID + * @param func 函数编号 + */ + public void remoteAuthentication(String stationId, String userId, String func) { + // 查询数据平台站点是否可被遥控 + Result projectR = projectClient.getProjectByPid(stationId); + Assert.isTrue(projectR.isSuccess() && Func.isNotEmpty(projectR.getData()),() -> { + throw new ServiceException("未查询到站点,鉴权失败!"); + }); + ProjectVO project = projectR.getData(); + if(ProjectRemoteTypeEnum.NOT_ALLOW.getCtrlType().equals(project.getCtrlType())) { + // 不允许发送遥控 + throw new ServiceException("该站点不允许发送遥控指令,校验失败!"); + } + else if(ProjectRemoteTypeEnum.VALID.getCtrlType().equals(project.getCtrlType())) { + // 运行发送遥控并且需要校验权限 + //remoteClient.sendCtrlCheckParam(); + } + + } + + public List getStationPermissionsById(String userId) { + R> deptSattionR = deptClient.getStationPermissionsById(Long.valueOf(userId)); + Assert.isTrue(deptSattionR.isSuccess() && CollectionUtil.isNotEmpty(deptSattionR.getData()),() -> { + throw new ServiceException("获取人员站点权限失败!"); + }); + return deptSattionR.getData(); + } + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index f150638..d322d1d 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject; import com.hnac.hzims.bigmodel.configuration.BigModelInvokeUrl; import com.hnac.hzims.bigmodel.entity.FunctionEntity; import com.hnac.hzims.bigmodel.function.service.IFunctionService; +import com.hnac.hzims.bigmodel.interactive.constants.FuncRouteEnum; import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService; import com.hnac.hzims.bigmodel.interactive.service.IJumpPageService; @@ -57,9 +58,7 @@ public class InteractiveServiceImpl implements IInteractiveService { private final BigModelInvokeUrl bigModelInvokeUrl; - private final IDeptClient deptClient; - - private final IUserClient userClient; + private final AuthenticationService authenticationService; private final RedisTemplate redisTemplate; @@ -98,8 +97,8 @@ public class InteractiveServiceImpl implements IInteractiveService { params.put("id",sessionId); params.put("userid", userId); params.put("query",question); - params.put("stationids",this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId).filter(StringUtil::isNotBlank).filter(Func::isNotEmpty).toArray()); - params.put("projectids",this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getDeptId).filter(Func::isNotEmpty).map(String::valueOf).toArray()); + params.put("stationids",authenticationService.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId).filter(StringUtil::isNotBlank).filter(Func::isNotEmpty).toArray()); + params.put("projectids",authenticationService.getStationPermissionsById(userId).stream().map(DeptStationDTO::getDeptId).filter(Func::isNotEmpty).map(String::valueOf).toArray()); HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getAssistantAsk()) .body(JSON.toJSONString(params)).execute(); logger.info("interactive:ask","问答传参为:" + JSON.toJSONString(params) + "结果为:" + response.body()); @@ -132,8 +131,8 @@ public class InteractiveServiceImpl implements IInteractiveService { params.put("id",sessionId); params.put("userid", userId); params.put("extra",extra); - params.put("stationids",this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId).filter(StringUtil::isNotBlank).filter(Func::isNotEmpty).toArray()); - params.put("projectids",this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getDeptId).filter(Func::isNotEmpty).map(String::valueOf).toArray()); + params.put("stationids",authenticationService.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId).filter(StringUtil::isNotBlank).filter(Func::isNotEmpty).toArray()); + params.put("projectids",authenticationService.getStationPermissionsById(userId).stream().map(DeptStationDTO::getDeptId).filter(Func::isNotEmpty).map(String::valueOf).toArray()); HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getAssistantSpecialAsk()) .body(JSON.toJSONString(params)).execute(); if(response.getStatus() != HttpServletResponse.SC_OK) { @@ -200,21 +199,15 @@ public class InteractiveServiceImpl implements IInteractiveService { public Boolean authentication(String stationId, String userId, String func) { // 站点鉴权 if(StringUtil.isNotBlank(stationId)) { - List stations = this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId) - .filter(StringUtil::isNotBlank).filter(Func::isNotEmpty).collect(Collectors.toList()); - Assert.isTrue(stations.contains(stationId),() -> { - throw new ServiceException("人员站点鉴权失败!"); - }); + authenticationService.stationAuthentication(stationId,userId); } // 菜单鉴权 if(StringUtil.isNotBlank(func) && StringUtil.isNotBlank(userId)) { - FunctionEntity function = functionService.getFunctionByCode(func); - if(Func.isNotEmpty(function) && Func.isNotEmpty(function.getRoute()) && StringUtil.isNotBlank(function.getRoute())) { - R authenticationR = userClient.permissionMenuById(Long.valueOf(userId), function.getRoute()); - Assert.isTrue(authenticationR.isSuccess() && authenticationR.getData(), () -> { - throw new ServiceException("人员菜单鉴权失败!"); - }); - } + authenticationService.menuAuthentication(stationId,userId,func); + } + // 遥控鉴权 + if(FuncRouteEnum.CONFIRM_YK.getFuncCode().equals(func)) { + authenticationService.remoteAuthentication(stationId,userId,func); } return true; } @@ -256,9 +249,9 @@ public class InteractiveServiceImpl implements IInteractiveService { params.put("userid", userId); params.put("query", question); params.put("knowledge", knowledge); - params.put("stationids", this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId) + params.put("stationids", authenticationService.getStationPermissionsById(userId).stream().map(DeptStationDTO::getStationId) .filter(StringUtil::isNotBlank).filter(Func::isNotEmpty).toArray()); - params.put("projectids", this.getStationPermissionsById(userId).stream().map(DeptStationDTO::getDeptId) + params.put("projectids", authenticationService.getStationPermissionsById(userId).stream().map(DeptStationDTO::getDeptId) .filter(Func::isNotEmpty).map(String::valueOf).toArray()); HttpResponse response = HttpRequest.post(fdpHost + bigModelInvokeUrl.getAssistantKnowledgeAsk()) .body(JSON.toJSONString(params)).execute(); @@ -270,12 +263,4 @@ public class InteractiveServiceImpl implements IInteractiveService { this.addQuestionSessionId(sessionId); return R.success("消息发送成功"); } - - private List getStationPermissionsById(String userId) { - R> deptSattionR = deptClient.getStationPermissionsById(Long.valueOf(userId)); - Assert.isTrue(deptSattionR.isSuccess() && CollectionUtil.isNotEmpty(deptSattionR.getData()),() -> { - throw new ServiceException("获取人员站点权限失败!"); - }); - return deptSattionR.getData(); - } } From 893d05d0bf7371e05e93fec5d8a789ef5592c433 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 21 May 2024 20:31:16 +0800 Subject: [PATCH 23/35] =?UTF-8?q?add:=E9=81=A5=E6=8E=A7=E9=89=B4=E6=9D=83?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/InteractiveController.java | 5 ++-- .../interactive/service/IInteractiveService.java | 2 +- .../service/impl/AuthenticationService.java | 34 ++++++++++++++++++---- .../service/impl/InteractiveServiceImpl.java | 6 ++-- 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java index 90102a3..25de021 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java @@ -48,8 +48,9 @@ public class InteractiveController { @RequestMapping(value = "/authentication",method = {RequestMethod.GET,RequestMethod.POST}) public R authentication(@RequestParam(required = false) @ApiParam("站点编号") String stationId, @RequestParam @ApiParam("用户ID") String userId, - @RequestParam(required = false) @ApiParam("菜单ID") String func) { - return R.status(interactiveService.authentication(stationId,userId,func)); + @RequestParam(required = false) @ApiParam("菜单ID") String func, + @RequestParam(required = false) @ApiParam("会话ID")String sessionId) { + return R.status(interactiveService.authentication(stationId,userId,func,sessionId)); } @ApiOperation("获取问答sessionId") diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java index 241a25b..8ace8cc 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java @@ -27,7 +27,7 @@ public interface IInteractiveService { List getAnswerBySessionIds(String sessionIds); - Boolean authentication(String stationId, String userId, String func); + Boolean authentication(String stationId, String userId, String func,String sessionId); Boolean removeSessionId(String sessionId); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java index f5b9d5b..1960da9 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java @@ -3,6 +3,8 @@ package com.hnac.hzims.bigmodel.interactive.service.impl; import com.hnac.hzims.bigmodel.entity.FunctionEntity; import com.hnac.hzims.bigmodel.function.service.IFunctionService; import com.hnac.hzims.bigmodel.interactive.constants.ProjectRemoteTypeEnum; +import com.hnac.hzims.bigmodel.interactive.vo.SessionContentVO; +import com.hnac.hzims.bigmodel.websocket.constants.RedisKeyConstants; import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.v5.project.ProjectClient; import com.hnac.hzinfo.sdk.v5.project.vo.ProjectVO; @@ -13,13 +15,16 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.dto.DeptStationDTO; +import org.springblade.system.entity.CtrlAuth; import org.springblade.system.feign.IDeptClient; import org.springblade.system.feign.IRemoteClient; import org.springblade.system.user.feign.IUserClient; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.util.Assert; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -35,6 +40,7 @@ public class AuthenticationService { private final IUserClient userClient; private final ProjectClient projectClient; private final IRemoteClient remoteClient; + private final RedisTemplate redisTemplate; /** * 站点鉴权 @@ -51,11 +57,10 @@ public class AuthenticationService { /** * 菜单鉴权 - * @param stationId 站点ID * @param userId 用户ID * @param func 函数编号 */ - public void menuAuthentication(String stationId, String userId, String func) { + public void menuAuthentication(String userId, String func) { FunctionEntity function = functionService.getFunctionByCode(func); if(Func.isNotEmpty(function) && Func.isNotEmpty(function.getRoute()) && StringUtil.isNotBlank(function.getRoute())) { R authenticationR = userClient.permissionMenuById(Long.valueOf(userId), function.getRoute()); @@ -69,9 +74,8 @@ public class AuthenticationService { * 遥控鉴权 * @param stationId 站点ID * @param userId 用户ID - * @param func 函数编号 */ - public void remoteAuthentication(String stationId, String userId, String func) { + public void remoteAuthentication(String stationId, String userId,String sessionId) { // 查询数据平台站点是否可被遥控 Result projectR = projectClient.getProjectByPid(stationId); Assert.isTrue(projectR.isSuccess() && Func.isNotEmpty(projectR.getData()),() -> { @@ -84,7 +88,27 @@ public class AuthenticationService { } else if(ProjectRemoteTypeEnum.VALID.getCtrlType().equals(project.getCtrlType())) { // 运行发送遥控并且需要校验权限 - //remoteClient.sendCtrlCheckParam(); + R> ctrlAuthR = remoteClient.getCtrlAuth(Optional.ofNullable(userId).filter(StringUtil::isNotBlank).map(Long::parseLong).orElse(null)); + Assert.isTrue(ctrlAuthR.isSuccess(),() -> { + throw new ServiceException("该站点未设置鉴权用户,校验失败!"); + }); + List ctrlAuthList = ctrlAuthR.getData(); + Optional authOptional = ctrlAuthList.stream().filter(c -> c.getProjectId().equals(stationId)).findFirst(); + Assert.isTrue(authOptional.isPresent() && Func.isNotEmpty(authOptional.get().getIsLimitMachine()), () -> { + throw new ServiceException("该用户不存在相应站点权限,校验不通过!"); + }); + CtrlAuth ctrlAuth = authOptional.get(); + // 如限制机器发送遥控指令 + if(ctrlAuth.getIsLimitMachine().intValue() == 1) { + SessionContentVO sessionContent = (SessionContentVO) redisTemplate.opsForHash().get(RedisKeyConstants.SESSION_CONTENT_KEY, sessionId); + String machineCode = sessionContent.getMachineCode(); + Assert.isTrue(StringUtil.isNotBlank(machineCode) && Func.isNotEmpty(machineCode) ,() -> { + throw new ServiceException("获取问题机器码失败,校验不通过!"); + }); + Assert.isTrue(machineCode.equals(ctrlAuth.getMachineCode()),() -> { + throw new ServiceException("站点校验码校验失败,校验不通过!"); + }); + } } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index d322d1d..a27ef9a 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -196,18 +196,18 @@ public class InteractiveServiceImpl implements IInteractiveService { } @Override - public Boolean authentication(String stationId, String userId, String func) { + public Boolean authentication(String stationId, String userId, String func,String sessionId) { // 站点鉴权 if(StringUtil.isNotBlank(stationId)) { authenticationService.stationAuthentication(stationId,userId); } // 菜单鉴权 if(StringUtil.isNotBlank(func) && StringUtil.isNotBlank(userId)) { - authenticationService.menuAuthentication(stationId,userId,func); + authenticationService.menuAuthentication(userId,func); } // 遥控鉴权 if(FuncRouteEnum.CONFIRM_YK.getFuncCode().equals(func)) { - authenticationService.remoteAuthentication(stationId,userId,func); + authenticationService.remoteAuthentication(stationId,userId,sessionId); } return true; } From 05282c062e1dbe44e1febab7a83f4356c5bb1103 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 22 May 2024 15:12:09 +0800 Subject: [PATCH 24/35] =?UTF-8?q?add:=E9=81=A5=E6=8E=A7=E9=89=B4=E6=9D=83?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/InteractiveController.java | 4 +-- .../service/impl/AuthenticationService.java | 7 ++-- .../hzims/bigmodel/interactive/vo/DataItemVO.java | 39 ++++++++++++++++++++++ .../hnac/hzims/bigmodel/interactive/vo/DataVO.java | 28 ++++++++++++++++ 4 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java create mode 100644 hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java index 25de021..3c9788c 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java @@ -49,8 +49,8 @@ public class InteractiveController { public R authentication(@RequestParam(required = false) @ApiParam("站点编号") String stationId, @RequestParam @ApiParam("用户ID") String userId, @RequestParam(required = false) @ApiParam("菜单ID") String func, - @RequestParam(required = false) @ApiParam("会话ID")String sessionId) { - return R.status(interactiveService.authentication(stationId,userId,func,sessionId)); + @RequestParam(required = false) @ApiParam("会话ID")String askId) { + return R.status(interactiveService.authentication(stationId,userId,func,askId)); } @ApiOperation("获取问答sessionId") diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java index 1960da9..f836450 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java @@ -1,5 +1,6 @@ package com.hnac.hzims.bigmodel.interactive.service.impl; +import com.google.common.collect.Lists; import com.hnac.hzims.bigmodel.entity.FunctionEntity; import com.hnac.hzims.bigmodel.function.service.IFunctionService; import com.hnac.hzims.bigmodel.interactive.constants.ProjectRemoteTypeEnum; @@ -77,11 +78,11 @@ public class AuthenticationService { */ public void remoteAuthentication(String stationId, String userId,String sessionId) { // 查询数据平台站点是否可被遥控 - Result projectR = projectClient.getProjectByPid(stationId); - Assert.isTrue(projectR.isSuccess() && Func.isNotEmpty(projectR.getData()),() -> { + Result> projectR = projectClient.getProjectIds(Lists.newArrayList(stationId)); + Assert.isTrue(projectR.isSuccess() && CollectionUtil.isNotEmpty(projectR.getData()) && projectR.getData().size() == 1,() -> { throw new ServiceException("未查询到站点,鉴权失败!"); }); - ProjectVO project = projectR.getData(); + ProjectVO project = projectR.getData().get(0); if(ProjectRemoteTypeEnum.NOT_ALLOW.getCtrlType().equals(project.getCtrlType())) { // 不允许发送遥控 throw new ServiceException("该站点不允许发送遥控指令,校验失败!"); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java new file mode 100644 index 0000000..914f25b --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataItemVO.java @@ -0,0 +1,39 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author: huangxing + * @Date: 2024/05/22 10:20 + */ +@Data +public class DataItemVO implements Serializable { + + private String name; + + @JSONField(name = "id") + private String attrId; + + @JSONField(name = "param_name") + private String attrName; + + @JSONField(name = "device_name") + private String deviceName; + + @JSONField(name = "device_id") + private String deviceId; + + @JSONField(name = "station_id") + private String projectId; + + @JSONField(name = "station_name") + private String projectName; + + private String signage; + + private String units; + +} diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java new file mode 100644 index 0000000..a94a2bc --- /dev/null +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java @@ -0,0 +1,28 @@ +package com.hnac.hzims.bigmodel.interactive.vo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Map; + +/** + * @Author: huangxing + * @Date: 2024/05/22 10:28 + */ +@Data +public class DataVO implements Serializable { + + /**数据查询类型:实时、历史**/ + private String type; + + private String startTime; + + private String endTime; + + /**包括:"其它"、"最大值"、"最小值"、"总和值"、"平均值"**/ + private String method; + + /**实时数据结果集**/ + private Map real; + +} From eede11fea92d6ac28bcafac85e11401638cd5872 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 22 May 2024 15:27:37 +0800 Subject: [PATCH 25/35] =?UTF-8?q?#=E4=B8=8B=E5=8F=91=E9=81=A5=E6=8E=A7?= =?UTF-8?q?=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interactive/controller/InteractiveController.java | 11 ++++++++++- .../bigmodel/interactive/service/IInteractiveService.java | 3 +++ .../interactive/service/impl/InteractiveServiceImpl.java | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java index 3c9788c..a80b2aa 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/controller/InteractiveController.java @@ -1,5 +1,6 @@ package com.hnac.hzims.bigmodel.interactive.controller; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.hzims.bigmodel.BigModelConstants; @@ -12,9 +13,12 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import org.springblade.core.tool.api.R; +import org.springblade.system.dto.ControlDTO; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; /** * @Author: huangxing @@ -67,5 +71,10 @@ public class InteractiveController { return R.data(interactiveService.removeSessionId(sessionId)); } - + @ApiOperation("下发遥控指令") + @ApiOperationSupport(order = 6) + @PostMapping("/sendRemoteControl") + public R sendRemoteControl(@RequestBody ControlDTO operate) { + return R.data(interactiveService.sendRemoteControl(operate)); + } } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java index 8ace8cc..34c0a4f 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/IInteractiveService.java @@ -3,6 +3,7 @@ package com.hnac.hzims.bigmodel.interactive.service; import com.hnac.hzims.bigmodel.interactive.req.ModelFunctionReq; import com.hnac.hzims.bigmodel.interactive.vo.AnswerVO; import org.springblade.core.tool.api.R; +import org.springblade.system.dto.ControlDTO; import java.util.List; import java.util.Map; @@ -40,4 +41,6 @@ public interface IInteractiveService { * @return 发起结果 */ R knowledgeAsk(String question, String sessionId, String userId, String knowledge); + + Object sendRemoteControl(ControlDTO operate); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java index a27ef9a..0395fd4 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/InteractiveServiceImpl.java @@ -24,8 +24,10 @@ import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.dto.ControlDTO; import org.springblade.system.dto.DeptStationDTO; import org.springblade.system.feign.IDeptClient; +import org.springblade.system.feign.IRemoteClient; import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; @@ -50,6 +52,8 @@ public class InteractiveServiceImpl implements IInteractiveService { private final BladeLogger logger; + private final IRemoteClient remoteClient; + private final IJumpPageService jumpPageService; private final IParamsService paramsService; @@ -263,4 +267,14 @@ public class InteractiveServiceImpl implements IInteractiveService { this.addQuestionSessionId(sessionId); return R.success("消息发送成功"); } + + /** + * 下发遥控指令 + * @param operate + * @return + */ + @Override + public Object sendRemoteControl(ControlDTO operate) { + return remoteClient.sendCtrl(operate); + } } From 69cacf370a2478c6ce657ce9181e7ffd818f271f Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 22 May 2024 16:27:59 +0800 Subject: [PATCH 26/35] =?UTF-8?q?add:=E9=81=A5=E6=8E=A7=E9=89=B4=E6=9D=83?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bigmodel/interactive/constants/FuncRouteEnum.java | 1 + .../service/impl/ExtraResolveStrategyService.java | 15 +++++++++++++++ .../com/hnac/hzims/bigmodel/interactive/vo/DataVO.java | 3 +++ 3 files changed, 19 insertions(+) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java index 46887e8..4b1d359 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java @@ -20,6 +20,7 @@ public enum FuncRouteEnum { CHOOSE_CANVAS("choose_canvas","选择画面",null), CHOOSE_FAULT("choose_fault","选择故障",null), CONFIRM_YK("confirm_yk","遥控确认", FunctionConstants.TypeEnum.PARAMS), + SHOW_PARAM("show_param","设备参数查询", FunctionConstants.TypeEnum.PARAMS), ; @Getter private String funcCode; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java index a9c63a6..bcda8cb 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java @@ -69,6 +69,8 @@ public class ExtraResolveStrategyService { return this.resolveChooseFault(extra); case CONFIRM_YK: return this.resolveConfirmRemote(extra); + case SHOW_PARAM: + return this.resolveShowParam(extra); default: break; } @@ -77,6 +79,17 @@ public class ExtraResolveStrategyService { return JSONObject.parseObject(JSON.toJSONString(extra),ExtraVO.class); } + private ExtraVO resolveShowParam(Map extra) { + ExtraVO result = new ExtraVO(); + result.setFuncCode(FuncRouteEnum.SHOW_PARAM.getFuncCode()); + result.setType(FuncRouteEnum.SHOW_PARAM.getType().getType()); + Map param = new HashMap(1); + DataVO data = JSONObject.parseObject(JSON.toJSONString(extra.get("data")),DataVO.class); + param.put("data", data); + result.setParams(param); + return result; + } + private ExtraVO resolveConfirmRemote(Map extra) { ExtraVO result = new ExtraVO(); RemoteParamVO remoteParam = JSONObject.parseObject(JSON.toJSONString(extra.get("data")), RemoteParamVO.class); @@ -86,6 +99,8 @@ public class ExtraResolveStrategyService { if(funcVOR.isSuccess()) { Map param = new HashMap(1); param.put("control",funcVOR.getData()); + param.put("deviceName",remoteParam.getDeviceName()); + param.put("projectName",remoteParam.getProjectName()); param.put("value",remoteParam.getValue()); result.setParams(param); } diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java index a94a2bc..97dfe29 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java @@ -1,5 +1,6 @@ package com.hnac.hzims.bigmodel.interactive.vo; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; import java.io.Serializable; @@ -15,8 +16,10 @@ public class DataVO implements Serializable { /**数据查询类型:实时、历史**/ private String type; + @JSONField(name = "time_begin") private String startTime; + @JSONField(name = "time_end") private String endTime; /**包括:"其它"、"最大值"、"最小值"、"总和值"、"平均值"**/ From 5ff72180306f71d5793a1324986a773be27abf4b Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 23 May 2024 08:34:44 +0800 Subject: [PATCH 27/35] =?UTF-8?q?#=E5=91=8A=E8=AD=A6=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=99=90=E5=88=B61=E5=A4=A9=E4=B8=8D=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=8A=A5=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitor/service/impl/AlarmSaveServiceImpl.java | 54 ++++++++++++++-------- .../alarm/show/service/AlarmHandleService.java | 4 ++ .../show/service/impl/AlarmHandleServiceImpl.java | 18 ++++++++ .../alarm/show/service/impl/AlarmServiceImpl.java | 8 ++-- .../bigmodel/interactive/vo/RemoteParamVO.java | 2 +- 5 files changed, 62 insertions(+), 24 deletions(-) diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java index 15564c3..3bdfb4a 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/monitor/service/impl/AlarmSaveServiceImpl.java @@ -6,6 +6,7 @@ import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.entity.AlarmEntity; import com.hnac.hzims.alarm.monitor.service.AlarmSaveService; +import com.hnac.hzims.alarm.show.service.AlarmHandleService; import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.config.vo.AlarmHandleMarkVo; import com.hnac.hzims.message.entity.MessagePushRecordEntity; @@ -21,6 +22,7 @@ import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -35,6 +37,8 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { private final AlarmService alarmService; + private final AlarmHandleService handleService; + private final AlarmConfigService alarmConfigService; private final IStationClient stationClient; @@ -49,41 +53,55 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { @Override public Boolean save(List alarms) { // 步骤1.查询告警数据对应站点 - R> result = stationClient.querySatationByCodes(alarms.stream().map(AlarmEntity::getStationId).collect(Collectors.toList())); - if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){ + R> stations = stationClient.querySatationByCodes(alarms.stream().map(AlarmEntity::getStationId).collect(Collectors.toList())); + if(!stations.isSuccess() || CollectionUtil.isEmpty(stations.getData())){ log.error("alarm_query_station_is_null : {}",alarms.stream().map(AlarmEntity::getAlarmId).collect(Collectors.toList())); return false; } + // 步骤2.查询当天处理的告警 + List handlers = handleService.sameDayContent(); + // 步骤3.查询延后未完成的告警 + List delays = handleService.incompleteContent(); + // 步骤4.近5分钟内告警 Set keys = stringRedisTemplate.keys("hzims:queue:filter:alarm" + "*"); - // 步骤2.遍历保存告警数据 + // 步骤5.遍历保存告警数据 alarms.forEach(alarm->{ - List stations = result.getData().stream().filter(o->o.getCode().equals(alarm.getStationId())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(stations)){ + // 未匹配到站点 + Optional optional = stations.getData().stream().filter(o->o.getCode().equals(alarm.getStationId())).findFirst(); + if(!optional.isPresent()){ return; } - // 根据最近5分钟的数据,做去重 + // 告警已处理 + if(handlers.contains(alarm.getAlarmContext())){ + return; + } + // 告警已延后处理 + if(delays.contains(alarm.getAlarmContext())){ + return; + } + // 近5分钟内告警重复 for (String key : keys) { String value = stringRedisTemplate.opsForValue().get(key); - if (value.equals(stations.get(0).getName()+alarm.getAlarmContext())){ + if (value.equals(optional.get().getName()+alarm.getAlarmContext())){ return; } } - // fpd告警拼接 + // fpd告警拼接站点名称 if(AlarmConstants.EARLY_WARNING.equals(alarm.getAlarmSource())){ - alarm.setAlarmContext(stations.get(0).getName() + "." + alarm.getAlarmContext()); + alarm.setAlarmContext(optional.get().getName() + "." + alarm.getAlarmContext()); } - // 步骤3.站点参数设置 - alarm.setCreateDept(stations.get(0).getCreateDept()); - alarm.setStationName(stations.get(0).getName()); - alarm.setTenantId(stations.get(0).getTenantId()); + // 站点参数设置 + alarm.setCreateDept(optional.get().getCreateDept()); + alarm.setStationName(optional.get().getName()); + alarm.setTenantId(optional.get().getTenantId()); alarm.setStatus(0); - // 步骤4.根据站点查询配置标识 + // 根据站点查询配置标识 AlarmHandleMarkVo mark = alarmConfigService.mark(alarm.getStationId(),alarm.getAlarmSource(),alarm.getAlarmType()); if(ObjectUtil.isEmpty(mark)){ log.error("alarm_obtain_mark_is_null : {}",alarm.getAlarmId()); return; } - // 步骤5.告警处理标识赋值 + // 告警处理标识赋值 alarm.setIsRightTabulation(mark.getIsRightTabulation()); alarm.setIsBroadcast(mark.getIsBroadcast()); alarm.setIsMask(mark.getIsMask()); @@ -92,16 +110,16 @@ public class AlarmSaveServiceImpl implements AlarmSaveService { alarm.setIsSmallBell(mark.getIsSmallBell()); alarm.setIsShortMessage(mark.getIsShortMessage()); alarm.setIsWxMessage(mark.getIsWxMessage()); - // 步骤6.保存当日告警数据 + // 保存告警 boolean isSave = alarmService.save(alarm); if(!isSave){ log.error("alarm_save_fail : {}",alarm.getAlarmId()); return; } String key="hzims:queue:filter:alarm"+alarm.getAlarmId(); - stringRedisTemplate.opsForValue().set(key,stations.get(0).getName()+alarm.getAlarmContext()); + stringRedisTemplate.opsForValue().set(key,optional.get().getName()+alarm.getAlarmContext()); stringRedisTemplate.expire(key,5, TimeUnit.MINUTES); - // 步骤7.发生数据至redis告警队列 + // 发送告警数据进行消息推送队列 stringRedisTemplate.opsForList().rightPush("hzims:queue:alarm", JSON.toJSONString(alarm)); }); return true; diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java index e196455..f4af51c 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/AlarmHandleService.java @@ -25,4 +25,8 @@ public interface AlarmHandleService extends BaseService { List handleUser(); List handles(); + + List sameDayContent(); + + List incompleteContent(); } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java index 7fd7cb4..b53128a 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmHandleServiceImpl.java @@ -170,4 +170,22 @@ public class AlarmHandleServiceImpl extends BaseServiceImpl sameDayContent() { + return null; + } + + /** + * 查询未到延后期限告警的内容 + * @return + */ + @Override + public List incompleteContent() { + return null; + } } diff --git a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java index 2b769ec..1e3838e 100644 --- a/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java +++ b/hzims-service/hzims-alarm/src/main/java/com/hnac/hzims/alarm/show/service/impl/AlarmServiceImpl.java @@ -3,15 +3,15 @@ package com.hnac.hzims.alarm.show.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import com.hnac.hzims.alarm.config.service.AlarmConfigService; import com.hnac.hzims.alarm.config.constants.AlarmConstants; import com.hnac.hzims.alarm.config.entity.AlarmEntity; +import com.hnac.hzims.alarm.config.service.AlarmConfigService; +import com.hnac.hzims.alarm.config.vo.AlarmCountVo; +import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo; import com.hnac.hzims.alarm.show.mapper.AlarmMapper; import com.hnac.hzims.alarm.show.service.AlarmHandleService; import com.hnac.hzims.alarm.show.service.AlarmService; import com.hnac.hzims.alarm.source.service.MessageService; -import com.hnac.hzims.alarm.config.vo.AlarmCountVo; -import com.hnac.hzims.alarm.config.vo.ChildAlarmCountVo; import com.hnac.hzims.equipment.entity.EmInfoEntity; import com.hnac.hzims.equipment.entity.EmVideoBandingEntity; import com.hnac.hzims.equipment.feign.IEmInfoClient; @@ -20,10 +20,8 @@ import com.hnac.hzims.message.dto.MailMessageDTO; import com.hnac.hzims.message.fegin.IMessageClient; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.feign.IStationClient; -import com.hnac.hzinfo.sdk.v5.device.DeviceDataClient; import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; -import com.hnac.hzinfo.sdk.v5.project.ProjectClient; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteParamVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteParamVO.java index 3bcf351..f9661f6 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteParamVO.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/RemoteParamVO.java @@ -21,7 +21,7 @@ public class RemoteParamVO implements Serializable { private String remoteName; @JSONField(name = "device_id") - private String deviceCode; + private String deviceId; @JSONField(name = "device_name") private String deviceName; From 135011776156ea2c4937dacb6e69242eba0e384f Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 14 May 2024 11:01:12 +0800 Subject: [PATCH 28/35] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E6=96=87=E4=BB=B6=E7=9A=84=E8=B6=85=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E6=9C=89=E5=A4=9A=E4=B8=AA=E6=97=B6=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/RehearsalRecordServiceImpl.java | 5 ++++- .../java/com/hnac/hzims/safeproduct/utils/BaseUtil.java | 14 ++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java index 55aaf12..2b9b50c 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java @@ -161,7 +161,10 @@ public class RehearsalRecordServiceImpl extends ServiceImpl iterator = p.getRuns().iterator(); - while (iterator.hasNext()) { - XWPFRun r = iterator.next(); - String text = r.getText(0); + for (int index = 0; index < p.getRuns().size(); index++) { + XWPFRun run = p.getRuns().get(index); + String text = run.getText(0); if (findText.equals(text)) { - r.setText("", 0); // 清除原有文本 - XWPFParagraph paragraph = r.getParagraph(); + run.setText("", 0); // 清除原有文本 + XWPFParagraph paragraph = run.getParagraph(); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); String name = jsonObject.getString("name"); String url = jsonObject.getString("url"); - url = URLEncoder.encode(url, "UTF-8"); String id = paragraph.getDocument().getPackagePart().addExternalRelationship(url, XWPFRelation.HYPERLINK.getRelation()).getId(); CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); cLink.setId(id); @@ -148,7 +146,7 @@ public class BaseUtil { CTR ctr = CTR.Factory.newInstance(); ctr.setTArray(new CTText[]{ctText}); cLink.setRArray(new CTR[]{ctr}); - if (i Date: Tue, 14 May 2024 11:51:54 +0800 Subject: [PATCH 29/35] =?UTF-8?q?fix:=20=E8=B6=85=E9=93=BE=E6=8E=A5url?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=A0=BC=E5=BC=8F=E5=8C=96=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java index 1340d78..7a4cbca 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java @@ -138,7 +138,12 @@ public class BaseUtil { JSONObject jsonObject = jsonArray.getJSONObject(i); String name = jsonObject.getString("name"); String url = jsonObject.getString("url"); - String id = paragraph.getDocument().getPackagePart().addExternalRelationship(url, XWPFRelation.HYPERLINK.getRelation()).getId(); + // url编码格式化 + String encodeName = URLEncoder.encode(name, "UTF-8").replaceAll("\\+", "%20"); + String prefixString = url.substring(0, url.lastIndexOf("/") + 1); + String encodeUrl = prefixString + encodeName; + String id = paragraph.getDocument().getPackagePart().addExternalRelationship(encodeUrl, + XWPFRelation.HYPERLINK.getRelation()).getId(); CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); cLink.setId(id); CTText ctText = CTText.Factory.newInstance(); From ecd2ed1a7c4babc57616860e13bd435af747de04 Mon Sep 17 00:00:00 2001 From: liwen Date: Thu, 16 May 2024 10:55:42 +0800 Subject: [PATCH 30/35] =?UTF-8?q?update:=20=E5=AF=BC=E5=87=BA=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/safeproduct/utils/BaseUtil.java | 56 +++++++++++----------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java index 7a4cbca..3c84c29 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java @@ -119,14 +119,13 @@ public class BaseUtil { XWPFDocument xwpfDocument = null; try { xwpfDocument = WordExportUtil.exportWord07(templatePath, params); - if (StringUtils.isNotEmpty(findName)) { + if (findName != null && !findName.isEmpty()) { String findText = params.get(findName).toString(); - if (StringUtils.isNotEmpty(findText)) { + if (findText != null && !findText.isEmpty()) { JSONArray jsonArray = new JSONArray(findText); for (XWPFTable table : xwpfDocument.getTables()) { - for (int row = 0; row < table.getNumberOfRows(); row++) { - for (int col = 0; col < table.getRow(row).getTableCells().size(); col++) { - XWPFTableCell cell = table.getRow(row).getCell(col); + for (XWPFTableRow row : table.getRows()) { + for (XWPFTableCell cell : row.getTableCells()) { for (XWPFParagraph p : cell.getParagraphs()) { for (int index = 0; index < p.getRuns().size(); index++) { XWPFRun run = p.getRuns().get(index); @@ -134,27 +133,7 @@ public class BaseUtil { if (findText.equals(text)) { run.setText("", 0); // 清除原有文本 XWPFParagraph paragraph = run.getParagraph(); - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - String name = jsonObject.getString("name"); - String url = jsonObject.getString("url"); - // url编码格式化 - String encodeName = URLEncoder.encode(name, "UTF-8").replaceAll("\\+", "%20"); - String prefixString = url.substring(0, url.lastIndexOf("/") + 1); - String encodeUrl = prefixString + encodeName; - String id = paragraph.getDocument().getPackagePart().addExternalRelationship(encodeUrl, - XWPFRelation.HYPERLINK.getRelation()).getId(); - CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); - cLink.setId(id); - CTText ctText = CTText.Factory.newInstance(); - ctText.setStringValue(name); - CTR ctr = CTR.Factory.newInstance(); - ctr.setTArray(new CTText[]{ctText}); - cLink.setRArray(new CTR[]{ctr}); - if (i < jsonArray.length() - 1) { - paragraph.createRun().addBreak(); - } - } + insertJsonArrayIntoParagraph(jsonArray, paragraph); } } } @@ -167,12 +146,35 @@ public class BaseUtil { formatHygieneRecordTable(xwpfDocument); } } catch (Exception e) { - log.error("数据写入异常: {}",e.getCause().toString()+ e.getStackTrace()); e.printStackTrace(); } return xwpfDocument; } + + private static void insertJsonArrayIntoParagraph(JSONArray jsonArray, XWPFParagraph paragraph) throws IOException { + for (int i = 0; i < jsonArray.length(); i++) { + JSONObject jsonObject = jsonArray.getJSONObject(i); + String name = jsonObject.getString("name"); + String url = jsonObject.getString("url"); + // URL编码格式化 + String encodeName = URLEncoder.encode(name, "UTF-8").replaceAll("\\+", "%20"); + String prefixString = url.substring(0, url.lastIndexOf("/") + 1); + String encodeUrl = prefixString + encodeName; + String id = paragraph.getDocument().getPackagePart().addExternalRelationship(encodeUrl, + XWPFRelation.HYPERLINK.getRelation()).getId(); + CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); + cLink.setId(id); + CTText ctText = CTText.Factory.newInstance(); + ctText.setStringValue(name); + CTR ctr = CTR.Factory.newInstance(); + ctr.setTArray(new CTText[]{ctText}); + cLink.setRArray(new CTR[]{ctr}); + if (i < jsonArray.length() - 1) { + paragraph.createRun().addBreak(); + } + } + } /** * 卫生自查表格式处理 * @param xwpfDocument word文件类 From 1d74620316fef3b2346c1e33b189a29ad54a19cd Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 20 May 2024 16:00:36 +0800 Subject: [PATCH 31/35] =?UTF-8?q?update:=20=E8=80=83=E8=AF=95=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=B7=BB=E5=8A=A0=E5=8F=8A=E6=A0=BC=E5=88=86=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java | 9 ++++++++- .../main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java | 8 +++++--- .../hzims/safeproduct/service/impl/TestScoreServiceImpl.java | 5 +++-- hzims-service/safeproduct/src/main/resources/db/2.0.1.sql | 6 +++++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java index 17e5119..27ae3d7 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java @@ -9,6 +9,8 @@ import lombok.EqualsAndHashCode; import org.springblade.core.mp.base.BaseEntity; import org.springframework.format.annotation.DateTimeFormat; +import javax.validation.constraints.Max; +import javax.validation.constraints.Min; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import java.util.Date; @@ -59,6 +61,12 @@ public class TestEntity extends BaseEntity { private Date testEndTime; @NotNull + @Min(value = 0, message = "及格分必须大于等于0") + @Max(value = 100, message = "及格分必须小于等于100") + @ApiModelProperty("及格分") + private Integer passingScore; + + @NotNull @Size(max = 255, message = "考试地点字段长度不能超过255") @ApiModelProperty("考试地点") private String location; @@ -77,7 +85,6 @@ public class TestEntity extends BaseEntity { @ApiModelProperty("参考人员") private String peopleName; - @Size(max = 1000, message = "考试图片字段长度不能超过1000") @ApiModelProperty("考试图片") private String imgPath; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java index 518ebb5..7d89726 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TestScoreSumVO.java @@ -13,12 +13,14 @@ import lombok.Data; public class TestScoreSumVO { @ApiModelProperty("应考人数") - private Integer peopleNum=0; + private Integer peopleNum = 0; @ApiModelProperty("实考人数") - private Integer actualPeopleNum=0; + private Integer actualPeopleNum = 0; @ApiModelProperty("及格率") - private Double percentage=0.0; + private Double percentage = 0.0; + @ApiModelProperty("及格分") + private Integer passingScore; } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java index 6145b38..ca24f67 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java @@ -126,6 +126,7 @@ public class TestScoreServiceImpl extends ServiceImpl s.getScore() != null).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(list)) { testScoreSumVO.setActualPeopleNum(list.size()); - List passCollect = list.stream().filter(s -> s.getScore() > 60).collect(Collectors.toList()); + List passCollect = list.stream().filter(s -> s.getScore() > testEntity.getPassingScore()).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(list)&&CollectionUtils.isNotEmpty(passCollect)) { double result = BigDecimal.valueOf(passCollect.size()).divide(BigDecimal.valueOf(list.size()),2, RoundingMode.UP).doubleValue(); testScoreSumVO.setPercentage(result); - }else { + } else { testScoreSumVO.setPercentage(0.0); } } diff --git a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql index b1296e1..3730612 100644 --- a/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql +++ b/hzims-service/safeproduct/src/main/resources/db/2.0.1.sql @@ -40,4 +40,8 @@ CREATE TABLE IF NOT EXISTS `hzims_hygiene_template_detail` ( `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态', `is_deleted` int(2) NOT NULL DEFAULT '0' COMMENT '逻辑删除状态:0-未删除,1-删除', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='卫生自查模板详情表'; \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='卫生自查模板详情表'; + +-- 添加考试及格分字段 +ALTER TABLE hzims_test + ADD COLUMN passing_score int(10) NOT NULL DEFAULT 60 COMMENT '考试及格分'; \ No newline at end of file From e3c3a4edbc11f5fd467dfacf077717457f655a96 Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 20 May 2024 16:55:37 +0800 Subject: [PATCH 32/35] =?UTF-8?q?update:=20=E5=9F=B9=E8=AE=AD=E3=80=81?= =?UTF-8?q?=E6=BC=94=E7=BB=83=E7=9A=84=E6=9C=88=E5=BA=A6=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=82=B9=E5=87=BB=E6=9F=A5=E7=9C=8B=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=95=B0=E6=8D=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/safeproduct/controller/RehearsalController.java | 3 ++- .../java/com/hnac/hzims/safeproduct/controller/TrainController.java | 3 ++- .../main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml | 3 +++ .../hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java | 6 +++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java index ae78443..14cdc89 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java @@ -82,7 +82,8 @@ public class RehearsalController extends BladeController { @ApiImplicitParams({ @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "rehearsalStatus", value = "演练状态", dataType = "query", paramType = "string") }) @ApiOperation(value = "演练计划分页") @ApiOperationSupport(order = 5) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java index 57ef4ba..7eda44c 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java @@ -91,7 +91,8 @@ public class TrainController extends BladeController { @ApiImplicitParams({ @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "trainStatus", value = "培训计划状态", dataType = "query", paramType = "string") }) @ApiOperation(value = "培训计划分页") @ApiOperationSupport(order = 5) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml index a9ca3f6..19ef188 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml @@ -87,6 +87,9 @@ AND scheduled_end_time <= #{param.endTime} + + AND train_status = #{param.trainStatus} + ORDER BY create_time DESC diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java index 1714714..9cd63ef 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java @@ -275,7 +275,8 @@ public class RehearsalPlanServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); String unit = String.valueOf(param.get("unit")); String startTime = String.valueOf(param.get("scheduledStartTime")); - String endTime = String.valueOf((param.get("scheduledEndTime"))); + String endTime = String.valueOf(param.get("scheduledEndTime")); + String rehearsalStatus = String.valueOf(param.get("rehearsalStatus")); if (!unit.equals("null") && !unit.equals("")) { queryWrapper.lambda().like(RehearsalPlanEntity::getUnit, unit); } @@ -285,6 +286,9 @@ public class RehearsalPlanServiceImpl extends ServiceImpl Date: Tue, 21 May 2024 21:44:04 +0800 Subject: [PATCH 33/35] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E6=96=87=E4=BB=B6=E6=97=A0=E5=9B=BE=E7=89=87=E6=97=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/vo/RehearsalRecordDetailImgVO.java | 16 ++++++++ .../safeproduct/vo/RehearsalRecordDetailStrVO.java | 15 +++++++ .../safeproduct/vo/RehearsalRecordDetailVO.java | 3 -- .../service/impl/RehearsalRecordServiceImpl.java | 43 ++++++++++++--------- .../com/hnac/hzims/safeproduct/utils/BaseUtil.java | 33 ++++++++++++++++ .../main/resources/template/演练记录表.docx | Bin 12341 -> 12368 bytes 6 files changed, 89 insertions(+), 21 deletions(-) create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java create mode 100644 hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java new file mode 100644 index 0000000..abb312d --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailImgVO.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.safeproduct.vo; + +import cn.afterturn.easypoi.entity.ImageEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel(value = "演练记录表VO类") +public class RehearsalRecordDetailImgVO extends RehearsalRecordDetailVO{ + + @ApiModelProperty("图片列表") + private List images; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java new file mode 100644 index 0000000..2a7c8bf --- /dev/null +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailStrVO.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.safeproduct.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel(value = "演练记录表VO类") +public class RehearsalRecordDetailStrVO extends RehearsalRecordDetailVO{ + + @ApiModelProperty("图片列表") + private List images; +} diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java index e1d414f..545065f 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalRecordDetailVO.java @@ -55,9 +55,6 @@ public class RehearsalRecordDetailVO { @ApiModelProperty("演练科目") private String subject; - @ApiModelProperty("图片列表") - private List images; - @ApiModelProperty("年份") private String year; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java index 2b9b50c..4018a62 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java @@ -19,10 +19,13 @@ import com.hnac.hzims.safeproduct.mapper.RehearsalRecordMapper; import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.utils.TimeUtils; +import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailImgVO; +import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailStrVO; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import com.hnac.hzims.safeproduct.vo.RehearsalRecordlVO; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.support.Query; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -150,23 +153,6 @@ public class RehearsalRecordServiceImpl extends ServiceImpl list = new ArrayList<>(); - if (StringUtils.isNotEmpty(rehearsalRecordDetailVO.getImgPath())) { - String[] imgArr = rehearsalRecordDetailVO.getImgPath().split(","); - for (String img : imgArr) { - ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath + - BaseUtil.downloadFileByUrl(img, savePath)), 180, 150); - list.add(imageEntity); - } - } else { - // 添加空的ImageEntity,防止数据填入时显示"{{" - ImageEntity imageEntity = new ImageEntity(); - // 设置空字符串,防止空指针报错 - imageEntity.setUrl(""); - list.add(imageEntity); - } - rehearsalRecordDetailVO.setImages(list); // 记录:换行符使用\r\n String standardRecord = rehearsalRecordDetailVO.getRecord().replaceAll("\n", "\r\n"); rehearsalRecordDetailVO.setRecord(standardRecord); @@ -186,7 +172,28 @@ public class RehearsalRecordServiceImpl extends ServiceImpl params = BaseUtil.obj2Map(rehearsalRecordDetailVO); + // 图片 + Map params; + if (StringUtils.isNotEmpty(rehearsalRecordDetailVO.getImgPath())) { + List list = new ArrayList<>(); + RehearsalRecordDetailImgVO imgVO = new RehearsalRecordDetailImgVO(); + BeanUtils.copyProperties(rehearsalRecordDetailVO, imgVO); + String[] imgArr = rehearsalRecordDetailVO.getImgPath().split(","); + for (String img : imgArr) { + ImageEntity imageEntity = new ImageEntity(BaseUtil.imgToByte(savePath + + BaseUtil.downloadFileByUrl(img, savePath)), 180, 150); + list.add(imageEntity); + } + imgVO.setImages(list); + params = BaseUtil.obj2Map(imgVO); + } else { + List list = new ArrayList<>(); + list.add(""); + RehearsalRecordDetailStrVO strVO = new RehearsalRecordDetailStrVO(); + BeanUtils.copyProperties(rehearsalRecordDetailVO, strVO); + strVO.setImages(list); + params = BaseUtil.obj2Map(strVO); + } String templateFile = "template/演练记录表" + SafeProductConstant.DOCX_SUFFIX; String wordPath = savePath + "/演练记录表" + SafeProductConstant.DOCX_SUFFIX; String pdfPath = savePath + "/演练记录表" + SafeProductConstant.PDF_SUFFIX; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java index 3c84c29..da74c7f 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java @@ -119,6 +119,7 @@ public class BaseUtil { XWPFDocument xwpfDocument = null; try { xwpfDocument = WordExportUtil.exportWord07(templatePath, params); + // 超链接处理 if (findName != null && !findName.isEmpty()) { String findText = params.get(findName).toString(); if (findText != null && !findText.isEmpty()) { @@ -142,6 +143,7 @@ public class BaseUtil { } } } + // 表格处理 if (templatePath.equals("template/卫生自查表.docx")) { formatHygieneRecordTable(xwpfDocument); } @@ -151,6 +153,36 @@ public class BaseUtil { return xwpfDocument; } + /** + * 车辆检查表格式处理 + * @param xwpfDocument word文件类 + */ + private static void formatCarCheckRecordTable(XWPFDocument xwpfDocument) { + // 获取文档中所有的表格 + List tableList = xwpfDocument.getTables(); + if (tableList.size() > 0) { + // 循环表格 + for (XWPFTable table : tableList) { + // 获取表格所有行数 + List rows = table.getRows(); + // 第五行到倒数第三行为需合并区域 + for (int row = 5; row < rows.size() - 2;) { + XWPFTableCell startCell = rows.get(row).getCell(0); + String startText = startCell.getText(); + int index = row + 1; + for (; index < rows.size(); index++) { + XWPFTableCell endCell = rows.get(index).getCell(0); + String endText = endCell.getText(); + if (!startText.equals(endText)) { + break; + } + } + mergeCellsVertically(table, 0, row, index - 1); + row = index; + } + } + } + } private static void insertJsonArrayIntoParagraph(JSONArray jsonArray, XWPFParagraph paragraph) throws IOException { for (int i = 0; i < jsonArray.length(); i++) { @@ -175,6 +207,7 @@ public class BaseUtil { } } } + /** * 卫生自查表格式处理 * @param xwpfDocument word文件类 diff --git a/hzims-service/safeproduct/src/main/resources/template/演练记录表.docx b/hzims-service/safeproduct/src/main/resources/template/演练记录表.docx index c83a99c9bb39ebd1d1ae7ced45cd96bb4028312e..38209f5d8c5c03de5ceb57815dc08da24b9aaf6b 100644 GIT binary patch delta 5126 zcmZ9QWmwdGv&U&%y1Tm@0cq)GLApaix|_d%ES*b82olmEwSXYHAT8an#DW4M-Oai0 z^Wu4~bLRJEUd&uG*UY^5eLrosleX#NAo#Gyx-%*YN=Swr6<{!`+b2ZS&3ZxzK1?8; zIsa4-2A#kAXkZwsoYUgLN3zn4|K^DyuJpNO=fTgRt&>#b<6_$sr8#Gt`HztNeqx>y zw`ziYAfHlrYM0m$4_BCn z^dWjHcIj0ZH*gG2njpyL6dN7DNMkTc39uJ{oGke~{(f>ZcbnSr^O_re_Z^RCUwc%x zIaf}%V17ABL4dFB29hE z;D1*D{fWv27$|@t{_%jH|-3a>F&ih^xSmdnTvcMb=8Ajjvi>T)+q z6{ZEYDinB+bRbPzy!t=c;UzI0RrU6AS%C@oTY~NYNRs^*9q+NW(1bT`@|c3Mtids= ztF^}*D#oCG6xsoO1*l)%n$WmYUeJFe%24B*I8rA9p#MTB0e>| z7wh_ZR79h-`bdubYCAgUK*TdDgb0k{*cBM|+s8jbw767+{g0Wpi}s*jrqfnZa{3P4 zk=29I14W0!9PIu!{OLB>O|}m#ot7vik6UJ;PGqtIzp$Y0tzLWZ`r=bKEk*yDTS~Vb zJIe#Wbz3?FYxsqm2F{%{XRZI=@rLR36+qR|d7d%vN3<~BxU@q<(K&z(`X7#=^#%&z zcrqn4tCw$bqbmn-1frbX>z6|(HOn`+@JyW-OokuI)r6OESMifN1vuvsmBcB1&nLg@5!_2sgXq)T)W}Hox@d3NoU+(=rL`yfk;Tv9{o4>PAUSOb5+{}%V+)S$ z#*rx8LYqn4eoej27Rm8Tg4zGe{7vo>_P1 zF(Es^Y1-qHH%+iup`oX~tgtK zX${O9{|%r0TkWVNQrDoYEBV%qS+ow>h&TsC_<~f{bd+-(bWF0q5xY__deb%Z$zO3D^@kbtA)6)(4OJFyk=_8;CQcAKBZi4Zeyys-W!Ey(50A26 zH}yr9dxP{T`+{6sl?Z{F#cBN&_8SvZ>=vXfx4?q_ba+)j$tg+ur)BL zcA#c-kcNWQxp9iDN%6$=Pm-CZ&A$LCJ{<3QY_`V zY(o=FaQROM3U_9)3=^*O;c1x_HVLz0aQBQY40U|o(-@xSteQe(Ut9V)CQBdRi{Sxp zIH6jC$$iT56LNdg4^C>8b@iK(<)#xiyVo&^U6+ZnEsi;u8Pn}&KCNI0^8|1{>-(Ea zs2@y3lLxv9w#dd5{Yl!4VwkK=n6F&=mZe}uB7e_gI4i$&mE>N#LUM^4G8bsiVFaRZ z=N9HSG$z(OyjCMPb8q_O_Mjk!SCC0rsW+L}o&|M#DPa-OSHiWgyI#zU6Z-+s-6^N{!ishq?n4KPtq(|p$C8I@U`pPKZh z=Ovod_{VnMH?pETEbJ5tvE_qFGs&yP){dbWb`+ zPhK&HOB>lt`uIJjosJ1n{>T6uJWYpE!}Zx0rN1#AS`3U7y%)}(;07!s%*eO(QZ6pb zYAh=n?P$XL4L+pqu#aKv8>ggwVvf_>yiG6n|e%^X;r|NbqP{|zBK zc5pMgu)6B&ysjpFwElbG=8_}}Wp^t*?SVrvJnIBM>NuK=v0mkgZ7}EF19_40%X{t}{f+2{@W zHPSmr-wt_Y_*e=)Lv-|~Zs`y;gJl(LT+bdN*H0k143bb#Gv~=iOwiYA+4#MJ3r!2E zU>6~e;Z#z5x{0DTrUuz2dQKN5qO3|Qr^)s^pIw{VZ3qYU1CYbh(X^r_;4AoAhO%EE zUy?swJ{~=6GSf|v3Zr4G%{3`}h2S7(?PSw-V`ud-h z2GT)(5p)U2i`Jq0djSkPGVGR)PwTgy8;i*DPjV3xX(hl4(fY|P^y5!1OT!r!Z;6(S z5UI$VvEiS~x`6T6A0lU74IgLEwH)uxmMP7{iY$ri#P87PLe?bvxwosHm{oY9&tp~* zD6b`#hPtU(ng!;XrE&_OYxznr1LWB0pQ=%r#`ybZUKQQVusCtEvB?3t({6Ld-=A$; zAPtFgr5T&YaxyU+sDV#>DZOjlvUeGfi9}z@)y)~)c;NVOt2bHCpmC$=qWJ(4q)JmE z1jRiQf4MC=QL8rkCT4&_RGNWW82`!Onuq(T?zwJ?6g$=vp7A3*0YuU9H^#0i^}7+H zu2_3XCnrsJC$HR*@)>PDP>P9<-;;P*#=oyH%(V_L^-6{GP$VbFYBbVrE`DJ$(%>>d z;Om)Ykdn9%EfVfQ1jWLkd3eP=zt*0xp&1x7&}42<3lTXO3v`vMP8bD3L8*eip``&< zJZT3nzA8LLEe0i&D}zOddAuD5h0`%qe~YE{drPrNtgV{u6SU=kP+bd{K>18U(})c+ z55~mv;bEop-i!~8O>B39q2rc0UB3)i7GN(Mw^cURwtcq||GaDyuQ1QoX^@P*dzg_; zy&3u5O5NY<2iV2<*n$bHPV+~?IyJk%nd{1OWyZzceDiP#ef+XWY!d;~!m=!Ae> zuej?lw&quUYyNJ0ALY*H97@!JTSs~$=U9>TcAwGevEND44+dPzwOYCDIhn4|Kq9s9 zUD&CKBBwLa4W7;^k+Xchx7jw`?WvN*((Nzl$&* zeJ|~cTOxR=4U~U;#ukRT+Mq@!Pi@+iP@!Pd z_yOxxEVX31PcE&YgFHFR4egtu6_$d*#7m}ym(TGskr?AGZGo%bvRh-bzJ4EiGge)# zf-5eha@U1UGU+I(*eaSVdDcLrn;EzzX`K?|GIvSNssXl%_==M@z-UH3;b}#7bjQa= zPq|I8K%3ps16D+9f<*;Et?B82E^l5>i|>rc+6NRGcBS#m!G(vzS=`kXwva~}TM}=x zDJoq5v!P4N_d$r}ywSI3@z0SWUuIx5!SXoq_z`oCN&*KbrR#xI*y$7xFZ^#~daa}* zfBFBRRk_P4erj6WF=`reJq|)h49n4Ox)0zk`2{x{OV0+Zvyd?UFn_%O$eJ0q(Hys0 zqYGCTXcci16`y>C{7J_8H3WqZjbi9D#_CcwRTDl1y~q9PAX?BSE|v20plw@Kbmy|J zo%SMhe8nPIkKpCinD`jtS>u|qe;jLP-8N zImy5+$3_rC_Q^4RzLPF3Fs4)94`+l7-GBgSruyXb&4#_C6*LPE6&;xUp+(AAC;|P} zP$2r|-zagm0B>o=g^0my!Sc=kUr{@pmpyFl;)3ey{iv09i(UIK9vsP@SFMT7DpyyK zY;>bZ)nB>GZk*KmXelyQQ1>Wb;ly5LOCu^K9WdK1eC-Ps)c3>4$*8a}e zm8=_;M`IGYC!h&Tws;I^@G8*b?L# zXU~Oq$Rjixg0Z0JYbq=&Q97$rjaS7ox5z(V35yxl$TRmvswQUI#S4le?fabgW`@{C zU-kX`tQ~M9)$+5SDniQct^L+7qzUKKtzWGOO_WCp106txIt8QnWW&njdzDuO_D3k2 z505%3RdkG#a4p!kgUAG~5W^f&WyleoMExO(K7zsvsp=7{WmctJR_EtAK$y^FVer13vIv^K?k{6LT|K~WVxC6PJfh7t`?~}(J5pw2*%cF=t}2Eo zn-A>YQ0%=_X6rR$LW@tW_Yq}p2ODR@gL*Sj?59mBb8xV@9?F|TeXsjZnVDjkGWOpSI4$P=pJccxNp;xm)O0Amh!0z@86jjh3nmJl3~~);Yt6A_2eX z)L)Q7q}f09l6r4WN~$AesbSx#YoaIoezzt0+3@jP-kT@9m=AC*>gAG8lxQuM%ZWwQ zBd;CIl}5l7%005@^hL~{49rbndNX}ar?{+x+TAEW3dhI^+S3&cJBxenPJRgziu{PH z10+Bk1qr!sH(?>HgUNJVp9NTQmsn(Zm2@ffa!}EQpT{D8(U97_8n|X*J>%#--I-U? zpW|8(XngNywr4+RBP$tt9ikfivpUJ{bgtE=f8!H;v^p!V)75a9`{j$bj#=>?USK&} ztCm>$!Lfq$t1giPrflwjNV})_qQN6Z1^~F7I;ni(?iC$-ybvoud&WSzDJcpxy*s2Y z=j1ZoRHUb%aoQbrx0UwH+@JJ06ZNGWWk=zk$}%$*lf@pxF*~mGHQ2}-mcwRpDb|dH zz4hUcaaQ`W^gXeTjGp28VHFy7CEDxIgYWLw62k3_E^S7xm_5SX-KbJwk*~dU3cPXY zcjqbti|u!-c|Bxy>UPwu%PB5Eln+`OaPxcjP(rn} zvexOnSoS9^L+TW?5wzSM9qq*~zE^EkcD)@{NnKT(e}6=2Q{3pP7IC`INa{rTRch3v zS~7?9a3?bA&YI>SYHHCSvF&^MK%ciQY)|XRc~bS+qH)2;Kw`04{Ld@QZ6*E|kY0gz zoS3{eEf%KY041)5f@$K6kxG5U*TUJS;cf}bGJdMT#=s1Ev@k^GY9#(X#~%oDbPvI|K+H zIdi|W6K_x=)4)~VdfIuAtE53AGfWUE<;K#gHvG(M8e;@Ib zkioZi*d=|`X~$iiZ34R9nCm)>1nse1=}^ooT6{Ze;!Cm)L`{MgP)(l9=-@kW&F%O> ziGhV~u#=gkDl{3ck>&As`jhy6z5K6D1F-Mpgx<&*QYIvvKJ5iXgp<|{_*K_c4!3iKpx8oOSa10LZQ_3btemxZ delta 5085 zcmZ8lXD}QL*R`x3C9K{edaq&C1ks{L?}X^RWQEv8^v)uBiPedyk6we-g2)Q1TQz!# zUf$>V-XG6=@1OhQ&Ye4V&YZb(&Y84nvPphM7&$5cvH@UW`K8Fy!cuxY`h>|}9;RQD z=^e!6z2H_JjE?lFG-FqkdOB(vjr!K?_HpHKSKLsowsU`M1XIRT-y-4f1+a@qJr$1e zrVUxI1f7VJK?bC=BSZZ)Gpda!Hdjg9S_+fM?CsLU!RW%thzOA!ItfPERnF)7h z*W-Fwky1kAgcTS)n3o9;)Z>M8+8bE~FaIYR+-!^Zk(O(FYxfLhyh|r@6Kkb%!W_8b zZ4RW{L2>#+B|anyof;B*zzj~HKh7MVzF92cZ@g6FG2w&TJTu=yWKQyZiDY{(7u`Ei zP2=aAFH#hxjA%Xsve|dOJuJD_Z&XJvP)@T|36T3qqRG1UVA?b;sFR0-hisgVPA`;^ z*pkSi0=~SdizV^*+}hj&$@vvbS%y;TVAlgU3qdDe4gaNgeU_@avo4i1SX>>Sp`M`v z9&HfGf0MhZ5f-Wb?V=4AD$%!y4tiA5?Yb;@ho`H70|a4VVG&?OX|KKLRx|~@{u}%E z*jQMP|L(%k09M$K*QV;cfZwsN)Ig!Lrss`K(RoM-tsv}o{Bz!&`5)P}l*rZihaPUm z|8h*7)86W(uGWuGf1E%-)Dx}9+n_zw@58LEw<0Th9D!Q+Rbq)rjiZ5e;W1K*_R`CKTJT-K>aXYe zOvYWq^BZ%`O}}AwicykkZK*|F!y(Yp`kLW zJV9@(?9$mgXj%T5LFpAAfLjCMG%sQs8kDR+Vl(uPYs1?wxFNTgpYvE*%}H%YgQDS> zgKb@^m&@1)(hXoXjTk2_IE+gAYjB$7*(tL1G%nDO5BJ1nxgE+E3|?$~(4vVFai7+r z%X{=A56g6VxzFfXP}&rbY_$2hm4A-r|HC}>RWTT@jl)Y|J9p#o{A8*W9)iOO!ycaK_C!PmIH;m<2khVKS!8 zaS*b1m!;wR*E!_!mbK)m3JFO=9k7Uq=oelA zDg+k`tB(Y3LB;{o`MN<&s*eV^WuJv3NDz6`lD5RU$s9@SLmb`r)gJ(&EmC>sgmueH zkS4zFnZ_i2%G66Dju~|Hqk%vz${)9l6eq@eGpQ+RvGHD(rh6KFJ@~z-jLk|^ z#@!bQ0`Ga=_fWp*t@x%7C3f8dbK&MhSE`pRlBevT1*c*|9@7$|Au~KW)+GhE* z>a$kN48KtU35}mnKoo_Dc$9mmUBg20r1M3>(P}V=$oKF`$9U&yrvi?U7-!MRm*9o) z@Ju{eC(U7c8cm^Nmm=k*>{DGk;q;bp3TT@6-77>Xp+g)a*9#X@rsw5s8WkgSOV-5d z)=xyoJ{P+^lKcSs`>N&2I~ET?c^cU%Wq;dy*3^PFT|UiblQp2vQ~(%P2w_uW>bt?= zw+@TRSNW2STM8ypWD{d$@!YMqiF~g}Z4;X^Yz0>X>Av;7R?+XQ$$YKfXdYHD4CIm- z_=-*(FR$zg6W}N{9C1+`V0u8>778@`)v!cII_n>=oe>5eXZZMNZ97zXf18SZ(y7*32`AzkiiQX7j>dK;0FHCLGJmP7?CH0|lk@fNN5$M{c`haL#jgVDB zKvx8X@zx_VQF}5(Cl1kakKD9Ce8VnJKJ)TLx86+WxB)Ank*+6^tbl!NCe=zH|5?6* zUW?Tvjp*hM7m^}E#KOOiCEzFnCp_opa{sl-fv+eVZ6z>n>!Lq+)C5H-rgAC;i>MOX z?Yph0gGyD8zP+X|?KS2{9S4~G(CqO+UFy=;Kd^Vf?Avp=6uO`9Pky-i+8&hccKBIH z=wj-23L7P-iF_S?oLtSLoPM16%4VFfoiidW zcLT@4LV-6o(DlLqbSN-?%i^j5M#|n5n>(48%a*tw#qBr96wUHPJO|8#bR)+*FU$%p z>tYpuhnKj_`q4s&V44uC%DoQ=3dGQ@x6_4KOKY+aRjt8_Yh!#@wtO6;u8uh!44 zVISyheNWowKNiW?nxnh42IIp{!t#mbk2NH=viKP?B5Wr%TPmO%0Vf$xOhUH39^EwY zNDO2kol}o69xVGPc>46|30sHH3EGS>t|mXQMr!DkJ~*xa)tFfuuTh*)Y(M+}7{)by z*C0-GGjx`wL}HDNI&T>mk|bWGNg@_IQfm-bof$oU6X=Mr^$=|phOv;_C!Tgd9jYb1 zBi}gi$*5@dcZ1~FE1y@9xCk5A9!=PwSaLIMLffTiBd-Z8##hyR&9j3Ly<)AKr-|a- zC0D9ulRs9JN*O(DUDZ{tNR51h#Lt>+G}G8SJ!05);|;iq%w9>#+A6;)RIvG6#n3f* zME6$o!|i3@1IynJIt7QOfsM)x55|cOXbB_4!m5P*R~tY)ee8woJ?;G6-+K572DrQJ zGg*4htDM}0+~bEHHnW>&FctZvNITOP3WQ0!v&2y~rOqZ>gjr;H193Wcnb4mFNPGWa zNOx8P$)c9@(NUkHeyYQ?+_)ar9L_&JWo&&XS*-`()j^-$Squq0XIHNX}`whB(Z1;~sjTn+qo3{RwD za3V7NgLYOkObcbAlWY}1UFdtab8gF^?6LU&@IUequJ zA)*><5SxT~AfFhMXfEMPr^XDR6fBl;uL`{=4w;=a(!%y}PNKPM?gtk(ZvQHpW&wGi zkJ-vJtcB3cx3`OL3XBKX%chpSm!I6YMHkcQ*iWnuTkPxp3Wlo%lKZCTUBK+kP;Ncb zfh0c>c%Ni-gyk_o3Da~~_7m{$$kA}k+6Zl$iVCs^NG5R&Tjn@An^9%++|0K)%Qt9d zJ|R$UYhR#)OQvXkGuzQ4+}M*(Ufm8&e*I?eZh=samAPreVRvO=m zC9n&o+?Gii4Y-unA}&kVgmIp%t?aYDg7z&JvQu;iTyi&IQ}GpYKGFluD93)2}Q7 zg1@{V-NiA71l+nTyrw0vwv$gH*GZh1r(WCkStn=gybq>y3+O4_f`!m`Ru&NZ6YS#V z?`TB5{OSLpa!~6QN~AsCCT24CUgM8JBN>~19*AN+UOq-b=HyVD{azJvHanBn6L+w; z;sv}v>%6+=kuSO*k!jzV+B%~zwF?qQm$A!&!GTB9PU`?te0=<&WvI{X(I~t>DSzSN zczeoN=l;%`l`EnV7Jj^HQ?d@Mq!vpKFdeb6;OlUOW?KK1@`+)CgCERvZHycZk7rB10f^k3 zCt2ifkG5|n61%Uib|jyVQ_radweG5~LU;hfuKJjW!uRC3xHFkT*pj;`tig#Ybb;X_ zY`9ix43tv}FgJPj0}plY)cgQ#Md9E%8qrOyY)e=ZD~7?Lg%>R^|vV=PU084J(hgTIGYmlGeZYS#vN zBk$tth!m225$^?-^>~NN#|N4*Ds0ZfmI4)K)29g*uwBShVvew-=x;(ngXl$IoaR?G z{v!iKP+eL|3320uaP4=V9`}WJZz1!+$0&@dwY`Cw%9rorH;&-FN0uW$NozXEvo`9D z&XBr748Q1o5`8#M_KOaW9`U9BXs-{>W|GjiqLp(v!F{sj_QkIyf-#%-_G~|i3l^Ac zD-Y^ahl$QGMo^KG{^E>vVBOu4gDN z5g&Tm90+B;=ScD#LN=N|{?x8G)woeTk-a}Ux`dr3B|U%8d7R}uQ(JZgdU2cy8p^t% z(V$&YfQE%}F#ohIvW+Yl!*0fK<}gWn+$Sy!oKu9PJB{%3x5?oz5}BTrog;e08g3Yq z3+;HX+Hp07SEXcrjAI+^y_(tyU0#-Jg*-2o-8Ao!kj(kyL;V$Q_}HK#w{O=B)K)Ub zV-B+-uE`{OD;^t}M^-+rV_y83G$qD^b8#HeE@0kf-q|I{>qEuEZ)ec1x8H4>--EG+ zO10fUiqX@CVq+5NCG(}C^tfrbg28c_jS$mv7rmiyLOmKXJ)M~toIL(>8M@&7Xe~#2B#jixMDH=VY9ks3R1qab{0|i>j?J&)| z-M3$NV?hdm-WLMc-Rv2rNzI}i2HFi{$FHQ3Z&nq4l<5t8!&APlJtq7;5G7rU=VFP_ zUQ{O<`t7qc@tUar5-8^1r{yoC=M@~IsJh*ja-)-fd$cta^)Tv`P$DXppmP*andtf< zEDOh(oGH_W#PPSiNpS`e$YSDu#nJmUzMOS z*TSsZ-)F1tr@1c?aw;2a3UZ=$g<5n@aziDOD<*r7k}OS#NeGnltQe6UOvo>v^s)-O zTYPZg)&223g)Gt?qy zcMCet>(_n>PWDw=*Zo8Lv4MMjrbNSa)(nOmC|O%CEa(=Ph@#v$_Lto=Y0T0J)H&>v z!JuN4p6NtYF{$>=zvHz@6Wr%xnQ=(EfU{m5{; z${pYp+n2;Z`j;*9%r3U-IbBG2dqsaFffs-j zI9N~=-~)FR1Osy52tgr+|5bMXF3^V`2+9M1Z~-9>hJS7OfA!zLQ}S?kA$dR}yjn;W bdmjY1Fx From 3bba4b39efa78f8afbabd3576f24af7727efdad0 Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 21 May 2024 21:45:55 +0800 Subject: [PATCH 34/35] =?UTF-8?q?update:=20=E8=80=83=E8=AF=95=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E5=8F=8A=E6=A0=BC=E5=88=86=E8=AE=BE=E7=BD=AE=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/safeproduct/entity/TestEntity.java | 10 +++++----- .../hzims/safeproduct/service/impl/TestScoreServiceImpl.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java index 27ae3d7..0235e18 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java @@ -60,11 +60,11 @@ public class TestEntity extends BaseEntity { @ApiModelProperty("考试结束时间") private Date testEndTime; - @NotNull - @Min(value = 0, message = "及格分必须大于等于0") - @Max(value = 100, message = "及格分必须小于等于100") - @ApiModelProperty("及格分") - private Integer passingScore; +// @NotNull +// @Min(value = 0, message = "及格分必须大于等于0") +// @Max(value = 100, message = "及格分必须小于等于100") +// @ApiModelProperty("及格分") +// private Integer passingScore; @NotNull @Size(max = 255, message = "考试地点字段长度不能超过255") diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java index ca24f67..a075bb2 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestScoreServiceImpl.java @@ -126,7 +126,7 @@ public class TestScoreServiceImpl extends ServiceImpl s.getScore() != null).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(list)) { testScoreSumVO.setActualPeopleNum(list.size()); - List passCollect = list.stream().filter(s -> s.getScore() > testEntity.getPassingScore()).collect(Collectors.toList()); + List passCollect = list.stream().filter(s -> s.getScore() > 60).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(list)&&CollectionUtils.isNotEmpty(passCollect)) { double result = BigDecimal.valueOf(passCollect.size()).divide(BigDecimal.valueOf(list.size()),2, RoundingMode.UP).doubleValue(); testScoreSumVO.setPercentage(result); From 31a420395eea82c9662ecfec370d7765eddd8218 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Thu, 23 May 2024 09:29:09 +0800 Subject: [PATCH 35/35] =?UTF-8?q?add:=E9=81=A5=E6=8E=A7=E9=89=B4=E6=9D=83?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/bigmodel/interactive/service/impl/AuthenticationService.java | 3 +++ .../src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java index f836450..f34088b 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/AuthenticationService.java @@ -102,6 +102,9 @@ public class AuthenticationService { // 如限制机器发送遥控指令 if(ctrlAuth.getIsLimitMachine().intValue() == 1) { SessionContentVO sessionContent = (SessionContentVO) redisTemplate.opsForHash().get(RedisKeyConstants.SESSION_CONTENT_KEY, sessionId); + Assert.isTrue(Func.isNotEmpty(sessionContent),() -> { + throw new ServiceException("获取问题机器码失败,校验不通过!"); + }); String machineCode = sessionContent.getMachineCode(); Assert.isTrue(StringUtil.isNotBlank(machineCode) && Func.isNotEmpty(machineCode) ,() -> { throw new ServiceException("获取问题机器码失败,校验不通过!"); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java index 97dfe29..d3ea096 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/vo/DataVO.java @@ -28,4 +28,6 @@ public class DataVO implements Serializable { /**实时数据结果集**/ private Map real; + private DataItemVO item; + }