Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd07f8bee3 | ||
| 58a559b7b7 | |||
|
|
52342d736d | ||
| 6f5ffb8395 | |||
|
|
ed7c02a116 | ||
|
|
e12d23d4e1 | ||
| 0965eed31b | |||
| f754cf61c4 | |||
| e32e820417 | |||
| 158917f2bc | |||
| 2df06d9597 | |||
| 81da6e54ca | |||
| 1f4e8c7e25 | |||
| f90a3228b9 | |||
| 04cdb50b13 | |||
| b377ad7c95 | |||
|
|
698c0a6eb0 | ||
| ada760eeb2 | |||
| b22bd79750 | |||
|
|
5f14f8fe2f | ||
| b93faee241 | |||
| 2191276185 | |||
| 2206f203e8 | |||
| c28724bb05 | |||
|
|
86d21f984c | ||
|
|
6f38ddf068 | ||
| d1aefa92d8 | |||
| 51a22057a9 | |||
| 8055d08bda | |||
| 8a0e0d8c08 | |||
| 3df2bedaa6 |
@@ -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,12 +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 java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -34,6 +32,7 @@ public class CsEquipmentDeliveryAddParm{
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value="网络设备ID")
|
@ApiModelProperty(value="网络设备ID")
|
||||||
@NotBlank(message="网络设备ID不能为空!")
|
@NotBlank(message="网络设备ID不能为空!")
|
||||||
|
@Pattern(regexp = "^[A-Za-z0-9]{6,32}$", message = "网络设备ID只可为数字或字母,长度至少为6位")
|
||||||
private String ndid;
|
private String ndid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ 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.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -32,6 +33,7 @@ public class CsEquipmentDeliveryAuditParm {
|
|||||||
* 网关识别码
|
* 网关识别码
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value="网关识别码")
|
@ApiModelProperty(value="网关识别码")
|
||||||
|
@Pattern(regexp = "^[A-Za-z0-9]{1,32}$", message = "网络设备ID只可为(数字,字母)")
|
||||||
private String ndid;
|
private String ndid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -48,4 +48,9 @@ public class CsLineParam extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String dataSetId;
|
private String dataSetId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计间隔
|
||||||
|
*/
|
||||||
|
private Integer lineInterval;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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("测试项名称")
|
||||||
@@ -112,6 +115,10 @@ public class WlRecordParam {
|
|||||||
@ApiModelProperty("测试项结束时间")
|
@ApiModelProperty("测试项结束时间")
|
||||||
private String itemEndTime;
|
private String itemEndTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据来源 0:补召 1:在线监测 ")
|
||||||
|
private Integer dataSource;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,4 +150,10 @@ public class WlRecord extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String gcDataPath;
|
private String gcDataPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据类型(Primary:一次值 Secondary:二次值)
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String dataLevel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,4 +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;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,6 +27,12 @@ public class DataGroupEventVO {
|
|||||||
@ApiModelProperty("监测点名称")
|
@ApiModelProperty("监测点名称")
|
||||||
private String lineName;
|
private String lineName;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置ID")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置名称")
|
||||||
|
private String devName;
|
||||||
|
|
||||||
@ApiModelProperty("项目名称")
|
@ApiModelProperty("项目名称")
|
||||||
private String projectName;
|
private String projectName;
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ public class RecordVo {
|
|||||||
@ApiModelProperty("名称")
|
@ApiModelProperty("名称")
|
||||||
private String itemName;
|
private String itemName;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
@ApiModelProperty("数据起始时间")
|
@ApiModelProperty("数据起始时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime startTime;
|
private LocalDateTime startTime;
|
||||||
@@ -30,6 +33,9 @@ public class RecordVo {
|
|||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime endTime;
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("持续时间")
|
||||||
|
private String lastTime;
|
||||||
|
|
||||||
@ApiModelProperty("测试位置")
|
@ApiModelProperty("测试位置")
|
||||||
private String location;
|
private String location;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.njcn.csdevice.utils;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2024/12/17 14:29【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
public class StringUtil {
|
||||||
|
public static void containsSpecialCharacters(String str) {
|
||||||
|
// 定义包含特殊字符的正则表达式
|
||||||
|
String specialChars = "[<>%'%;()&+/\\\\-\\\\\\\\_|@*?#$!,.]|html";
|
||||||
|
// 创建Pattern对象
|
||||||
|
Pattern pattern = Pattern.compile(specialChars);
|
||||||
|
// 使用Pattern对象的matcher方法检查字符串
|
||||||
|
if(pattern.matcher(str).find()){
|
||||||
|
throw new BusinessException("存在特殊字符[<>\"'%;()&+//\\-———|@*_?#$!,.html]");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
StringUtil.containsSpecialCharacters("*");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
@@ -23,6 +25,9 @@ import com.njcn.csdevice.service.IMqttUserService;
|
|||||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||||
import com.njcn.poi.excel.ExcelUtil;
|
import com.njcn.poi.excel.ExcelUtil;
|
||||||
import com.njcn.poi.util.PoiUtil;
|
import com.njcn.poi.util.PoiUtil;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.web.advice.DeviceLog;
|
import com.njcn.web.advice.DeviceLog;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
@@ -30,6 +35,7 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
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 org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -37,6 +43,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -58,9 +65,9 @@ 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;
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/addEquipmentDelivery")
|
@PostMapping("/addEquipmentDelivery")
|
||||||
@@ -100,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,12 +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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +230,13 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
ExportParams exportParams = new ExportParams("批量导入模板(请严格按照模板标准填入数据)", "终端入网检测录入信息");
|
ExportParams exportParams = new ExportParams("批量导入模板(请严格按照模板标准填入数据)", "终端入网检测录入信息");
|
||||||
exportParams.setStyle(ExcelStyleUtil.class);
|
exportParams.setStyle(ExcelStyleUtil.class);
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DeviceExcelTemplete.class, new ArrayList<DeviceExcelTemplete>());
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DeviceExcelTemplete.class, new ArrayList<DeviceExcelTemplete>());
|
||||||
ExcelUtil.selectList(workbook, 2, 2, Stream.of("直连设备","网关设备").collect(Collectors.toList()).toArray(new String[]{}));
|
List<SysDicTreePO> deviceType = dictTreeFeignClient.queryByCodeList(DicDataTypeEnum.DEVICE_TYPE.getCode()).getData();
|
||||||
|
if(!CollectionUtils.isEmpty(deviceType)){
|
||||||
|
List<String> collect = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getName).collect(Collectors.toList());
|
||||||
|
ExcelUtil.selectList(workbook, 2, 2, collect.toArray(new String[]{}));
|
||||||
|
List<String> collect2 = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getChildren).flatMap(Collection::stream).map(SysDicTreePO::getName).collect(Collectors.toList());
|
||||||
|
ExcelUtil.selectList(workbook, 3, 3, collect2.toArray(new String[]{}));
|
||||||
|
}
|
||||||
ExcelUtil.selectList(workbook, 4, 4, Stream.of("MQTT","CLD").collect(Collectors.toList()).toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 4, 4, Stream.of("MQTT","CLD").collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
String fileName = "设备模板.xlsx";
|
String fileName = "设备模板.xlsx";
|
||||||
ExportParams exportExcel = new ExportParams("设备模板", "设备模板");
|
ExportParams exportExcel = new ExportParams("设备模板", "设备模板");
|
||||||
@@ -234,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
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ public class CslineController extends BaseController {
|
|||||||
@PostMapping("/getById")
|
@PostMapping("/getById")
|
||||||
@ApiOperation("根据监测点id获取监测点详情")
|
@ApiOperation("根据监测点id获取监测点详情")
|
||||||
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true)
|
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true)
|
||||||
@ApiIgnore
|
|
||||||
public HttpResult<CsLinePO> getById(@RequestParam String lineId) {
|
public HttpResult<CsLinePO> getById(@RequestParam String lineId) {
|
||||||
String methodDescribe = getMethodDescribe("getById");
|
String methodDescribe = getMethodDescribe("getById");
|
||||||
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增或修改方案
|
* 新增或修改方案
|
||||||
*/
|
*/
|
||||||
@@ -246,6 +260,5 @@ public class WlRecordController extends BaseController {
|
|||||||
List<WlRecord> result = wlRecordService.getWlAssByWlId(wlId);
|
List<WlRecord> result = wlRecordService.getWlAssByWlId(wlId);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,5 +49,5 @@ public interface WlRecordMapper extends BaseMapper<WlRecord> {
|
|||||||
|
|
||||||
List<CsLedgerVO> getAllLine(@Param("devId") String devId);
|
List<CsLedgerVO> getAllLine(@Param("devId") String devId);
|
||||||
|
|
||||||
List<WlRecord> getWlAssByWlId(String wlId);
|
List<WlRecord> getWlAssByWlId(@Param("wlId") String wlId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
where
|
where
|
||||||
pid = #{modelId}
|
pid = #{modelId}
|
||||||
and cl_dev = #{clDev}
|
and cl_dev = #{clDev}
|
||||||
and data_type in ('Stat',NULL)
|
and (data_type = 'Stat' or data_type IS NULL)
|
||||||
order by type,cl_dev
|
order by type,cl_dev
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
</if>
|
</if>
|
||||||
exists
|
exists
|
||||||
(select 1 from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id} and wd.data_id = a.id)
|
(select 1 from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id} and wd.data_id = a.id)
|
||||||
order by a.start_time asc
|
order by a.start_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAll" resultType="com.njcn.csdevice.pojo.vo.CsLedgerVO">
|
<select id="getAll" resultType="com.njcn.csdevice.pojo.vo.CsLedgerVO">
|
||||||
@@ -95,6 +95,53 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getWlAssByWlId" resultType="com.njcn.csdevice.pojo.po.WlRecord">
|
<select id="getWlAssByWlId" resultType="com.njcn.csdevice.pojo.po.WlRecord">
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.start_time,
|
||||||
|
a.end_time,
|
||||||
|
a.line_id,
|
||||||
|
a.type,
|
||||||
|
c.data_level AS dataLevel,
|
||||||
|
b.ct_ratio AS ct,
|
||||||
|
b.pt_ratio AS pt,
|
||||||
|
NULL AS itemName,
|
||||||
|
NULL AS voltageLevel,
|
||||||
|
NULL AS capacitySscb,
|
||||||
|
NULL AS capacitySscmin,
|
||||||
|
NULL AS capacitySt,
|
||||||
|
NULL AS capacitySi
|
||||||
|
FROM
|
||||||
|
wl_record a
|
||||||
|
INNER JOIN cs_line b ON a.line_id = b.line_id
|
||||||
|
INNER JOIN cs_data_set c ON b.data_set_id = c.id
|
||||||
|
WHERE
|
||||||
|
a.type = 1
|
||||||
|
AND a.id IN (
|
||||||
|
SELECT
|
||||||
|
data_id
|
||||||
|
FROM
|
||||||
|
wl_record_test_data
|
||||||
|
WHERE
|
||||||
|
test_item_id = #{wlId} )
|
||||||
|
UNION
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.start_time,
|
||||||
|
a.end_time,
|
||||||
|
a.line_id,
|
||||||
|
a.type,
|
||||||
|
NULL AS dataLevel,
|
||||||
|
(a.ct / a.ct1) AS ct,
|
||||||
|
(a.pt / a.pt1) AS pt,
|
||||||
|
a.item_name,
|
||||||
|
a.voltage_level,
|
||||||
|
a.capacity_sscb,
|
||||||
|
a.capacity_sscmin,
|
||||||
|
a.capacity_st,
|
||||||
|
a.capacity_si
|
||||||
|
FROM
|
||||||
|
wl_record a
|
||||||
|
WHERE
|
||||||
|
a.id = #{wlId}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.njcn.csdevice.service.ICsDataSetService;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
|||||||
.in(CsDataSet::getType, Arrays.asList(0,2))
|
.in(CsDataSet::getType, Arrays.asList(0,2))
|
||||||
.eq(CsDataSet::getStoreFlag,1)
|
.eq(CsDataSet::getStoreFlag,1)
|
||||||
.and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
|
.and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
|
||||||
.orderByAsc(CsDataSet::getType,CsDataSet::getClDev)
|
.orderByAsc(CsDataSet::getIdx)
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -31,6 +32,7 @@ import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
|||||||
import com.njcn.csdevice.service.*;
|
import com.njcn.csdevice.service.*;
|
||||||
import com.njcn.csdevice.util.QRCodeUtil;
|
import com.njcn.csdevice.util.QRCodeUtil;
|
||||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||||
|
import com.njcn.csdevice.utils.StringUtil;
|
||||||
import com.njcn.db.constant.DbConstant;
|
import com.njcn.db.constant.DbConstant;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
@@ -39,6 +41,7 @@ import com.njcn.redis.utils.RedisUtil;
|
|||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.DictTreeFeignClient;
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
import com.njcn.system.enums.DicTreeEnum;
|
import com.njcn.system.enums.DicTreeEnum;
|
||||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||||
@@ -91,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<>();
|
||||||
@@ -104,6 +108,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||||
boolean result;
|
boolean result;
|
||||||
|
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAddParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||||
|
if(Objects.nonNull (one)){
|
||||||
|
throw new BusinessException ("设备名称不能重复");
|
||||||
|
}
|
||||||
|
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAddParm.getNdid());
|
||||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
|
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
|
||||||
if(!Objects.isNull (po)){
|
if(!Objects.isNull (po)){
|
||||||
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
|
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
|
||||||
@@ -218,6 +227,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) {
|
public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) {
|
||||||
|
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAuditParm.getNdid());
|
||||||
|
|
||||||
|
|
||||||
boolean result;
|
boolean result;
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
|
||||||
@@ -228,6 +240,14 @@ 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::getId, csEquipmentDeliveryAuditParm.getId())
|
||||||
|
.ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid())
|
||||||
|
.eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName())
|
||||||
|
.ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||||
|
if(!CollectionUtils.isEmpty (list)){
|
||||||
|
throw new BusinessException ("设备名称不能重复");
|
||||||
|
}
|
||||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||||
BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
||||||
result = this.updateById(csEquipmentDeliveryPo);
|
result = this.updateById(csEquipmentDeliveryPo);
|
||||||
@@ -293,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,47 +418,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CsDataSet item = dataSet.get(0);
|
CsDataSet item = dataSet.get(0);
|
||||||
//准实时数据
|
boolean isPortableDevice = DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType());
|
||||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
addDataSet(dataSetList, item, "最新数据", "rt");
|
||||||
dataSetVO.setId(item.getId());
|
addDataSet(dataSetList, item, "历史统计数据", "history");
|
||||||
dataSetVO.setName("准实时数据");
|
addDataSet(dataSetList, item, "历史趋势", "trenddata");
|
||||||
dataSetVO.setType("rt");
|
if (isPortableDevice) {
|
||||||
dataSetList.add(dataSetVO);
|
// 便携式设备特有的数据集
|
||||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
||||||
//历史数据tab
|
addDataSet(dataSetList, item, "暂态事件", "event");
|
||||||
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
addDataSet(dataSetList, item, "测试项日志", "items");
|
||||||
dataSetVo2.setId(item.getId());
|
|
||||||
dataSetVo2.setName("历史统计数据");
|
|
||||||
dataSetVo2.setType("history");
|
|
||||||
dataSetList.add(dataSetVo2);
|
|
||||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
|
||||||
//趋势数据tab
|
|
||||||
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
|
|
||||||
dataSetVo3.setId(item.getId());
|
|
||||||
dataSetVo3.setName("历史趋势");
|
|
||||||
dataSetVo3.setType("trenddata");
|
|
||||||
dataSetList.add(dataSetVo3);
|
|
||||||
//下面这些tab仅仅只限于设备监控的便携式设备才会有
|
|
||||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType())){
|
|
||||||
//实时数据tab
|
|
||||||
DeviceManagerVO.DataSetVO dataSetVo4 = new DeviceManagerVO.DataSetVO();
|
|
||||||
dataSetVo4.setId(item.getId());
|
|
||||||
dataSetVo4.setName("实时数据");
|
|
||||||
dataSetVo4.setType("realtimedata");
|
|
||||||
dataSetList.add(dataSetVo4);
|
|
||||||
//暂态事件tab
|
|
||||||
DeviceManagerVO.DataSetVO dataSetVo5 = new DeviceManagerVO.DataSetVO();
|
|
||||||
dataSetVo5.setId(item.getId());
|
|
||||||
dataSetVo5.setName("暂态事件");
|
|
||||||
dataSetVo5.setType("event");
|
|
||||||
dataSetList.add(dataSetVo5);
|
|
||||||
//测试项tab
|
|
||||||
DeviceManagerVO.DataSetVO dataSetVo6 = new DeviceManagerVO.DataSetVO();
|
|
||||||
dataSetVo6.setId(item.getId());
|
|
||||||
dataSetVo6.setName("测试项记录");
|
|
||||||
dataSetVo6.setType("items");
|
|
||||||
dataSetList.add(dataSetVo6);
|
|
||||||
}
|
}
|
||||||
|
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||||
}
|
}
|
||||||
deviceManagerVo.setDataSetList(dataSetList);
|
deviceManagerVo.setDataSetList(dataSetList);
|
||||||
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
|
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
|
||||||
@@ -432,6 +438,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addDataSet(List<DeviceManagerVO.DataSetVO> dataSetList, CsDataSet item, String name, String type) {
|
||||||
|
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||||
|
dataSetVO.setId(item.getId());
|
||||||
|
dataSetVO.setName(name);
|
||||||
|
dataSetVO.setType(type);
|
||||||
|
dataSetList.add(dataSetVO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSoftInfoBynDid(String nDid, String id, Integer module) {
|
public void updateSoftInfoBynDid(String nDid, String id, Integer module) {
|
||||||
boolean result;
|
boolean result;
|
||||||
@@ -450,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);
|
||||||
//如果存在非法数据,将不合格的数据导出
|
//如果存在非法数据,将不合格的数据导出
|
||||||
@@ -465,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();
|
||||||
@@ -473,39 +497,47 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
falseCollect.add(idlegalityDeviceException);
|
falseCollect.add(idlegalityDeviceException);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(Objects.equals(deviceExcelTemplete.getDevType(),DicDataEnum.GATEWAY_DEV.getName())){
|
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, deviceExcelTemplete.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||||
DictTreeVO data = dictTreeFeignClient.queryByCode(DicDataEnum.GATEWAY_DEV.getCode()).getData();
|
if(Objects.nonNull (one)){
|
||||||
deviceExcelTemplete.setDevType(data.getId());
|
|
||||||
List<DictTreeVO> data1 = dictTreeFeignClient.query(data.getId()).getData();
|
|
||||||
Map<String, DictTreeVO> collect = data1.stream().collect(Collectors.toMap(DictTreeVO::getCode, dictTreeVO -> dictTreeVO));
|
|
||||||
if(collect.containsKey(deviceExcelTemplete.getDevModel())){
|
|
||||||
deviceExcelTemplete.setDevModel(collect.get(deviceExcelTemplete.getDevModel()).getId());
|
|
||||||
trueCollect.add(deviceExcelTemplete);
|
|
||||||
}else {
|
|
||||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
||||||
idlegalityDeviceException.setMsg("装置型号不正确");
|
idlegalityDeviceException.setMsg("NDID重复");
|
||||||
falseCollect.add(idlegalityDeviceException);
|
falseCollect.add(idlegalityDeviceException);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
} else if (Objects.equals(deviceExcelTemplete.getDevType(),DicDataEnum.CONNECT_DEV.getName())) {
|
List<SysDicTreePO> deviceType = dictTreeFeignClient.queryByCodeList(DicDataTypeEnum.DEVICE_TYPE.getCode()).getData();
|
||||||
DictTreeVO data = dictTreeFeignClient.queryByCode(DicDataEnum.CONNECT_DEV.getCode()).getData();
|
//设备类型
|
||||||
deviceExcelTemplete.setDevType(data.getId());
|
List<SysDicTreePO> children = deviceType.get(0).getChildren();
|
||||||
List<DictTreeVO> data1 = dictTreeFeignClient.query(data.getId()).getData();
|
Map<String, SysDicTreePO> map = children.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO));
|
||||||
Map<String, DictTreeVO> collect = data1.stream().collect(Collectors.toMap(DictTreeVO::getCode, dictTreeVO -> dictTreeVO));
|
|
||||||
if(collect.containsKey(deviceExcelTemplete.getDevModel())){
|
List<SysDicTreePO> collect = children.stream().filter(temp -> Objects.equals(temp.getName(), deviceExcelTemplete.getDevType())).collect(Collectors.toList());
|
||||||
deviceExcelTemplete.setDevModel(collect.get(deviceExcelTemplete.getDevModel()).getId());
|
SysDicTreePO sysDicTreePO = map.get(deviceExcelTemplete.getDevType());
|
||||||
trueCollect.add(deviceExcelTemplete);
|
if(CollectionUtils.isEmpty(collect)){
|
||||||
}else {
|
|
||||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
||||||
idlegalityDeviceException.setMsg("装置型号不正确");
|
idlegalityDeviceException.setMsg("设备类型不正确");
|
||||||
falseCollect.add(idlegalityDeviceException);
|
falseCollect.add(idlegalityDeviceException);
|
||||||
|
continue;
|
||||||
|
}else {
|
||||||
|
deviceExcelTemplete.setDevType(map.get(deviceExcelTemplete.getDevType()).getId());
|
||||||
|
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
|
//设备型号
|
||||||
|
List<SysDicTreePO> children1 = sysDicTreePO.getChildren();
|
||||||
|
Map<String, SysDicTreePO> map2 = children1.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO));
|
||||||
|
|
||||||
|
List<SysDicTreePO> collect2 = children1.stream().filter(temp -> Objects.equals(temp.getName(), deviceExcelTemplete.getDevModel())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if(CollectionUtils.isEmpty(collect2)){
|
||||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
||||||
idlegalityDeviceException.setMsg("装置类型不正确");
|
idlegalityDeviceException.setMsg("设备类型与设备型号不匹配");
|
||||||
falseCollect.add(idlegalityDeviceException);
|
falseCollect.add(idlegalityDeviceException);
|
||||||
|
continue;
|
||||||
|
}else {
|
||||||
|
deviceExcelTemplete.setDevModel(map2.get(deviceExcelTemplete.getDevModel()).getId());
|
||||||
|
trueCollect.add(deviceExcelTemplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -522,6 +554,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
csEquipmentDeliveryPO.setRunStatus(1);
|
csEquipmentDeliveryPO.setRunStatus(1);
|
||||||
csEquipmentDeliveryPO.setStatus(1);
|
csEquipmentDeliveryPO.setStatus(1);
|
||||||
csEquipmentDeliveryPO.setProcess(2);
|
csEquipmentDeliveryPO.setProcess(2);
|
||||||
|
csEquipmentDeliveryPO.setSort(100);
|
||||||
|
|
||||||
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
||||||
csEquipmentProcess.setDevId(csEquipmentDeliveryPO.getNdid());
|
csEquipmentProcess.setDevId(csEquipmentDeliveryPO.getNdid());
|
||||||
@@ -534,17 +567,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;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* 物理删除设备相关数据
|
* 物理删除设备相关数据
|
||||||
|
|||||||
@@ -333,28 +333,66 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
vo.setStatMethod(temp.getValueType());
|
vo.setStatMethod(temp.getValueType());
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
if(temp.getValue()!=null) {
|
if(temp.getValue()!=null) {
|
||||||
double re;
|
double re = 0;
|
||||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
|
||||||
unit = epdPqd.getUnit();
|
|
||||||
} else {
|
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 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(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue())));
|
||||||
unit = epdPqd.getUnit();
|
unit = epdPqd.getUnit();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = temp.getValue() * pt / 1000;
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = temp.getValue() * ct;
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() * pt * ct / 1000;
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}else {
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct);
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = temp.getValue() / pt;
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = temp.getValue() / ct;
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() / pt / ct;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
}else {
|
}else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
re = temp.getValue();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
@@ -367,8 +405,21 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
unit = epdPqd.getUnit();
|
unit = epdPqd.getUnit();
|
||||||
} else {
|
} else {
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
unit = "k" + epdPqd.getUnit();
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
unit = epdPqd.getUnit();
|
unit = epdPqd.getUnit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,15 @@ import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
|||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
import com.njcn.csdevice.service.*;
|
import com.njcn.csdevice.service.*;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.system.api.AreaFeignClient;
|
import com.njcn.system.api.AreaFeignClient;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
|
||||||
import com.njcn.system.pojo.po.Area;
|
import com.njcn.system.pojo.po.Area;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,15 +39,12 @@ import java.util.stream.Collectors;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> implements ICsLedgerService {
|
public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> implements ICsLedgerService {
|
||||||
|
|
||||||
private final ICsEngineeringUserService csEngineeringUserService;
|
|
||||||
private final AreaFeignClient areaFeignClient;
|
private final AreaFeignClient areaFeignClient;
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
private final AppTopologyDiagramMapper appTopologyDiagramMapper;
|
private final AppTopologyDiagramMapper appTopologyDiagramMapper;
|
||||||
private final AppProjectMapper appProjectMapper;
|
private final AppProjectMapper appProjectMapper;
|
||||||
private final CsEngineeringMapper csEngineeringMapper;
|
private final CsEngineeringMapper csEngineeringMapper;
|
||||||
private final CsLinePOService csLinePOService;
|
private final CsLinePOService csLinePOService;
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
|
||||||
private final RoleEngineerDevService roleEngineerDevService;
|
private final RoleEngineerDevService roleEngineerDevService;
|
||||||
private final CsDevModelRelationService csDevModelRelationService;
|
private final CsDevModelRelationService csDevModelRelationService;
|
||||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||||
@@ -77,17 +73,29 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||||
List<String> device = roleEngineerDevService.getDevice();
|
List<String> device = roleEngineerDevService.getDevice();
|
||||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||||
|
|
||||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
|
|
||||||
peek(
|
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
||||||
temp->{
|
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(temp.getId());
|
.map(CsLedgerVO::getId)
|
||||||
temp.setComFlag(csEquipmentDeliveryPO.getRunStatus());
|
.distinct()
|
||||||
temp.setType("device");
|
.collect(Collectors.toMap(
|
||||||
}
|
Function.identity(),
|
||||||
).
|
csEquipmentDeliveryMapper::selectById
|
||||||
sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
));
|
||||||
|
|
||||||
|
List<CsLedgerVO> deviceList = allList.stream()
|
||||||
|
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||||
|
.peek(item -> {
|
||||||
|
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
||||||
|
item.setComFlag(po.getRunStatus());
|
||||||
|
item.setNDId(po.getNdid());
|
||||||
|
item.setType("device");
|
||||||
|
})
|
||||||
|
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||||
|
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
List<CsLedgerVO> finalLineList = allList.stream()
|
List<CsLedgerVO> finalLineList = allList.stream()
|
||||||
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
|
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
|
||||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||||
@@ -117,16 +125,28 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
portable.setName(DataParam.portableDev);
|
portable.setName(DataParam.portableDev);
|
||||||
portable.setPid("0");
|
portable.setPid("0");
|
||||||
portable.setId(IdUtil.simpleUUID());
|
portable.setId(IdUtil.simpleUUID());
|
||||||
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
|
//针对未启用的装置判断
|
||||||
for(CsLedgerVO c : portables){
|
List<CsLedgerVO> ledger = allList.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
CsLedgerVO::getId,
|
||||||
|
csEquipmentDeliveryMapper::selectById,
|
||||||
|
(existing, replacement) -> existing
|
||||||
|
));
|
||||||
|
List<CsLedgerVO> portables = ledger.stream()
|
||||||
|
.peek(c -> {
|
||||||
|
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
||||||
c.setPid(portable.getId());
|
c.setPid(portable.getId());
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
|
||||||
c.setComFlag(po.getRunStatus());
|
c.setComFlag(po.getRunStatus());
|
||||||
c.setNDId(po.getNdid());
|
c.setNDId(po.getNdid());
|
||||||
c.setType("device");
|
c.setType("device");
|
||||||
c.setName(po.getName());
|
c.setName(po.getName());
|
||||||
c.setSort(po.getSort());
|
c.setSort(po.getSort());
|
||||||
}
|
})
|
||||||
|
.filter(c -> poMap2.get(c.getId()).getUsageStatus() == 1)
|
||||||
|
.collect(Collectors.toList());
|
||||||
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||||
checkDevSetData(portables);
|
checkDevSetData(portables);
|
||||||
@@ -185,17 +205,28 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<String> device = roleEngineerDevService.getDevice();
|
List<String> device = roleEngineerDevService.getDevice();
|
||||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
|
|
||||||
peek(
|
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
||||||
temp->{
|
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
|
.map(CsLedgerVO::getId)
|
||||||
temp.setComFlag(po.getRunStatus());
|
.distinct()
|
||||||
temp.setNDId(po.getNdid());
|
.collect(Collectors.toMap(
|
||||||
temp.setType("device");
|
Function.identity(),
|
||||||
}
|
csEquipmentDeliveryMapper::selectById
|
||||||
).
|
));
|
||||||
sorted(Comparator.comparing(CsLedgerVO::getSort))
|
|
||||||
|
List<CsLedgerVO> deviceList = allList.stream()
|
||||||
|
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||||
|
.peek(item -> {
|
||||||
|
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
||||||
|
item.setComFlag(po.getRunStatus());
|
||||||
|
item.setNDId(po.getNdid());
|
||||||
|
item.setType("device");
|
||||||
|
})
|
||||||
|
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||||
|
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
checkDevSetData(deviceList);
|
checkDevSetData(deviceList);
|
||||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||||
@@ -206,17 +237,30 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
portable.setName(DataParam.portableDev);
|
portable.setName(DataParam.portableDev);
|
||||||
portable.setPid("0");
|
portable.setPid("0");
|
||||||
portable.setId(IdUtil.simpleUUID());
|
portable.setId(IdUtil.simpleUUID());
|
||||||
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
|
|
||||||
checkDevSetData(portables);
|
//针对未启用的装置判断
|
||||||
for(CsLedgerVO c : portables){
|
List<CsLedgerVO> ledger = allList.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
CsLedgerVO::getId,
|
||||||
|
csEquipmentDeliveryMapper::selectById,
|
||||||
|
(existing, replacement) -> existing
|
||||||
|
));
|
||||||
|
List<CsLedgerVO> portables = ledger.stream()
|
||||||
|
.peek(c -> {
|
||||||
|
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
||||||
c.setPid(portable.getId());
|
c.setPid(portable.getId());
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
|
||||||
c.setComFlag(po.getRunStatus());
|
c.setComFlag(po.getRunStatus());
|
||||||
c.setNDId(po.getNdid());
|
c.setNDId(po.getNdid());
|
||||||
c.setType("device");
|
c.setType("device");
|
||||||
c.setName(po.getName());
|
c.setName(po.getName());
|
||||||
c.setSort(po.getSort());
|
c.setSort(po.getSort());
|
||||||
}
|
})
|
||||||
|
.filter(c -> poMap2.get(c.getId()).getUsageStatus() == 1)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
portable.setChildren(portables);
|
portable.setChildren(portables);
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
.set(CsLinePO::getVolGrade,csLineParam.getVolGrade())
|
.set(CsLinePO::getVolGrade,csLineParam.getVolGrade())
|
||||||
.set(CsLinePO::getPtRatio,csLineParam.getPtRatio())
|
.set(CsLinePO::getPtRatio,csLineParam.getPtRatio())
|
||||||
.set(CsLinePO::getCtRatio,csLineParam.getCtRatio())
|
.set(CsLinePO::getCtRatio,csLineParam.getCtRatio())
|
||||||
.set(CsLinePO::getConType,csLineParam.getConType());
|
.set(CsLinePO::getConType,csLineParam.getConType())
|
||||||
|
.set(CsLinePO::getLineInterval,csLineParam.getLineInterval());
|
||||||
this.update(lambdaUpdateWrapper);
|
this.update(lambdaUpdateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||||
@@ -12,9 +13,11 @@ import com.njcn.csdevice.constant.DataParam;
|
|||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||||
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
import com.njcn.csdevice.service.IPortableOfflLogService;
|
import com.njcn.csdevice.service.IPortableOfflLogService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.param.UploadDataParam;
|
import com.njcn.csdevice.param.UploadDataParam;
|
||||||
@@ -53,6 +56,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
@@ -99,6 +103,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
private final MqttPublisher publisher;
|
private final MqttPublisher publisher;
|
||||||
private final PortableOffMainLogService portableOffMainLogService;
|
private final PortableOffMainLogService portableOffMainLogService;
|
||||||
private final IWlRecordService wlRecordService;
|
private final IWlRecordService wlRecordService;
|
||||||
|
private final CsLinePOService csLinePOService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
||||||
@@ -175,6 +180,10 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public void importEquipment(UploadDataParam uploadDataParam){
|
public void importEquipment(UploadDataParam uploadDataParam){
|
||||||
String lineId = uploadDataParam.getLineId();
|
String lineId = uploadDataParam.getLineId();
|
||||||
|
//获取监测点信息
|
||||||
|
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(CsLinePO::getLineId,lineId).eq(CsLinePO::getStatus,1);
|
||||||
|
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||||
String cdid = uploadDataParam.getLineId().substring(uploadDataParam.getLineId().length() - 1);
|
String cdid = uploadDataParam.getLineId().substring(uploadDataParam.getLineId().length() - 1);
|
||||||
//第一步解析redcord.bin文件获取监测点序号做校验
|
//第一步解析redcord.bin文件获取监测点序号做校验
|
||||||
List<MultipartFile> record = uploadDataParam.getFiles().stream().filter(
|
List<MultipartFile> record = uploadDataParam.getFiles().stream().filter(
|
||||||
@@ -304,25 +313,22 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
//插入测试项
|
//插入测试项
|
||||||
WlRecord wlRecord = new WlRecord();
|
WlRecord wlRecord = new WlRecord();
|
||||||
wlRecord.setId(IdUtil.fastSimpleUUID());
|
wlRecord.setId(IdUtil.fastSimpleUUID());
|
||||||
wlRecord.setItemName("基础数据");
|
wlRecord.setItemName("补召");
|
||||||
wlRecord.setGcName("补召数据");
|
wlRecord.setGcName("补召");
|
||||||
wlRecord.setDevId(csEquipmentDeliveryDTO.getId());
|
wlRecord.setDevId(csEquipmentDeliveryDTO.getId());
|
||||||
wlRecord.setLineId(lineId);
|
wlRecord.setLineId(lineId);
|
||||||
// wlRecord.setStatisticalInterval();
|
|
||||||
// wlRecord.setPt();
|
wlRecord.setStatisticalInterval(po.getLineInterval());
|
||||||
// wlRecord.setCt();
|
wlRecord.setPt(po.getPtRatio().intValue());
|
||||||
// wlRecord.setPt1();
|
wlRecord.setCt(po.getCtRatio().intValue());
|
||||||
// wlRecord.setCt1();
|
//电压等级
|
||||||
// wlRecord.setVoltageLevel();
|
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(channelVol(new Float(po.getVolGrade())) + "kV","Dev_Voltage_Stand").getData();
|
||||||
// wlRecord.setCapacitySscb();
|
wlRecord.setVoltageLevel(Objects.isNull(dictData)?null:dictData.getId());
|
||||||
// wlRecord.setCapacitySscmin();
|
//电压接线方式
|
||||||
// wlRecord.setCapacitySt();
|
wlRecord.setVolConType(getVolConType(po.getConType()));
|
||||||
// wlRecord.setCapacitySi();
|
|
||||||
// wlRecord.setVolConType();
|
|
||||||
// wlRecord.setCurConSel();
|
|
||||||
wlRecord.setStartTime(instantMin.atZone(ZoneId.systemDefault()).toLocalDateTime());
|
wlRecord.setStartTime(instantMin.atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||||
wlRecord.setEndTime(instantMax.atZone(ZoneId.systemDefault()).toLocalDateTime());
|
wlRecord.setEndTime(instantMax.atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||||
// wlRecord.setLocation();
|
|
||||||
wlRecord.setType(1);
|
wlRecord.setType(1);
|
||||||
wlRecord.setState(DataStateEnum.ENABLE.getCode());
|
wlRecord.setState(DataStateEnum.ENABLE.getCode());
|
||||||
wlRecordService.lambdaUpdate().set(WlRecord::getState,DataStateEnum.DELETED.getCode())
|
wlRecordService.lambdaUpdate().set(WlRecord::getState,DataStateEnum.DELETED.getCode())
|
||||||
@@ -562,4 +568,40 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
}
|
}
|
||||||
return s1;
|
return s1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理电压
|
||||||
|
* @param vol
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String channelVol(Float vol) {
|
||||||
|
BigDecimal value = new BigDecimal(vol);
|
||||||
|
BigDecimal noZeros = value.stripTrailingZeros();
|
||||||
|
return noZeros.toPlainString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0-星型, 1-角型, 2-V型
|
||||||
|
// star-星型、Star_Triangle-星三角、Open_Delta-开口三角
|
||||||
|
public String getVolConType(Integer volConType) {
|
||||||
|
String result = null;
|
||||||
|
String dictDataCode = null;
|
||||||
|
switch (volConType) {
|
||||||
|
case 0:
|
||||||
|
dictDataCode = "star";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
dictDataCode = "Star_Triangle";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
dictDataCode = "Open_Delta";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!Objects.isNull(dictDataCode)) {
|
||||||
|
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(dictDataCode,"Dev_Connect").getData();
|
||||||
|
result = dictData.getId();
|
||||||
|
}
|
||||||
|
return Objects.isNull(result)?null:result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import com.njcn.csdevice.pojo.vo.RecordVo;
|
|||||||
import com.njcn.csdevice.service.IWlRecordService;
|
import com.njcn.csdevice.service.IWlRecordService;
|
||||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||||
import com.njcn.csdevice.utils.DataChangeUtil;
|
import com.njcn.csdevice.utils.DataChangeUtil;
|
||||||
|
import com.njcn.csdevice.utils.StringUtil;
|
||||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||||
@@ -61,6 +62,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@@ -102,6 +104,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
@Override
|
@Override
|
||||||
// @Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public void addRecord(WlRecordParam.AddRecord records) {
|
public void addRecord(WlRecordParam.AddRecord records) {
|
||||||
|
checkRecord(records);
|
||||||
//整理的方案下测试项集合(可能添加多个测试项)
|
//整理的方案下测试项集合(可能添加多个测试项)
|
||||||
List<WlRecord> insertList = new ArrayList<>();
|
List<WlRecord> insertList = new ArrayList<>();
|
||||||
//校验方案ID是否存在
|
//校验方案ID是否存在
|
||||||
@@ -142,6 +145,34 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
this.saveBatch(insertList);
|
this.saveBatch(insertList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkRecord(WlRecordParam record) {
|
||||||
|
if (record instanceof WlRecordParam.AddRecord) {
|
||||||
|
WlRecordParam.AddRecord temp =( WlRecordParam.AddRecord) record;
|
||||||
|
String itemName = temp.getRecords().get(0).getItemName();
|
||||||
|
StringUtil.containsSpecialCharacters(itemName);
|
||||||
|
if(StrUtil.isBlank(itemName)){
|
||||||
|
throw new BusinessException("测试项名称不能为空或空格");
|
||||||
|
}
|
||||||
|
List<WlRecord> list = this.lambdaQuery().eq(WlRecord::getPId, temp.getId()).eq(WlRecord::getState, 1).eq(WlRecord::getItemName, itemName).list();
|
||||||
|
if(!CollectionUtils.isEmpty(list)){
|
||||||
|
throw new BusinessException("数据列表中存在同名测试项");
|
||||||
|
}
|
||||||
|
}else if (record instanceof WlRecordParam.UpdateRecord) {
|
||||||
|
WlRecordParam.UpdateRecord temp =( WlRecordParam.UpdateRecord) record;
|
||||||
|
String itemName = temp.getItemName();
|
||||||
|
StringUtil.containsSpecialCharacters(itemName);
|
||||||
|
if(StrUtil.isBlank(itemName)){
|
||||||
|
throw new BusinessException("测试项名称不能为空或空格");
|
||||||
|
}
|
||||||
|
WlRecord one = this.lambdaQuery().eq(WlRecord::getId, temp.getId()).one();
|
||||||
|
List<WlRecord> list = this.lambdaQuery().eq(WlRecord::getPId, one.getPId()).ne(WlRecord::getId, temp.getId()).eq(WlRecord::getState, 1).eq(WlRecord::getItemName, itemName).list();
|
||||||
|
if(!CollectionUtils.isEmpty(list)){
|
||||||
|
throw new BusinessException("数据列表中存在同名测试项");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBaseData(WlRecord wlRecord) {
|
public void addBaseData(WlRecord wlRecord) {
|
||||||
this.save(wlRecord);
|
this.save(wlRecord);
|
||||||
@@ -155,6 +186,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
@Override
|
@Override
|
||||||
// @Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public void updateTestRecord(WlRecordParam.UpdateRecord record) {
|
public void updateTestRecord(WlRecordParam.UpdateRecord record) {
|
||||||
|
checkRecord(record);
|
||||||
WlRecord wlRecord = new WlRecord();
|
WlRecord wlRecord = new WlRecord();
|
||||||
BeanUtils.copyProperties(record, wlRecord);
|
BeanUtils.copyProperties(record, wlRecord);
|
||||||
wlRecord.setStartTime(record.getProStartTime());
|
wlRecord.setStartTime(record.getProStartTime());
|
||||||
@@ -174,15 +206,37 @@ 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();
|
||||||
|
checkString(record.getItemName());
|
||||||
if(record.getId()!=null){
|
if(record.getId()!=null){
|
||||||
BeanUtils.copyProperties(record, wlRecord);
|
BeanUtils.copyProperties(record, wlRecord);
|
||||||
|
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
|
||||||
|
qw.eq(WlRecord::getItemName,record.getItemName()).isNull(WlRecord::getPId).eq(WlRecord::getType,0).eq(WlRecord::getState,1).ne(WlRecord::getId,record.getId());
|
||||||
|
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
||||||
|
//方案名称重复校验
|
||||||
|
if(!wlRecordList.isEmpty()){
|
||||||
|
throw new BusinessException(LineBaseEnum.EXISTWLRECORD_FAIL.getMessage());
|
||||||
|
}
|
||||||
this.updateById(wlRecord);
|
this.updateById(wlRecord);
|
||||||
}else{
|
}else{
|
||||||
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
|
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
|
||||||
qw.eq(WlRecord::getItemName,record.getItemName()).eq(WlRecord::getType,0).eq(WlRecord::getState,1);
|
qw.eq(WlRecord::getItemName,record.getItemName()).isNull(WlRecord::getPId).eq(WlRecord::getType,0).eq(WlRecord::getState,1);
|
||||||
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
||||||
//方案名称重复校验
|
//方案名称重复校验
|
||||||
if(!wlRecordList.isEmpty()){
|
if(!wlRecordList.isEmpty()){
|
||||||
@@ -196,6 +250,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkString(String itemName) {
|
||||||
|
StringUtil.containsSpecialCharacters(itemName);
|
||||||
|
if(StrUtil.isBlank(itemName)){
|
||||||
|
throw new BusinessException("测试项名称不能为空或空格");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecordVo.RecordItemVo getTestRecordById(String testRecordId) {
|
public RecordVo.RecordItemVo getTestRecordById(String testRecordId) {
|
||||||
RecordVo.RecordItemVo recordItemVo = new RecordVo.RecordItemVo();
|
RecordVo.RecordItemVo recordItemVo = new RecordVo.RecordItemVo();
|
||||||
@@ -452,28 +513,60 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
vo.setTime(temp.getTime());
|
vo.setTime(temp.getTime());
|
||||||
vo.setStatMethod(temp.getValueType());
|
vo.setStatMethod(temp.getValueType());
|
||||||
if(temp.getValue()!=null) {
|
if(temp.getValue()!=null) {
|
||||||
double re;
|
double re = 0;
|
||||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
unit = epdPqd.getUnit();
|
unit = epdPqd.getUnit();
|
||||||
} else {
|
} else {
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
case "*PT":
|
||||||
|
re = temp.getValue() * pt / 1000;
|
||||||
unit = "k" + epdPqd.getUnit();
|
unit = "k" + epdPqd.getUnit();
|
||||||
} else {
|
break;
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
case "*CT":
|
||||||
|
re = temp.getValue() * ct;
|
||||||
unit = epdPqd.getUnit();
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() * pt * ct / 1000;
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}else {
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct);
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = temp.getValue() / pt;
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = temp.getValue() / ct;
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() / pt / ct;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
}else {
|
}else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
re = temp.getValue();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
@@ -486,8 +579,21 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
unit = epdPqd.getUnit();
|
unit = epdPqd.getUnit();
|
||||||
} else {
|
} else {
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
unit = "k" + epdPqd.getUnit();
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
unit = epdPqd.getUnit();
|
unit = epdPqd.getUnit();
|
||||||
}
|
}
|
||||||
@@ -510,6 +616,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WlRecord findDevBaseData(WlRecordParam.Record param) {
|
public WlRecord findDevBaseData(WlRecordParam.Record param) {
|
||||||
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
@@ -529,7 +636,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
lambdaQueryWrapper.eq(WlRecord::getLineId,param.getLineId())
|
lambdaQueryWrapper.eq(WlRecord::getLineId,param.getLineId())
|
||||||
.between(WlRecord::getStartTime,param.getItemStartTime(),param.getItemEndTime())
|
.between(WlRecord::getStartTime,param.getItemStartTime(),param.getItemEndTime())
|
||||||
.eq(WlRecord::getType,1)
|
.eq(WlRecord::getType,1)
|
||||||
.eq(WlRecord::getState,1).orderByDesc(WlRecord::getStartTime);
|
.eq(WlRecord::getState,1)
|
||||||
|
.orderByDesc(WlRecord::getStartTime);
|
||||||
|
if (Objects.equals(param.getDataSource(),0)) {
|
||||||
|
lambdaQueryWrapper.eq(WlRecord::getItemName,"补召");
|
||||||
|
} else if (Objects.equals(param.getDataSource(),1)) {
|
||||||
|
lambdaQueryWrapper.eq(WlRecord::getItemName,"在线监测");
|
||||||
|
}
|
||||||
List<WlRecord> list = this.list(lambdaQueryWrapper);
|
List<WlRecord> list = this.list(lambdaQueryWrapper);
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
@@ -583,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();
|
||||||
@@ -636,7 +749,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<WlRecord> getWlAssByWlId(String wlId) {
|
public List<WlRecord> getWlAssByWlId(String wlId) {
|
||||||
return this.baseMapper.getDataRecordByTestId(wlId,0);
|
return this.baseMapper.getWlAssByWlId(wlId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -26,4 +26,7 @@ public class DataParam implements Serializable {
|
|||||||
@ApiModelProperty("数据标志")
|
@ApiModelProperty("数据标志")
|
||||||
private String dataLevel;
|
private String dataLevel;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据来源 0:补召 1:在线监测 ")
|
||||||
|
private Integer dataSource;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,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.vo.DataGroupEventVO;
|
||||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||||
import com.njcn.csharmonic.param.DataParam;
|
import com.njcn.csharmonic.param.DataParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||||
@@ -15,10 +16,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
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.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -53,4 +51,15 @@ public class DataController extends BaseController {
|
|||||||
List<RecordVo> list = dataService.getTestData(param);
|
List<RecordVo> list = dataService.getTestData(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getEventByItem")
|
||||||
|
@ApiOperation("方案数据-》根据测试项获取暂态事件")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
|
public HttpResult<List<DataGroupEventVO>> getEventByItem(@RequestParam("id") String id) {
|
||||||
|
String methodDescribe = getMethodDescribe("getEventByItem");
|
||||||
|
List<DataGroupEventVO> list = dataService.getEventByItem(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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}
|
||||||
@@ -162,6 +161,14 @@
|
|||||||
<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>
|
||||||
|
|
||||||
|
<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>
|
||||||
order by b.start_time desc
|
order by b.start_time desc
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -11,6 +11,7 @@ import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
|||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,4 +50,6 @@ public interface CsEventPOService extends IService<CsEventPO>{
|
|||||||
void saveBatchEventList(List<CsEventPO> csEventPOS);
|
void saveBatchEventList(List<CsEventPO> csEventPOS);
|
||||||
|
|
||||||
void getFileZip(String eventId,HttpServletResponse response);
|
void getFileZip(String eventId,HttpServletResponse response);
|
||||||
|
|
||||||
|
List<DataGroupEventVO> queryEventList(LocalDateTime startDate, LocalDateTime endDate, String lineId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csharmonic.service;
|
package com.njcn.csharmonic.service;
|
||||||
|
|
||||||
|
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||||
import com.njcn.csharmonic.param.DataParam;
|
import com.njcn.csharmonic.param.DataParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||||
@@ -23,4 +24,9 @@ public interface IDataService {
|
|||||||
*/
|
*/
|
||||||
List<RecordVo> getTestData(DataParam param);
|
List<RecordVo> getTestData(DataParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据测试项id获取时间范围内的暂态事件
|
||||||
|
*/
|
||||||
|
List<DataGroupEventVO> getEventByItem(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
@@ -206,6 +207,20 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DataGroupEventVO> queryEventList(LocalDateTime startDate, LocalDateTime endDate, String lineId) {
|
||||||
|
List<DataGroupEventVO> dataGroupEventVOList = new ArrayList<>();
|
||||||
|
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(CsEventPO::getLineId,lineId)
|
||||||
|
.eq(CsEventPO::getType,0).between(CsEventPO::getStartTime,startDate,endDate)
|
||||||
|
.orderByDesc(CsEventPO::getStartTime);
|
||||||
|
List<CsEventPO> pos = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||||
|
if(CollUtil.isNotEmpty(pos)){
|
||||||
|
dataGroupEventVOList = BeanUtil.copyToList(pos,DataGroupEventVO.class);
|
||||||
|
}
|
||||||
|
return dataGroupEventVOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return WaveDataDTO
|
* @return WaveDataDTO
|
||||||
|
|||||||
@@ -1,33 +1,45 @@
|
|||||||
package com.njcn.csharmonic.service.impl;
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
import com.njcn.csdevice.api.WlRecordFeignClient;
|
import com.njcn.csdevice.api.WlRecordFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||||
|
import com.njcn.csdevice.pojo.param.WlRecordTemplete;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||||
import com.njcn.csdevice.utils.DataChangeUtil;
|
import com.njcn.csdevice.utils.DataChangeUtil;
|
||||||
|
import com.njcn.csharmonic.api.EventFeignClient;
|
||||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||||
import com.njcn.csharmonic.mapper.CsDataSetMapper;
|
import com.njcn.csharmonic.mapper.CsDataSetMapper;
|
||||||
import com.njcn.csharmonic.param.DataParam;
|
import com.njcn.csharmonic.param.DataParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||||
|
import com.njcn.csharmonic.service.CsEventPOService;
|
||||||
import com.njcn.csharmonic.service.IDataService;
|
import com.njcn.csharmonic.service.IDataService;
|
||||||
import com.njcn.csharmonic.util.InfluxDbParamUtil;
|
import com.njcn.csharmonic.util.InfluxDbParamUtil;
|
||||||
|
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
import com.njcn.influx.service.CommonService;
|
import com.njcn.influx.service.CommonService;
|
||||||
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
import com.njcn.influx.service.EvtDataService;
|
||||||
import com.njcn.system.api.DictTreeFeignClient;
|
import com.njcn.system.api.*;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
|
import com.njcn.system.pojo.po.EleEvtParm;
|
||||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
import java.time.Duration;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -49,7 +61,12 @@ public class DataServiceImpl implements IDataService {
|
|||||||
private final CsLineFeignClient csLineFeignClient;
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
private final CsDataSetMapper csDataSetMapper;
|
private final CsDataSetMapper csDataSetMapper;
|
||||||
private final WlRecordFeignClient wlRecordFeignClient;
|
private final WlRecordFeignClient wlRecordFeignClient;
|
||||||
|
private final CsEventPOService csEventPOService;
|
||||||
private final DecimalFormat df = new DecimalFormat("#0.00");
|
private final DecimalFormat df = new DecimalFormat("#0.00");
|
||||||
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
private final EvtDataService evtDataService;
|
||||||
|
private final EleEvtFeignClient eleEvtFeignClient;
|
||||||
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RealTimeDataVo> getRealTimeData(DataParam param) {
|
public List<RealTimeDataVo> getRealTimeData(DataParam param) {
|
||||||
@@ -97,7 +114,92 @@ public class DataServiceImpl implements IDataService {
|
|||||||
String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(param.getEndTime(), DatePattern.NORM_DATE_PATTERN)),DatePattern.NORM_DATETIME_PATTERN);
|
String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(param.getEndTime(), DatePattern.NORM_DATE_PATTERN)),DatePattern.NORM_DATETIME_PATTERN);
|
||||||
record.setItemStartTime(beginDay);
|
record.setItemStartTime(beginDay);
|
||||||
record.setItemEndTime(endDay);
|
record.setItemEndTime(endDay);
|
||||||
return wlRecordFeignClient.findDevBaseDataByLineId(record).getData();
|
record.setDataSource(param.getDataSource());
|
||||||
|
List<RecordVo> list = wlRecordFeignClient.findDevBaseDataByLineId(record).getData();
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
list.forEach(item->{
|
||||||
|
if (Objects.nonNull(item.getEndTime())) {
|
||||||
|
Duration duration = Duration.between(item.getStartTime(), item.getEndTime());
|
||||||
|
long totalMinutes = duration.toMinutes();
|
||||||
|
long completeHours = totalMinutes / 60;
|
||||||
|
long remainingMinutes = totalMinutes % 60;
|
||||||
|
long millis = duration.getSeconds();
|
||||||
|
if (completeHours == 0 && remainingMinutes == 0 && millis <= 60) {
|
||||||
|
remainingMinutes = 1;
|
||||||
|
}
|
||||||
|
item.setLastTime(completeHours + "小时" + remainingMinutes + "分钟");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DataGroupEventVO> getEventByItem(String id) {
|
||||||
|
List<DataGroupEventVO> result = new ArrayList<>();
|
||||||
|
List<WlRecord> list = wlRecordFeignClient.getWlAssByWlId(id).getData();
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
list.forEach(item->{
|
||||||
|
List<DataGroupEventVO> eventList = csEventPOService.queryEventList(item.getStartTime(),item.getEndTime(),item.getLineId());
|
||||||
|
result.addAll(eventList);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(temp->{
|
||||||
|
String lineName = csLineFeignClient.getById(temp.getLineId()).getData().getName();
|
||||||
|
temp.setLineName(lineName);
|
||||||
|
List<CsEquipmentDeliveryDTO> dto = equipmentFeignClient.queryDeviceById(Collections.singletonList(temp.getDeviceId())).getData();
|
||||||
|
if (CollUtil.isNotEmpty(dto)) {
|
||||||
|
String devName = dto.get(0).getName();
|
||||||
|
temp.setDevName(devName);
|
||||||
|
}
|
||||||
|
|
||||||
|
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
|
||||||
|
if(ele!=null){
|
||||||
|
temp.setShowName(ele.getShowName());
|
||||||
|
//相别
|
||||||
|
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
|
||||||
|
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
|
||||||
|
for (EleEvtParm eleEvtParm : data1) {
|
||||||
|
EventDataSetDTO eventDataSetDTO = new EventDataSetDTO();
|
||||||
|
BeanUtils.copyProperties(eleEvtParm,eventDataSetDTO);
|
||||||
|
EventDataSetDTO evtData = evtDataService.getEventDataSet(com.njcn.csdevice.constant.DataParam.evtData, temp.getId(), eleEvtParm.getName());
|
||||||
|
if (evtData == null) {
|
||||||
|
eventDataSetDTO.setValue("-");
|
||||||
|
}else {
|
||||||
|
eventDataSetDTO.setValue(Optional.ofNullable(evtData.getValue()).orElse("-"));
|
||||||
|
}
|
||||||
|
eventDataSetDTOS.add(eventDataSetDTO);
|
||||||
|
}
|
||||||
|
List<EventDataSetDTO> evtParamPhase = eventDataSetDTOS.stream().
|
||||||
|
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), com.njcn.csdevice.constant.DataParam.EvtParamPhase)).
|
||||||
|
collect(Collectors.toList());
|
||||||
|
if(CollectionUtil.isEmpty(evtParamPhase)){
|
||||||
|
temp.setPhaseType(null);
|
||||||
|
}else {
|
||||||
|
temp.setPhaseType(evtParamPhase.get(0).getValue()+(Objects.isNull(evtParamPhase.get(0).getUnit())?"":evtParamPhase.get(0).getUnit()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<EventDataSetDTO> evtParamDepth = eventDataSetDTOS.stream().
|
||||||
|
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), com.njcn.csdevice.constant.DataParam.EvtParamDepth)).
|
||||||
|
collect(Collectors.toList());
|
||||||
|
if(CollectionUtil.isEmpty(evtParamDepth)){
|
||||||
|
temp.setFeatureAmplitude(null);
|
||||||
|
}else {
|
||||||
|
temp.setFeatureAmplitude("-".equals(evtParamDepth.get(0).getValue())?null:Float.parseFloat(evtParamDepth.get(0).getValue()));
|
||||||
|
}
|
||||||
|
List<EventDataSetDTO> evtParmTm = eventDataSetDTOS.stream().
|
||||||
|
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), com.njcn.csdevice.constant.DataParam.EVTPARAMTM)).
|
||||||
|
collect(Collectors.toList());
|
||||||
|
if(CollectionUtil.isEmpty(evtParamDepth)){
|
||||||
|
temp.setPersistTime(null);
|
||||||
|
}else {
|
||||||
|
temp.setPersistTime("-".equals(evtParmTm.get(0).getValue())?null:Double.parseDouble(evtParmTm.get(0).getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//基础数据
|
//基础数据
|
||||||
@@ -117,33 +219,66 @@ public class DataServiceImpl implements IDataService {
|
|||||||
vo.setSort(item2.getSort());
|
vo.setSort(item2.getSort());
|
||||||
if (Objects.equals("Primary",dataLevel)) {
|
if (Objects.equals("Primary",dataLevel)) {
|
||||||
if (Objects.equals("Primary",csDataSetLevel)) {
|
if (Objects.equals("Primary",csDataSetLevel)) {
|
||||||
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
|
||||||
unit = item2.getUnit();
|
|
||||||
} else {
|
|
||||||
if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) {
|
if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) {
|
||||||
if (Objects.isNull(statisticalDataDTO)) {
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue() / 1000));
|
||||||
vo.setAvgValue(3.14159);
|
vo.setAvgValue(re);
|
||||||
} else {
|
|
||||||
re = DataChangeUtil.secondaryToPrimary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct) / 1000;
|
|
||||||
vo.setAvgValue(Double.valueOf(df.format(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())));
|
||||||
unit = item2.getUnit();
|
unit = item2.getUnit();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if(Objects.nonNull(item2.getPrimaryFormula())){
|
||||||
|
switch (item2.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() * pt / 1000;
|
||||||
|
unit = "k" + item2.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() * ct;
|
||||||
|
unit = item2.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() * pt * ct / 1000;
|
||||||
|
unit = "k" + item2.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue();
|
||||||
|
unit = item2.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vo.setAvgValue(Objects.equals(re,3.14159) ? 3.14159 : Double.parseDouble(df.format(re)));
|
||||||
|
}else {
|
||||||
|
if (Objects.nonNull(statisticalDataDTO)) {
|
||||||
|
re = statisticalDataDTO.getValue();
|
||||||
|
vo.setAvgValue(Double.valueOf(df.format(re)));
|
||||||
|
}
|
||||||
|
unit = item2.getUnit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Objects.equals("Primary",csDataSetLevel)) {
|
if (Objects.equals("Primary",csDataSetLevel)) {
|
||||||
if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) {
|
if(Objects.nonNull(item2.getPrimaryFormula())) {
|
||||||
if (Objects.isNull(statisticalDataDTO)) {
|
switch (item2.getPrimaryFormula()) {
|
||||||
vo.setAvgValue(3.14159);
|
case "*PT":
|
||||||
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / pt;
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / ct;
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / pt / ct / 1000;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vo.setAvgValue(Objects.equals(re,3.14159) ? 3.14159 : Double.parseDouble(df.format(re)));
|
||||||
}else {
|
}else {
|
||||||
re = DataChangeUtil.primaryToSecondary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct);
|
if (Objects.nonNull(statisticalDataDTO)) {
|
||||||
|
re = statisticalDataDTO.getValue();
|
||||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
vo.setAvgValue(Double.valueOf(df.format(re)));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
|
||||||
}
|
}
|
||||||
} 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())));
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csharmonic.service.impl;
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
@@ -51,6 +52,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -154,7 +156,7 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
|||||||
// 创建 DateTimeFormatter 对象并指定格式
|
// 创建 DateTimeFormatter 对象并指定格式
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
List<RspDataDto.ProjectInfo> projectInfoList = channelObjectUtil.objectToList(redisUtil.getObjectByKey(key),RspDataDto.ProjectInfo.class);
|
List<RspDataDto.ProjectInfo> projectInfoList = channelObjectUtil.objectToList(redisUtil.getObjectByKey(key),RspDataDto.ProjectInfo.class);
|
||||||
projectInfoList.forEach(item->{
|
for (RspDataDto.ProjectInfo item : projectInfoList) {
|
||||||
MakeUpVo vo = new MakeUpVo();
|
MakeUpVo vo = new MakeUpVo();
|
||||||
vo.setType("dir");
|
vo.setType("dir");
|
||||||
BeanUtils.copyProperties(item,vo);
|
BeanUtils.copyProperties(item,vo);
|
||||||
@@ -171,11 +173,14 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
|||||||
vo.setEndTime(formattedDate);
|
vo.setEndTime(formattedDate);
|
||||||
}
|
}
|
||||||
result.add(vo);
|
result.add(vo);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
|
result = result.stream().sorted(Comparator.comparing(MakeUpVo::getStartTime).reversed()).collect(Collectors.toList());
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.influxdb.dto.QueryResult;
|
import org.influxdb.dto.QueryResult;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
@@ -273,7 +274,11 @@ public class StableDataServiceImpl implements StableDataService {
|
|||||||
List<CsLinePO> finalCsLinePOList = csLinePOList;
|
List<CsLinePO> finalCsLinePOList = csLinePOList;
|
||||||
data.forEach(epdPqd->{
|
data.forEach(epdPqd->{
|
||||||
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
|
String frequency = Optional.ofNullable(commonStatisticalQueryParam.getFrequency()).orElse("");
|
||||||
|
if(StringUtils.isEmpty(commonStatisticalQueryParam.getFrequency())){
|
||||||
|
frequency ="";
|
||||||
|
}else {
|
||||||
|
frequency = "_"+commonStatisticalQueryParam.getFrequency();
|
||||||
|
}
|
||||||
String finalFrequency1 = frequency;
|
String finalFrequency1 = frequency;
|
||||||
List<CommonQueryParam> commonQueryParams = csLinePOList1.stream().map(temp -> {
|
List<CommonQueryParam> commonQueryParams = csLinePOList1.stream().map(temp -> {
|
||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
|
|||||||
@@ -24,5 +24,8 @@ public class AppVersionParam implements Serializable {
|
|||||||
@ApiModelProperty("整改内容")
|
@ApiModelProperty("整改内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty("版本类型 APP WEB")
|
||||||
|
@NotNull(message = "版本类型不能为空")
|
||||||
|
private String versionType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.njcn.cssystem.pojo.po;
|
package com.njcn.cssystem.pojo.po;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.njcn.db.bo.BaseEntity;
|
import com.njcn.db.bo.BaseEntity;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -44,6 +43,11 @@ public class AppVersion extends BaseEntity implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Integer sev;
|
private Integer sev;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本类型 APP Web
|
||||||
|
*/
|
||||||
|
private String versionType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改内容
|
* 修改内容
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -22,5 +22,4 @@ public class AppVersionVo implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty("严重度(0:优化 1:bug调整)")
|
@ApiModelProperty("严重度(0:优化 1:bug调整)")
|
||||||
private Integer sev;
|
private Integer sev;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ 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.cssystem.pojo.param.AppVersionParam;
|
import com.njcn.cssystem.pojo.param.AppVersionParam;
|
||||||
|
import com.njcn.cssystem.pojo.po.AppVersion;
|
||||||
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
||||||
import com.njcn.cssystem.service.IAppVersionService;
|
import com.njcn.cssystem.service.IAppVersionService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -16,10 +17,9 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import java.util.List;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequestMapping("/appVersion")
|
@RequestMapping("/appVersion")
|
||||||
@Api(tags = "app版本信息")
|
@Api(tags = "版本信息")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class AppVersionController extends BaseController {
|
public class AppVersionController extends BaseController {
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public class AppVersionController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@ApiOperation("新增app版本信息")
|
@ApiOperation("新增版本信息")
|
||||||
@ApiImplicitParam(name = "param", value = "app版本信息", required = true)
|
@ApiImplicitParam(name = "param", value = "app版本信息", required = true)
|
||||||
public HttpResult<String> add(@RequestBody @Validated AppVersionParam param){
|
public HttpResult<String> add(@RequestBody @Validated AppVersionParam param){
|
||||||
String methodDescribe = getMethodDescribe("add");
|
String methodDescribe = getMethodDescribe("add");
|
||||||
@@ -54,12 +54,23 @@ public class AppVersionController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getLastData")
|
@PostMapping("/getLastData")
|
||||||
@ApiOperation("查询app最新版本信息")
|
@ApiOperation("查询最新版本信息")
|
||||||
public HttpResult<AppVersionVo> getLastData(){
|
@ApiImplicitParam(name = "versionType", value = "版本类型(APP WEB)", required = true)
|
||||||
|
public HttpResult<AppVersionVo> getLastData(@RequestParam("versionType") String versionType){
|
||||||
String methodDescribe = getMethodDescribe("getLastData");
|
String methodDescribe = getMethodDescribe("getLastData");
|
||||||
AppVersionVo vo = appVersionService.getLastData();
|
AppVersionVo vo = appVersionService.getLastData(versionType);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getAllData")
|
||||||
|
@ApiOperation("查询所有版本信息")
|
||||||
|
@ApiImplicitParam(name = "versionType", value = "版本类型(APP WEB)")
|
||||||
|
public HttpResult< List<AppVersion>> getAllData(@RequestParam(value = "versionType",required = false) String versionType){
|
||||||
|
String methodDescribe = getMethodDescribe("getAllData");
|
||||||
|
List<AppVersion> list = appVersionService.getAllData(versionType);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import com.njcn.cssystem.pojo.param.AppVersionParam;
|
|||||||
import com.njcn.cssystem.pojo.po.AppVersion;
|
import com.njcn.cssystem.pojo.po.AppVersion;
|
||||||
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
@@ -17,5 +19,7 @@ public interface IAppVersionService extends IService<AppVersion> {
|
|||||||
|
|
||||||
boolean add(AppVersionParam param);
|
boolean add(AppVersionParam param);
|
||||||
|
|
||||||
AppVersionVo getLastData();
|
AppVersionVo getLastData(String versionType);
|
||||||
|
|
||||||
|
List<AppVersion> getAllData(String versionType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import org.springframework.beans.BeanUtils;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,14 +32,16 @@ public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVers
|
|||||||
appVersion.setVersionName(param.getAppVersion());
|
appVersion.setVersionName(param.getAppVersion());
|
||||||
appVersion.setPublishTime(LocalDateTime.now());
|
appVersion.setPublishTime(LocalDateTime.now());
|
||||||
appVersion.setSev(param.getSev());
|
appVersion.setSev(param.getSev());
|
||||||
|
appVersion.setVersionType(param.getVersionType());
|
||||||
appVersion.setContent(param.getContent());
|
appVersion.setContent(param.getContent());
|
||||||
return this.save(appVersion);
|
return this.save(appVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AppVersionVo getLastData() {
|
public AppVersionVo getLastData(String versionType) {
|
||||||
AppVersionVo vo = new AppVersionVo();
|
AppVersionVo vo = new AppVersionVo();
|
||||||
LambdaQueryWrapper<AppVersion> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<AppVersion> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AppVersion::getVersionType, versionType);
|
||||||
queryWrapper.orderByDesc(AppVersion::getPublishTime).last("limit 1");
|
queryWrapper.orderByDesc(AppVersion::getPublishTime).last("limit 1");
|
||||||
AppVersion appVersion = this.getOne(queryWrapper);
|
AppVersion appVersion = this.getOne(queryWrapper);
|
||||||
if (Objects.nonNull(appVersion)) {
|
if (Objects.nonNull(appVersion)) {
|
||||||
@@ -45,4 +49,14 @@ public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVers
|
|||||||
}
|
}
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AppVersion> getAllData(String versionType) {
|
||||||
|
LambdaQueryWrapper<AppVersion> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (Objects.nonNull(versionType)) {
|
||||||
|
queryWrapper.eq(AppVersion::getVersionType, versionType);
|
||||||
|
}
|
||||||
|
queryWrapper.orderByDesc(AppVersion::getPublishTime);
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user