提交
This commit is contained in:
@@ -3,6 +3,7 @@ package com.njcn.csdevice.api;
|
|||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.fallback.CsLedgerFeignClientFallbackFactory;
|
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.param.CsLedgerParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
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.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
*/
|
*/
|
||||||
@@ -23,4 +26,8 @@ public interface CsLedgerFeignClient {
|
|||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
HttpResult<CsLedger> add(@RequestBody @Validated CsLedgerParam csLedgerParam);
|
HttpResult<CsLedger> add(@RequestBody @Validated CsLedgerParam csLedgerParam);
|
||||||
|
|
||||||
}
|
@PostMapping("/queryLine")
|
||||||
|
HttpResult<List<CsLedger>> queryLine(@RequestBody @Validated LineParamDTO lineParamdto);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
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.param.CsLedgerParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
||||||
@@ -11,6 +12,8 @@ import feign.hystrix.FallbackFactory;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
*/
|
*/
|
||||||
@@ -39,6 +42,12 @@ public class CsLedgerFeignClientFallbackFactory implements FallbackFactory<CsLed
|
|||||||
log.error("{}异常,降级处理,异常为:{}","新增台账数据",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","新增台账数据",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<CsLedger>> queryLine(LineParamDTO lineParamdto) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","查询监测点",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ public enum AlgorithmResponseEnum {
|
|||||||
CHIRLDREN_EXIST("A00513","工程下存在项目,不能删除"),
|
CHIRLDREN_EXIST("A00513","工程下存在项目,不能删除"),
|
||||||
CHIRLDREN2_EXIST("A00514","项目下存在设备,不能删除"),
|
CHIRLDREN2_EXIST("A00514","项目下存在设备,不能删除"),
|
||||||
|
|
||||||
DATA_ARRAY_MISSING("A00515","详细数据为空")
|
DATA_ARRAY_MISSING("A00515","详细数据为空"),
|
||||||
|
UNKNOW_ROLE("A00515","角色无权限操作")
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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<AppLineTopologyDiagramPO> pointList;
|
||||||
|
}
|
||||||
@@ -17,29 +17,39 @@ import java.util.List;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class DevCountVO {
|
public class DevCountVO {
|
||||||
@ApiModelProperty(value = "工程id")
|
//
|
||||||
private String id;
|
@ApiModelProperty(value = "设备在线总数")
|
||||||
@ApiModelProperty(value = "设备总数")
|
private Integer onLineDevCount;
|
||||||
private Integer allDevCount;
|
|
||||||
private List<CsEquipmentDeliveryPO> allDevs;
|
|
||||||
@ApiModelProperty(value = "在线设备数")
|
|
||||||
private Integer onLineCount;
|
|
||||||
private List<CsEquipmentDeliveryPO> onLineDevs;
|
private List<CsEquipmentDeliveryPO> onLineDevs;
|
||||||
|
|
||||||
@ApiModelProperty(value = "离线设备数")
|
@ApiModelProperty(value = "设备离线总数")
|
||||||
private Integer offLineCount;
|
private Integer offLineDevCount;
|
||||||
private List<CsEquipmentDeliveryPO> offLineDevs;
|
private List<CsEquipmentDeliveryPO> offLineDevs;
|
||||||
@ApiModelProperty(value = "报警设备数")
|
@ApiModelProperty(value = "警告数")
|
||||||
private Integer alarmLineCount;
|
private Integer alarmCount;
|
||||||
private List<CsEquipmentAlarmVO> alarmLineDevs;
|
@ApiModelProperty(value = "事件数")
|
||||||
|
|
||||||
@ApiModelProperty(value = "设备报警事件数")
|
|
||||||
private Integer alarmEventCount;
|
|
||||||
@ApiModelProperty(value = "稳态/暂态发生事件数")
|
|
||||||
private Integer eventCount;
|
private Integer eventCount;
|
||||||
@ApiModelProperty(value = "项目数")
|
@ApiModelProperty(value = "项目数")
|
||||||
private Integer projectCount;
|
private Integer projectCount;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "当前工程id")
|
||||||
|
private String currentId;
|
||||||
|
@ApiModelProperty(value = "当前工程设备在线总数")
|
||||||
|
private Integer currentOnLineDevCount;
|
||||||
|
private List<CsEquipmentDeliveryPO> currentOnLineDevs;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "当前工程设备在线总数")
|
||||||
|
private Integer currentOffLineDevCount;
|
||||||
|
private List<CsEquipmentDeliveryPO> currentOffLineDevs;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "警告数")
|
||||||
|
private Integer currentAlarmCount;
|
||||||
|
@ApiModelProperty(value = "事件数")
|
||||||
|
private Integer currentEventCount;
|
||||||
|
@ApiModelProperty(value = "项目数")
|
||||||
|
private Integer currentProjectCount;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@ import java.util.List;
|
|||||||
@RequestMapping("/EquipmentTransfer")
|
@RequestMapping("/EquipmentTransfer")
|
||||||
@Api(tags = " 设备转移、恢复")
|
@Api(tags = " 设备转移、恢复")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@Deprecated
|
||||||
public class CsEquipmentTransferPOController extends BaseController {
|
public class CsEquipmentTransferPOController extends BaseController {
|
||||||
|
|
||||||
private final CsEquipmentTransferPOService csEquipmentTransferPOService;
|
private final CsEquipmentTransferPOService csEquipmentTransferPOService;
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ public class DeviceUserController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/share")
|
@PostMapping("/share")
|
||||||
@ApiOperation("设备扫码分享")
|
@ApiOperation("设备扫码分享")
|
||||||
@ApiImplicitParam(name = "id", value = "设备id", required = true)
|
@ApiImplicitParam(name = "ids", value = "设备id集合", required = true)
|
||||||
public HttpResult<Boolean> share(@RequestParam("id") String id){
|
public HttpResult<Boolean> share(@RequestParam("ids") List<String> ids){
|
||||||
String methodDescribe = getMethodDescribe("share");
|
String methodDescribe = getMethodDescribe("share");
|
||||||
|
|
||||||
Boolean flag = csDeviceUserPOService.share (id);
|
Boolean flag = csDeviceUserPOService.share (ids);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,11 +83,11 @@ public class DeviceUserController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/transfer")
|
@PostMapping("/transfer")
|
||||||
@ApiOperation("设备转移(直接扫码不用申请)")
|
@ApiOperation("设备转移(直接扫码不用申请)")
|
||||||
@ApiImplicitParam(name = "eid", value = "设备Id", required = true)
|
@ApiImplicitParam(name = "ids", value = "设备Id集合", required = true)
|
||||||
public HttpResult<Boolean> transfer(@RequestParam("eid") String eid){
|
public HttpResult<Boolean> transfer(@RequestParam("ids") List<String> ids){
|
||||||
String methodDescribe = getMethodDescribe("transfer");
|
String methodDescribe = getMethodDescribe("transfer");
|
||||||
|
|
||||||
Boolean flag = csDeviceUserPOService.transfer (eid);
|
Boolean flag = csDeviceUserPOService.transfer (ids);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
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.param.CsLedgerParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
@@ -114,5 +115,15 @@ public class CsLedgerController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/queryLine")
|
||||||
|
@ApiOperation("按条件查询监测点")
|
||||||
|
@ApiImplicitParam(name = "lineParamdto", value = "查询条件", required = true)
|
||||||
|
public HttpResult<List<CsLedger>> queryLine(@RequestBody @Validated LineParamDTO lineParamdto){
|
||||||
|
String methodDescribe = getMethodDescribe("queryLine");
|
||||||
|
List<CsLedger> list = csLedgerService.queryLine(lineParamdto);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.pojo.param.AppLineTopologyDiagramAddParm;
|
import com.njcn.csdevice.pojo.param.AppLineTopologyDiagramAddParm;
|
||||||
import com.njcn.csdevice.pojo.param.AppLineTopologyDiagramAuditParm;
|
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.po.AppLineTopologyDiagramPO;
|
||||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||||
import com.njcn.csdevice.service.AppLineTopologyDiagramService;
|
import com.njcn.csdevice.service.AppLineTopologyDiagramService;
|
||||||
@@ -33,7 +34,7 @@ import java.util.List;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/lineTopologyDiagram")
|
@RequestMapping("/lineTopologyDiagram")
|
||||||
@Api(tags = " 拓扑图-监测点")
|
@Api(tags = "拓扑图-监测点")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class LineTopologyDiagramController extends BaseController {
|
public class LineTopologyDiagramController extends BaseController {
|
||||||
|
|
||||||
@@ -83,4 +84,14 @@ public class LineTopologyDiagramController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/auditList")
|
||||||
|
@ApiOperation("批量修改监测点拓扑图关系")
|
||||||
|
@ApiImplicitParam(name = "list", value = "监测点拓扑图数据集", required = true)
|
||||||
|
public HttpResult<String> auditList(@RequestBody LinePostionParam linePostionParam){
|
||||||
|
String methodDescribe = getMethodDescribe("auditList");
|
||||||
|
appLineTopologyDiagramService.auditList(linePostionParam.getPointList());
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.njcn.csdevice.mapper;
|
package com.njcn.csdevice.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
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.po.CsLedger;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -18,4 +20,5 @@ public interface CsLedgerMapper extends BaseMapper<CsLedger> {
|
|||||||
|
|
||||||
List<CsLedgerVO> getAll();
|
List<CsLedgerVO> getAll();
|
||||||
|
|
||||||
|
List<CsLedger> queryLine(@Param("lineParamdto") LineParamDTO lineParamdto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,35 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.njcn.csdevice.mapper.CsLedgerMapper">
|
<mapper namespace="com.njcn.csdevice.mapper.CsLedgerMapper">
|
||||||
|
|
||||||
<select id="getAll" resultType="CsLedgerVO">
|
<sql id="Base_Column_List">
|
||||||
|
id,
|
||||||
|
pid,
|
||||||
|
pids,
|
||||||
|
`name`,
|
||||||
|
`level`,
|
||||||
|
sort,
|
||||||
|
remark,
|
||||||
|
`state`,
|
||||||
|
create_by,
|
||||||
|
create_time,
|
||||||
|
update_by,
|
||||||
|
update_time
|
||||||
|
</sql>
|
||||||
|
<resultMap id="BaseResultMap" type="com.njcn.csdevice.pojo.po.CsLedger">
|
||||||
|
<result column="id" property="id"/>
|
||||||
|
<result column="pid" property="pid"/>
|
||||||
|
<result column="pids" property="pids"/>
|
||||||
|
<result column="name" property="name"/>
|
||||||
|
<result column="level" property="level"/>
|
||||||
|
<result column="sort" property="sort"/>
|
||||||
|
<result column="remark" property="remark"/>
|
||||||
|
<result column="state" property="state"/>
|
||||||
|
<result column="create_by" property="createBy"/>
|
||||||
|
<result column="create_time" property="createTime"/>
|
||||||
|
<result column="update_by" property="updateBy"/>
|
||||||
|
<result column="update_time" property="updateTime"/>
|
||||||
|
</resultMap>
|
||||||
|
<select id="getAll" resultType="CsLedgerVO">
|
||||||
select
|
select
|
||||||
id,pid,name,level,sort
|
id,pid,name,level,sort
|
||||||
from
|
from
|
||||||
@@ -11,4 +39,19 @@
|
|||||||
state = 1
|
state = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryLine" resultType="com.njcn.csdevice.pojo.po.CsLedger">
|
||||||
|
select id from cs_ledger a where a.`Level`='3' and a.state='1'
|
||||||
|
<if test="lineParamdto.engineerId!=null and lineParamdto.engineerId!=''">
|
||||||
|
and FIND_IN_SET(#{lineParamdto.engineerId}, a.pids )
|
||||||
|
</if>
|
||||||
|
<if test="lineParamdto.projectId!=null and lineParamdto.projectId!=''">
|
||||||
|
and FIND_IN_SET(#{lineParamdto.projectId}, a.pids )
|
||||||
|
</if>
|
||||||
|
<if test="lineParamdto.devId!=null and lineParamdto.devId!=''">
|
||||||
|
and FIND_IN_SET(#{lineParamdto.devId}, a.pids )
|
||||||
|
</if>
|
||||||
|
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -23,4 +23,6 @@ public interface AppLineTopologyDiagramService extends IService<AppLineTopologyD
|
|||||||
AppTopologyDiagramVO query(String devId);
|
AppTopologyDiagramVO query(String devId);
|
||||||
|
|
||||||
List<AppLineTopologyDiagramVO> queryByTopoId(String id);
|
List<AppLineTopologyDiagramVO> queryByTopoId(String id);
|
||||||
|
|
||||||
|
void auditList(List<AppLineTopologyDiagramPO> list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||||
import com.njcn.csdevice.pojo.vo.DevCountVO;
|
import com.njcn.csdevice.pojo.vo.DevCountVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -17,13 +19,13 @@ public interface CsDeviceUserPOService extends IService<CsDeviceUserPO>{
|
|||||||
|
|
||||||
Boolean add(String id);
|
Boolean add(String id);
|
||||||
|
|
||||||
Boolean share(String id);
|
Boolean share(List<String> ids);
|
||||||
|
|
||||||
DevCountVO devCount(String id);
|
DevCountVO devCount(String id);
|
||||||
|
|
||||||
String isPrimaryUser(String deviceId);
|
String isPrimaryUser(String deviceId);
|
||||||
|
|
||||||
Boolean transfer(String eid);
|
Boolean transfer( List<String> ids);
|
||||||
|
|
||||||
Boolean delete(String eid);
|
Boolean delete(String eid);
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.List;
|
|||||||
* @author clam
|
* @author clam
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface CsEquipmentTransferPOService extends IService<CsEquipmentTransferPO>{
|
public interface CsEquipmentTransferPOService extends IService<CsEquipmentTransferPO>{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.service;
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
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.param.CsLedgerParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
@@ -68,4 +69,6 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
|||||||
CsLedger findDataById(String id);
|
CsLedger findDataById(String id);
|
||||||
|
|
||||||
List<CsLedgerVO> getProjectTree();
|
List<CsLedgerVO> getProjectTree();
|
||||||
|
|
||||||
|
List<CsLedger> queryLine(LineParamDTO lineParamdto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.njcn.csdevice.service.AppTopologyDiagramService;
|
|||||||
import com.njcn.csdevice.service.CsLinePOService;
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -62,4 +63,14 @@ public class AppLineTopologyDiagramServiceImpl extends ServiceImpl<AppLineTopolo
|
|||||||
result = this.getBaseMapper().queryByTopoId( id);
|
result = this.getBaseMapper().queryByTopoId( id);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void auditList(List<AppLineTopologyDiagramPO> 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();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
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.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
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.api.CsEquipmentAlarmFeignClient;
|
||||||
import com.njcn.cswarn.pojo.parm.CsEquipmentAlarmParm;
|
import com.njcn.cswarn.pojo.parm.CsEquipmentAlarmParm;
|
||||||
import com.njcn.cswarn.pojo.vo.CsEquipmentAlarmVO;
|
import com.njcn.cswarn.pojo.vo.CsEquipmentAlarmVO;
|
||||||
|
import com.njcn.user.enums.AppRoleEnum;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -50,7 +52,7 @@ import static java.util.Objects.*;
|
|||||||
public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper, CsDeviceUserPO> implements CsDeviceUserPOService{
|
public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper, CsDeviceUserPO> implements CsDeviceUserPOService{
|
||||||
|
|
||||||
private final ICsLedgerService iCsLedgerService;
|
private final ICsLedgerService iCsLedgerService;
|
||||||
private final CsEquipmentAlarmFeignClient csEquipmentAlarmFeignClient;
|
// private final CsEquipmentAlarmFeignClient csEquipmentAlarmFeignClient;
|
||||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||||
private final RoleEngineerDevService roleEngineerDevService;
|
private final RoleEngineerDevService roleEngineerDevService;
|
||||||
@Override
|
@Override
|
||||||
@@ -73,80 +75,117 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean share(String id) {
|
public Boolean share(List<String> ids) {
|
||||||
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, id).eq(CsDeviceUserPO::getStatus,"1" ).list();
|
ids.stream().forEach(id->{
|
||||||
if(CollectionUtils.isEmpty(list)){
|
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, id).eq(CsDeviceUserPO::getStatus,"1" ).list();
|
||||||
throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE);
|
|
||||||
|
|
||||||
}
|
if(CollectionUtils.isEmpty(list)){
|
||||||
String userIndex = RequestUtil.getUserIndex();
|
throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE);
|
||||||
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 save;
|
}
|
||||||
|
String userIndex = RequestUtil.getUserIndex();
|
||||||
|
String userRole = RequestUtil.getUserRole();
|
||||||
|
List<String> 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
|
@Override
|
||||||
public DevCountVO devCount(String id) {
|
public DevCountVO devCount(String id) {
|
||||||
|
QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
DevCountVO devCountVO = new DevCountVO();
|
DevCountVO devCountVO = new DevCountVO();
|
||||||
|
|
||||||
List<String> device = roleEngineerDevService.getDevice();
|
List<String> 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<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
||||||
|
List<CsEquipmentDeliveryPO> collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryPO> 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<String> roleProject = roleEngineerDevService.getRoleProject();
|
||||||
|
devCountVO.setProjectCount(roleProject.size());
|
||||||
|
}
|
||||||
|
|
||||||
List<CsLedgerVO> deviceTree = iCsLedgerService.getDeviceTree();
|
List<CsLedgerVO> deviceTree = iCsLedgerService.getDeviceTree();
|
||||||
List<String> 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());
|
List<String> 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);
|
device.retainAll(collect1);
|
||||||
if(CollectionUtils.isEmpty(device)){
|
if(CollectionUtils.isEmpty(device)){
|
||||||
devCountVO.setOnLineCount(0);
|
devCountVO.setCurrentOnLineDevCount(0);
|
||||||
devCountVO.setOnLineDevs(new ArrayList<>());
|
devCountVO.setCurrentOnLineDevs(new ArrayList<>());
|
||||||
devCountVO.setOffLineCount(0);
|
devCountVO.setCurrentOffLineDevCount(0);
|
||||||
devCountVO.setOffLineDevs(new ArrayList<>());
|
devCountVO.setCurrentOffLineDevs(new ArrayList<>());
|
||||||
|
devCountVO.setCurrentProjectCount(0);
|
||||||
devCountVO.setAllDevCount(0);
|
devCountVO.setCurrentProjectCount(0);
|
||||||
devCountVO.setAllDevs(new ArrayList<>());
|
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
devCountVO.setAllDevCount(device.size());
|
queryWrapper.clear();
|
||||||
|
|
||||||
QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<>();
|
|
||||||
queryWrapper.in("id",device);
|
queryWrapper.in("id",device);
|
||||||
|
|
||||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
||||||
devCountVO.setAllDevs(csEquipmentDeliveryPOS);
|
|
||||||
List<CsEquipmentDeliveryPO> collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList());
|
List<CsEquipmentDeliveryPO> collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList());
|
||||||
List<CsEquipmentDeliveryPO> collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList());
|
List<CsEquipmentDeliveryPO> collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList());
|
||||||
devCountVO.setOnLineCount(collect2.size());
|
devCountVO.setCurrentOnLineDevCount(collect2.size());
|
||||||
devCountVO.setOnLineDevs(collect2);
|
devCountVO.setCurrentOnLineDevs(collect2);
|
||||||
devCountVO.setOffLineCount(collect.size());
|
devCountVO.setCurrentOffLineDevCount(collect.size());
|
||||||
devCountVO.setOffLineDevs(collect);
|
devCountVO.setCurrentOffLineDevs(collect);
|
||||||
|
List<CsLedger> list = iCsLedgerService.lambdaQuery().eq(CsLedger::getPid, id).eq(CsLedger::getState, 1).list();
|
||||||
|
devCountVO.setCurrentProjectCount(list.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CsEquipmentAlarmParm csEquipmentAlarmPageParm = new CsEquipmentAlarmParm();
|
|
||||||
csEquipmentAlarmPageParm.setEngineerId(id);
|
|
||||||
|
|
||||||
//未处理的
|
//todo 后续添加警告数,事件数
|
||||||
csEquipmentAlarmPageParm.setDealFlag("0");
|
devCountVO.setEventCount(0);
|
||||||
//todo 后续添加时间条件
|
devCountVO.setAlarmCount(0);
|
||||||
|
devCountVO.setCurrentEventCount(0);
|
||||||
|
devCountVO.setCurrentAlarmCount(0);
|
||||||
|
|
||||||
// csEquipmentAlarmPageParm.setStartTime();
|
// csEquipmentAlarmPageParm.setStartTime();
|
||||||
// csEquipmentAlarmPageParam.setEndTime();
|
// csEquipmentAlarmPageParam.setEndTime();
|
||||||
List<CsEquipmentAlarmVO> data = csEquipmentAlarmFeignClient.queryList(csEquipmentAlarmPageParm).getData();
|
// List<CsEquipmentAlarmVO> data = csEquipmentAlarmFeignClient.queryList(csEquipmentAlarmPageParm).getData();
|
||||||
List<String> devIds = data.stream().map(CsEquipmentAlarmVO::getEquipmentId).distinct().collect(Collectors.toList());
|
// List<String> devIds = data.stream().map(CsEquipmentAlarmVO::getEquipmentId).distinct().collect(Collectors.toList());
|
||||||
devCountVO.setAlarmLineDevs(data);
|
// queryWrapper.clear();
|
||||||
devCountVO.setAlarmEventCount(data.size());
|
// queryWrapper.in("id",devIds);
|
||||||
|
//
|
||||||
|
// List<CsEquipmentDeliveryPO> 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;
|
return devCountVO;
|
||||||
}
|
}
|
||||||
@@ -167,16 +206,20 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public Boolean transfer(String eid) {
|
public Boolean transfer(List<String> ids) {
|
||||||
String userIndex = RequestUtil.getUserIndex();
|
String userIndex = RequestUtil.getUserIndex();
|
||||||
|
ids.forEach(eid->{
|
||||||
|
List<CsDeviceUserPO> 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<CsDeviceUserPO> 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;
|
return true;
|
||||||
@@ -196,6 +239,10 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
csEquipmentDeliveryPO.setRunStatus(0);
|
csEquipmentDeliveryPO.setRunStatus(0);
|
||||||
csEquipmentDeliveryMapper.updateById(csEquipmentDeliveryPO);
|
csEquipmentDeliveryMapper.updateById(csEquipmentDeliveryPO);
|
||||||
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).set(CsDeviceUserPO::getStatus,"0").update();
|
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).set(CsDeviceUserPO::getStatus,"0").update();
|
||||||
|
//删除监测点,设备
|
||||||
|
iCsLedgerService.lambdaUpdate().eq(CsLedger::getId,eid).set(CsLedger::getState,0).update();
|
||||||
|
iCsLedgerService.lambdaUpdate().eq(CsLedger::getPid,eid).set(CsLedger::getState,0).update();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ import static java.util.Objects.isNull;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@Deprecated
|
||||||
public class CsEquipmentTransferPOServiceImpl extends ServiceImpl<CsEquipmentTransferPOMapper, CsEquipmentTransferPO> implements CsEquipmentTransferPOService{
|
public class CsEquipmentTransferPOServiceImpl extends ServiceImpl<CsEquipmentTransferPOMapper, CsEquipmentTransferPO> implements CsEquipmentTransferPOService{
|
||||||
private final CsDeviceUserPOService csDeviceUserPOService;
|
private final CsDeviceUserPOService csDeviceUserPOService;
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ public class CsEquipmentTransferPOServiceImpl extends ServiceImpl<CsEquipmentTra
|
|||||||
String[] split = equipmentIds.split(",");
|
String[] split = equipmentIds.split(",");
|
||||||
for (int i = 0; i < split.length; i++) {
|
for (int i = 0; i < split.length; i++) {
|
||||||
if(Objects.equals(collect1.get(DicDataEnum.AUTHORITY_TRANSFER.getCode()),csEquipmentTransferPO.getEventType())){
|
if(Objects.equals(collect1.get(DicDataEnum.AUTHORITY_TRANSFER.getCode()),csEquipmentTransferPO.getEventType())){
|
||||||
csDeviceUserPOService.transfer(split[i]);
|
// csDeviceUserPOService.transfer(split[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(Objects.equals(collect1.get(DicDataEnum.DATA_RECOVERY.getCode()),csEquipmentTransferPO.getEventType())){
|
else if(Objects.equals(collect1.get(DicDataEnum.DATA_RECOVERY.getCode()),csEquipmentTransferPO.getEventType())){
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.njcn.csdevice.mapper.AppProjectMapper;
|
|||||||
import com.njcn.csdevice.mapper.AppTopologyDiagramMapper;
|
import com.njcn.csdevice.mapper.AppTopologyDiagramMapper;
|
||||||
import com.njcn.csdevice.mapper.CsEngineeringMapper;
|
import com.njcn.csdevice.mapper.CsEngineeringMapper;
|
||||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||||
|
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||||
import com.njcn.csdevice.pojo.po.AppTopologyDiagramPO;
|
import com.njcn.csdevice.pojo.po.AppTopologyDiagramPO;
|
||||||
@@ -209,6 +210,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
return engineeringList;
|
return engineeringList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsLedger> queryLine(LineParamDTO lineParamdto) {
|
||||||
|
List<CsLedger> lineIds = this.getBaseMapper().queryLine(lineParamdto);
|
||||||
|
return lineIds;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子节点
|
* 获取子节点
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -50,9 +50,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
List<String> collect = new ArrayList<>();
|
List<String> collect = new ArrayList<>();
|
||||||
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
|
if(Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||||
|
|
||||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
|
||||||
csDeviceUserPOQueryWrapper.clear();
|
csDeviceUserPOQueryWrapper.clear();
|
||||||
csEngineeringUserPOQueryWrapper.clear();
|
csEngineeringUserPOQueryWrapper.clear();
|
||||||
csLedgerQueryWrapper.clear();
|
csLedgerQueryWrapper.clear();
|
||||||
@@ -81,7 +79,8 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
return collect;
|
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<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
||||||
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
||||||
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
||||||
@@ -113,7 +112,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
List<String> collect = new ArrayList<>();
|
List<String> collect = new ArrayList<>();
|
||||||
if(Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())||
|
if(
|
||||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||||
csDeviceUserPOQueryWrapper.clear();
|
csDeviceUserPOQueryWrapper.clear();
|
||||||
csEngineeringUserPOQueryWrapper.clear();
|
csEngineeringUserPOQueryWrapper.clear();
|
||||||
@@ -130,7 +129,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
return collect1;
|
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<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<CsMarketData> csMarketDataQueryWrapper = new QueryWrapper<>();
|
||||||
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
csMarketDataQueryWrapper.eq("user_id", userIndex);
|
||||||
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
List<CsMarketData> csMarketData = csMarketDataMapper.selectList(csMarketDataQueryWrapper);
|
||||||
@@ -149,8 +148,6 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
|
|
||||||
collect = csLedgers1.stream().map(CsLedger::getId).collect(Collectors.toList());
|
collect = csLedgers1.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
|
else if (Objects.equals(role,AppRoleEnum.TOURIST.getCode())) {
|
||||||
|
|
||||||
|
|||||||
@@ -27,12 +27,21 @@ public class CsStatLimitRatePageParm {
|
|||||||
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
|
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
|
||||||
private Integer pageSize;
|
private Integer pageSize;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "工程id")
|
||||||
|
private String engineerId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目Id
|
* 项目Id
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "项目Id")
|
@ApiModelProperty(value = "项目Id")
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备id")
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测点id")
|
||||||
|
private String lineId;
|
||||||
/**
|
/**
|
||||||
* 开始时间
|
* 开始时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,5 +18,5 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface CsEventDetailPOMapper extends BaseMapper<CsEventDetailPO> {
|
public interface CsEventDetailPOMapper extends BaseMapper<CsEventDetailPO> {
|
||||||
|
|
||||||
Page<CsEventDetailVO> queryPage(Page<CsEventDetailVO> returnpage, @Param("csEventDetailPageParm") CsEventDetailParm.CsEventDetailPageParm csEventDetailPageParm);
|
Page<CsEventDetailVO> queryPage(Page<CsEventDetailVO> returnpage, @Param("lineIds") List<String> lineIds);
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,8 @@ import com.njcn.cswarn.pojo.po.CsStatLimitRateDPO;
|
|||||||
import com.njcn.cswarn.pojo.vo.CsStatLimitRateDVO;
|
import com.njcn.cswarn.pojo.vo.CsStatLimitRateDVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -16,5 +18,5 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
*/
|
*/
|
||||||
public interface CsStatLimitRateDPOMapper extends BaseMapper<CsStatLimitRateDPO> {
|
public interface CsStatLimitRateDPOMapper extends BaseMapper<CsStatLimitRateDPO> {
|
||||||
Page<CsStatLimitRateDVO> queryPage(Page<CsStatLimitRateDVO> returnpage, @Param("csStatLimitRatePageParm") CsStatLimitRatePageParm csStatLimitRatePageParm);
|
Page<CsStatLimitRateDVO> queryPage(Page<CsStatLimitRateDVO> returnpage, @Param("lineIds") List<String> lineIds);
|
||||||
}
|
}
|
||||||
@@ -40,33 +40,12 @@
|
|||||||
|
|
||||||
<select id="queryPage" resultType="com.njcn.cswarn.pojo.vo.CsEventDetailVO">
|
<select id="queryPage" resultType="com.njcn.cswarn.pojo.vo.CsEventDetailVO">
|
||||||
SELECT
|
SELECT
|
||||||
temp.*, cs.*
|
*
|
||||||
FROM
|
FROM
|
||||||
cs_event_detail cs
|
cs_event_detail a
|
||||||
INNER JOIN (
|
where a.measurement_point_id in
|
||||||
SELECT
|
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
|
||||||
a.line_id,
|
#{item}
|
||||||
a. NAME line_name,
|
</foreach>
|
||||||
c.id project_id,
|
|
||||||
c. NAME project_name
|
|
||||||
FROM
|
|
||||||
cs_line a,
|
|
||||||
cs_project_equipment b,
|
|
||||||
cs_project c
|
|
||||||
WHERE
|
|
||||||
1 = 1
|
|
||||||
AND c.id = b.project_id
|
|
||||||
AND b.equipment_id = a.dev_id
|
|
||||||
<if test="csEventDetailPageParm.projectId != null and csEventDetailPageParm.projectId != ''">
|
|
||||||
AND c.id = #{csEventDetailPageParm.projectId }
|
|
||||||
</if>
|
|
||||||
) temp ON cs.measurement_point_id = temp.line_id
|
|
||||||
where 1=1
|
|
||||||
<if test="csEventDetailPageParm.startTime != null and csEventDetailPageParm.startTime != ''">
|
|
||||||
AND cs.start_time >= #{csEventDetailPageParm.startTime }
|
|
||||||
</if>
|
|
||||||
<if test="csEventDetailPageParm.endTime != null and csEventDetailPageParm.endTime != ''">
|
|
||||||
AND cs.start_time <= #{csEventDetailPageParm.endTime }
|
|
||||||
</if>
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -100,34 +100,14 @@
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="queryPage" resultType="com.njcn.cswarn.pojo.vo.CsStatLimitRateDVO">
|
<select id="queryPage" resultType="com.njcn.cswarn.pojo.vo.CsStatLimitRateDVO">
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
temp.*, cs.*
|
*
|
||||||
FROM
|
FROM
|
||||||
cs_stat_limit_rate_d cs
|
cs_stat_limit_rate_d a
|
||||||
INNER JOIN (
|
where a.my_index in
|
||||||
SELECT
|
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
|
||||||
a.line_id,
|
#{item}
|
||||||
a. NAME line_name,
|
</foreach>
|
||||||
c.id project_id,
|
|
||||||
c. NAME project_name
|
|
||||||
FROM
|
|
||||||
cs_line a,
|
|
||||||
cs_project_equipment b,
|
|
||||||
cs_project c
|
|
||||||
WHERE
|
|
||||||
1 = 1
|
|
||||||
AND c.id = b.project_id
|
|
||||||
AND b.equipment_id = a.dev_id
|
|
||||||
<if test="csStatLimitRatePageParm.projectId != null and csStatLimitRatePageParm.projectId != ''">
|
|
||||||
AND c.id = #{csStatLimitRatePageParm.projectId }
|
|
||||||
</if>
|
|
||||||
) temp ON cs.my_index = temp.line_id
|
|
||||||
where 1=1
|
|
||||||
<if test="csStatLimitRatePageParm.startTime != null and csStatLimitRatePageParm.startTime != ''">
|
|
||||||
AND cs.time_id >= #{csStatLimitRatePageParm.startTime }
|
|
||||||
</if>
|
|
||||||
<if test="csStatLimitRatePageParm.endTime != null and csStatLimitRatePageParm.endTime != ''">
|
|
||||||
AND cs.time_id <= #{csStatLimitRatePageParm.endTime }
|
|
||||||
</if>
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -3,6 +3,9 @@ package com.njcn.cswarn.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
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.mapper.CsEventDetailPOMapper;
|
||||||
import com.njcn.cswarn.pojo.parm.CsEventDetailParm;
|
import com.njcn.cswarn.pojo.parm.CsEventDetailParm;
|
||||||
import com.njcn.cswarn.pojo.po.CsEventDetailPO;
|
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 com.njcn.cswarn.service.CsEventDetailPOService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -26,11 +34,25 @@ import java.util.List;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class CsEventDetailPOServiceImpl extends ServiceImpl<CsEventDetailPOMapper, CsEventDetailPO> implements CsEventDetailPOService {
|
public class CsEventDetailPOServiceImpl extends ServiceImpl<CsEventDetailPOMapper, CsEventDetailPO> implements CsEventDetailPOService {
|
||||||
|
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||||
@Override
|
@Override
|
||||||
public IPage<CsEventDetailVO> queryPage(CsEventDetailParm.CsEventDetailPageParm csEventDetailPageParm) {
|
public IPage<CsEventDetailVO> queryPage(CsEventDetailParm.CsEventDetailPageParm csEventDetailPageParm) {
|
||||||
Page<CsEventDetailVO> returnpage = new Page<> (csEventDetailPageParm.getPageNum ( ), csEventDetailPageParm.getPageSize ( ));
|
Page<CsEventDetailVO> returnpage = new Page<> (csEventDetailPageParm.getPageNum ( ), csEventDetailPageParm.getPageSize ( ));
|
||||||
returnpage = this.getBaseMapper().queryPage(returnpage,csEventDetailPageParm);
|
List<String> lineIds = new ArrayList<>();
|
||||||
|
if(Objects.nonNull(csEventDetailPageParm.getLineId())){
|
||||||
|
lineIds.add(csEventDetailPageParm.getLineId());
|
||||||
|
}else {
|
||||||
|
LineParamDTO lineParamDTO = new LineParamDTO();
|
||||||
|
BeanUtils.copyProperties(csEventDetailPageParm, lineParamDTO);
|
||||||
|
List<CsLedger> data = csLedgerFeignClient.queryLine(lineParamDTO).getData();
|
||||||
|
List<String> 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;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,25 @@ package com.njcn.cswarn.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
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.mapper.CsStatLimitRateDPOMapper;
|
||||||
import com.njcn.cswarn.pojo.parm.CsStatLimitRatePageParm;
|
import com.njcn.cswarn.pojo.parm.CsStatLimitRatePageParm;
|
||||||
import com.njcn.cswarn.pojo.po.CsStatLimitRateDPO;
|
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.pojo.vo.CsStatLimitRateDVO;
|
||||||
import com.njcn.cswarn.service.CsStatLimitRateDPOService;
|
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.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
|
* @version V1.0.0
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class CsStatLimitRateDPOServiceImpl extends ServiceImpl<CsStatLimitRateDPOMapper, CsStatLimitRateDPO> implements CsStatLimitRateDPOService {
|
public class CsStatLimitRateDPOServiceImpl extends ServiceImpl<CsStatLimitRateDPOMapper, CsStatLimitRateDPO> implements CsStatLimitRateDPOService {
|
||||||
|
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<CsStatLimitRateDVO> queryPage(CsStatLimitRatePageParm csStatLimitRatePageParm) {
|
public IPage<CsStatLimitRateDVO> queryPage(CsStatLimitRatePageParm csStatLimitRatePageParm) {
|
||||||
Page<CsStatLimitRateDVO> returnpage = new Page<> (csStatLimitRatePageParm.getPageNum ( ), csStatLimitRatePageParm.getPageSize ( ));
|
Page<CsStatLimitRateDVO> returnpage = new Page<> (csStatLimitRatePageParm.getPageNum ( ), csStatLimitRatePageParm.getPageSize ( ));
|
||||||
returnpage = this.getBaseMapper().queryPage(returnpage,csStatLimitRatePageParm);
|
List<String> lineIds = new ArrayList<>();
|
||||||
|
if(Objects.nonNull(csStatLimitRatePageParm.getLineId())){
|
||||||
|
lineIds.add(csStatLimitRatePageParm.getLineId());
|
||||||
|
}else {
|
||||||
|
LineParamDTO lineParamDTO = new LineParamDTO();
|
||||||
|
BeanUtils.copyProperties(csStatLimitRatePageParm, lineParamDTO);
|
||||||
|
List<CsLedger> data = csLedgerFeignClient.queryLine(lineParamDTO).getData();
|
||||||
|
List<String> 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;
|
return returnpage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user