diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLedgerFeignClient.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLedgerFeignClient.java index f45e921..f259a6d 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLedgerFeignClient.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/CsLedgerFeignClient.java @@ -3,6 +3,7 @@ package com.njcn.csdevice.api; import com.njcn.common.pojo.constant.ServerInfo; import com.njcn.common.pojo.response.HttpResult; import com.njcn.csdevice.api.fallback.CsLedgerFeignClientFallbackFactory; +import com.njcn.csdevice.pojo.dto.LineParamDTO; import com.njcn.csdevice.pojo.param.CsLedgerParam; import com.njcn.csdevice.pojo.po.CsLedger; import org.springframework.cloud.openfeign.FeignClient; @@ -11,6 +12,8 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; +import java.util.List; + /** * @author xy */ @@ -23,4 +26,8 @@ public interface CsLedgerFeignClient { @PostMapping("/add") HttpResult add(@RequestBody @Validated CsLedgerParam csLedgerParam); -} + @PostMapping("/queryLine") + HttpResult> queryLine(@RequestBody @Validated LineParamDTO lineParamdto); + + + } diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLedgerFeignClientFallbackFactory.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLedgerFeignClientFallbackFactory.java index c653e22..4c26bdc 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLedgerFeignClientFallbackFactory.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/api/fallback/CsLedgerFeignClientFallbackFactory.java @@ -4,6 +4,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.response.HttpResult; import com.njcn.csdevice.api.CsLedgerFeignClient; +import com.njcn.csdevice.pojo.dto.LineParamDTO; import com.njcn.csdevice.pojo.param.CsLedgerParam; import com.njcn.csdevice.pojo.po.CsLedger; import com.njcn.csdevice.utils.CsDeviceEnumUtil; @@ -11,6 +12,8 @@ import feign.hystrix.FallbackFactory; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +import java.util.List; + /** * @author xy */ @@ -39,6 +42,12 @@ public class CsLedgerFeignClientFallbackFactory implements FallbackFactory> queryLine(LineParamDTO lineParamdto) { + log.error("{}异常,降级处理,异常为:{}","查询监测点",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } }; } } diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/enums/AlgorithmResponseEnum.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/enums/AlgorithmResponseEnum.java index 397deda..0e1050f 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/enums/AlgorithmResponseEnum.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/enums/AlgorithmResponseEnum.java @@ -32,8 +32,8 @@ public enum AlgorithmResponseEnum { CHIRLDREN_EXIST("A00513","工程下存在项目,不能删除"), CHIRLDREN2_EXIST("A00514","项目下存在设备,不能删除"), - DATA_ARRAY_MISSING("A00515","详细数据为空") - + DATA_ARRAY_MISSING("A00515","详细数据为空"), + UNKNOW_ROLE("A00515","角色无权限操作") ; diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/LineParamDTO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/LineParamDTO.java new file mode 100644 index 0000000..7c1f1c5 --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/dto/LineParamDTO.java @@ -0,0 +1,26 @@ +package com.njcn.csdevice.pojo.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * Description: + * Date: 2023/8/1 15:25【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Data +public class LineParamDTO { + @ApiModelProperty(value = "工程id") + private String engineerId; + + /** + * 项目Id + */ + @ApiModelProperty(value = "项目Id") + private String projectId; + + @ApiModelProperty(value = "设备id") + private String devId; +} diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/param/LinePostionParam.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/param/LinePostionParam.java new file mode 100644 index 0000000..61508ae --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/param/LinePostionParam.java @@ -0,0 +1,18 @@ +package com.njcn.csdevice.pojo.param; + +import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO; +import lombok.Data; + +import java.util.List; + +/** + * Description: + * Date: 2023/8/2 9:14【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +@Data +public class LinePostionParam { + private List pointList; +} diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/DevCountVO.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/DevCountVO.java index 090ac75..f4b544a 100644 --- a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/DevCountVO.java +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/pojo/vo/DevCountVO.java @@ -17,29 +17,39 @@ import java.util.List; @Data public class DevCountVO { - @ApiModelProperty(value = "工程id") - private String id; - @ApiModelProperty(value = "设备总数") - private Integer allDevCount; - private List allDevs; - @ApiModelProperty(value = "在线设备数") - private Integer onLineCount; + // + @ApiModelProperty(value = "设备在线总数") + private Integer onLineDevCount; private List onLineDevs; - @ApiModelProperty(value = "离线设备数") - private Integer offLineCount; + @ApiModelProperty(value = "设备离线总数") + private Integer offLineDevCount; private List offLineDevs; - @ApiModelProperty(value = "报警设备数") - private Integer alarmLineCount; - private List alarmLineDevs; - - @ApiModelProperty(value = "设备报警事件数") - private Integer alarmEventCount; - @ApiModelProperty(value = "稳态/暂态发生事件数") + @ApiModelProperty(value = "警告数") + private Integer alarmCount; + @ApiModelProperty(value = "事件数") private Integer eventCount; @ApiModelProperty(value = "项目数") private Integer projectCount; + @ApiModelProperty(value = "当前工程id") + private String currentId; + @ApiModelProperty(value = "当前工程设备在线总数") + private Integer currentOnLineDevCount; + private List currentOnLineDevs; + + @ApiModelProperty(value = "当前工程设备在线总数") + private Integer currentOffLineDevCount; + private List currentOffLineDevs; + + @ApiModelProperty(value = "警告数") + private Integer currentAlarmCount; + @ApiModelProperty(value = "事件数") + private Integer currentEventCount; + @ApiModelProperty(value = "项目数") + private Integer currentProjectCount; + + } diff --git a/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/utils/MqttTest.java b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/utils/MqttTest.java new file mode 100644 index 0000000..05cb3ec --- /dev/null +++ b/cs-device/cs-device-api/src/main/java/com/njcn/csdevice/utils/MqttTest.java @@ -0,0 +1,74 @@ +package com.njcn.csdevice.utils; + +import org.eclipse.paho.client.mqttv3.*; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +/** + * Description: + * Date: 2023/8/2 13:41【需求编号】 + * + * @author clam + * @version V1.0.0 + */ +public class MqttTest { + private static final String MQTT_BROKER = "tcp://192.168.1.13:1883"; + private static final String MQTT_TOPIC = "file/upload"; + private static final String FILE_PATH = "C:\\Users\\无名\\Desktop\\111.json"; // Replace with the path to your file + + public static void main(String[] args) { + MqttClient mqttClient = null; + try { + // Connect to the MQTT broker + mqttClient = new MqttClient(MQTT_BROKER, MqttClient.generateClientId()); + MqttConnectOptions connOpts = new MqttConnectOptions(); + connOpts.setUserName("t_user"); + connOpts.setPassword("njcnpqs".toCharArray()); + + mqttClient.connect(connOpts); + + // Read the file + File file = new File(FILE_PATH); + FileInputStream fis = new FileInputStream(file); + byte[] fileContent = new byte[(int) file.length()]; + fis.read(fileContent); + fis.close(); + + // Create a new MQTT message + MqttMessage message = new MqttMessage(fileContent); + + // Set QoS level and retain flag as per your requirement + message.setQos(1); +// message.setRetained(false); + + // Record the start time + long startTime = System.currentTimeMillis(); + + // Publish the message to the MQTT topic + mqttClient.publish(MQTT_TOPIC, message); + + // Record the end time + long endTime = System.currentTimeMillis(); + + System.out.println("File published successfully!"); + System.out.println("Time taken: " + (endTime - startTime) + " ms"); + } catch (MqttException | IOException e) { + e.printStackTrace(); + } finally { + // Disconnect from the MQTT broker + if (mqttClient != null && mqttClient.isConnected()) { + try { + mqttClient.disconnect(); + } catch (MqttException e) { + e.printStackTrace(); + } + } + } + } + +} diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/CsEquipmentTransferPOController.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/CsEquipmentTransferPOController.java index 1ba3d6d..a597cfa 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/CsEquipmentTransferPOController.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/CsEquipmentTransferPOController.java @@ -29,6 +29,7 @@ import java.util.List; @RequestMapping("/EquipmentTransfer") @Api(tags = " 设备转移、恢复") @AllArgsConstructor +@Deprecated public class CsEquipmentTransferPOController extends BaseController { private final CsEquipmentTransferPOService csEquipmentTransferPOService; diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/DeviceUserController.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/DeviceUserController.java index 98d81c0..651c970 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/DeviceUserController.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/equipment/DeviceUserController.java @@ -45,11 +45,11 @@ public class DeviceUserController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/share") @ApiOperation("设备扫码分享") - @ApiImplicitParam(name = "id", value = "设备id", required = true) - public HttpResult share(@RequestParam("id") String id){ + @ApiImplicitParam(name = "ids", value = "设备id集合", required = true) + public HttpResult share(@RequestParam("ids") List ids){ String methodDescribe = getMethodDescribe("share"); - Boolean flag = csDeviceUserPOService.share (id); + Boolean flag = csDeviceUserPOService.share (ids); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe); } @@ -83,11 +83,11 @@ public class DeviceUserController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/transfer") @ApiOperation("设备转移(直接扫码不用申请)") - @ApiImplicitParam(name = "eid", value = "设备Id", required = true) - public HttpResult transfer(@RequestParam("eid") String eid){ + @ApiImplicitParam(name = "ids", value = "设备Id集合", required = true) + public HttpResult transfer(@RequestParam("ids") List ids){ String methodDescribe = getMethodDescribe("transfer"); - Boolean flag = csDeviceUserPOService.transfer (eid); + Boolean flag = csDeviceUserPOService.transfer (ids); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe); } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/ledger/CsLedgerController.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/ledger/CsLedgerController.java index 1de3b31..3d6e45d 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/ledger/CsLedgerController.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/ledger/CsLedgerController.java @@ -6,6 +6,7 @@ import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.utils.HttpResultUtil; +import com.njcn.csdevice.pojo.dto.LineParamDTO; import com.njcn.csdevice.pojo.param.CsLedgerParam; import com.njcn.csdevice.pojo.po.CsLedger; import com.njcn.csdevice.pojo.vo.CsLedgerVO; @@ -114,5 +115,15 @@ public class CsLedgerController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/queryLine") + @ApiOperation("按条件查询监测点") + @ApiImplicitParam(name = "lineParamdto", value = "查询条件", required = true) + public HttpResult> queryLine(@RequestBody @Validated LineParamDTO lineParamdto){ + String methodDescribe = getMethodDescribe("queryLine"); + List list = csLedgerService.queryLine(lineParamdto); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); + } + } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/project/LineTopologyDiagramController.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/project/LineTopologyDiagramController.java index a29664c..eb39259 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/project/LineTopologyDiagramController.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/controller/project/LineTopologyDiagramController.java @@ -7,6 +7,7 @@ import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.utils.HttpResultUtil; import com.njcn.csdevice.pojo.param.AppLineTopologyDiagramAddParm; import com.njcn.csdevice.pojo.param.AppLineTopologyDiagramAuditParm; +import com.njcn.csdevice.pojo.param.LinePostionParam; import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO; import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO; import com.njcn.csdevice.service.AppLineTopologyDiagramService; @@ -33,7 +34,7 @@ import java.util.List; @Slf4j @RestController @RequestMapping("/lineTopologyDiagram") -@Api(tags = " 拓扑图-监测点") +@Api(tags = "拓扑图-监测点") @AllArgsConstructor public class LineTopologyDiagramController extends BaseController { @@ -83,4 +84,14 @@ public class LineTopologyDiagramController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/auditList") + @ApiOperation("批量修改监测点拓扑图关系") + @ApiImplicitParam(name = "list", value = "监测点拓扑图数据集", required = true) + public HttpResult auditList(@RequestBody LinePostionParam linePostionParam){ + String methodDescribe = getMethodDescribe("auditList"); + appLineTopologyDiagramService.auditList(linePostionParam.getPointList()); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/CsLedgerMapper.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/CsLedgerMapper.java index 50e117c..42db921 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/CsLedgerMapper.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/CsLedgerMapper.java @@ -1,8 +1,10 @@ package com.njcn.csdevice.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.njcn.csdevice.pojo.dto.LineParamDTO; import com.njcn.csdevice.pojo.po.CsLedger; import com.njcn.csdevice.pojo.vo.CsLedgerVO; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -18,4 +20,5 @@ public interface CsLedgerMapper extends BaseMapper { List getAll(); + List queryLine(@Param("lineParamdto") LineParamDTO lineParamdto); } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsLedgerMapper.xml b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsLedgerMapper.xml index 9978c15..3d98601 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsLedgerMapper.xml +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/mapper/mapping/CsLedgerMapper.xml @@ -2,7 +2,35 @@ - select id,pid,name,level,sort from @@ -11,4 +39,19 @@ state = 1 + + \ No newline at end of file diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/AppLineTopologyDiagramService.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/AppLineTopologyDiagramService.java index e42a570..ca2e8c1 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/AppLineTopologyDiagramService.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/AppLineTopologyDiagramService.java @@ -23,4 +23,6 @@ public interface AppLineTopologyDiagramService extends IService queryByTopoId(String id); + + void auditList(List list); } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsDeviceUserPOService.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsDeviceUserPOService.java index 2910757..2b40c4d 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsDeviceUserPOService.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsDeviceUserPOService.java @@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.njcn.csdevice.pojo.po.CsDeviceUserPO; import com.njcn.csdevice.pojo.vo.DevCountVO; +import java.util.List; + /** * * Description: @@ -17,13 +19,13 @@ public interface CsDeviceUserPOService extends IService{ Boolean add(String id); - Boolean share(String id); + Boolean share(List ids); DevCountVO devCount(String id); String isPrimaryUser(String deviceId); - Boolean transfer(String eid); + Boolean transfer( List ids); Boolean delete(String eid); diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEquipmentTransferPOService.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEquipmentTransferPOService.java index c2f9bc9..ba85d40 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEquipmentTransferPOService.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/CsEquipmentTransferPOService.java @@ -14,6 +14,7 @@ import java.util.List; * @author clam * @version V1.0.0 */ +@Deprecated public interface CsEquipmentTransferPOService extends IService{ /** diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/ICsLedgerService.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/ICsLedgerService.java index 97b9206..7aa86cc 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/ICsLedgerService.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/ICsLedgerService.java @@ -1,6 +1,7 @@ package com.njcn.csdevice.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.njcn.csdevice.pojo.dto.LineParamDTO; import com.njcn.csdevice.pojo.param.CsLedgerParam; import com.njcn.csdevice.pojo.po.CsLedger; import com.njcn.csdevice.pojo.vo.CsLedgerVO; @@ -68,4 +69,6 @@ public interface ICsLedgerService extends IService { CsLedger findDataById(String id); List getProjectTree(); + + List queryLine(LineParamDTO lineParamdto); } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/AppLineTopologyDiagramServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/AppLineTopologyDiagramServiceImpl.java index f75a5c7..3214c2b 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/AppLineTopologyDiagramServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/AppLineTopologyDiagramServiceImpl.java @@ -16,6 +16,7 @@ import com.njcn.csdevice.service.AppTopologyDiagramService; import com.njcn.csdevice.service.CsLinePOService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; @@ -62,4 +63,14 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl list) { + list.forEach(temp->{ + this.lambdaUpdate().eq(AppLineTopologyDiagramPO::getId,temp.getId()). + eq(AppLineTopologyDiagramPO::getLineId,temp.getLineId()).set(AppLineTopologyDiagramPO::getLat,temp.getLat()). + set(AppLineTopologyDiagramPO::getLng,temp.getLng()).update(); + }); + } } diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java index c7e7cd9..5ba878e 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/CsDeviceUserPOServiceImpl.java @@ -1,5 +1,6 @@ package com.njcn.csdevice.service.impl; +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; @@ -23,6 +24,7 @@ import com.njcn.csdevice.service.RoleEngineerDevService; import com.njcn.cswarn.api.CsEquipmentAlarmFeignClient; import com.njcn.cswarn.pojo.parm.CsEquipmentAlarmParm; import com.njcn.cswarn.pojo.vo.CsEquipmentAlarmVO; +import com.njcn.user.enums.AppRoleEnum; import com.njcn.web.utils.RequestUtil; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -50,7 +52,7 @@ import static java.util.Objects.*; public class CsDeviceUserPOServiceImpl extends ServiceImpl implements CsDeviceUserPOService{ private final ICsLedgerService iCsLedgerService; - private final CsEquipmentAlarmFeignClient csEquipmentAlarmFeignClient; +// private final CsEquipmentAlarmFeignClient csEquipmentAlarmFeignClient; private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper; private final RoleEngineerDevService roleEngineerDevService; @Override @@ -73,80 +75,117 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, id).eq(CsDeviceUserPO::getStatus,"1" ).list(); - if(CollectionUtils.isEmpty(list)){ - throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE); + public Boolean share(List ids) { + ids.stream().forEach(id->{ + List list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, id).eq(CsDeviceUserPO::getStatus,"1" ).list(); - } - String userIndex = RequestUtil.getUserIndex(); - CsDeviceUserPO one = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, id).eq(CsDeviceUserPO::getStatus,"1" ).eq(CsDeviceUserPO::getSubUserId,userIndex).one(); - if(!isNull(one)){ - throw new BusinessException(AlgorithmResponseEnum.REPEAT_SHARE); - } - CsDeviceUserPO csDeviceUserPO = list.get(0); - csDeviceUserPO.setSubUserId(userIndex); - boolean save = this.save(csDeviceUserPO); + if(CollectionUtils.isEmpty(list)){ + throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE); - return save; + } + String userIndex = RequestUtil.getUserIndex(); + String userRole = RequestUtil.getUserRole(); + List strings = JSONArray.parseArray(userRole, String.class); + if(CollectionUtils.isEmpty(strings)){ + throw new BusinessException(AlgorithmResponseEnum.UNKNOW_ROLE); + + } + userRole=strings.get(0); + //分享只能给vip用户分享 + if( + Objects.equals(userRole, AppRoleEnum.APP_VIP_USER.getCode()) + ){ + throw new BusinessException(AlgorithmResponseEnum.UNKNOW_ROLE); + + } + CsDeviceUserPO one = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, id).eq(CsDeviceUserPO::getStatus,"1" ).eq(CsDeviceUserPO::getSubUserId,userIndex).one(); + if(!isNull(one)){ + throw new BusinessException(AlgorithmResponseEnum.REPEAT_SHARE); + } + CsDeviceUserPO csDeviceUserPO = list.get(0); + csDeviceUserPO.setSubUserId(userIndex); + boolean save = this.save(csDeviceUserPO); + }); + + + return true; } @Override public DevCountVO devCount(String id) { + QueryWrapper queryWrapper = new QueryWrapper<>(); DevCountVO devCountVO = new DevCountVO(); + List device = roleEngineerDevService.getDevice(); + if(CollectionUtils.isEmpty(device)){ + devCountVO.setOnLineDevCount(0); + devCountVO.setOnLineDevs(new ArrayList<>()); + devCountVO.setOffLineDevCount(0); + devCountVO.setOffLineDevs(new ArrayList<>()); + }else { + queryWrapper.clear(); + queryWrapper.in("id",device); + + List csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper); + List collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList()); + List collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList()); + devCountVO.setOnLineDevCount(collect2.size()); + devCountVO.setOnLineDevs(collect2); + devCountVO.setOffLineDevCount(collect.size()); + devCountVO.setOffLineDevs(collect); + List roleProject = roleEngineerDevService.getRoleProject(); + devCountVO.setProjectCount(roleProject.size()); + } + List deviceTree = iCsLedgerService.getDeviceTree(); List collect1 = deviceTree.stream().filter(temp -> temp.getId().equals(id)).map(CsLedgerVO::getChildren).flatMap(Collection::stream).map(CsLedgerVO::getChildren).flatMap(Collection::stream).map(CsLedgerVO::getId).collect(Collectors.toList()); //求交集 device.retainAll(collect1); if(CollectionUtils.isEmpty(device)){ - devCountVO.setOnLineCount(0); - devCountVO.setOnLineDevs(new ArrayList<>()); - devCountVO.setOffLineCount(0); - devCountVO.setOffLineDevs(new ArrayList<>()); - - devCountVO.setAllDevCount(0); - devCountVO.setAllDevs(new ArrayList<>()); + devCountVO.setCurrentOnLineDevCount(0); + devCountVO.setCurrentOnLineDevs(new ArrayList<>()); + devCountVO.setCurrentOffLineDevCount(0); + devCountVO.setCurrentOffLineDevs(new ArrayList<>()); + devCountVO.setCurrentProjectCount(0); + devCountVO.setCurrentProjectCount(0); }else { - devCountVO.setAllDevCount(device.size()); - - QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.clear(); queryWrapper.in("id",device); List csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper); - devCountVO.setAllDevs(csEquipmentDeliveryPOS); List collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList()); List collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList()); - devCountVO.setOnLineCount(collect2.size()); - devCountVO.setOnLineDevs(collect2); - devCountVO.setOffLineCount(collect.size()); - devCountVO.setOffLineDevs(collect); - - + devCountVO.setCurrentOnLineDevCount(collect2.size()); + devCountVO.setCurrentOnLineDevs(collect2); + devCountVO.setCurrentOffLineDevCount(collect.size()); + devCountVO.setCurrentOffLineDevs(collect); + List list = iCsLedgerService.lambdaQuery().eq(CsLedger::getPid, id).eq(CsLedger::getState, 1).list(); + devCountVO.setCurrentProjectCount(list.size()); } - CsEquipmentAlarmParm csEquipmentAlarmPageParm = new CsEquipmentAlarmParm(); - csEquipmentAlarmPageParm.setEngineerId(id); - //未处理的 - csEquipmentAlarmPageParm.setDealFlag("0"); - //todo 后续添加时间条件 + //todo 后续添加警告数,事件数 + devCountVO.setEventCount(0); + devCountVO.setAlarmCount(0); + devCountVO.setCurrentEventCount(0); + devCountVO.setCurrentAlarmCount(0); + // csEquipmentAlarmPageParm.setStartTime(); // csEquipmentAlarmPageParam.setEndTime(); - List data = csEquipmentAlarmFeignClient.queryList(csEquipmentAlarmPageParm).getData(); - List devIds = data.stream().map(CsEquipmentAlarmVO::getEquipmentId).distinct().collect(Collectors.toList()); - devCountVO.setAlarmLineDevs(data); - devCountVO.setAlarmEventCount(data.size()); +// List data = csEquipmentAlarmFeignClient.queryList(csEquipmentAlarmPageParm).getData(); +// List devIds = data.stream().map(CsEquipmentAlarmVO::getEquipmentId).distinct().collect(Collectors.toList()); +// queryWrapper.clear(); +// queryWrapper.in("id",devIds); +// +// List csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper); +// +// devCountVO.setAlarmLineDevs(csEquipmentDeliveryPOS); +// devCountVO.setAlarmEventCount(devIds.size()); + - devCountVO.setId(id); - // - devCountVO.setEventCount(0); - devCountVO.setAlarmLineCount(data.size()); - //todo重寫 offLineCount AlarmLineCount - devCountVO.setOffLineCount(0); return devCountVO; } @@ -167,16 +206,20 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl ids) { String userIndex = RequestUtil.getUserIndex(); + ids.forEach(eid->{ + List list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).list(); + if(CollectionUtils.isEmpty(list)){ + throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE); + + } + this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).apply("primary_user_id=sub_user_id").set(CsDeviceUserPO::getPrimaryUserId,userIndex).set(CsDeviceUserPO::getSubUserId,userIndex).update(); + this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).apply("primary_user_id<>sub_user_id").set(CsDeviceUserPO::getPrimaryUserId,userIndex).update(); + + }); - List list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).list(); - if(CollectionUtils.isEmpty(list)){ - throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE); - } - this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).apply("primary_user_id=sub_user_id").set(CsDeviceUserPO::getPrimaryUserId,userIndex).set(CsDeviceUserPO::getSubUserId,userIndex).update(); - this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).apply("primary_user_id<>sub_user_id").set(CsDeviceUserPO::getPrimaryUserId,userIndex).update(); return true; @@ -196,6 +239,10 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl implements CsEquipmentTransferPOService{ private final CsDeviceUserPOService csDeviceUserPOService; @@ -79,7 +80,7 @@ public class CsEquipmentTransferPOServiceImpl extends ServiceImpl i return engineeringList; } + @Override + public List queryLine(LineParamDTO lineParamdto) { + List lineIds = this.getBaseMapper().queryLine(lineParamdto); + return lineIds; + } + /** * 获取子节点 */ diff --git a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/RoleEngineerDevServiceImpl.java b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/RoleEngineerDevServiceImpl.java index 73268bd..f389968 100644 --- a/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/RoleEngineerDevServiceImpl.java +++ b/cs-device/cs-device-boot/src/main/java/com/njcn/csdevice/service/impl/RoleEngineerDevServiceImpl.java @@ -50,9 +50,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService { QueryWrapper csLedgerQueryWrapper = new QueryWrapper<>(); List collect = new ArrayList<>(); - if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())|| - - Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){ + if(Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){ csDeviceUserPOQueryWrapper.clear(); csEngineeringUserPOQueryWrapper.clear(); csLedgerQueryWrapper.clear(); @@ -81,7 +79,8 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService { return collect; } - } else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())) { + } else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())|| + Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) { QueryWrapper csMarketDataQueryWrapper = new QueryWrapper<>(); csMarketDataQueryWrapper.eq("user_id", userIndex); List csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper); @@ -113,7 +112,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService { QueryWrapper csLedgerQueryWrapper = new QueryWrapper<>(); List collect = new ArrayList<>(); - if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())|| + if( Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){ csDeviceUserPOQueryWrapper.clear(); csEngineeringUserPOQueryWrapper.clear(); @@ -130,7 +129,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService { return collect1; } - else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())) { + else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) { QueryWrapper csMarketDataQueryWrapper = new QueryWrapper<>(); csMarketDataQueryWrapper.eq("user_id", userIndex); List csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper); @@ -149,8 +148,6 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService { collect = csLedgers1.stream().map(CsLedger::getId).collect(Collectors.toList()); - - } else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) { diff --git a/cs-warn/cs-warn-api/src/main/java/com/njcn/cswarn/pojo/parm/CsStatLimitRatePageParm.java b/cs-warn/cs-warn-api/src/main/java/com/njcn/cswarn/pojo/parm/CsStatLimitRatePageParm.java index 0d4149d..273ecd7 100644 --- a/cs-warn/cs-warn-api/src/main/java/com/njcn/cswarn/pojo/parm/CsStatLimitRatePageParm.java +++ b/cs-warn/cs-warn-api/src/main/java/com/njcn/cswarn/pojo/parm/CsStatLimitRatePageParm.java @@ -27,12 +27,21 @@ public class CsStatLimitRatePageParm { @ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true) private Integer pageSize; + + @ApiModelProperty(value = "工程id") + private String engineerId; + /** * 项目Id */ @ApiModelProperty(value = "项目Id") private String projectId; + @ApiModelProperty(value = "设备id") + private String devId; + + @ApiModelProperty(value = "监测点id") + private String lineId; /** * 开始时间 */ diff --git a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/CsEventDetailPOMapper.java b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/CsEventDetailPOMapper.java index df692c2..e7ef0c4 100644 --- a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/CsEventDetailPOMapper.java +++ b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/CsEventDetailPOMapper.java @@ -18,5 +18,5 @@ import java.util.List; */ public interface CsEventDetailPOMapper extends BaseMapper { - Page queryPage(Page returnpage, @Param("csEventDetailPageParm") CsEventDetailParm.CsEventDetailPageParm csEventDetailPageParm); + Page queryPage(Page returnpage, @Param("lineIds") List lineIds); } \ No newline at end of file diff --git a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/CsStatLimitRateDPOMapper.java b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/CsStatLimitRateDPOMapper.java index 0ed6798..9a7419f 100644 --- a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/CsStatLimitRateDPOMapper.java +++ b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/CsStatLimitRateDPOMapper.java @@ -7,6 +7,8 @@ import com.njcn.cswarn.pojo.po.CsStatLimitRateDPO; import com.njcn.cswarn.pojo.vo.CsStatLimitRateDVO; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * * Description: @@ -16,5 +18,5 @@ import org.apache.ibatis.annotations.Param; * @version V1.0.0 */ public interface CsStatLimitRateDPOMapper extends BaseMapper { - Page queryPage(Page returnpage, @Param("csStatLimitRatePageParm") CsStatLimitRatePageParm csStatLimitRatePageParm); + Page queryPage(Page returnpage, @Param("lineIds") List lineIds); } \ No newline at end of file diff --git a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/mapping/CsEventDetailPOMapper.xml b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/mapping/CsEventDetailPOMapper.xml index 8c5272e..d103919 100644 --- a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/mapping/CsEventDetailPOMapper.xml +++ b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/mapping/CsEventDetailPOMapper.xml @@ -40,33 +40,12 @@ \ No newline at end of file diff --git a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/mapping/CsStatLimitRateDPOMapper.xml b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/mapping/CsStatLimitRateDPOMapper.xml index 27f35c5..1d84d40 100644 --- a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/mapping/CsStatLimitRateDPOMapper.xml +++ b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/mapper/mapping/CsStatLimitRateDPOMapper.xml @@ -100,34 +100,14 @@ \ No newline at end of file diff --git a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/service/impl/CsEventDetailPOServiceImpl.java b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/service/impl/CsEventDetailPOServiceImpl.java index 9efb9ca..116e3cf 100644 --- a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/service/impl/CsEventDetailPOServiceImpl.java +++ b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/service/impl/CsEventDetailPOServiceImpl.java @@ -3,6 +3,9 @@ package com.njcn.cswarn.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.csdevice.api.CsLedgerFeignClient; +import com.njcn.csdevice.pojo.dto.LineParamDTO; +import com.njcn.csdevice.pojo.po.CsLedger; import com.njcn.cswarn.mapper.CsEventDetailPOMapper; import com.njcn.cswarn.pojo.parm.CsEventDetailParm; import com.njcn.cswarn.pojo.po.CsEventDetailPO; @@ -10,9 +13,14 @@ import com.njcn.cswarn.pojo.vo.CsEventDetailVO; import com.njcn.cswarn.service.CsEventDetailPOService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; /** * @@ -26,11 +34,25 @@ import java.util.List; @RequiredArgsConstructor @Slf4j public class CsEventDetailPOServiceImpl extends ServiceImpl implements CsEventDetailPOService { - + private final CsLedgerFeignClient csLedgerFeignClient; @Override public IPage queryPage(CsEventDetailParm.CsEventDetailPageParm csEventDetailPageParm) { Page returnpage = new Page<> (csEventDetailPageParm.getPageNum ( ), csEventDetailPageParm.getPageSize ( )); - returnpage = this.getBaseMapper().queryPage(returnpage,csEventDetailPageParm); + List lineIds = new ArrayList<>(); + if(Objects.nonNull(csEventDetailPageParm.getLineId())){ + lineIds.add(csEventDetailPageParm.getLineId()); + }else { + LineParamDTO lineParamDTO = new LineParamDTO(); + BeanUtils.copyProperties(csEventDetailPageParm, lineParamDTO); + List data = csLedgerFeignClient.queryLine(lineParamDTO).getData(); + List collect = data.stream().map(CsLedger::getId).collect(Collectors.toList()); + lineIds.addAll(collect); + } + if (CollectionUtils.isEmpty(lineIds)){ + return returnpage; + } + + returnpage = this.getBaseMapper().queryPage(returnpage,lineIds); return returnpage; } diff --git a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/service/impl/CsStatLimitRateDPOServiceImpl.java b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/service/impl/CsStatLimitRateDPOServiceImpl.java index c2f084e..84e4caa 100644 --- a/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/service/impl/CsStatLimitRateDPOServiceImpl.java +++ b/cs-warn/cs-warn-boot/src/main/java/com/njcn/cswarn/service/impl/CsStatLimitRateDPOServiceImpl.java @@ -3,12 +3,25 @@ package com.njcn.cswarn.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.csdevice.api.CsLedgerFeignClient; +import com.njcn.csdevice.pojo.dto.LineParamDTO; +import com.njcn.csdevice.pojo.po.CsLedger; import com.njcn.cswarn.mapper.CsStatLimitRateDPOMapper; import com.njcn.cswarn.pojo.parm.CsStatLimitRatePageParm; import com.njcn.cswarn.pojo.po.CsStatLimitRateDPO; +import com.njcn.cswarn.pojo.vo.CsEventDetailVO; import com.njcn.cswarn.pojo.vo.CsStatLimitRateDVO; import com.njcn.cswarn.service.CsStatLimitRateDPOService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; /** * @@ -19,12 +32,29 @@ import org.springframework.stereotype.Service; * @version V1.0.0 */ @Service +@RequiredArgsConstructor +@Slf4j public class CsStatLimitRateDPOServiceImpl extends ServiceImpl implements CsStatLimitRateDPOService { + private final CsLedgerFeignClient csLedgerFeignClient; @Override public IPage queryPage(CsStatLimitRatePageParm csStatLimitRatePageParm) { Page returnpage = new Page<> (csStatLimitRatePageParm.getPageNum ( ), csStatLimitRatePageParm.getPageSize ( )); - returnpage = this.getBaseMapper().queryPage(returnpage,csStatLimitRatePageParm); + List lineIds = new ArrayList<>(); + if(Objects.nonNull(csStatLimitRatePageParm.getLineId())){ + lineIds.add(csStatLimitRatePageParm.getLineId()); + }else { + LineParamDTO lineParamDTO = new LineParamDTO(); + BeanUtils.copyProperties(csStatLimitRatePageParm, lineParamDTO); + List data = csLedgerFeignClient.queryLine(lineParamDTO).getData(); + List collect = data.stream().map(CsLedger::getId).collect(Collectors.toList()); + lineIds.addAll(collect); + } + if (CollectionUtils.isEmpty(lineIds)){ + return returnpage; + } + + returnpage = this.getBaseMapper().queryPage(returnpage,lineIds); return returnpage; } }