Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f5ffb8395 | |||
|
|
ed7c02a116 | ||
|
|
e12d23d4e1 | ||
| 0965eed31b | |||
| f754cf61c4 | |||
| e32e820417 | |||
| 158917f2bc | |||
| 2df06d9597 | |||
| 81da6e54ca | |||
| 1f4e8c7e25 | |||
| f90a3228b9 |
@@ -46,7 +46,7 @@ public interface WlRecordFeignClient {
|
|||||||
HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record);
|
HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record);
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/dayDealNoEndTimeEvent")
|
@PostMapping("/dayDealNoEndTimeEvent")
|
||||||
void dayDealNoEndTimeEvent(@RequestParam("date") String date);
|
void dayDealNoEndTimeEvent(@RequestParam("date") String date);
|
||||||
|
|
||||||
@GetMapping("/getWlAssByWlId")
|
@GetMapping("/getWlAssByWlId")
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ public class CsDevModelQueryParm {
|
|||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
private String versionEndDate;
|
private String versionEndDate;
|
||||||
|
@ApiModelProperty(value = "装置型号")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package com.njcn.csdevice.pojo.param;
|
package com.njcn.csdevice.pojo.param;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -35,7 +32,7 @@ public class CsEquipmentDeliveryAddParm{
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value="网络设备ID")
|
@ApiModelProperty(value="网络设备ID")
|
||||||
@NotBlank(message="网络设备ID不能为空!")
|
@NotBlank(message="网络设备ID不能为空!")
|
||||||
@Pattern(regexp = "^[A-Za-z0-9]{1,32}$", message = "网络设备ID只可为(数字,字母)")
|
@Pattern(regexp = "^[A-Za-z0-9]{6,32}$", message = "网络设备ID只可为数字或字母,长度至少为6位")
|
||||||
private String ndid;
|
private String ndid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csdevice.pojo.param;
|
package com.njcn.csdevice.pojo.param;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -34,9 +35,11 @@ public class WlRecordParam {
|
|||||||
private String lineId;
|
private String lineId;
|
||||||
|
|
||||||
@ApiModelProperty("项目起始时间")
|
@ApiModelProperty("项目起始时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime proStartTime;
|
private LocalDateTime proStartTime;
|
||||||
|
|
||||||
@ApiModelProperty("项目结束时间")
|
@ApiModelProperty("项目结束时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime proEndTime;
|
private LocalDateTime proEndTime;
|
||||||
|
|
||||||
@ApiModelProperty("测试项名称")
|
@ApiModelProperty("测试项名称")
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
|||||||
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
|
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
|
||||||
private Integer usageStatus ;
|
private Integer usageStatus ;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="装置与MQTT服务器连接状态")
|
||||||
|
private String connectStatus ;
|
||||||
|
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,9 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|||||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||||
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.njcn.access.utils.MqttUtil;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
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;
|
||||||
@@ -63,10 +65,8 @@ import java.util.stream.Stream;
|
|||||||
public class EquipmentDeliveryController extends BaseController {
|
public class EquipmentDeliveryController extends BaseController {
|
||||||
|
|
||||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
|
|
||||||
private final IMqttUserService mqttUserService;
|
private final IMqttUserService mqttUserService;
|
||||||
private final CsDevModelRelationService csDevModelRelationService;
|
private final CsDevModelRelationService csDevModelRelationService;
|
||||||
|
|
||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -107,6 +107,14 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
public HttpResult<Boolean> updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm ){
|
public HttpResult<Boolean> updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm ){
|
||||||
String methodDescribe = getMethodDescribe("updateEquipmentDelivery");
|
String methodDescribe = getMethodDescribe("updateEquipmentDelivery");
|
||||||
Boolean flag = csEquipmentDeliveryService.updateEquipmentDelivery(csEquipmentDeliveryAuditParm);
|
Boolean flag = csEquipmentDeliveryService.updateEquipmentDelivery(csEquipmentDeliveryAuditParm);
|
||||||
|
if (flag){
|
||||||
|
//查询mqtt用户名和密码是否存在
|
||||||
|
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAuditParm.getNdid());
|
||||||
|
if (result){
|
||||||
|
//初始化装置mqtt连接信息(使用sha256加密)
|
||||||
|
mqttUserService.insertMqttUser(csEquipmentDeliveryAuditParm.getNdid());
|
||||||
|
}
|
||||||
|
}
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,14 +178,6 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
public HttpResult<Page<CsEquipmentDeliveryVO>> list(@RequestBody CsEquipmentDeliveryQueryParm param){
|
public HttpResult<Page<CsEquipmentDeliveryVO>> list(@RequestBody CsEquipmentDeliveryQueryParm param){
|
||||||
String methodDescribe = getMethodDescribe("list");
|
String methodDescribe = getMethodDescribe("list");
|
||||||
Page<CsEquipmentDeliveryVO> page = csEquipmentDeliveryService.list(param);
|
Page<CsEquipmentDeliveryVO> page = csEquipmentDeliveryService.list(param);
|
||||||
//新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
|
||||||
for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : page.getRecords()){
|
|
||||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
|
||||||
csEquipmentDeliveryVO.setStatus(5);
|
|
||||||
} else if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 2) {
|
|
||||||
csEquipmentDeliveryVO.setStatus(6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +249,18 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping(value = "importEquipment")
|
@PostMapping(value = "importEquipment")
|
||||||
public HttpResult<String> importEquipment(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
public HttpResult<String> importEquipment(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
||||||
String methodDescribe = getMethodDescribe("importEquipment");
|
String methodDescribe = getMethodDescribe("importEquipment");
|
||||||
csEquipmentDeliveryService.importEquipment(file, response);
|
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.importEquipment(file, response);
|
||||||
|
if (!CollectionUtils.isEmpty(csEquipmentDeliveryPOS)){
|
||||||
|
csEquipmentDeliveryPOS.forEach(temp->{
|
||||||
|
//查询mqtt用户名和密码是否存在
|
||||||
|
boolean result = mqttUserService.findMqttUser(temp.getNdid());
|
||||||
|
if (result){
|
||||||
|
//初始化装置mqtt连接信息(使用sha256加密)
|
||||||
|
mqttUserService.insertMqttUser(temp.getNdid());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
|||||||
@@ -127,6 +127,20 @@ public class WlRecordController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改测试项日志
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||||
|
@PostMapping("/updateRecordData")
|
||||||
|
@ApiOperation("修改测试项日志")
|
||||||
|
@ApiImplicitParam(name = "record", value = "测试项日志信息", required = true)
|
||||||
|
public HttpResult<Boolean> updateRecordData(@RequestBody @Validated WlRecordParam.UpdateRecord record) {
|
||||||
|
String methodDescribe = getMethodDescribe("updateRecordData");
|
||||||
|
LogUtil.njcnDebug(log, "{},修改的测试项日志信息:{}", methodDescribe, record);
|
||||||
|
wlRecordService.updateRecordData(record);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增或修改方案
|
* 新增或修改方案
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -33,13 +33,10 @@
|
|||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''">
|
<if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''">
|
||||||
AND a.dev_type_name LIKE concat('%',#{csDevModelQueryParm.devName},'%')
|
AND a.dev_type_name = #{csDevModelQueryParm.devName}
|
||||||
</if>
|
</if>
|
||||||
<!-- <if test="csDevModelQueryParm.devType != null and csDevModelQueryParm.devType != ''">-->
|
|
||||||
<!-- AND a.dev_type = #{csDevModelQueryParm.devType}-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<if test="csDevModelQueryParm.name != null and csDevModelQueryParm.name != ''">
|
<if test="csDevModelQueryParm.name != null and csDevModelQueryParm.name != ''">
|
||||||
AND a.name = #{csDevModelQueryParm.name}
|
AND a.name LIKE concat('%',#{csDevModelQueryParm.name},'%')
|
||||||
</if>
|
</if>
|
||||||
order by a.version_date desc
|
order by a.version_date desc
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
*/
|
*/
|
||||||
CsEquipmentDeliveryPO findDevByNDid(String nDid);
|
CsEquipmentDeliveryPO findDevByNDid(String nDid);
|
||||||
|
|
||||||
void importEquipment(MultipartFile file, HttpServletResponse response);
|
List<CsEquipmentDeliveryPO> importEquipment(MultipartFile file, HttpServletResponse response);
|
||||||
|
|
||||||
void delete(String devId);
|
void delete(String devId);
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ public interface IWlRecordService extends IService<WlRecord> {
|
|||||||
*/
|
*/
|
||||||
void updateTestRecord(WlRecordParam.UpdateRecord record);
|
void updateTestRecord(WlRecordParam.UpdateRecord record);
|
||||||
|
|
||||||
|
void updateRecordData(WlRecordParam.UpdateRecord record);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增或修改方案
|
* 新增或修改方案
|
||||||
* @param record
|
* @param record
|
||||||
|
|||||||
@@ -1,37 +1,32 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
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.mapper.CsDevModelMapper;
|
import com.njcn.csdevice.mapper.CsDevModelMapper;
|
||||||
import com.njcn.csdevice.pojo.dto.CsDevModelDto;
|
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelQueryParm;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
||||||
import com.njcn.csdevice.service.CsDevModelService;
|
import com.njcn.csdevice.service.CsDevModelService;
|
||||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||||
import com.njcn.csdevice.service.ICsDataSetService;
|
import com.njcn.csdevice.service.ICsDataSetService;
|
||||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -50,6 +45,7 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
|||||||
private final ICsDataSetService csDataSetService;
|
private final ICsDataSetService csDataSetService;
|
||||||
private final ICsDataArrayService csDataArrayService;
|
private final ICsDataArrayService csDataArrayService;
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshDevModelCache() {
|
public void refreshDevModelCache() {
|
||||||
@@ -128,7 +124,14 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
|||||||
@Override
|
@Override
|
||||||
public IPage<CsDevModelPageVO> queryPage(CsDevModelQueryParm csDevModelQueryParm) {
|
public IPage<CsDevModelPageVO> queryPage(CsDevModelQueryParm csDevModelQueryParm) {
|
||||||
Page<CsDevModelPageVO> returnpage = new Page<> (csDevModelQueryParm.getPageNum ( ), csDevModelQueryParm.getPageSize ( ));
|
Page<CsDevModelPageVO> returnpage = new Page<> (csDevModelQueryParm.getPageNum ( ), csDevModelQueryParm.getPageSize ( ));
|
||||||
|
if (Objects.nonNull (csDevModelQueryParm.getDevType()) && StringUtils.isNotBlank(csDevModelQueryParm.getDevType())) {
|
||||||
|
SysDicTreePO po = dictTreeFeignClient.queryById(csDevModelQueryParm.getDevType()).getData();
|
||||||
|
if (Objects.isNull (po)) {
|
||||||
|
throw new BusinessException("装置型号字典缺失");
|
||||||
|
} else {
|
||||||
|
csDevModelQueryParm.setDevName(po.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
returnpage = this.getBaseMapper ().getPage(returnpage,csDevModelQueryParm);
|
returnpage = this.getBaseMapper ().getPage(returnpage,csDevModelQueryParm);
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ 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.access.api.AskDeviceDataFeignClient;
|
import com.njcn.access.api.AskDeviceDataFeignClient;
|
||||||
|
import com.njcn.access.utils.MqttUtil;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
@@ -93,7 +94,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
private final CsSoftInfoMapper csSoftInfoMapper;
|
private final CsSoftInfoMapper csSoftInfoMapper;
|
||||||
|
private final IMqttUserService mqttUserService;
|
||||||
|
private final MqttUtil mqttUtil;
|
||||||
@Override
|
@Override
|
||||||
public void refreshDeviceDataCache() {
|
public void refreshDeviceDataCache() {
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
@@ -238,7 +240,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
if (countByAccount >= 1) {
|
if (countByAccount >= 1) {
|
||||||
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
|
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
|
||||||
}
|
}
|
||||||
List<CsEquipmentDeliveryPO> list = this.lambdaQuery().ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid()).eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
List<CsEquipmentDeliveryPO> list = this.lambdaQuery()
|
||||||
|
.ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId())
|
||||||
|
.ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid())
|
||||||
|
.eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName())
|
||||||
|
.ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||||
if(!CollectionUtils.isEmpty (list)){
|
if(!CollectionUtils.isEmpty (list)){
|
||||||
throw new BusinessException ("设备名称不能重复");
|
throw new BusinessException ("设备名称不能重复");
|
||||||
}
|
}
|
||||||
@@ -307,6 +313,22 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
item.setQrPath(item.getQrPath());
|
item.setQrPath(item.getQrPath());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
||||||
|
for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : page.getRecords()){
|
||||||
|
if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
||||||
|
csEquipmentDeliveryVO.setStatus(5);
|
||||||
|
} else if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 2) {
|
||||||
|
csEquipmentDeliveryVO.setStatus(6);
|
||||||
|
}
|
||||||
|
//判断装置是否已经连接上mqtt服务器
|
||||||
|
String clientName = "NJCN-" + csEquipmentDeliveryVO.getNdid().substring(csEquipmentDeliveryVO.getNdid().length() - 6);
|
||||||
|
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||||
|
if (mqttClient) {
|
||||||
|
csEquipmentDeliveryVO.setConnectStatus("已连接");
|
||||||
|
} else {
|
||||||
|
csEquipmentDeliveryVO.setConnectStatus("未连接");
|
||||||
|
}
|
||||||
|
}
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,13 +464,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void importEquipment(MultipartFile file, HttpServletResponse response) {
|
public List<CsEquipmentDeliveryPO> importEquipment(MultipartFile file, HttpServletResponse response) {
|
||||||
ImportParams params = new ImportParams ( );
|
ImportParams params = new ImportParams ( );
|
||||||
params.setHeadRows(1);
|
params.setHeadRows(1);
|
||||||
params.setTitleRows(1);
|
params.setTitleRows(1);
|
||||||
//第一个sheet为台账信息
|
//第一个sheet为台账信息
|
||||||
params.setStartSheetIndex(0);
|
params.setStartSheetIndex(0);
|
||||||
params.setSheetNum(1);
|
params.setSheetNum(1);
|
||||||
|
String regex = "^[A-Za-z0-9]{6,32}$";
|
||||||
try {
|
try {
|
||||||
ExcelImportResult<DeviceExcelTemplete> terminalBaseList = ExcelImportUtil.importExcelMore (file.getInputStream ( ), DeviceExcelTemplete.class, params);
|
ExcelImportResult<DeviceExcelTemplete> terminalBaseList = ExcelImportUtil.importExcelMore (file.getInputStream ( ), DeviceExcelTemplete.class, params);
|
||||||
//如果存在非法数据,将不合格的数据导出
|
//如果存在非法数据,将不合格的数据导出
|
||||||
@@ -457,6 +480,15 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
|
|
||||||
for (int i = 0; i < terminalBaseList.getList ( ).size ( ); i++) {
|
for (int i = 0; i < terminalBaseList.getList ( ).size ( ); i++) {
|
||||||
DeviceExcelTemplete deviceExcelTemplete = terminalBaseList.getList ( ).get (i);
|
DeviceExcelTemplete deviceExcelTemplete = terminalBaseList.getList ( ).get (i);
|
||||||
|
|
||||||
|
if(!deviceExcelTemplete.getNdid().matches(regex)){
|
||||||
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
|
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
||||||
|
idlegalityDeviceException.setMsg("网络设备ID只可为数字或字母,长度至少为6位");
|
||||||
|
falseCollect.add(idlegalityDeviceException);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (deviceExcelTemplete.getNdid ( ));
|
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (deviceExcelTemplete.getNdid ( ));
|
||||||
if(!Objects.isNull (po)){
|
if(!Objects.isNull (po)){
|
||||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
@@ -534,17 +566,20 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}).collect (Collectors.toList ( ));
|
}).collect (Collectors.toList ( ));
|
||||||
csEquipmentProcessPOService.saveBatch(collect1,500);
|
csEquipmentProcessPOService.saveBatch(collect1,500);
|
||||||
this.saveOrUpdateBatch (collect, 500);
|
this.saveOrUpdateBatch (collect, 500);
|
||||||
|
|
||||||
|
return collect;
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty (falseCollect)) {
|
if (!CollectionUtils.isEmpty (falseCollect)) {
|
||||||
ExportParams exportExcel = new ExportParams ("批量导入模板(请严格按照模板标准填入数据)", "非法设备信息");
|
ExportParams exportExcel = new ExportParams ("批量导入模板(请严格按照模板标准填入数据)", "非法设备信息");
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel (exportExcel, DeviceExcelTemplete.IllegalityDeviceExcelTemplete.class, falseCollect);
|
Workbook workbook = ExcelExportUtil.exportExcel (exportExcel, DeviceExcelTemplete.IllegalityDeviceExcelTemplete.class, falseCollect);
|
||||||
ExcelStyleUtil.exportFileByWorkbook (workbook, "非法设备信息.xlsx", response);
|
ExcelStyleUtil.exportFileByWorkbook (workbook, "非法设备信息.xlsx", response);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace ( );
|
e.printStackTrace ( );
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* 物理删除设备相关数据
|
* 物理删除设备相关数据
|
||||||
|
|||||||
@@ -337,8 +337,8 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||||
re = Objects.isNull(temp.getValue()) ? 3.14159 : temp.getValue() / 1000;
|
re = Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue() / 1000));
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
vo.setStatisticalData(re);
|
||||||
unit = "k" + epdPqd.getUnit();
|
unit = "k" + epdPqd.getUnit();
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue())));
|
vo.setStatisticalData(Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue())));
|
||||||
|
|||||||
@@ -206,6 +206,20 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
overlimitService.saveOrUpdate(overlimit);
|
overlimitService.saveOrUpdate(overlimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRecordData(WlRecordParam.UpdateRecord record) {
|
||||||
|
LambdaQueryWrapper<WlRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(WlRecord::getId, record.getId());
|
||||||
|
WlRecord wlRecord = this.getOne(queryWrapper);
|
||||||
|
if (Objects.isNull(wlRecord)) {
|
||||||
|
throw new BusinessException("测试项缺失!");
|
||||||
|
} else {
|
||||||
|
wlRecord.setStartTime(record.getProStartTime());
|
||||||
|
wlRecord.setEndTime(record.getProEndTime());
|
||||||
|
}
|
||||||
|
this.updateById(wlRecord);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSchemeRecord(WlRecordParam.UpdateRecord record) {
|
public void updateSchemeRecord(WlRecordParam.UpdateRecord record) {
|
||||||
WlRecord wlRecord = new WlRecord();
|
WlRecord wlRecord = new WlRecord();
|
||||||
@@ -682,7 +696,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||||
if(Objects.nonNull(statisticalDataDTO)){
|
if(Objects.nonNull(statisticalDataDTO)){
|
||||||
LocalDateTime endTime = statisticalDataDTO.getTime().atOffset(ZoneOffset.ofHours(0)).toLocalDateTime();
|
LocalDateTime endTime = statisticalDataDTO.getTime().atOffset(ZoneOffset.ofHours(0)).toLocalDateTime();
|
||||||
Duration duration = Duration.between(now, endTime);
|
Duration duration = Duration.between(endTime,now);
|
||||||
long hour = duration.toHours();
|
long hour = duration.toHours();
|
||||||
if(hour>6){
|
if(hour>6){
|
||||||
WlRecord wlRecord = new WlRecord();
|
WlRecord wlRecord = new WlRecord();
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import lombok.NoArgsConstructor;
|
|||||||
|
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -46,7 +45,4 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
|
|||||||
|
|
||||||
@ApiModelProperty(value = "测点id")
|
@ApiModelProperty(value = "测点id")
|
||||||
private String lineId;
|
private String lineId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -45,10 +45,14 @@ public class CsEventUserQueryParam {
|
|||||||
|
|
||||||
private String level;
|
private String level;
|
||||||
@ApiModelProperty(value="起始时间")
|
@ApiModelProperty(value="起始时间")
|
||||||
// @NotNull(message="起始时间不能为空!")
|
|
||||||
private String startTime;
|
private String startTime;
|
||||||
|
|
||||||
@ApiModelProperty(value="结束时间")
|
@ApiModelProperty(value="结束时间")
|
||||||
// @NotNull(message="结束时间不能为空!")
|
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "事件类型 Evt_Sys_DipStr:电压暂降 Evt_Sys_SwlStr:电压暂升 Evt_Sys_IntrStr:电压中断")
|
||||||
|
private String eventType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "位置 grid:电网侧 load:负载侧")
|
||||||
|
private String location;
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,6 @@
|
|||||||
AND DATE(b.start_time) >= DATE(#{csEventUserQueryPage.startTime})
|
AND DATE(b.start_time) >= DATE(#{csEventUserQueryPage.startTime})
|
||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.target != null and csEventUserQueryPage.target.size()>0">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.target != null and csEventUserQueryPage.target.size()>0">
|
||||||
|
|
||||||
and b.tag in
|
and b.tag in
|
||||||
<foreach collection="csEventUserQueryPage.target" index="index" item="item" open="(" separator="," close=")">
|
<foreach collection="csEventUserQueryPage.target" index="index" item="item" open="(" separator="," close=")">
|
||||||
#{item}
|
#{item}
|
||||||
@@ -160,7 +159,15 @@
|
|||||||
|
|
||||||
</if>
|
</if>
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
|
||||||
AND b.level =#{ csEventUserQueryPage.level}
|
AND b.level = #{ csEventUserQueryPage.level}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.eventType != null and csEventUserQueryPage.eventType !=''">
|
||||||
|
AND b.tag = #{csEventUserQueryPage.eventType}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.location != null and csEventUserQueryPage.location !=''">
|
||||||
|
AND b.location = #{csEventUserQueryPage.location}
|
||||||
</if>
|
</if>
|
||||||
order by b.start_time desc
|
order by b.start_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -220,8 +220,8 @@ public class DataServiceImpl implements IDataService {
|
|||||||
if (Objects.equals("Primary",dataLevel)) {
|
if (Objects.equals("Primary",dataLevel)) {
|
||||||
if (Objects.equals("Primary",csDataSetLevel)) {
|
if (Objects.equals("Primary",csDataSetLevel)) {
|
||||||
if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) {
|
if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) {
|
||||||
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / 1000;
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue() / 1000));
|
||||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
vo.setAvgValue(re);
|
||||||
unit = "k" + item2.getUnit();
|
unit = "k" + item2.getUnit();
|
||||||
} else {
|
} else {
|
||||||
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
||||||
@@ -243,11 +243,11 @@ public class DataServiceImpl implements IDataService {
|
|||||||
unit = "k" + item2.getUnit();
|
unit = "k" + item2.getUnit();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
re = statisticalDataDTO.getValue();
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue();
|
||||||
unit = item2.getUnit();
|
unit = item2.getUnit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
vo.setAvgValue(Objects.equals(re,3.14159) ? 3.14159 : Double.parseDouble(df.format(re)));
|
||||||
}else {
|
}else {
|
||||||
if (Objects.nonNull(statisticalDataDTO)) {
|
if (Objects.nonNull(statisticalDataDTO)) {
|
||||||
re = statisticalDataDTO.getValue();
|
re = statisticalDataDTO.getValue();
|
||||||
@@ -270,10 +270,10 @@ public class DataServiceImpl implements IDataService {
|
|||||||
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / pt / ct / 1000;
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / pt / ct / 1000;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
re = statisticalDataDTO.getValue();
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
vo.setAvgValue(Objects.equals(re,3.14159) ? 3.14159 : Double.parseDouble(df.format(re)));
|
||||||
}else {
|
}else {
|
||||||
if (Objects.nonNull(statisticalDataDTO)) {
|
if (Objects.nonNull(statisticalDataDTO)) {
|
||||||
re = statisticalDataDTO.getValue();
|
re = statisticalDataDTO.getValue();
|
||||||
|
|||||||
Reference in New Issue
Block a user