提交
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.EquipmentFeignClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.EquipmentFeignClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
@@ -23,5 +24,5 @@ public interface EquipmentFeignClient {
|
|||||||
@PostMapping("/updateStatusBynDid")
|
@PostMapping("/updateStatusBynDid")
|
||||||
HttpResult<Boolean> updateStatusBynDid(@RequestParam("nDId") String nDid,@RequestParam("status") Integer status);
|
HttpResult<Boolean> updateStatusBynDid(@RequestParam("nDId") String nDid,@RequestParam("status") Integer status);
|
||||||
@PostMapping("/queryEquipmentById")
|
@PostMapping("/queryEquipmentById")
|
||||||
HttpResult<List<CsEquipmentDeliveryPO>> queryDeviceById(@RequestParam("ids") List<String> ids);
|
HttpResult<List<CsEquipmentDeliveryDTO>> queryDeviceById(@RequestParam("ids") List<String> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.EquipmentFeignClient;
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
@@ -42,7 +43,7 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<CsEquipmentDeliveryPO>> queryDeviceById(List<String> ids) {
|
public HttpResult<List<CsEquipmentDeliveryDTO>> queryDeviceById(List<String> ids) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","查询出厂设备详情",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","查询出厂设备详情",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ public enum AlgorithmResponseEnum {
|
|||||||
LOSE_EFFICACY ("A00509","二维码失效,该设备已绑定"),
|
LOSE_EFFICACY ("A00509","二维码失效,该设备已绑定"),
|
||||||
DATA_LOSE ("A00510","未找到设备与主用户信息"),
|
DATA_LOSE ("A00510","未找到设备与主用户信息"),
|
||||||
REPEAT_SHARE ("A00511","设备已分享完成,请勿再次分享"),
|
REPEAT_SHARE ("A00511","设备已分享完成,请勿再次分享"),
|
||||||
DEVICE_LOSE("A00512","设备id缺失")
|
DEVICE_LOSE("A00512","设备id缺失"),
|
||||||
|
CHIRLDREN_EXIST("A00513","工程下存在项目,不能删除");
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package com.njcn.csdevice.pojo.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2023/3/30 16:23【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备出厂表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CsEquipmentDeliveryDTO {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableField(value = "id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网关识别码
|
||||||
|
*/
|
||||||
|
@TableField(value = "ndid")
|
||||||
|
private String ndid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置mac地址
|
||||||
|
*/
|
||||||
|
@TableField(value = "mac")
|
||||||
|
private String mac;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置用途(治理、监测...)
|
||||||
|
*/
|
||||||
|
// @TableField(value = "dev_use")
|
||||||
|
// private String devUse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置类型(直连设备、网关设备、装置)
|
||||||
|
*/
|
||||||
|
@TableField(value = "dev_type")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置型号(pqs588、pqs680...)
|
||||||
|
*/
|
||||||
|
@TableField(value = "dev_model")
|
||||||
|
private String devModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置接入方式(mqtt、cloud)
|
||||||
|
*/
|
||||||
|
@TableField(value = "dev_access_method")
|
||||||
|
private String devAccessMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置程序版本
|
||||||
|
*/
|
||||||
|
@TableField(value = "program_version")
|
||||||
|
private String programVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调试人员
|
||||||
|
*/
|
||||||
|
@TableField(value = "debug_person")
|
||||||
|
private String debugPerson;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合同号
|
||||||
|
*/
|
||||||
|
@TableField(value = "cntract_no")
|
||||||
|
private String cntractNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营销经理
|
||||||
|
*/
|
||||||
|
@TableField(value = "sales_manager")
|
||||||
|
private String salesManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接入状态(1:未注册 2:注册 3:接入)
|
||||||
|
*/
|
||||||
|
@TableField(value = "status")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备状态(0:删除 1:离线 2:在线)
|
||||||
|
*/
|
||||||
|
@TableField(value = "run_status")
|
||||||
|
private Integer runStatus;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +7,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.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAuditParm;
|
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAuditParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
||||||
@@ -24,10 +25,12 @@ import io.swagger.annotations.ApiImplicitParams;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
@@ -121,10 +124,15 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/queryEquipmentById")
|
@PostMapping("/queryEquipmentById")
|
||||||
@ApiOperation("设备查询通过id获取")
|
@ApiOperation("设备查询通过id获取")
|
||||||
@ApiImplicitParam(name = "ids", value = "设备id集合", required = true)
|
@ApiImplicitParam(name = "ids", value = "设备id集合", required = true)
|
||||||
public HttpResult<List<CsEquipmentDeliveryPO>> queryEquipmentById(@RequestParam List<String> ids){
|
public HttpResult<List<CsEquipmentDeliveryDTO>> queryEquipmentById(@RequestParam List<String> ids){
|
||||||
String methodDescribe = getMethodDescribe("queryEquipmentById");
|
String methodDescribe = getMethodDescribe("queryEquipmentById");
|
||||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(ids);
|
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(ids);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csEquipmentDeliveryPOS, methodDescribe);
|
List<CsEquipmentDeliveryDTO> collect = csEquipmentDeliveryPOS.stream().map(temp -> {
|
||||||
|
CsEquipmentDeliveryDTO csEquipmentDeliveryDTO = new CsEquipmentDeliveryDTO();
|
||||||
|
BeanUtils.copyProperties(temp, csEquipmentDeliveryDTO);
|
||||||
|
return csEquipmentDeliveryDTO;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, collect, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
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.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
@@ -133,6 +136,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
devCountVO.setId(id);
|
devCountVO.setId(id);
|
||||||
//
|
//
|
||||||
devCountVO.setEventCount(0);
|
devCountVO.setEventCount(0);
|
||||||
|
devCountVO.setAlarmLineCount(data.size());
|
||||||
//todo重寫 offLineCount AlarmLineCount
|
//todo重寫 offLineCount AlarmLineCount
|
||||||
devCountVO.setOffLineCount(0);
|
devCountVO.setOffLineCount(0);
|
||||||
|
|
||||||
@@ -156,21 +160,16 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public Boolean transfer(String eid) {
|
public Boolean transfer(String eid) {
|
||||||
|
String userIndex = RequestUtil.getUserIndex();
|
||||||
|
|
||||||
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).list();
|
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).list();
|
||||||
if(CollectionUtils.isEmpty(list)){
|
if(CollectionUtils.isEmpty(list)){
|
||||||
throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE);
|
throw new BusinessException(AlgorithmResponseEnum.DATA_LOSE);
|
||||||
|
|
||||||
}
|
}
|
||||||
this.update(this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).set(CsDeviceUserPO::getStatus,"0"));
|
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();
|
||||||
String userIndex = RequestUtil.getUserIndex();
|
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getStatus,"1" ).apply("primary_user_id<>sub_user_id").set(CsDeviceUserPO::getPrimaryUserId,userIndex).update();
|
||||||
list.forEach(temp->{
|
|
||||||
temp.setPrimaryUserId(userIndex);
|
|
||||||
temp.setStatus("1");
|
|
||||||
if(temp.getPrimaryUserId().equals(temp.getSubUserId())){
|
|
||||||
temp.setSubUserId(userIndex);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.saveBatch(list) ;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -188,7 +187,7 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
csEquipmentDeliveryPO.setId(eid);
|
csEquipmentDeliveryPO.setId(eid);
|
||||||
csEquipmentDeliveryPO.setRunStatus(0);
|
csEquipmentDeliveryPO.setRunStatus(0);
|
||||||
csEquipmentDeliveryMapper.updateById(csEquipmentDeliveryPO);
|
csEquipmentDeliveryMapper.updateById(csEquipmentDeliveryPO);
|
||||||
this.update(this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).set(CsDeviceUserPO::getStatus,"0"));
|
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).set(CsDeviceUserPO::getStatus,"0").update();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -204,11 +203,11 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
|||||||
String userIndex = RequestUtil.getUserIndex();
|
String userIndex = RequestUtil.getUserIndex();
|
||||||
//主用户
|
//主用户
|
||||||
if(Objects.equals(isPrimaryUser(eid),"1")){
|
if(Objects.equals(isPrimaryUser(eid),"1")){
|
||||||
this.update(this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).ne(CsDeviceUserPO::getSubUserId,userIndex).set(CsDeviceUserPO::getStatus,"0"));
|
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).ne(CsDeviceUserPO::getSubUserId,userIndex).set(CsDeviceUserPO::getStatus,"0").update();
|
||||||
}
|
}
|
||||||
//子用户
|
//子用户
|
||||||
else if (Objects.equals(isPrimaryUser(eid),"0")) {
|
else if (Objects.equals(isPrimaryUser(eid),"0")) {
|
||||||
this.update(this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getSubUserId,userIndex).set(CsDeviceUserPO::getStatus,"0"));
|
this.lambdaUpdate().eq(CsDeviceUserPO::getDeviceId, eid).eq(CsDeviceUserPO::getSubUserId,userIndex).set(CsDeviceUserPO::getStatus,"0").update();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
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.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.CsEngineeringMapper;
|
import com.njcn.csdevice.mapper.CsEngineeringMapper;
|
||||||
import com.njcn.csdevice.mapper.CsEngineeringUserMapper;
|
import com.njcn.csdevice.mapper.CsEngineeringUserMapper;
|
||||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||||
@@ -92,9 +94,16 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
|||||||
CsLedger csLedger1 = new CsLedger();
|
CsLedger csLedger1 = new CsLedger();
|
||||||
csLedger1.setId(csEngineeringAuditParm.getId());
|
csLedger1.setId(csEngineeringAuditParm.getId());
|
||||||
if(Objects.equals("0",csEngineeringAuditParm.getStatus())){
|
if(Objects.equals("0",csEngineeringAuditParm.getStatus())){
|
||||||
|
QueryWrapper<CsLedger> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("status",1).eq("pid",csEngineeringAuditParm.getId());
|
||||||
|
List<CsLedger> csLedgers = csLedgerMapper.selectList(queryWrapper);
|
||||||
|
if(!CollectionUtil.isEmpty(csLedgers)){
|
||||||
|
throw new BusinessException(AlgorithmResponseEnum.CHIRLDREN_EXIST.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
csLedger1.setState(0);
|
csLedger1.setState(0);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(csEngineeringAuditParm.getName())){
|
if(StringUtils.isNotBlank(csEngineeringAuditParm.getName())){
|
||||||
csLedger1.setName(csEngineeringAuditParm.getName());
|
csLedger1.setName(csEngineeringAuditParm.getName());
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
<if test="temp!=null and temp.searchValue != null and temp.searchValue !=''">
|
<if test="temp!=null and temp.searchValue != null and temp.searchValue !=''">
|
||||||
AND a.name = #{temp.searchValue}
|
AND a.name like concat(concat("%",#{temp.searchValue}),"%")
|
||||||
</if>
|
</if>
|
||||||
<if test="temp!=null and temp.searchEndTime != null and temp.searchEndTime !=''">
|
<if test="temp!=null and temp.searchEndTime != null and temp.searchEndTime !=''">
|
||||||
AND a.create_time <= #{temp.searchEndTime}"
|
AND a.create_time <= #{temp.searchEndTime}"
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public boolean add(CsConfigurationParm csConfigurationParm) {
|
public boolean add(CsConfigurationParm csConfigurationParm) {
|
||||||
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
CsConfigurationPO csConfigurationPO = new CsConfigurationPO();
|
||||||
|
|
||||||
BeanUtils.copyProperties(csConfigurationParm,csConfigurationPO);
|
BeanUtils.copyProperties(csConfigurationParm,csConfigurationPO);
|
||||||
|
|
||||||
List<String> projectIds = csConfigurationParm.getProjectIds();
|
List<String> projectIds = csConfigurationParm.getProjectIds();
|
||||||
@@ -66,6 +67,12 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
|||||||
|
|
||||||
csConfigurationPO.setStatus("1");
|
csConfigurationPO.setStatus("1");
|
||||||
boolean save = this.save(csConfigurationPO);
|
boolean save = this.save(csConfigurationPO);
|
||||||
|
|
||||||
|
String name = csConfigurationPO.getName();
|
||||||
|
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, name).eq(CsConfigurationPO::getStatus, "1").count();
|
||||||
|
if(count>1){
|
||||||
|
throw new BusinessException("存在相同的组态项目名称");
|
||||||
|
}
|
||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ 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.AppProjectFeignClient;
|
import com.njcn.csdevice.api.AppProjectFeignClient;
|
||||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.cswarn.mapper.CsEquipmentAlarmPOMapper;
|
import com.njcn.cswarn.mapper.CsEquipmentAlarmPOMapper;
|
||||||
@@ -60,11 +61,11 @@ public class CsEquipmentAlarmPOServiceImpl extends ServiceImpl<CsEquipmentAlarmP
|
|||||||
|
|
||||||
CsEquipmentAlarmVO csEquipmentAlarmVO = new CsEquipmentAlarmVO();
|
CsEquipmentAlarmVO csEquipmentAlarmVO = new CsEquipmentAlarmVO();
|
||||||
|
|
||||||
List<CsEquipmentDeliveryPO> data = equipmentFeignClient.queryDeviceById(Stream.of(csEquipmentAlarmAddParm.getEquipmentId()).collect(toList())).getData();
|
List<CsEquipmentDeliveryDTO> data = equipmentFeignClient.queryDeviceById(Stream.of(csEquipmentAlarmAddParm.getEquipmentId()).collect(toList())).getData();
|
||||||
List<AppProjectPO> data1 = appProjectFeignClient.queryProjectById(Stream.of(csEquipmentAlarmAddParm.getProjectId()).collect(toList())).getData();
|
List<AppProjectPO> data1 = appProjectFeignClient.queryProjectById(Stream.of(csEquipmentAlarmAddParm.getProjectId()).collect(toList())).getData();
|
||||||
List<DictData> data3 = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.ALARM_TYPE.getCode()).getData();
|
List<DictData> data3 = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.ALARM_TYPE.getCode()).getData();
|
||||||
|
|
||||||
Map<String, String> collect3 = data.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, CsEquipmentDeliveryPO::getName));
|
Map<String, String> collect3 = data.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, CsEquipmentDeliveryDTO::getName));
|
||||||
Map<String, String> collect4 = data1.stream().collect(Collectors.toMap(AppProjectPO::getId, AppProjectPO::getName));
|
Map<String, String> collect4 = data1.stream().collect(Collectors.toMap(AppProjectPO::getId, AppProjectPO::getName));
|
||||||
Map<String, String> collect5 = data3.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
Map<String, String> collect5 = data3.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
||||||
csEquipmentAlarmVO.setEquipmentName(collect3.get(csEquipmentAlarmAddParm.getEquipmentId()));
|
csEquipmentAlarmVO.setEquipmentName(collect3.get(csEquipmentAlarmAddParm.getEquipmentId()));
|
||||||
@@ -92,11 +93,11 @@ public class CsEquipmentAlarmPOServiceImpl extends ServiceImpl<CsEquipmentAlarmP
|
|||||||
List<String> collect1 = csEquipmentAlarmPOPage.getRecords().stream().map(CsEquipmentAlarmPO::getProjectId).distinct().collect(toList());
|
List<String> collect1 = csEquipmentAlarmPOPage.getRecords().stream().map(CsEquipmentAlarmPO::getProjectId).distinct().collect(toList());
|
||||||
List<String> collect2 = csEquipmentAlarmPOPage.getRecords().stream().map(CsEquipmentAlarmPO::getEquipmentId).distinct().collect(toList());
|
List<String> collect2 = csEquipmentAlarmPOPage.getRecords().stream().map(CsEquipmentAlarmPO::getEquipmentId).distinct().collect(toList());
|
||||||
|
|
||||||
List<CsEquipmentDeliveryPO> data = equipmentFeignClient.queryDeviceById(collect2).getData();
|
List<CsEquipmentDeliveryDTO> data = equipmentFeignClient.queryDeviceById(collect2).getData();
|
||||||
List<AppProjectPO> data1 = appProjectFeignClient.queryProjectById(collect1).getData();
|
List<AppProjectPO> data1 = appProjectFeignClient.queryProjectById(collect1).getData();
|
||||||
List<DictData> data3 = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.ALARM_TYPE.getCode()).getData();
|
List<DictData> data3 = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.ALARM_TYPE.getCode()).getData();
|
||||||
|
|
||||||
Map<String, String> collect3 = data.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, CsEquipmentDeliveryPO::getName));
|
Map<String, String> collect3 = data.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, CsEquipmentDeliveryDTO::getName));
|
||||||
Map<String, String> collect4 = data1.stream().collect(Collectors.toMap(AppProjectPO::getId, AppProjectPO::getName));
|
Map<String, String> collect4 = data1.stream().collect(Collectors.toMap(AppProjectPO::getId, AppProjectPO::getName));
|
||||||
Map<String, String> collect5 = data3.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
Map<String, String> collect5 = data3.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
||||||
|
|
||||||
@@ -128,20 +129,21 @@ public class CsEquipmentAlarmPOServiceImpl extends ServiceImpl<CsEquipmentAlarmP
|
|||||||
List<String> collect1 = csEquipmentAlarmPOS.stream().map(CsEquipmentAlarmPO::getProjectId).distinct().collect(toList());
|
List<String> collect1 = csEquipmentAlarmPOS.stream().map(CsEquipmentAlarmPO::getProjectId).distinct().collect(toList());
|
||||||
List<String> collect2 = csEquipmentAlarmPOS.stream().map(CsEquipmentAlarmPO::getEquipmentId).distinct().collect(toList());
|
List<String> collect2 = csEquipmentAlarmPOS.stream().map(CsEquipmentAlarmPO::getEquipmentId).distinct().collect(toList());
|
||||||
|
|
||||||
List<CsEquipmentDeliveryPO> data = equipmentFeignClient.queryDeviceById(collect2).getData();
|
List<CsEquipmentDeliveryDTO> data = equipmentFeignClient.queryDeviceById(collect2).getData();
|
||||||
List<AppProjectPO> data1 = appProjectFeignClient.queryProjectById(collect1).getData();
|
List<AppProjectPO> data1 = appProjectFeignClient.queryProjectById(collect1).getData();
|
||||||
List<DictData> data3 = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.ALARM_TYPE.getCode()).getData();
|
List<DictData> data3 = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.ALARM_TYPE.getCode()).getData();
|
||||||
|
|
||||||
Map<String, String> collect3 = data.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, CsEquipmentDeliveryPO::getName));
|
Map<String, String> collect3 = data.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, CsEquipmentDeliveryDTO::getName));
|
||||||
Map<String, String> collect4 = data1.stream().collect(Collectors.toMap(AppProjectPO::getId, AppProjectPO::getName));
|
Map<String, String> collect4 = data1.stream().collect(Collectors.toMap(AppProjectPO::getId, AppProjectPO::getName));
|
||||||
Map<String, String> collect5 = data3.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
Map<String, String> collect5 = data3.stream().collect(Collectors.toMap(DictData::getId, DictData::getName));
|
||||||
|
|
||||||
|
|
||||||
List<CsEquipmentAlarmVO> collect = csEquipmentAlarmPOS.stream().map(temp -> {
|
List<CsEquipmentAlarmVO> collect = csEquipmentAlarmPOS.stream().map(temp -> {
|
||||||
CsEquipmentAlarmVO csEquipmentAlarmVO = new CsEquipmentAlarmVO();
|
CsEquipmentAlarmVO csEquipmentAlarmVO = new CsEquipmentAlarmVO();
|
||||||
|
BeanUtils.copyProperties(temp, csEquipmentAlarmVO);
|
||||||
csEquipmentAlarmVO.setEquipmentName(collect3.get(temp.getEquipmentId()));
|
csEquipmentAlarmVO.setEquipmentName(collect3.get(temp.getEquipmentId()));
|
||||||
csEquipmentAlarmVO.setAlarmLevelName(collect4.get(temp.getAlarmLevel()));
|
csEquipmentAlarmVO.setAlarmLevelName(collect5.get(temp.getAlarmLevel()));
|
||||||
csEquipmentAlarmVO.setProjectName(collect5.get(temp.getProjectId()));
|
csEquipmentAlarmVO.setProjectName(collect4.get(temp.getProjectId()));
|
||||||
return csEquipmentAlarmVO;
|
return csEquipmentAlarmVO;
|
||||||
}).collect(toList());
|
}).collect(toList());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user