微调
This commit is contained in:
@@ -93,10 +93,10 @@ public class PqDevController extends BaseController {
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除被检设备")
|
||||
@ApiImplicitParam(name = "ids", value = "被检设备id", required = true)
|
||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
||||
public HttpResult<Object> delete(@RequestBody @Validated PqDevParam.DeleteParam param) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = pqDevService.deletePqDev(ids);
|
||||
LogUtil.njcnDebug(log, "{},删除ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, param.getIds()));
|
||||
boolean result = pqDevService.deletePqDev(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
|
||||
@@ -206,4 +206,15 @@ public class PqDevParam {
|
||||
@Max(value = 2, message = DevValidMessage.CHECK_RESULT_FORMAT_ERROR)
|
||||
private Integer checkResult;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DeleteParam {
|
||||
@ApiModelProperty(value = "ids")
|
||||
private List<@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR) String> ids;
|
||||
|
||||
@ApiModelProperty(value = "设备模式,字典表(数字、模拟、比对)", required = true)
|
||||
@NotBlank(message = DevValidMessage.PATTERN_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.PATTERN_FORMAT_ERROR)
|
||||
private String pattern;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
/**
|
||||
* 删除被检设备信息
|
||||
*
|
||||
* @param ids 被检设备id列表
|
||||
* @param param 被检设备信息
|
||||
* @return 删除成功返回true,否则返回false
|
||||
*/
|
||||
boolean deletePqDev(List<String> ids);
|
||||
boolean deletePqDev(PqDevParam.DeleteParam param);
|
||||
|
||||
/**
|
||||
* 下载模板文件
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.njcn.gather.device.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.device.util.DeviceUtil;
|
||||
import com.njcn.gather.device.monitor.pojo.vo.PqMonitorExcel;
|
||||
import com.njcn.gather.device.monitor.service.IPqMonitorService;
|
||||
import com.njcn.gather.device.plan.pojo.param.AdPlanParam;
|
||||
import com.njcn.gather.device.pojo.constant.DevConst;
|
||||
@@ -112,16 +113,23 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
if (Objects.nonNull(pqDev.getDevKey())) {
|
||||
pqDev.setDevKey(DeviceUtil.encodeString(1, pqDev.getDevKey()));
|
||||
}
|
||||
//todo 比对式设备处理
|
||||
// 比对式设备修改监测点
|
||||
if (DevConst.PATTERN_CONTRAST.equals(dictDataService.getDictDataById(updateParam.getPattern()).getCode())) {
|
||||
pqMonitorService.addPqMonitorByDevId(updateParam.getId(), updateParam.getPqMonitorList());
|
||||
pqMonitorService.updatePqMonitorByDevId(updateParam.getId(), updateParam.getPqMonitorList());
|
||||
}
|
||||
return this.updateById(pqDev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deletePqDev(List<String> ids) {
|
||||
return this.lambdaUpdate().set(PqDev::getState, DataStateEnum.DELETED.getCode()).in(PqDev::getId, ids).update();
|
||||
public boolean deletePqDev(PqDevParam.DeleteParam param) {
|
||||
if (DevConst.PATTERN_CONTRAST.equals(dictDataService.getDictDataById(param.getPattern()).getCode())) {
|
||||
for (String id : param.getIds()) {
|
||||
if (ObjectUtils.isEmpty(pqMonitorService.listPqMonitorByDevId(id))) {
|
||||
throw new BusinessException(DevResponseEnum.PQ_DEV_HAS_MONITOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.lambdaUpdate().set(PqDev::getState, DataStateEnum.DELETED.getCode()).in(PqDev::getId, param.getIds()).update();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,7 +171,33 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
if (ObjectUtil.isNotNull(dictData)) {
|
||||
if (DevConst.PATTERN_CONTRAST.equals(dictData.getCode())) {
|
||||
List<PqDevExcel.ContrastExportData> pqDevExcels = BeanUtil.copyToList(pqDevs, PqDevExcel.ContrastExportData.class);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", "被检设备", PqDevExcel.ContrastExportData.class, pqDevExcels);
|
||||
|
||||
Map<String, Object> sheet1 = new HashMap<String, Object>();
|
||||
sheet1.put("sheetName", "被检设备");
|
||||
sheet1.put("data", pqDevExcels);
|
||||
sheet1.put("entity", PqDevExcel.ContrastExportData.class);
|
||||
|
||||
List<PqMonitorExcel> pqMonitorExcels = new ArrayList<>();
|
||||
// for (String devId : pqDevs.stream().map(PqDev::getId).collect(Collectors.toList())) {
|
||||
// List<PqMonitor> pqMonitors = pqMonitorService.listPqMonitorByDevId(devId);
|
||||
// pqMonitors.forEach(pqMonitor -> {
|
||||
// PqMonitorExcel pqMonitorExcel = new PqMonitorExcel();
|
||||
// BeanUtil.copyProperties(pqMonitor, pqMonitorExcel);
|
||||
// pqMonitorExcels.add(pqMonitorExcel);
|
||||
// });
|
||||
// }
|
||||
// todo 监测点可视化
|
||||
|
||||
Map<String, Object> sheet2 = new HashMap<String, Object>();
|
||||
sheet2.put("sheetName", "监测点台账");
|
||||
sheet2.put("data", pqMonitorExcels);
|
||||
sheet2.put("entity", PqMonitorExcel.class);
|
||||
|
||||
List<Map<String, Object>> sheetsList = new ArrayList<Map<String, Object>>();
|
||||
sheetsList.add(sheet1);
|
||||
sheetsList.add(sheet2);
|
||||
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", sheetsList);
|
||||
} else {
|
||||
List<PqDevExcel.SimulateAndDigitalExportData> pqDevExcels = BeanUtil.copyToList(pqDevs, PqDevExcel.SimulateAndDigitalExportData.class);
|
||||
ExcelUtil.exportExcel("被检设备导出数据.xlsx", "被检设备", PqDevExcel.SimulateAndDigitalExportData.class, pqDevExcels);
|
||||
@@ -368,4 +402,24 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
pqDev.setState(DataStateEnum.ENABLE.getCode());
|
||||
});
|
||||
}
|
||||
|
||||
private void checkRepeat(PqDevParam param, boolean isExcludeSelf) {
|
||||
QueryWrapper<PqDev> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper
|
||||
.eq("state", DataStateEnum.ENABLE.getCode())
|
||||
.and(q -> q.eq("name", param.getName())
|
||||
.eq("pattern", param.getPattern())
|
||||
.eq("manufacturer", param.getManufacturer())
|
||||
.eq("Dev_Type", param.getDevType()).or()
|
||||
.eq("Create_Id", param.getCreateId())); //设备序列号重复
|
||||
if (isExcludeSelf) {
|
||||
if (param instanceof PqDevParam.UpdateParam) {
|
||||
queryWrapper.ne("id", ((PqDevParam.UpdateParam) param).getId());
|
||||
}
|
||||
}
|
||||
int count = this.count(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(DevResponseEnum.PQ_DEV_REPEAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ public class PqMonitorParam {
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "所属设备ID")
|
||||
@NotBlank(message = DevValidMessage.DEVICE_ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEVICE_ID_FORMAT_ERROR)
|
||||
@NotBlank(message = DevValidMessage.DEV_ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_ID_FORMAT_ERROR)
|
||||
private String devId;
|
||||
|
||||
@ApiModelProperty(value = "所属母线")
|
||||
@@ -50,12 +50,4 @@ public class PqMonitorParam {
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
||||
private String ptType;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdateParam extends PqMonitorParam {
|
||||
@ApiModelProperty(value = "监测点ID")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.ID_FORMAT_ERROR)
|
||||
// @Pattern(regexp = PatternRegex.SYSTEM_ID, message = DeviceValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.njcn.gather.device.monitor.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.device.pojo.constant.DevValidMessage;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2024-12-09
|
||||
*/
|
||||
public class PqMonitorExcel {
|
||||
|
||||
@Excel(name = "监测点编号", width = 20)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.MONITOR_CODE_FORMAT_ERROR)
|
||||
private String code;
|
||||
|
||||
@Excel(name = "所属设备Id", width = 20)
|
||||
@NotBlank(message = DevValidMessage.DEV_ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.DEV_ID_FORMAT_ERROR)
|
||||
private String devId;
|
||||
|
||||
@Excel(name = "所属母线", width = 20)
|
||||
@NotBlank(message = DevValidMessage.BELONG_LINE_NOT_BLANK)
|
||||
private String name;
|
||||
|
||||
// @Excel(name = "监测点序号", width = 20)
|
||||
// @NotBlank(message = DevValidMessage.MONITOR_NUM_NOT_BLANK)
|
||||
// private Integer num;
|
||||
|
||||
@Excel(name = "PT变比", width = 20)
|
||||
@NotNull(message = DevValidMessage.PT_NOT_NULL)
|
||||
private Float pt;
|
||||
|
||||
@Excel(name = "CT变比", width = 20)
|
||||
@NotNull(message = DevValidMessage.CT_NOT_NULL)
|
||||
private Float ct;
|
||||
|
||||
@Excel(name = "接线方式", width = 20)
|
||||
@NotBlank(message = DevValidMessage.WIRING_TYPE_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = DevValidMessage.WIRING_TYPE_FORMAT_ERROR)
|
||||
private String ptType;
|
||||
}
|
||||
@@ -44,5 +44,5 @@ public interface IPqMonitorService extends IService<PqMonitor> {
|
||||
* @param paramList 监测点信息
|
||||
* @return 修改成功返回true,否则返回false
|
||||
*/
|
||||
boolean updatePqMonitor(String devId, List<PqMonitorParam.UpdateParam> paramList);
|
||||
boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updatePqMonitor(String devId, List<PqMonitorParam.UpdateParam> paramList) {
|
||||
public boolean updatePqMonitorByDevId(String devId, List<PqMonitorParam> paramList) {
|
||||
// 先删除原有数据
|
||||
this.deletePqMonitorByDevId(devId);
|
||||
// 再添加新数据
|
||||
|
||||
@@ -134,9 +134,9 @@ public interface DevValidMessage {
|
||||
|
||||
String PQ_SOURCE_PARAMETER_VALUE_NOT_BLANK = "参数值不能为空,请检查pqSourceParameterValue参数";
|
||||
|
||||
String DEVICE_ID_NOT_BLANK = "所属设备ID不能为空,请检查deviceId参数";
|
||||
String DEV_ID_NOT_BLANK = "所属设备ID不能为空";
|
||||
|
||||
String DEVICE_ID_FORMAT_ERROR = "所属设备ID格式错误,请检查deviceId参数";
|
||||
String DEV_ID_FORMAT_ERROR = "所属设备ID格式错误";
|
||||
|
||||
String BELONG_LINE_NOT_BLANK = "所属母线不能为空";
|
||||
|
||||
@@ -181,4 +181,6 @@ public interface DevValidMessage {
|
||||
String CHECK_RESULT_FORMAT_ERROR = "检测结果格式错误";
|
||||
|
||||
String DOCUMENT_STATE_FORMAT_ERROR = "归档状态格式错误";
|
||||
|
||||
String MONITOR_CODE_FORMAT_ERROR = "监测点编码格式错误";
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@ public enum DevResponseEnum {
|
||||
SERIES_AND_DEVKEY_NOT_BLANK("A001003", "加密设备的序列号和设备密钥不能为空"),
|
||||
PQ_SOURCE_GEN_NAME_ERROR("A001004", "检测源生成名称出错"),
|
||||
PQ_ERRSYS_GEN_NAME_ERROR("A001005", "误差体系生成名称出错"),
|
||||
PLAN_HAS_DEVICE_BIND("A001006", "检测计划下已绑定设备,请先解绑设备");
|
||||
PLAN_HAS_DEVICE_BIND("A001006", "检测计划下已绑定设备,请先解绑设备"),
|
||||
PQ_DEV_REPEAT("A001007", "重复的被检设备"),
|
||||
PQ_DEV_HAS_MONITOR("A001008", "该设备下关联有监测点,请先移除监测点"),;
|
||||
|
||||
private final String code;
|
||||
|
||||
|
||||
@@ -25,9 +25,19 @@ public class PqScriptDtls implements Serializable {
|
||||
private String scriptId;
|
||||
|
||||
/**
|
||||
* 检测脚本类型,树形字典表(没有树形表则需要拆分字段)
|
||||
* 总检测脚本中的测试项序号
|
||||
*/
|
||||
private String type;
|
||||
private Integer index;
|
||||
|
||||
/**
|
||||
* 检测脚本类型
|
||||
*/
|
||||
private String scritpType;
|
||||
|
||||
/**
|
||||
* 误差体系类型
|
||||
*/
|
||||
private String errorType;
|
||||
|
||||
/**
|
||||
* 相别,字典表
|
||||
@@ -44,6 +54,31 @@ public class PqScriptDtls implements Serializable {
|
||||
*/
|
||||
private Float angle;
|
||||
|
||||
/**
|
||||
* (间)谐波次数
|
||||
*/
|
||||
private Float harmNum;
|
||||
|
||||
/**
|
||||
* 暂态幅度(%)
|
||||
*/
|
||||
private Float transValue;
|
||||
|
||||
/**
|
||||
* 持续时间(周波)
|
||||
*/
|
||||
private Float retainTime;
|
||||
|
||||
/**
|
||||
* 变动频度(次/min)
|
||||
*/
|
||||
private Float chagFre;
|
||||
|
||||
/**
|
||||
* 变动量(%)
|
||||
*/
|
||||
private Float chagValue;
|
||||
|
||||
/**
|
||||
* 状态:0-不启用 1-启用
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user