1.完成icd管理和终端类型管理
2.完成终端运维管理
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.njcn.device.pq.api;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.api.fallback.PqDevTypeFallbackFactory;
|
||||
import com.njcn.device.pq.pojo.po.PqDevType;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2022年02月14日 14:02
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.DEVICE, path = "/devType", fallbackFactory = PqDevTypeFallbackFactory.class, contextId = "devType")
|
||||
public interface PqDevTypeClient {
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getDevTypeList")
|
||||
HttpResult<List<PqDevType>> getDevTypeList();
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.device.pq.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import com.njcn.device.pq.api.PqDevTypeClient;
|
||||
import com.njcn.device.pq.pojo.po.PqDevType;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zbj
|
||||
* @version 1.0.0
|
||||
* @date 2023年04月13日 13:34
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PqDevTypeFallbackFactory implements FallbackFactory<PqDevTypeClient> {
|
||||
@Override
|
||||
public PqDevTypeClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new PqDevTypeClient()
|
||||
{
|
||||
|
||||
@Override
|
||||
public HttpResult<List<PqDevType>> getDevTypeList() {
|
||||
log.error("{}异常,降级处理,异常为:{}", "查询装置型号全部信息", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.device.pq.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -11,13 +12,31 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class PqIcdPathDTO {
|
||||
//模型索引
|
||||
/**
|
||||
* icd主键
|
||||
*/
|
||||
@ApiModelProperty("icd主键")
|
||||
private String id;
|
||||
//更新时间
|
||||
private String updateTime;
|
||||
//icd文件名
|
||||
/**
|
||||
* icd文件名
|
||||
*/
|
||||
@ApiModelProperty("icd文件名")
|
||||
private String fileName;
|
||||
//icd文件存储的地址
|
||||
/**
|
||||
* icd文件存储的地址
|
||||
*/
|
||||
@ApiModelProperty("icd文件存储的地址")
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 装置类型名称
|
||||
*/
|
||||
@ApiModelProperty("装置类型名称")
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty("更新时间")
|
||||
private String updateTime;
|
||||
}
|
||||
|
||||
@@ -20,4 +20,7 @@ public class LogsListParam extends BaseParam {
|
||||
@ApiModelProperty("日志类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty("id:终端或者监测点)")
|
||||
private String id;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.njcn.device.pq.pojo.param;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/11/5 11:34【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class PqDevTypeParam {
|
||||
|
||||
/**
|
||||
* icd文件名
|
||||
*/
|
||||
@ApiModelProperty("装置类型名称")
|
||||
@NotBlank(message = "装置类型名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 关联icdId
|
||||
*/
|
||||
@ApiModelProperty("关联icd表Id")
|
||||
@NotBlank(message = "关联icd不能为空")
|
||||
private String icdId;
|
||||
|
||||
/**
|
||||
* 更新操作实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class PqDevTypeUpdateParam extends PqDevTypeParam {
|
||||
/**
|
||||
* 表Id
|
||||
*/
|
||||
@ApiModelProperty("id")
|
||||
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class A {
|
||||
|
||||
@ApiModelProperty("Id")
|
||||
private String id;
|
||||
|
||||
@ExcelProperty("Name")
|
||||
private String name;
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,19 @@ import javax.validation.constraints.Pattern;
|
||||
@Data
|
||||
public class PqIcdPathParam {
|
||||
|
||||
|
||||
//icd文件名
|
||||
/**
|
||||
* icd文件名
|
||||
*/
|
||||
@ApiModelProperty("icd文件名")
|
||||
@NotBlank(message = "icd文件名不能为空")
|
||||
private String fileName;
|
||||
//icd文件存储的地址
|
||||
|
||||
/**
|
||||
* icd文件存储的地址
|
||||
*/
|
||||
@ApiModelProperty("icd文件存储的地址")
|
||||
@NotBlank(message = "icd文件存储的地址不能为空")
|
||||
private String filePath;
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 更新操作实体
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.njcn.device.pq.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -25,6 +25,7 @@ public class Device implements Serializable{
|
||||
/**
|
||||
* 装置序号
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.njcn.device.pq.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/11/5 11:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "pq_dev_type")
|
||||
public class PqDevType extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 型号id
|
||||
*/
|
||||
@TableId(value = "ID", type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 型号名称
|
||||
*/
|
||||
@TableField(value = "Name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 关联icd表id
|
||||
*/
|
||||
@TableField(value = "Icd_Id")
|
||||
private String icdId;
|
||||
|
||||
/**
|
||||
* 状态 0-删除;1-正常;默认正常
|
||||
*/
|
||||
@TableField(value = "State")
|
||||
private Integer state;
|
||||
}
|
||||
@@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -21,7 +24,9 @@ import lombok.NoArgsConstructor;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "pq_icd_path")
|
||||
public class PqIcdPath {
|
||||
public class PqIcdPath extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 装置类型GUID
|
||||
*/
|
||||
@@ -29,16 +34,21 @@ public class PqIcdPath {
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 装置类型名称
|
||||
* icd名称
|
||||
*/
|
||||
@TableField(value = "Name")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* icd文件路径
|
||||
*/
|
||||
@TableField(value = "Path")
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 状态 0-删除;1-正常;默认正常
|
||||
*/
|
||||
@TableField(value = "State")
|
||||
private Integer state;
|
||||
|
||||
|
||||
@TableField(value = "Update_Time")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.param.PqDevTypeParam;
|
||||
import com.njcn.device.pq.pojo.po.PqDevType;
|
||||
import com.njcn.device.pq.service.PqDevTypeService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 前置程序控制器
|
||||
*
|
||||
* @author cdf
|
||||
* @since 2022-01-07
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "装置型号管理")
|
||||
@RestController
|
||||
@RequestMapping("/devType")
|
||||
@RequiredArgsConstructor
|
||||
public class PqDevTypeController extends BaseController {
|
||||
|
||||
private final PqDevTypeService pqDevTypeService;
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getDevTypeList")
|
||||
@ApiOperation("查询装置型号全部信息")
|
||||
public HttpResult<List<PqDevType>> getDevTypeList() {
|
||||
String methodDescribe = getMethodDescribe("getDevTypeList");
|
||||
List<PqDevType> list = pqDevTypeService.list(new LambdaQueryWrapper<PqDevType>()
|
||||
.eq(PqDevType::getState, DataStateEnum.ENABLE.getCode())
|
||||
.orderByDesc(PqDevType::getCreateTime)
|
||||
);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/pageDevTypeList")
|
||||
@ApiOperation("分页查询装置型号信息")
|
||||
public HttpResult<Page<PqDevType>> pageDevTypeList(@RequestBody BaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("pageDevTypeList");
|
||||
Page<PqDevType> list = pqDevTypeService.pageDevTypeList(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("新增装置型号")
|
||||
@PostMapping("/addDevType")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM, operateType = OperateType.ADD)
|
||||
public HttpResult<Boolean> addDevType(@RequestBody PqDevTypeParam param) {
|
||||
String methodDescribe = getMethodDescribe("addDevType");
|
||||
Boolean result = pqDevTypeService.addDevType(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("更新装置型号")
|
||||
@PostMapping("/updateDevType")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM, operateType = OperateType.UPDATE)
|
||||
public HttpResult<Boolean> updateDevType(@RequestBody PqDevTypeParam.PqDevTypeUpdateParam param) {
|
||||
String methodDescribe = getMethodDescribe("updateDevType");
|
||||
Boolean result = pqDevTypeService.updateDevType(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/delDevType")
|
||||
@ApiOperation(value = "删除新装置型号")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
||||
public HttpResult<Boolean> delIDevType(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delIDevType");
|
||||
Boolean flag = pqDevTypeService.delIDevType(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +1,41 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.dto.DeviceInfo;
|
||||
import com.njcn.device.pq.pojo.dto.PqIcdPathDTO;
|
||||
import com.njcn.device.pq.pojo.param.NodeDeviceParam;
|
||||
import com.njcn.device.pq.pojo.param.PqIcdPathParam;
|
||||
import com.njcn.device.pq.pojo.po.PqIcdPath;
|
||||
import com.njcn.device.pq.service.NodeDeviceService;
|
||||
import com.njcn.device.pq.service.PqIcdPathService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 前置程序控制器
|
||||
*
|
||||
* @author cdf
|
||||
* @since 2022-01-07
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "icd模型管理")
|
||||
@RestController
|
||||
@RequestMapping("icd")
|
||||
@RequestMapping("/icd")
|
||||
@RequiredArgsConstructor
|
||||
public class PqIcdPathController extends BaseController {
|
||||
|
||||
@@ -43,48 +44,65 @@ public class PqIcdPathController extends BaseController {
|
||||
|
||||
/**
|
||||
* 根据终端模型获取icd模型,如果模型为空则获取全部icd模型
|
||||
|
||||
*/
|
||||
@ApiOperation("获取icd模型")
|
||||
@ApiOperation("前置获取icd模型")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
@PostMapping("icdPathList")
|
||||
public HttpResult<List<PqIcdPathDTO>> icdPathList(@RequestBody List<String> devType){
|
||||
@PostMapping("/icdPathList")
|
||||
public HttpResult<List<PqIcdPathDTO>> icdPathList(@RequestBody List<String> devType) {
|
||||
String methodDescribe = getMethodDescribe("icdPathList");
|
||||
List<PqIcdPath> list = pqIcdPathService.lambdaQuery().in(!CollectionUtils.isEmpty(devType), PqIcdPath::getName, devType).list();
|
||||
|
||||
List<PqIcdPathDTO> result = list.stream().map(temp -> {
|
||||
PqIcdPathDTO pqIcdPathDTO = new PqIcdPathDTO();
|
||||
pqIcdPathDTO.setId(temp.getId());
|
||||
pqIcdPathDTO.setUpdateTime(LocalDateTimeUtil.format(temp.getUpdateTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
pqIcdPathDTO.setFileName(temp.getPath().substring(temp.getPath().lastIndexOf('/') + 1));
|
||||
pqIcdPathDTO.setFilePath(temp.getPath());
|
||||
pqIcdPathDTO.setDevType(temp.getName());
|
||||
return pqIcdPathDTO;
|
||||
}).collect(Collectors.toList());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
List<PqIcdPathDTO> list = pqIcdPathService.icdPathList(devType);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("获取icd模型")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
@PostMapping("addIcdPath")
|
||||
public HttpResult<Boolean> addIcdPath(@RequestBody PqIcdPathParam pqIcdPathParam){
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getIcdList")
|
||||
@ApiOperation("查询icd全部信息")
|
||||
public HttpResult<List<PqIcdPath>> getIcdList() {
|
||||
String methodDescribe = getMethodDescribe("getIcdList");
|
||||
List<PqIcdPath> list = pqIcdPathService.list(new LambdaQueryWrapper<PqIcdPath>()
|
||||
.eq(PqIcdPath::getState, DataStateEnum.ENABLE.getCode())
|
||||
.orderByDesc(PqIcdPath::getCreateTime)
|
||||
);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/pageIcdList")
|
||||
@ApiOperation("分页查询icd信息")
|
||||
public HttpResult<Page<PqIcdPath>> pageIcdList(@RequestBody BaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("pageIcdList");
|
||||
Page<PqIcdPath> list = pqIcdPathService.pageIcdList(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("新增icd模型")
|
||||
@PostMapping("/addIcdPath")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM, operateType = OperateType.ADD)
|
||||
public HttpResult<Boolean> addIcdPath(@RequestBody PqIcdPathParam pqIcdPathParam) {
|
||||
String methodDescribe = getMethodDescribe("addIcdPath");
|
||||
Boolean result = pqIcdPathService.addIcdPath(pqIcdPathParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@ApiOperation("更新icd模型")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||
@PostMapping("updateIcdPath")
|
||||
public HttpResult<Boolean> updateIcdPath(@RequestBody PqIcdPathParam.PqIcdPathUpdateParam pqIcdPathUpdateParam){
|
||||
@PostMapping("/updateIcdPath")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM, operateType = OperateType.UPDATE)
|
||||
public HttpResult<Boolean> updateIcdPath(@RequestBody PqIcdPathParam.PqIcdPathUpdateParam pqIcdPathUpdateParam) {
|
||||
String methodDescribe = getMethodDescribe("updateIcdPath");
|
||||
Boolean result = pqIcdPathService.updateIcdPath(pqIcdPathUpdateParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/delIcdPath")
|
||||
@ApiOperation(value = "icd模型删除")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
|
||||
public HttpResult<Boolean> delIcdPath(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delIcdPath");
|
||||
Boolean flag = pqIcdPathService.delIcdPath(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pq.pojo.po.PqDevType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/11/5 11:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface PqDevTypeMapper extends BaseMapper<PqDevType> {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.device.pq.mapper.PqDevTypeMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -1,16 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.device.pq.mapper.PqIcdPathMapper">
|
||||
<resultMap id="BaseResultMap" type="com.njcn.device.pq.pojo.po.PqIcdPath">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table pq_icd_path-->
|
||||
<id column="ID" jdbcType="CHAR" property="id" />
|
||||
<result column="Name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="Path" jdbcType="VARCHAR" property="path" />
|
||||
<result column="Update_Time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
ID, Name, Pat`, Update_Time
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -9,6 +9,7 @@
|
||||
a.NAME,
|
||||
a.level,
|
||||
b.run_flag,
|
||||
b.ip,
|
||||
b.com_flag,
|
||||
e.NAME devType,
|
||||
ifnull(g.name,'/') version,
|
||||
@@ -25,7 +26,7 @@
|
||||
LEFT JOIN cld_dev_version f on a.id = f.line_id and f.flag = 1 and f.state = 1
|
||||
LEFT JOIN cld_version g on f.version_id = g.id
|
||||
LEFT JOIN
|
||||
(select * from cld_month_flow where date_format(time_id,'%Y-%m' ) = date_format(CURRENT_TIME(),'%Y-%m')) mo on a.id = mo.Dev_Id
|
||||
(select * from cld_month_flow where DATE_FORMAT(time_id,'%Y-%m' ) = DATE_FORMAT(now(),'%Y-%m')) mo on a.id = mo.Dev_Id
|
||||
where a.id in
|
||||
<foreach collection="devIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.pq.pojo.param.PqDevTypeParam;
|
||||
import com.njcn.device.pq.pojo.po.PqDevType;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/11/5 11:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface PqDevTypeService extends IService<PqDevType>{
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 分页查询装置型号信息
|
||||
* @param param
|
||||
* @return: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.njcn.device.pq.pojo.po.PqIcdPath>
|
||||
* @Author: wr
|
||||
* @Date: 2025/4/17 10:47
|
||||
*/
|
||||
Page<PqDevType> pageDevTypeList(BaseParam param);
|
||||
|
||||
/**
|
||||
* @Description: 新增装置型号
|
||||
* @param param
|
||||
* @return: java.lang.Boolean
|
||||
* @Author: wr
|
||||
* @Date: 2025/4/17 10:43
|
||||
*/
|
||||
Boolean addDevType(PqDevTypeParam param);
|
||||
|
||||
/**
|
||||
* @Description: 修改装置型号
|
||||
* @param param
|
||||
* @return: java.lang.Boolean
|
||||
* @Author: wr
|
||||
* @Date: 2025/4/17 10:43
|
||||
*/
|
||||
Boolean updateDevType(PqDevTypeParam.PqDevTypeUpdateParam param);
|
||||
|
||||
/**
|
||||
* 删除装置型号信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Boolean delIDevType(List<String> ids);
|
||||
|
||||
void batchTerminal(MultipartFile file, HttpServletResponse response);
|
||||
}
|
||||
@@ -1,20 +1,61 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.device.pq.pojo.dto.PqIcdPathDTO;
|
||||
import com.njcn.device.pq.pojo.param.PqIcdPathParam;
|
||||
import com.njcn.device.pq.pojo.po.PqIcdPath;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
/**
|
||||
*
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/11/5 11:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface PqIcdPathService extends IService<PqIcdPath>{
|
||||
public interface PqIcdPathService extends IService<PqIcdPath> {
|
||||
|
||||
/**
|
||||
* 前置获取icd模型
|
||||
* @param devType
|
||||
* @return
|
||||
*/
|
||||
List<PqIcdPathDTO> icdPathList(List<String> devType);
|
||||
|
||||
Boolean addIcdPath(PqIcdPathParam pqIcdPathParam);
|
||||
/**
|
||||
* @Description: 分页查询icd信息
|
||||
* @param param
|
||||
* @return: com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.njcn.device.pq.pojo.po.PqIcdPath>
|
||||
* @Author: wr
|
||||
* @Date: 2025/4/17 10:47
|
||||
*/
|
||||
Page<PqIcdPath> pageIcdList(BaseParam param);
|
||||
|
||||
Boolean updateIcdPath(PqIcdPathParam.PqIcdPathUpdateParam pqIcdPathUpdateParam);
|
||||
}
|
||||
/**
|
||||
* @Description: 新增icd
|
||||
* @param pqIcdPathParam
|
||||
* @return: java.lang.Boolean
|
||||
* @Author: wr
|
||||
* @Date: 2025/4/17 10:43
|
||||
*/
|
||||
Boolean addIcdPath(PqIcdPathParam pqIcdPathParam);
|
||||
|
||||
/**
|
||||
* @Description: 修改icd
|
||||
* @param param
|
||||
* @return: java.lang.Boolean
|
||||
* @Author: wr
|
||||
* @Date: 2025/4/17 10:43
|
||||
*/
|
||||
Boolean updateIcdPath(PqIcdPathParam.PqIcdPathUpdateParam param);
|
||||
|
||||
/**
|
||||
* 删除icd信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
Boolean delIcdPath(List<String> ids);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pms.enums.PmsDeviceResponseEnum;
|
||||
import com.njcn.device.pq.mapper.PqDevTypeMapper;
|
||||
import com.njcn.device.pq.pojo.param.PqDevTypeParam;
|
||||
import com.njcn.device.pq.pojo.po.Device;
|
||||
import com.njcn.device.pq.pojo.po.PqDevType;
|
||||
import com.njcn.device.pq.service.IDeviceService;
|
||||
import com.njcn.device.pq.service.PqDevTypeService;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/11/5 11:24【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqDevTypeServiceImpl extends ServiceImpl<PqDevTypeMapper, PqDevType> implements PqDevTypeService {
|
||||
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final IDeviceService deviceService;
|
||||
|
||||
@Override
|
||||
public Page<PqDevType> pageDevTypeList(BaseParam param) {
|
||||
Page<PqDevType> page = this.page(new Page<>(param.getPageNum(), param.getPageSize())
|
||||
, new LambdaQueryWrapper<PqDevType>()
|
||||
.like(StrUtil.isNotBlank(param.getSearchValue()), PqDevType::getName, param.getSearchValue())
|
||||
.eq(PqDevType::getState, DataStateEnum.ENABLE.getCode())
|
||||
.orderByDesc(PqDevType::getCreateTime)
|
||||
);
|
||||
List<PqDevType> records = page.getRecords();
|
||||
if (CollUtil.isNotEmpty(records)) {
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.addAll(records.stream().map(PqDevType::getCreateBy).filter(x -> StrUtil.isNotBlank(x)).distinct().collect(Collectors.toList()));
|
||||
userIds.addAll(records.stream().map(PqDevType::getUpdateBy).filter(x -> StrUtil.isNotBlank(x)).distinct().collect(Collectors.toList()));
|
||||
List<String> collect = userIds.stream().distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
List<User> users = userFeignClient.getUserByIdList(collect).getData();
|
||||
Map<String, String> userMap = users.stream().collect(Collectors.toMap(User::getId, User::getName));
|
||||
for (PqDevType record : records) {
|
||||
if (userMap.containsKey(record.getCreateBy())) {
|
||||
record.setCreateBy(userMap.get(record.getCreateBy()));
|
||||
}
|
||||
if (userMap.containsKey(record.getUpdateBy())) {
|
||||
record.setUpdateBy(userMap.get(record.getUpdateBy()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean addDevType(PqDevTypeParam param) {
|
||||
Integer count = this.lambdaQuery()
|
||||
.eq(PqDevType::getState, DataStateEnum.ENABLE.getCode())
|
||||
.eq(PqDevType::getName, param.getName()).count();
|
||||
if (count > 0) {
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
}
|
||||
PqDevType devType = new PqDevType();
|
||||
devType.setName(param.getName());
|
||||
devType.setIcdId(param.getIcdId());
|
||||
devType.setState(DataStateEnum.ENABLE.getCode());
|
||||
return this.save(devType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateDevType(PqDevTypeParam.PqDevTypeUpdateParam param) {
|
||||
int count = this.count(new LambdaQueryWrapper<PqDevType>()
|
||||
.ne(PqDevType::getId, param.getId())
|
||||
.eq(PqDevType::getState, DataStateEnum.ENABLE.getCode())
|
||||
.and(wrapper ->
|
||||
wrapper.eq(PqDevType::getName, param.getName())
|
||||
)
|
||||
);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
}
|
||||
PqDevType pqDevType = BeanUtil.copyProperties(param, PqDevType.class);
|
||||
return this.updateById(pqDevType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean delIDevType(List<String> ids) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
int count = deviceService.count(new LambdaQueryWrapper<Device>()
|
||||
.in(Device::getDevType, ids));
|
||||
if (count > 0) {
|
||||
throw new BusinessException("装置类型已绑定装置无法删除!");
|
||||
}
|
||||
return this.update(new LambdaUpdateWrapper<PqDevType>()
|
||||
.set(PqDevType::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(PqDevType::getId, ids)
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchTerminal(MultipartFile file, HttpServletResponse response) {
|
||||
List<PqDevTypeParam.A> list = EasyExcel.read(new File("C:\\Users\\web2023\\Desktop\\sys_dict_data.xlsx"))
|
||||
.head(PqDevTypeParam.A.class)
|
||||
.sheet(0).doReadSync();
|
||||
List<PqDevType> info = new ArrayList<>();
|
||||
for (PqDevTypeParam.A a : list) {
|
||||
PqDevType pqDevType = new PqDevType();
|
||||
pqDevType.setId(a.getId());
|
||||
pqDevType.setName(a.getName());
|
||||
pqDevType.setState(DataStateEnum.ENABLE.getCode());
|
||||
info.add(pqDevType);
|
||||
}
|
||||
this.saveBatch(info);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,29 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pms.enums.PmsDeviceResponseEnum;
|
||||
import com.njcn.device.pq.pojo.dto.PqIcdPathDTO;
|
||||
import com.njcn.device.pq.pojo.param.PqIcdPathParam;
|
||||
import com.njcn.device.pq.pojo.po.PqDevType;
|
||||
import com.njcn.device.pq.service.PqDevTypeService;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.pq.pojo.po.PqIcdPath;
|
||||
@@ -16,7 +32,6 @@ import com.njcn.device.pq.service.PqIcdPathService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/11/5 11:24【需求编号】
|
||||
*
|
||||
@@ -24,28 +39,119 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath> implements PqIcdPathService{
|
||||
@RequiredArgsConstructor
|
||||
public class PqIcdPathServiceImpl extends ServiceImpl<PqIcdPathMapper, PqIcdPath> implements PqIcdPathService {
|
||||
|
||||
private final PqDevTypeService devTypeService;
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
public List<PqIcdPathDTO> icdPathList(List<String> devType) {
|
||||
List<PqDevType> list = devTypeService.list(
|
||||
new LambdaQueryWrapper<PqDevType>()
|
||||
.in(CollUtil.isNotEmpty(devType), PqDevType::getName, devType)
|
||||
.eq(PqDevType::getState, DataStateEnum.ENABLE.getCode())
|
||||
);
|
||||
List<PqIcdPathDTO> info = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<String> icdIDS = list.stream().map(PqDevType::getIcdId).distinct().collect(Collectors.toList());
|
||||
List<PqIcdPath> pqIcdPaths = this.listByIds(icdIDS);
|
||||
Map<String, PqIcdPath> pqIcdPathMap = pqIcdPaths.stream().collect(Collectors.toMap(PqIcdPath::getId, Function.identity()));
|
||||
for (PqDevType pqDevType : list) {
|
||||
if (pqIcdPathMap.containsKey(pqDevType.getIcdId())) {
|
||||
PqIcdPath pqIcdPath = pqIcdPathMap.get(pqDevType.getIcdId());
|
||||
PqIcdPathDTO pqIcdPathDTO = new PqIcdPathDTO();
|
||||
pqIcdPathDTO.setId(pqDevType.getId());
|
||||
pqIcdPathDTO.setDevType(pqDevType.getName());
|
||||
pqIcdPathDTO.setFileName(pqIcdPath.getName());
|
||||
pqIcdPathDTO.setFilePath(pqIcdPath.getPath());
|
||||
pqIcdPathDTO.setUpdateTime(LocalDateTimeUtil.format(pqDevType.getUpdateTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
info.add(pqIcdPathDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PqIcdPath> pageIcdList(BaseParam param) {
|
||||
Page<PqIcdPath> page = this.page(new Page<>(param.getPageNum(), param.getPageSize())
|
||||
, new LambdaQueryWrapper<PqIcdPath>()
|
||||
.like(StrUtil.isNotBlank(param.getSearchValue()), PqIcdPath::getName, param.getSearchValue())
|
||||
.eq(PqIcdPath::getState, DataStateEnum.ENABLE.getCode())
|
||||
.orderByDesc(PqIcdPath::getCreateTime)
|
||||
);
|
||||
List<PqIcdPath> records = page.getRecords();
|
||||
if (CollUtil.isNotEmpty(records)) {
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.addAll(records.stream().map(PqIcdPath::getCreateBy).filter(x -> StrUtil.isNotBlank(x)).distinct().collect(Collectors.toList()));
|
||||
userIds.addAll(records.stream().map(PqIcdPath::getUpdateBy).filter(x -> StrUtil.isNotBlank(x)).distinct().collect(Collectors.toList()));
|
||||
List<String> collect = userIds.stream().distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
List<User> users = userFeignClient.getUserByIdList(collect).getData();
|
||||
Map<String, String> userMap = users.stream().collect(Collectors.toMap(User::getId, User::getName));
|
||||
for (PqIcdPath record : records) {
|
||||
if (userMap.containsKey(record.getCreateBy())) {
|
||||
record.setCreateBy(userMap.get(record.getCreateBy()));
|
||||
}
|
||||
if (userMap.containsKey(record.getUpdateBy())) {
|
||||
record.setUpdateBy(userMap.get(record.getUpdateBy()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addIcdPath(PqIcdPathParam pqIcdPathParam) {
|
||||
PqIcdPath pqIcdPath = new PqIcdPath();
|
||||
PqIcdPath one = this.lambdaQuery().eq(PqIcdPath::getName, pqIcdPathParam.getDevType()).one();
|
||||
if(Objects.isNull(one)){
|
||||
throw new BusinessException(pqIcdPathParam.getDevType()+"已存在icd文件");
|
||||
Integer count = this.lambdaQuery()
|
||||
.eq(PqIcdPath::getState, DataStateEnum.ENABLE.getCode())
|
||||
.eq(PqIcdPath::getName, pqIcdPathParam.getFileName()).count();
|
||||
if (count > 0) {
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
}
|
||||
pqIcdPath.setName(pqIcdPathParam.getDevType());
|
||||
PqIcdPath pqIcdPath = new PqIcdPath();
|
||||
pqIcdPath.setName(pqIcdPathParam.getFileName());
|
||||
pqIcdPath.setPath(pqIcdPathParam.getFilePath());
|
||||
pqIcdPath.setUpdateTime(LocalDateTime.now());
|
||||
this.save(pqIcdPath);
|
||||
return true;
|
||||
pqIcdPath.setState(DataStateEnum.ENABLE.getCode());
|
||||
return this.save(pqIcdPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateIcdPath(PqIcdPathParam.PqIcdPathUpdateParam pqIcdPathUpdateParam) {
|
||||
this.lambdaUpdate().eq(PqIcdPath::getName, pqIcdPathUpdateParam.getDevType())
|
||||
.set(PqIcdPath::getPath,pqIcdPathUpdateParam.getFilePath())
|
||||
.set(PqIcdPath::getUpdateTime,LocalDateTime.now()).update();
|
||||
return true;
|
||||
public Boolean updateIcdPath(PqIcdPathParam.PqIcdPathUpdateParam param) {
|
||||
int count = this.count(new LambdaQueryWrapper<PqIcdPath>()
|
||||
.ne(PqIcdPath::getId, param.getId())
|
||||
.eq(PqIcdPath::getState, DataStateEnum.ENABLE.getCode())
|
||||
.and(wrapper ->
|
||||
wrapper.eq(PqIcdPath::getName, param.getFileName())
|
||||
)
|
||||
);
|
||||
if (count > 0) {
|
||||
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
|
||||
}
|
||||
PqIcdPath icdPath = BeanUtil.copyProperties(param, PqIcdPath.class);
|
||||
icdPath.setName(param.getFileName());
|
||||
icdPath.setPath(param.getFilePath());
|
||||
return this.updateById(icdPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean delIcdPath(List<String> ids) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
int count = devTypeService.count(new LambdaQueryWrapper<PqDevType>()
|
||||
.in(PqDevType::getIcdId, ids));
|
||||
if (count > 0) {
|
||||
throw new BusinessException("icd已被装置类型绑定无法删除!");
|
||||
}
|
||||
return this.update(new LambdaUpdateWrapper<PqIcdPath>()
|
||||
.set(PqIcdPath::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(PqIcdPath::getId, ids)
|
||||
);
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ public class PqsTerminalLogsServiceImpl extends ServiceImpl<PqsTerminalLogsMappe
|
||||
Page<PqsTerminalLogs> page;
|
||||
LambdaQueryWrapper<PqsTerminalLogs> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(StrUtil.isNotBlank(logsListParam.getType()),PqsTerminalLogs::getLogsType,logsListParam.getType())
|
||||
.like(StrUtil.isNotBlank(logsListParam.getSearchValue()),PqsTerminalLogs::getTerminalDescribe,logsListParam.getSearchValue())
|
||||
.eq(StrUtil.isNotBlank(logsListParam.getId()),PqsTerminalLogs::getObjIndex,logsListParam.getId())
|
||||
.between(PqsTerminalLogs::getCreateTime, DateUtil.beginOfDay(DateUtil.parse(logsListParam.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(logsListParam.getSearchEndTime())))
|
||||
.orderByDesc(PqsTerminalLogs::getCreateTime);
|
||||
page = pqsTerminalLogsMapper.selectPage(new Page<>(PageFactory.getPageNum(logsListParam),PageFactory.getPageSize(logsListParam)),lambdaQueryWrapper);
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -138,20 +139,12 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
||||
|
||||
@Override
|
||||
public boolean updateRunFlagManage(TerminalParam terminalParam) {
|
||||
//终端状态管理
|
||||
List<Device> tem = new ArrayList<>();
|
||||
terminalParam.getIds().forEach(item -> {
|
||||
Device device = new Device();
|
||||
device.setId(item);
|
||||
device.setRunFlag(terminalParam.getRunFlag());
|
||||
tem.add(device);
|
||||
});
|
||||
|
||||
QueryWrapper<Device> wrapper = new QueryWrapper<>();
|
||||
List<String> idList = tem.stream().map(Device::getId).collect(Collectors.toList());
|
||||
wrapper.in("id", idList);
|
||||
List<Device> newList = iDeviceService.list(wrapper);
|
||||
boolean b = iDeviceService.updateBatchById(tem);
|
||||
wrapper.in("id", terminalParam.getIds());
|
||||
List<Device> newList = iDeviceService.listByIds(terminalParam.getIds());
|
||||
boolean b = iDeviceService.update(new LambdaUpdateWrapper<Device>()
|
||||
.set(Device::getRunFlag,terminalParam.getRunFlag())
|
||||
.in(Device::getId,terminalParam.getIds()));
|
||||
//添加日志信息
|
||||
if (b) {
|
||||
List<Device> oldList = iDeviceService.list(wrapper);
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.device.pq.api.PqDevTypeClient;
|
||||
import com.njcn.device.pq.pojo.po.PqDevType;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.enums.SystemResponseEnum;
|
||||
@@ -28,6 +30,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -43,8 +46,9 @@ import java.util.stream.Collectors;
|
||||
public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> implements IDictDataService {
|
||||
|
||||
private final IConfigService iConfigService;
|
||||
|
||||
private final IDictTypeService dictTypeService;
|
||||
private final PqDevTypeClient pqDevTypeClient;
|
||||
|
||||
|
||||
@Override
|
||||
public Page<DictDataVO> listDictData(DictDataParam.DictDataQueryParam queryParam) {
|
||||
@@ -129,14 +133,34 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
|
||||
@Override
|
||||
public List<DictData> getDicDataByTypeName(String dictTypeName) {
|
||||
if(DicDataTypeEnum.DEV_TYPE.getName().equals(dictTypeName)){
|
||||
return getDicData();
|
||||
}
|
||||
return this.baseMapper.getDicDataByTypeName(dictTypeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictData> getDicDataByTypeCode(String dictTypeCode) {
|
||||
if(DicDataTypeEnum.DEV_TYPE.getCode().equals(dictTypeCode)){
|
||||
return getDicData();
|
||||
}
|
||||
return this.baseMapper.getDicDataByTypeCode(dictTypeCode);
|
||||
}
|
||||
|
||||
|
||||
public List<DictData> getDicData() {
|
||||
List<DictData> info=new ArrayList<>();
|
||||
List<PqDevType> data = pqDevTypeClient.getDevTypeList().getData();
|
||||
DictData dictData;
|
||||
for (PqDevType datum : data) {
|
||||
dictData=new DictData();
|
||||
dictData.setId(datum.getId());
|
||||
dictData.setName(datum.getName());
|
||||
info.add(dictData);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictData getDicDataByName(String dicName) {
|
||||
return this.baseMapper.getDicDataByName(dicName);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TimerTaskInitListener implements ApplicationRunner, Ordered {
|
||||
List<Timers> list = sysTimersService.list(lambdaQueryChainWrapper);
|
||||
// 添加定时任务到调度器
|
||||
for (Timers sysTimers : list) {
|
||||
timerExeService.startTimer(String.valueOf(sysTimers.getId()), sysTimers.getCron(), sysTimers.getActionClass());
|
||||
// timerExeService.startTimer(String.valueOf(sysTimers.getId()), sysTimers.getCron(), sysTimers.getActionClass());
|
||||
}
|
||||
|
||||
// 设置秒级别的启用
|
||||
|
||||
Reference in New Issue
Block a user