在线监测点效率修改,监测点下来框接口

This commit is contained in:
hzj
2024-05-24 16:02:52 +08:00
parent 5b54fef317
commit cb3dbc86d5
15 changed files with 125 additions and 11 deletions

View File

@@ -48,4 +48,8 @@ public interface CommLineClient {
@GetMapping("/getLineAllDetail")
HttpResult<LineALLInfoDTO> getLineAllDetail(@RequestParam("id") String id);
@GetMapping("/getLineAllDetailList")
HttpResult<List<LineALLInfoDTO>> getLineAllDetailList(@RequestParam("ids") List<String> ids);
}

View File

@@ -50,6 +50,12 @@ public class CommLineClientFallbackFactory implements FallbackFactory<CommLineCl
throw new BusinessException(finalExceptionEnum);
}
@Override
public HttpResult<List<LineALLInfoDTO>> getLineAllDetailList(List<String> ids) {
log.error("{}异常,降级处理,异常为:{}", "获取监测点列表信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -49,7 +49,14 @@ public class CommLineController extends BaseController {
LineALLInfoDTO result = lineService.getLineAllDetail(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getLineAllDetailList")
@ApiOperation("获取多监测点id取超标监测点信息")
public HttpResult<List<LineALLInfoDTO>> getLineAllDetailList(@RequestParam("ids") List<String> ids) {
String methodDescribe = getMethodDescribe("getLineAllDetailList");
List<LineALLInfoDTO> result = lineService.getLineAllDetailList(ids);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getLineDetailBatch")

View File

@@ -8,6 +8,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil;
import com.njcn.device.pq.pojo.po.DeptLine;
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
import com.njcn.device.pq.service.DeptLineService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.pojo.param.DeptLineParam;
@@ -109,6 +110,16 @@ public class DeptLineController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@PostMapping("/getLineDetailByDeptId")
@ApiOperation("部门Id获取绑定监测点详情")
@ApiImplicitParam(name = "id", value = "部门id", required = true)
public HttpResult<List<LineDeviceStateVO>> getLineDetailByDeptId(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("getLineDetailByDeptId");
List<LineDeviceStateVO> list = deptLineService.getLineDetailByDeptId(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@PostMapping("/getLineByDeptRelation")
@ApiOperation("获取部门和监测点的关系(分稳态暂态)")
@ApiImplicitParam(name = "devDataType", value = "数据类型0暂态系统1稳态系统", required = true)

View File

@@ -623,10 +623,13 @@
AND device.id = subv.pid
AND device1.id = device.id
AND sub.id = device1.pid
<if test="list!=null and list.size()!=0">
AND t.id in
<foreach item="item" collection="list" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</select>
<select id="getSubstationInfo" resultType="PollutionSubstationDTO">

View File

@@ -6,6 +6,7 @@ import com.njcn.device.biz.pojo.dto.SubGetBase;
import com.njcn.device.biz.pojo.dto.TerminalGetBase;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.pq.pojo.po.DeptLine;
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
import com.njcn.web.pojo.param.DeptLineParam;
import java.util.List;
@@ -119,4 +120,6 @@ public interface DeptLineService extends IService<DeptLine> {
* @return 查询结果
*/
DeptLine getLineByLineIds(String ids);
List<LineDeviceStateVO> getLineDetailByDeptId(String id);
}

View File

@@ -213,4 +213,6 @@ public interface LineService extends IService<Line> {
DeviceVO getDeviceDetailData(String id);
List<Line> getSubIndexLineDetail(String id);
List<LineALLInfoDTO> getLineAllDetailList(List<String> ids);
}

View File

@@ -3,12 +3,14 @@ package com.njcn.device.pq.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.biz.pojo.dto.SubGetBase;
import com.njcn.device.biz.pojo.dto.TerminalGetBase;
import com.njcn.device.biz.pojo.param.SubstationParam;
import com.njcn.device.pq.mapper.DeptLineMapper;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.pq.mapper.LineMapper;
import com.njcn.device.pq.pojo.po.DeptLine;
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
import com.njcn.device.pq.service.DeptLineService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.dto.DeptDTO;
@@ -36,6 +38,7 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
private final DeptLineMapper deptLineMapper;
private final DeptFeignClient deptFeignClient;
private final LineMapper lineMapper;
@Override
@Transactional(rollbackFor = Exception.class)
@@ -138,5 +141,12 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
);
}
@Override
public List<LineDeviceStateVO> getLineDetailByDeptId(String id) {
List<String> lineByDeptId = this.getLineByDeptId(id);
List<LineDeviceStateVO> lineDeviceStateVO = lineMapper.getLineDeviceStateVO(lineByDeptId);
return lineDeviceStateVO;
}
}

View File

@@ -567,7 +567,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
@Override
public LineALLInfoDTO getLineAllDetail(String id) {
LineALLInfoDTO lineALLInfoDTO = new LineALLInfoDTO();
//根据id查询当前信息的pids
//根据id查询当前信息的pids
List<String> pids = Arrays.asList(this.baseMapper.selectById(id).getPids().split(","));
List<String> list = new ArrayList(pids);
list.add(id);
@@ -655,6 +655,12 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
.list();
}
@Override
public List<LineALLInfoDTO> getLineAllDetailList(List<String> ids) {
List<LineALLInfoDTO> collect = ids.stream().map(this::getLineAllDetail).collect(Collectors.toList());
return collect;
}
@Override
public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) {
return overlimitMapper.selectBatchIds(pollutionParamDTO.getLineList());

View File

@@ -1,5 +1,6 @@
package com.njcn.harmonic.pojo.param;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -13,7 +14,7 @@ import java.util.List;
* @version V1.0.0
*/
@Data
public class RMpPartHarmonicDetailQueryParam {
public class RMpPartHarmonicDetailQueryParam extends BaseParam {
/**
* 统计起始日期

View File

@@ -1,11 +1,7 @@
package com.njcn.supervision.pojo.param.device;
import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity;
import com.njcn.web.pojo.annotation.DateTimeStrValid;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
@@ -68,11 +64,11 @@ public class SupervisionTempLineRunTestParam {
private List<String> lineIds;
@NotBlank(message = "开始时间不可为空")
@DateTimeStrValid(format = "yyyy-MM-dd HH:mm:ss")
@DateTimeStrValid(format = "yyyy-MM-dd")
private String startTime;
@NotBlank(message = "结束时间不可为空")
@DateTimeStrValid(format = "yyyy-MM-dd HH:mm:ss")
@DateTimeStrValid(format = "yyyy-MM-dd")
private String endTime;

View File

@@ -210,7 +210,7 @@ public class SupervisionPlanPO extends BaseEntity {
private String effectUserName;
/**
* 0.未上送 1.上送 2.取消上送 3.待重新上送
* 0.未上送 1.上送是否发起告警单
*/
@TableField(value = "is_upload_head")
private Integer isUploadHead;

View File

@@ -83,5 +83,13 @@ public class SupervisionPlanController extends BaseController {
supervisionPlanPOService.updateStatus(businessKey,status);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/initiateWarningLeaflet")
@ApiOperation("针对技术监督问题发起告警单")
public HttpResult<Boolean> initiateWarningLeaflet(@RequestParam("id") String id){
String methodDescribe = getMethodDescribe("initiateWarningLeaflet");
supervisionPlanPOService.initiateWarningLeaflet(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Boolean.TRUE, methodDescribe);
}
}

View File

@@ -26,4 +26,6 @@ public interface SupervisionPlanPOService extends IService<SupervisionPlanPO>{
SupervisionPlanVO getDetailPlan(String id);
void updateStatus(String businessKey, Integer status);
void initiateWarningLeaflet(String id);
}

View File

@@ -9,6 +9,7 @@ import cn.hutool.core.date.DateUtil;
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.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.bpm.api.BpmProcessFeignClient;
@@ -17,11 +18,14 @@ import com.njcn.bpm.pojo.dto.BpmProcessInstanceCreateReqDTO;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
import com.njcn.supervision.enums.LeafletTypeEnum;
import com.njcn.supervision.enums.ProblemTypeEnum;
import com.njcn.supervision.mapper.plan.SupervisionPlanPOMapper;
import com.njcn.supervision.pojo.param.plan.SupervisionPlanParam;
import com.njcn.supervision.pojo.po.plan.SupervisionPlanPO;
import com.njcn.supervision.pojo.po.plan.SupervisionProblemPO;
import com.njcn.supervision.pojo.vo.plan.SupervisionPlanVO;
import com.njcn.supervision.service.leaflet.IWarningLeafletService;
import com.njcn.supervision.service.plan.SupervisionPlanPOService;
import com.njcn.supervision.service.plan.SupervisionProblemPOService;
import com.njcn.user.api.DeptFeignClient;
@@ -58,6 +62,8 @@ public class SupervisionPlanPOServiceImpl extends ServiceImpl<SupervisionPlanPOM
private final BpmProcessFeignClient bpmProcessFeignClient;
public static final String PROCESS_KEY = "sup_plan_add";
private final SupervisionProblemPOService supervisionProblemPOService;
private final IWarningLeafletService warningLeafletService;
@Override
@Transactional(rollbackFor = Exception.class)
public String addPlan(SupervisionPlanParam supvPlanParam) {
@@ -102,6 +108,7 @@ public class SupervisionPlanPOServiceImpl extends ServiceImpl<SupervisionPlanPOM
}
}
supvPlan.setState(DataStateEnum.ENABLE.getCode());
supvPlan.setIsUploadHead(0);
supvPlan.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
this.save(supvPlan);
return supvPlan.getPlanId();
@@ -288,6 +295,54 @@ public class SupervisionPlanPOServiceImpl extends ServiceImpl<SupervisionPlanPOM
this.lambdaUpdate().set(SupervisionPlanPO::getStatus,status).eq(SupervisionPlanPO::getPlanId,businessKey).update();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void initiateWarningLeaflet(String id) {
//获取数据源用于组装数据
List<SupervisionProblemPO> list = supervisionProblemPOService.lambdaQuery().eq(SupervisionProblemPO::getPlanId, id).list();
SupervisionPlanPO byId = this.getById(id);
/*
* 1、预告警单名称此处暂时用计算监督计划名称
* 2、预告警编号暂时随机by yxb
* 3、问题类型1技术监督管理2在线监测超标问题3用户投诉4现场测试超标此处是现场测试超标
* 4、对应问题源id用于查询详细数据
* 5、单子类型1预警单2告警单
* 6、问题详细描述
* */
warningLeafletService.createLeaflet(
byId.getWorkPlanName(),
IdWorker.get32UUID(),
id,
ProblemTypeEnum.PLAN.getCode(),
LeafletTypeEnum.ALARM.getCode(),
assembleIssueDetail(list,byId)
);
//将当前的问题记录是否告警修改为已告警
this.lambdaUpdate().eq(SupervisionPlanPO::getPlanId,id).set(SupervisionPlanPO::getIsUploadHead,1).update();
}
/**
* 组装谐波普测的问题
* 格式planCreateTime发起的planName普测计划由负责人leader测试后于planComplateTime完成其中subName在本次普测计划测试中存在电能质量问题详细请查看附件
*/
private String assembleIssueDetail(List<SupervisionProblemPO> supervisionProblemPOList, SupervisionPlanPO supervisionPlanPO) {
String join = String.join(",", supervisionProblemPOList.stream().map(SupervisionProblemPO::getRemark).collect(Collectors.toList()));
String issueDetail = ""
.concat(LocalDateTimeUtil.format(supervisionPlanPO.getCreateTime(), DatePattern.CHINESE_DATE_PATTERN))
.concat("发起的")
.concat(supervisionPlanPO.getWorkPlanName())
.concat("技术监督计划,由负责人")
.concat(supervisionPlanPO.getEffectUserName())
.concat("实施,于")
.concat(LocalDateTimeUtil.format(supervisionPlanPO.getEffectEndTime(), DatePattern.CHINESE_DATE_PATTERN))
.concat("完成,其中存在问题")
.concat(join)
.concat("在本次技术监督计划测试中存在电能质量问题,详细请查看问题附件");
return issueDetail;
}
private void checkParam(SupervisionPlanParam supvPlanParam, Boolean updateFlag) {