1.技术监督试运行评估-试运行结束后生成试运行报告
2.技术监督计划管理,权限调整为负责地市进行信息修改 3.调整常态化干扰源用户信息更新逻辑 4.调整谐波报告数据请求格式
This commit is contained in:
@@ -11,8 +11,15 @@ import lombok.Data;
|
||||
@Data
|
||||
public class LineDataQualityDTO {
|
||||
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 监测点名称
|
||||
*/
|
||||
private String lineName;
|
||||
|
||||
/**
|
||||
* 在线率
|
||||
|
||||
@@ -148,7 +148,6 @@ public class TerminalBaseController extends BaseController {
|
||||
@PostMapping("terminalSync")
|
||||
public HttpResult<String> terminalSync(@Valid @RequestBody SyncTerminalParam syncTerminalParam) {
|
||||
String methodDescribe = getMethodDescribe("terminalSync");
|
||||
|
||||
String subtation = terminalBaseService.terminalSync(syncTerminalParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, subtation, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ public class RStatIntegrityDServiceImpl extends ServiceImpl<RStatIntegrityDMappe
|
||||
for(Line item : lineList){
|
||||
LineDataQualityDTO lineDataQualityDTO = new LineDataQualityDTO();
|
||||
lineDataQualityDTO.setLineId(item.getId());
|
||||
lineDataQualityDTO.setLineName(item.getName());
|
||||
if(onlineMap.containsKey(item.getPid())){
|
||||
lineDataQualityDTO.setOnlineRate(Double.valueOf(onlineMap.get(item.getPid()).getOnlineRate()));
|
||||
}else {
|
||||
|
||||
@@ -38,6 +38,12 @@
|
||||
<artifactId>common-poi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-oss</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>${project.version}</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>user-api</artifactId>
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.harmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.harmonic.api.fallback.RStatLimitRateDFeignClientFallbackFactory;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
@FeignClient(
|
||||
value = ServerInfo.HARMONIC,
|
||||
path = "/exportmodel",
|
||||
fallbackFactory = RStatLimitRateDFeignClientFallbackFactory.class,
|
||||
contextId = "exportmodel")
|
||||
public interface ReportFeignClient {
|
||||
|
||||
@PostMapping(value ="/exportModel",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
HttpResult<String> exportWorld(
|
||||
@RequestParam("startTime") String startTime,
|
||||
@RequestParam("endTime") String endTime,
|
||||
@RequestParam("type") Integer type,
|
||||
@RequestParam("lineIndex") String lineIndex,
|
||||
@RequestParam("name") String name,
|
||||
@RequestParam("reportNumber") String reportNumber,
|
||||
@RequestParam("crmName") String crmName,
|
||||
@RequestParam("isUrl") Boolean isUrl,
|
||||
@RequestPart("file") MultipartFile file) throws IOException;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.njcn.harmonic.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.harmonic.api.PqTypicalSourceFeignClient;
|
||||
import com.njcn.harmonic.api.RStatLimitRateDClient;
|
||||
import com.njcn.harmonic.api.ReportFeignClient;
|
||||
import com.njcn.harmonic.pojo.param.RStatLimitQueryParam;
|
||||
import com.njcn.harmonic.pojo.param.UploadParam;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
|
||||
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
|
||||
import com.njcn.harmonic.pojo.vo.RStatLimitTargetVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年07月21日 14:31
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ReportClientFallbackFactory implements FallbackFactory<ReportFeignClient> {
|
||||
@Override
|
||||
public ReportFeignClient 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 ReportFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<String> exportWorld( String startTime, String endTime, Integer type, String lineIndex, String name, String reportNumber, String crmName, Boolean isUrl, MultipartFile file) throws IOException {
|
||||
log.error("{}异常,降级处理,异常为:{}", "获取谐波报告失败", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.njcn.harmonic.utils;
|
||||
|
||||
import ch.qos.logback.core.rolling.helper.FileStoreUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -16,10 +17,14 @@ import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class WordUtil2 {
|
||||
// 日志记录
|
||||
private static final Logger logger = LoggerFactory.getLogger(WordUtil2.class);
|
||||
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
|
||||
public void getWord(String path, Map<String, Object> params, String fileName, HttpServletResponse response)
|
||||
throws Exception {
|
||||
@@ -33,7 +38,7 @@ public class WordUtil2 {
|
||||
this.replaceInTable(doc, params); // 替换表格里面的变量
|
||||
this.replaceInPara(doc, params); // 替换文本里面的变量
|
||||
} catch (IOException e) {
|
||||
logger.error("获取报告模板异常,原因为:" + e);
|
||||
getError("获取报告模板异常,原因为:" + e);
|
||||
} finally {
|
||||
if (null != inStream) {
|
||||
inStream.close();
|
||||
@@ -46,7 +51,7 @@ public class WordUtil2 {
|
||||
doc.write(outputStream);
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
logger.error("输出稳态报告异常,原因为:" + e);
|
||||
getError("输出稳态报告异常,原因为:" + e);
|
||||
} finally {
|
||||
if (doc != null) {
|
||||
doc.close();
|
||||
@@ -66,7 +71,7 @@ public class WordUtil2 {
|
||||
this.replaceInTable(doc,params,tableList);
|
||||
this.replaceInPara(doc, params);
|
||||
} catch (IOException e) {
|
||||
logger.error("获取报告模板异常,原因为:" + e);
|
||||
getError("获取报告模板异常,原因为:" + e);
|
||||
} finally {
|
||||
if (null != inStream) {
|
||||
inStream.close();
|
||||
@@ -80,7 +85,7 @@ public class WordUtil2 {
|
||||
in = new ByteArrayInputStream(docByteAry);
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
logger.error("输出稳态报告异常,原因为:" + e);
|
||||
getError("输出稳态报告异常,原因为:" + e);
|
||||
} finally {
|
||||
if (doc != null) {
|
||||
doc.close();
|
||||
@@ -90,6 +95,43 @@ public class WordUtil2 {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getReportFileUrl(String path,String fileName, Map<String, Object> params)
|
||||
throws Exception {
|
||||
path = ClearPathUtil.cleanString(path);
|
||||
InputStream inStream = null,in = null;
|
||||
CustomXWPFDocument doc = null;
|
||||
//读取报告模板
|
||||
try {
|
||||
inStream = new ClassPathResource(path).getInputStream();;
|
||||
doc = new CustomXWPFDocument(inStream);
|
||||
this.replaceInTable(doc, params); // 替换表格里面的变量
|
||||
this.replaceInPara(doc, params); // 替换文本里面的变量
|
||||
|
||||
//临时缓冲区
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
doc.write(out);
|
||||
byte[] docByteAry = out.toByteArray();
|
||||
in = new ByteArrayInputStream(docByteAry);
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
getError("获取报告模板异常,原因为:" + e);
|
||||
} finally {
|
||||
if (null != inStream) {
|
||||
inStream.close();
|
||||
}
|
||||
if (doc != null) {
|
||||
doc.close();
|
||||
}
|
||||
}
|
||||
//上传文件服务器
|
||||
return fileStorageUtil.uploadStreamSpecifyName(in, OssPath.ONLINE_REPORT, fileName);
|
||||
}
|
||||
|
||||
|
||||
private static void getError(String e) {
|
||||
log.error(e);
|
||||
}
|
||||
/**
|
||||
* 替换段落里面的变量
|
||||
*
|
||||
@@ -155,7 +197,7 @@ public class WordUtil2 {
|
||||
s,paragraph);
|
||||
bflag = "break";
|
||||
} catch (Exception e) {
|
||||
logger.error("文本替换发生异常,异常是" + e.getMessage());
|
||||
getError("文本替换发生异常,异常是" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -234,7 +276,7 @@ public class WordUtil2 {
|
||||
para.createRun().setText(str, 0);
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
logger.error("文件替换发生异常,异常是" + e.getMessage());
|
||||
getError("文件替换发生异常,异常是" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -336,33 +378,4 @@ public class WordUtil2 {
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭输入流
|
||||
*
|
||||
* @param is
|
||||
*/
|
||||
private void close(InputStream is) {
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("关闭输入流发生异常,异常是" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭输出流
|
||||
*
|
||||
* @param os
|
||||
*/
|
||||
private void close(OutputStream os) {
|
||||
if (os != null) {
|
||||
try {
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
logger.error("关闭输出流发生异常,异常是" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,18 +75,39 @@ public class ExportModelController extends BaseController {
|
||||
private final ThemeFeignClient themeFeignClient;
|
||||
private final ReportService reportService;
|
||||
private final DeviceUnitClient deviceUnitClient;
|
||||
private final WordUtil2 wordUtil2;
|
||||
|
||||
/**
|
||||
* @param response
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param type 区分pq:0 pms:1
|
||||
* @param lineIndex 监测点id
|
||||
* @param name 监测点名称
|
||||
* @param reportNumber 客户编号
|
||||
* @param crmName 客户名称
|
||||
* @param file 接线图
|
||||
* @param isUrl 是否地址栏返回
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/exportModel")
|
||||
@ApiOperation("word报告")
|
||||
public HttpResult<String> exportWorld(HttpServletResponse response,
|
||||
String startTime, String endTime, Integer type, String lineIndex,
|
||||
String name, String reportNumber, String crmName,
|
||||
MultipartFile file) throws IOException {
|
||||
@RequestParam("startTime") String startTime,
|
||||
@RequestParam("endTime") String endTime,
|
||||
@RequestParam("type") Integer type,
|
||||
@RequestParam("lineIndex") String lineIndex,
|
||||
@RequestParam("name") String name,
|
||||
@RequestParam("reportNumber") String reportNumber,
|
||||
@RequestParam("crmName") String crmName,
|
||||
@RequestParam("isUrl") Boolean isUrl,
|
||||
@RequestPart("file") MultipartFile file) throws IOException {
|
||||
String methodDescribe = getMethodDescribe("exportWorld");
|
||||
//获取监测点信息
|
||||
String bdname = "";
|
||||
Integer pttype = 0;
|
||||
String areaName = "";
|
||||
String bdname;
|
||||
Integer pttype;
|
||||
String areaName;
|
||||
String atype = "";
|
||||
String btype = "";
|
||||
String ctype = "";
|
||||
@@ -163,9 +184,8 @@ public class ExportModelController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "dataFail", methodDescribe);
|
||||
}
|
||||
|
||||
String rtfPath = "";
|
||||
String rtfPath;
|
||||
String picPath = "file/default.jpg";
|
||||
boolean flagPath = false;
|
||||
|
||||
Theme theme = themeFeignClient.getTheme().getData();
|
||||
if (theme.getRemark().equals("国网")) {
|
||||
@@ -177,31 +197,16 @@ public class ExportModelController extends BaseController {
|
||||
} else {
|
||||
rtfPath = "file/reportModel.docx";
|
||||
}
|
||||
ClassPathResource rtfPathResource=null;
|
||||
ClassPathResource picPathResource=null;
|
||||
|
||||
//获取图片信息
|
||||
ClassPathResource picPathResource = null;
|
||||
try {
|
||||
rtfPathResource = new ClassPathResource(rtfPath);
|
||||
picPathResource = new ClassPathResource(picPath);
|
||||
rtfPath = rtfPath.replaceAll("%20", " ");
|
||||
picPath = picPath.replaceAll("%20", " ");
|
||||
} catch (Exception e1) {
|
||||
log.info("获取报表发生异常,异常是" + e1.getMessage());
|
||||
}
|
||||
|
||||
InputStream ins = null;
|
||||
try {
|
||||
ins = rtfPathResource.getInputStream();
|
||||
if (null != ins) {
|
||||
flagPath = true;
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
flagPath = false;
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "readError", methodDescribe);
|
||||
} finally {
|
||||
if (ins != null) {
|
||||
ins.close();
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> reportmap = new HashMap<>();// 报告Map
|
||||
//数据单位
|
||||
@@ -214,11 +219,31 @@ public class ExportModelController extends BaseController {
|
||||
Map<String, Object> header = new HashMap<String, Object>();
|
||||
if (ObjectUtil.isNotEmpty(file)) {
|
||||
byte[] bytes = file.getBytes();
|
||||
|
||||
if(bytes.length>0){
|
||||
header.put("width", 400);
|
||||
header.put("height", 250);
|
||||
header.put("type", file.getContentType());
|
||||
header.put("content", bytes);
|
||||
}else{
|
||||
InputStream inStream = null;
|
||||
byte[] data = null;
|
||||
try {
|
||||
inStream = picPathResource.getInputStream();
|
||||
data = new byte[inStream.available()];
|
||||
inStream.read(data);
|
||||
} catch (Exception e) {
|
||||
log.info("读取报表信息失败:" + e.getMessage());
|
||||
} finally {
|
||||
if (inStream != null) {
|
||||
inStream.close();
|
||||
}
|
||||
}
|
||||
String contentType = "application/x-jpg";
|
||||
header.put("width", 400);
|
||||
header.put("height", 250);
|
||||
header.put("type", contentType);
|
||||
header.put("content", data);
|
||||
}
|
||||
} else {
|
||||
InputStream inStream = null;
|
||||
byte[] data = null;
|
||||
@@ -226,7 +251,7 @@ public class ExportModelController extends BaseController {
|
||||
inStream = picPathResource.getInputStream();
|
||||
data = new byte[inStream.available()];
|
||||
inStream.read(data);
|
||||
} catch (FileNotFoundException e) {
|
||||
} catch (Exception e) {
|
||||
log.info("读取报表信息失败:" + e.getMessage());
|
||||
} finally {
|
||||
if (inStream != null) {
|
||||
@@ -243,12 +268,12 @@ public class ExportModelController extends BaseController {
|
||||
reportmap.put("$image$", header);
|
||||
|
||||
getVirtualData(param);
|
||||
ReportValue voltage1 = (ReportValue) this.listVirtual.get(0).getList().get(0);// 电压幅值
|
||||
ReportValue voltage2 = (ReportValue) this.listVirtual.get(0).getList().get(1);// 电压幅值
|
||||
ReportValue voltage3 = (ReportValue) this.listVirtual.get(0).getList().get(2);// 电压幅值
|
||||
ReportValue current1 = (ReportValue) this.listVirtual.get(1).getList().get(0);// 电流幅值
|
||||
ReportValue current2 = (ReportValue) this.listVirtual.get(1).getList().get(1);// 电流幅值
|
||||
ReportValue current3 = (ReportValue) this.listVirtual.get(1).getList().get(2);// 电流幅值
|
||||
ReportValue voltage1 = this.listVirtual.get(0).getList().get(0);// 电压幅值
|
||||
ReportValue voltage2 = this.listVirtual.get(0).getList().get(1);// 电压幅值
|
||||
ReportValue voltage3 = this.listVirtual.get(0).getList().get(2);// 电压幅值
|
||||
ReportValue current1 = this.listVirtual.get(1).getList().get(0);// 电流幅值
|
||||
ReportValue current2 = this.listVirtual.get(1).getList().get(1);// 电流幅值
|
||||
ReportValue current3 = this.listVirtual.get(1).getList().get(2);// 电流幅值
|
||||
|
||||
String strLineBaseName = String.format("%s%s", new String[]{bdname + "_", name});
|
||||
String strAnalysis = "";// 分析建议
|
||||
@@ -366,7 +391,7 @@ public class ExportModelController extends BaseController {
|
||||
iCount++;
|
||||
}
|
||||
// 假如所有的数据都为null,则返回(所选的时间段内未找到数据)
|
||||
if (iCount == reportmap.size()){
|
||||
if (iCount == reportmap.size()) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "exportWorld", methodDescribe);
|
||||
}
|
||||
// 基本数据判断
|
||||
@@ -480,12 +505,12 @@ public class ExportModelController extends BaseController {
|
||||
getVoltageRate(param, overLimit);
|
||||
getCurrentRate(param, overLimit);
|
||||
|
||||
ReportValue pst1 = (ReportValue) this.listFlicker.get(0).getList().get(0);// 短闪
|
||||
ReportValue pst2 = (ReportValue) this.listFlicker.get(0).getList().get(1);// 短闪
|
||||
ReportValue pst3 = (ReportValue) this.listFlicker.get(0).getList().get(2);// 短闪
|
||||
ReportValue plt1 = (ReportValue) this.listFlicker.get(1).getList().get(0);// 长闪
|
||||
ReportValue plt2 = (ReportValue) this.listFlicker.get(1).getList().get(1);// 长闪
|
||||
ReportValue plt3 = (ReportValue) this.listFlicker.get(1).getList().get(2);// 长闪
|
||||
ReportValue pst1 = this.listFlicker.get(0).getList().get(0);// 短闪
|
||||
ReportValue pst2 = this.listFlicker.get(0).getList().get(1);// 短闪
|
||||
ReportValue pst3 = this.listFlicker.get(0).getList().get(2);// 短闪
|
||||
ReportValue plt1 = this.listFlicker.get(1).getList().get(0);// 长闪
|
||||
ReportValue plt2 = this.listFlicker.get(1).getList().get(1);// 长闪
|
||||
ReportValue plt3 = this.listFlicker.get(1).getList().get(2);// 长闪
|
||||
|
||||
reportmap.put("$LineBase$", String.format("%s%s,CT变比为:%s,PT变比为:%s。",
|
||||
new String[]{bdname, name, lineDto.getCt(), lineDto.getPt()}));// 监测点基本信息
|
||||
@@ -539,9 +564,9 @@ public class ExportModelController extends BaseController {
|
||||
/**************************************************************
|
||||
**** 电压偏差(上偏差和下偏差)
|
||||
***************************************************************/
|
||||
ReportValue vdeviation1 = (ReportValue) this.listVdeviation.get(0).getList().get(0);
|
||||
ReportValue vdeviation2 = (ReportValue) this.listVdeviation.get(0).getList().get(1);
|
||||
ReportValue vdeviation3 = (ReportValue) this.listVdeviation.get(0).getList().get(2);
|
||||
ReportValue vdeviation1 = this.listVdeviation.get(0).getList().get(0);
|
||||
ReportValue vdeviation2 = this.listVdeviation.get(0).getList().get(1);
|
||||
ReportValue vdeviation3 = this.listVdeviation.get(0).getList().get(2);
|
||||
String vdeviationLimit = judgeNull(this.listVdeviation.get(0).getOverLimit());// 获取电压上下偏差的国标限值
|
||||
reportmap.put("$VD_L$", vdeviationLimit);
|
||||
String strResultVdeviationdata = "";
|
||||
@@ -615,7 +640,7 @@ public class ExportModelController extends BaseController {
|
||||
/**************************************************************
|
||||
**** 频率偏差
|
||||
***************************************************************/
|
||||
ReportValue valueOfFreValue = (ReportValue) this.listFrequency.get(1).getList().get(0);
|
||||
ReportValue valueOfFreValue = this.listFrequency.get(1).getList().get(0);
|
||||
String valueOfFreLimit = judgeNull(this.listFrequency.get(1).getOverLimit());// 获取频率偏差国标限值
|
||||
reportmap.put("$FRE_L$", valueOfFreLimit);
|
||||
String strResultFre = "";
|
||||
@@ -672,12 +697,12 @@ public class ExportModelController extends BaseController {
|
||||
|
||||
if ("".equals(tmpstrResultFre)) {
|
||||
reportmap.put("$FV0R$", "合格");// 三张大表取值
|
||||
strResultFre += "从上表中可以看出" + strLineBaseName + "频率偏差均满足国标限值(±" + valueOfFreLimit + deviceUnit.getUnitFrequencyDev()+")的要求。";
|
||||
strResultFre += "从上表中可以看出" + strLineBaseName + "频率偏差均满足国标限值(±" + valueOfFreLimit + deviceUnit.getUnitFrequencyDev() + ")的要求。";
|
||||
} else {
|
||||
reportmap.put("$FV0R$", "不合格");// 三张大表取值
|
||||
strAnalysis += tmpstrResultFre + ",均不满足国标限值(±" + valueOfFreLimit + deviceUnit.getUnitFrequencyDev()+")的要求。";
|
||||
strAnalysis += tmpstrResultFre + ",均不满足国标限值(±" + valueOfFreLimit + deviceUnit.getUnitFrequencyDev() + ")的要求。";
|
||||
strResultFre += "从上表中可以看出" + strLineBaseName + "频率偏差" + tmpstrResultFre + ",均不满足国标限值(±" + valueOfFreLimit
|
||||
+ deviceUnit.getUnitFrequencyDev()+")的要求。";
|
||||
+ deviceUnit.getUnitFrequencyDev() + ")的要求。";
|
||||
}
|
||||
|
||||
reportmap.put("$ResultFre$", strResultFre);
|
||||
@@ -687,7 +712,7 @@ public class ExportModelController extends BaseController {
|
||||
/**************************************************************
|
||||
**** 三相电压不平衡度
|
||||
***************************************************************/
|
||||
ReportValue valueOfThree = (ReportValue) this.listThreephase.get(0).getList().get(0);
|
||||
ReportValue valueOfThree = this.listThreephase.get(0).getList().get(0);
|
||||
String valueOfThreeLimit = judgeNull(this.listThreephase.get(0).getOverLimit());// 获取三相电压不平衡度国标限值
|
||||
reportmap.put("$THE_L$", valueOfThreeLimit);
|
||||
String strResultThree = "";
|
||||
@@ -887,9 +912,9 @@ public class ExportModelController extends BaseController {
|
||||
String strCurrentRate = strMap + (i + 1) + "%";
|
||||
|
||||
// 基波电压含有率
|
||||
strCurrentA = judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(0)).getCp95Value());
|
||||
strCurrentB = judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(1)).getCp95Value());
|
||||
strCurrentC = judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(2)).getCp95Value());
|
||||
strCurrentA = judgeNull((this.listVoltageRate.get(i).getList().get(0)).getCp95Value());
|
||||
strCurrentB = judgeNull((this.listVoltageRate.get(i).getList().get(1)).getCp95Value());
|
||||
strCurrentC = judgeNull((this.listVoltageRate.get(i).getList().get(2)).getCp95Value());
|
||||
strLimit = judgeNull(this.listVoltageRate.get(i).getOverLimit());
|
||||
|
||||
reportmap.put(strCurrentRate + "_A$", strCurrentA);
|
||||
@@ -905,27 +930,27 @@ public class ExportModelController extends BaseController {
|
||||
**** 三张大表取值
|
||||
**************************************/
|
||||
reportmap.put("$CV" + (i + 1) + "X_A$",
|
||||
judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(0)).getFmaxValue()));
|
||||
judgeNull((this.listVoltageRate.get(i).getList().get(0)).getFmaxValue()));
|
||||
reportmap.put("$CV" + (i + 1) + "X_B$",
|
||||
judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(1)).getFmaxValue()));
|
||||
judgeNull((this.listVoltageRate.get(i).getList().get(1)).getFmaxValue()));
|
||||
|
||||
reportmap.put("$CV" + (i + 1) + "N_A$",
|
||||
judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(0)).getMinValue()));
|
||||
judgeNull((this.listVoltageRate.get(i).getList().get(0)).getMinValue()));
|
||||
reportmap.put("$CV" + (i + 1) + "N_B$",
|
||||
judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(1)).getMinValue()));
|
||||
judgeNull((this.listVoltageRate.get(i).getList().get(1)).getMinValue()));
|
||||
|
||||
reportmap.put("$CV" + (i + 1) + "E_A$",
|
||||
judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(0)).getMeanValue()));
|
||||
judgeNull((this.listVoltageRate.get(i).getList().get(0)).getMeanValue()));
|
||||
reportmap.put("$CV" + (i + 1) + "E_B$",
|
||||
judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(1)).getMeanValue()));
|
||||
judgeNull((this.listVoltageRate.get(i).getList().get(1)).getMeanValue()));
|
||||
|
||||
if (pttype != 2) {
|
||||
reportmap.put("$CV" + (i + 1) + "X_C$",
|
||||
judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(2)).getFmaxValue()));
|
||||
judgeNull((this.listVoltageRate.get(i).getList().get(2)).getFmaxValue()));
|
||||
reportmap.put("$CV" + (i + 1) + "N_C$",
|
||||
judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(2)).getMinValue()));
|
||||
judgeNull((this.listVoltageRate.get(i).getList().get(2)).getMinValue()));
|
||||
reportmap.put("$CV" + (i + 1) + "E_C$",
|
||||
judgeNull(((ReportValue) this.listVoltageRate.get(i).getList().get(2)).getMeanValue()));
|
||||
judgeNull((this.listVoltageRate.get(i).getList().get(2)).getMeanValue()));
|
||||
reportmap.put("$CV" + (i + 1) + "%_C$", strCurrentC);
|
||||
} else {
|
||||
reportmap.put("$CV" + (i + 1) + "X_C$", "-");
|
||||
@@ -986,9 +1011,9 @@ public class ExportModelController extends BaseController {
|
||||
/**************************************************************
|
||||
**** 电压总谐波畸变率(THD)
|
||||
***************************************************************/
|
||||
ReportValue distortion1 = (ReportValue) this.listDistortion.get(0).getList().get(0);
|
||||
ReportValue distortion2 = (ReportValue) this.listDistortion.get(0).getList().get(1);
|
||||
ReportValue distortion3 = (ReportValue) this.listDistortion.get(0).getList().get(2);
|
||||
ReportValue distortion1 = this.listDistortion.get(0).getList().get(0);
|
||||
ReportValue distortion2 = this.listDistortion.get(0).getList().get(1);
|
||||
ReportValue distortion3 = this.listDistortion.get(0).getList().get(2);
|
||||
String distortionLimit = judgeNull(this.listDistortion.get(0).getOverLimit());
|
||||
reportmap.put("$DV0%_L$", distortionLimit);
|
||||
|
||||
@@ -1077,9 +1102,9 @@ public class ExportModelController extends BaseController {
|
||||
String strCurrent = strMap + (i + 1) + "%";
|
||||
|
||||
// 基波电压含有率
|
||||
strCurrentA = judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(0)).getCp95Value());
|
||||
strCurrentB = judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(1)).getCp95Value());
|
||||
strCurrentC = judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(2)).getCp95Value());
|
||||
strCurrentA = judgeNull(this.listICurrent.get(i).getList().get(0).getCp95Value());
|
||||
strCurrentB = judgeNull(this.listICurrent.get(i).getList().get(1).getCp95Value());
|
||||
strCurrentC = judgeNull(this.listICurrent.get(i).getList().get(2).getCp95Value());
|
||||
strLimit = judgeNull(this.listICurrent.get(i).getOverLimit());
|
||||
|
||||
reportmap.put(strCurrent + "_A$", strCurrentA);
|
||||
@@ -1090,17 +1115,17 @@ public class ExportModelController extends BaseController {
|
||||
/************************************
|
||||
**** 三张大表取值
|
||||
**************************************/
|
||||
reportmap.put("$CI" + (i + 1) + "X_A$", judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(0)).getFmaxValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "X_B$", judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(1)).getFmaxValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "X_C$", judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(2)).getFmaxValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "X_A$", judgeNull(this.listICurrent.get(i).getList().get(0).getFmaxValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "X_B$", judgeNull(this.listICurrent.get(i).getList().get(1).getFmaxValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "X_C$", judgeNull(this.listICurrent.get(i).getList().get(2).getFmaxValue()));
|
||||
|
||||
reportmap.put("$CI" + (i + 1) + "N_A$", judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(0)).getMinValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "N_B$", judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(1)).getMinValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "N_C$", judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(2)).getMinValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "N_A$", judgeNull(this.listICurrent.get(i).getList().get(0).getMinValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "N_B$", judgeNull(this.listICurrent.get(i).getList().get(1).getMinValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "N_C$", judgeNull(this.listICurrent.get(i).getList().get(2).getMinValue()));
|
||||
|
||||
reportmap.put("$CI" + (i + 1) + "E_A$", judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(0)).getMeanValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "E_B$", judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(1)).getMeanValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "E_C$", judgeNull(((ReportValue) this.listICurrent.get(i).getList().get(2)).getMeanValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "E_A$", judgeNull(this.listICurrent.get(i).getList().get(0).getMeanValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "E_B$", judgeNull(this.listICurrent.get(i).getList().get(1).getMeanValue()));
|
||||
reportmap.put("$CI" + (i + 1) + "E_C$", judgeNull(this.listICurrent.get(i).getList().get(2).getMeanValue()));
|
||||
|
||||
reportmap.put("$CI" + (i + 1) + "%_A$", strCurrentA);
|
||||
reportmap.put("$CI" + (i + 1) + "%_B$", strCurrentB);
|
||||
@@ -1159,7 +1184,7 @@ public class ExportModelController extends BaseController {
|
||||
// 测试结果填写
|
||||
reportmap.put("$ResultTitle$", String.format("通过对(%s——%s)时间段内%s电能质量统计数据分析后得出以下结论:",
|
||||
new String[]{DateUtil.format(startDate, "yyyy年MM月dd日 HH时mm分ss秒"),
|
||||
DateUtil.format(endDate, "yyyy年MM月dd日 HH时mm分ss秒"),strLineBaseName}));// 结论标题
|
||||
DateUtil.format(endDate, "yyyy年MM月dd日 HH时mm分ss秒"), strLineBaseName}));// 结论标题
|
||||
reportmap.put("$Result_VD$", String.format("(1)电压偏差:%s", new String[]{strResultVdeviationdata}));// 电压偏差
|
||||
reportmap.put("$Result_FRE$", String.format("(2)频率偏差:%s", new String[]{strResultFre}));// 频率偏差
|
||||
reportmap.put("$Result_THE$", String.format("(3)三相电压不平衡度:%s", new String[]{strResultThree}));// 三相电压不平衡度
|
||||
@@ -1177,10 +1202,10 @@ public class ExportModelController extends BaseController {
|
||||
**** 三张大表取值 有功:0-11 无功:12-23 视在:24-31 基波有功汇总:32-35 基波无功汇总:36-39
|
||||
* 基波视在汇总:40-43 功率因数:44-46
|
||||
**************************************/
|
||||
ReportValue powerDto1 = (ReportValue) this.listPower.get(0).getList().get(3);
|
||||
ReportValue powerDto2 = (ReportValue) this.listPower.get(1).getList().get(3);
|
||||
ReportValue powerDto3 = (ReportValue) this.listPower.get(2).getList().get(3);
|
||||
ReportValue powerDto4 = (ReportValue) this.listPower.get(3).getList().get(3);
|
||||
ReportValue powerDto1 = this.listPower.get(0).getList().get(3);
|
||||
ReportValue powerDto2 = this.listPower.get(1).getList().get(3);
|
||||
ReportValue powerDto3 = this.listPower.get(2).getList().get(3);
|
||||
ReportValue powerDto4 = this.listPower.get(3).getList().get(3);
|
||||
reportmap.put("$BF0X$", judgeNull(powerDto1.getFmaxValue()));
|
||||
reportmap.put("$BF0N$", judgeNull(powerDto1.getMinValue()));
|
||||
reportmap.put("$BF0E$", judgeNull(powerDto1.getMeanValue()));
|
||||
@@ -1198,64 +1223,70 @@ public class ExportModelController extends BaseController {
|
||||
reportmap.put("$YF0E$", judgeNull(powerDto4.getMeanValue()));
|
||||
formatter = new SimpleDateFormat("yyyyMMddHHmmss");// 报告时分秒格式
|
||||
|
||||
WordUtil2 oRTF = new WordUtil2();
|
||||
String reportFileUrl = "";
|
||||
try {
|
||||
oRTF.getWord(rtfPath, reportmap, name + formatter.format(currentTime) + ".docx", response);
|
||||
String fileName = name + formatter.format(currentTime) + ".docx";
|
||||
if (isUrl) {
|
||||
reportFileUrl = wordUtil2.getReportFileUrl(rtfPath, name + formatter.format(currentTime) + ".docx", reportmap);
|
||||
} else {
|
||||
wordUtil2.getWord(rtfPath, reportmap, fileName, response);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取报告发生异常,异常是" + e.getMessage());
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, reportFileUrl, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据单位信息 重组
|
||||
*
|
||||
* @param deviceUnit 数据单位对象
|
||||
* @return
|
||||
*/
|
||||
private Map<String,String> unitMap(PqsDeviceUnit deviceUnit){
|
||||
private Map<String, String> unitMap(PqsDeviceUnit deviceUnit) {
|
||||
List<DictData> dictData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEVICE_UNIT.getCode()).getData();
|
||||
Map<String,String> unit=new HashMap<>();
|
||||
Map<String, String> unit = new HashMap<>();
|
||||
List<String> list = dictData.stream().map(DictData::getCode).collect(Collectors.toList());
|
||||
for (String s : list) {
|
||||
//有效值
|
||||
if(s.equals(DicDataEnum.EFFECTIVE.getCode())){
|
||||
unit.put("$"+s+"_i$",deviceUnit.getIeffective());
|
||||
unit.put("$"+s+"_v$",deviceUnit.getLineVoltage());
|
||||
if (s.equals(DicDataEnum.EFFECTIVE.getCode())) {
|
||||
unit.put("$" + s + "_i$", deviceUnit.getIeffective());
|
||||
unit.put("$" + s + "_v$", deviceUnit.getLineVoltage());
|
||||
}
|
||||
//功率
|
||||
if(s.equals(DicDataEnum.POWER.getCode())){
|
||||
unit.put("$"+s+"_p$",deviceUnit.getTotalActiveP());
|
||||
unit.put("$"+s+"_q$",deviceUnit.getTotalNoP());
|
||||
unit.put("$"+s+"_s$",deviceUnit.getTotalViewP());
|
||||
if (s.equals(DicDataEnum.POWER.getCode())) {
|
||||
unit.put("$" + s + "_p$", deviceUnit.getTotalActiveP());
|
||||
unit.put("$" + s + "_q$", deviceUnit.getTotalNoP());
|
||||
unit.put("$" + s + "_s$", deviceUnit.getTotalViewP());
|
||||
}
|
||||
//畸变率
|
||||
if(s.equals(DicDataEnum.DISTORTION.getCode())){
|
||||
unit.put("$"+s+"_v$",deviceUnit.getVdistortion());
|
||||
if (s.equals(DicDataEnum.DISTORTION.getCode())) {
|
||||
unit.put("$" + s + "_v$", deviceUnit.getVdistortion());
|
||||
}
|
||||
//电压偏差
|
||||
if(s.equals(DicDataEnum.VOLTAGE.getCode())){
|
||||
unit.put("$"+s+"_v$",deviceUnit.getVoltageDev());
|
||||
if (s.equals(DicDataEnum.VOLTAGE.getCode())) {
|
||||
unit.put("$" + s + "_v$", deviceUnit.getVoltageDev());
|
||||
}
|
||||
//频率
|
||||
if(s.equals(DicDataEnum.UNIT_FREQUENCY.getCode())){
|
||||
unit.put("$"+s+"_freq$",deviceUnit.getUnitFrequency());
|
||||
unit.put("$"+s+"_freqDev$",deviceUnit.getUnitFrequencyDev());
|
||||
if (s.equals(DicDataEnum.UNIT_FREQUENCY.getCode())) {
|
||||
unit.put("$" + s + "_freq$", deviceUnit.getUnitFrequency());
|
||||
unit.put("$" + s + "_freqDev$", deviceUnit.getUnitFrequencyDev());
|
||||
}
|
||||
//三项不平衡度
|
||||
if(s.equals(DicDataEnum.UNBALANCE.getCode())){
|
||||
unit.put("$"+s+"_v$","%");
|
||||
unit.put("$"+s+"_vPos$",deviceUnit.getPositiveV());
|
||||
unit.put("$"+s+"_vNeg$",deviceUnit.getNoPositiveV());
|
||||
unit.put("$"+s+"_vZero$",deviceUnit.getNoPositiveV());
|
||||
unit.put("$"+s+"_i$","%");
|
||||
unit.put("$"+s+"_iPos$","A");
|
||||
unit.put("$"+s+"_iNeg$","A");
|
||||
unit.put("$"+s+"_iZero$","A");
|
||||
if (s.equals(DicDataEnum.UNBALANCE.getCode())) {
|
||||
unit.put("$" + s + "_v$", "%");
|
||||
unit.put("$" + s + "_vPos$", deviceUnit.getPositiveV());
|
||||
unit.put("$" + s + "_vNeg$", deviceUnit.getNoPositiveV());
|
||||
unit.put("$" + s + "_vZero$", deviceUnit.getNoPositiveV());
|
||||
unit.put("$" + s + "_i$", "%");
|
||||
unit.put("$" + s + "_iPos$", "A");
|
||||
unit.put("$" + s + "_iNeg$", "A");
|
||||
unit.put("$" + s + "_iZero$", "A");
|
||||
}
|
||||
//基波
|
||||
if(s.equals(DicDataEnum.FUND.getCode())){
|
||||
unit.put("$"+s+"_i$",deviceUnit.getIfund());
|
||||
unit.put("$"+s+"_v$",deviceUnit.getVfundEffective());
|
||||
if (s.equals(DicDataEnum.FUND.getCode())) {
|
||||
unit.put("$" + s + "_i$", deviceUnit.getIfund());
|
||||
unit.put("$" + s + "_v$", deviceUnit.getVfundEffective());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1485,7 +1516,7 @@ public class ExportModelController extends BaseController {
|
||||
List<Float> iHarmList = getIHarmList(overLimit);
|
||||
for (int i = 0; i < 50; i++) {
|
||||
Pass pass;
|
||||
if (i <iHarmList.size() + 1 && i > 0) {
|
||||
if (i < iHarmList.size() + 1 && i > 0) {
|
||||
pass = new Pass(iHarmList.get(i - 1),
|
||||
EnumPass.CP95.getCode());
|
||||
} else {
|
||||
@@ -1497,6 +1528,7 @@ public class ExportModelController extends BaseController {
|
||||
this.listICurrent = new ArrayList<>();
|
||||
transformData(this.listICurrent, listICurrent, list, true);
|
||||
}
|
||||
|
||||
// 谐波电压
|
||||
public void getVoltageRate(ReportQueryParam param, Overlimit overLimit) {
|
||||
List<ReportValue> listVoltageRate = reportService.getVoltageRate(param);
|
||||
@@ -1523,12 +1555,14 @@ public class ExportModelController extends BaseController {
|
||||
this.listVoltageRate = new ArrayList<>();
|
||||
transformData(this.listVoltageRate, listVoltageRate, list, true);
|
||||
}
|
||||
|
||||
public String judgeNull(Float result) {
|
||||
return (result == null) ? "/" : result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 谐波电流限值
|
||||
*
|
||||
* @param overLimit
|
||||
* @return
|
||||
*/
|
||||
@@ -1563,6 +1597,7 @@ public class ExportModelController extends BaseController {
|
||||
|
||||
/**
|
||||
* 谐波电压限值
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Float> getVHarmList(Overlimit overLimit) {
|
||||
|
||||
@@ -22,6 +22,7 @@ public enum SupervisionResponseEnum {
|
||||
DATA_NOT_EXISTS("A00550","数据不存在"),
|
||||
NO_POWER("A00550","不能操作非自己创建的任务!"),
|
||||
NO_USER_REPORT_UPDATE("A00550","常态化干扰源用户管理信息更新失败,不存在该条信息"),
|
||||
NO_DEPT_POWER("A00550","不能操作非自己部门创建的任务"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
@@ -48,6 +48,12 @@ public class UserReportParam {
|
||||
@ApiModelProperty(value = "填报部门")
|
||||
private String orgId;
|
||||
|
||||
/**
|
||||
* 填报部门
|
||||
*/
|
||||
@ApiModelProperty(value = "填报部门名称")
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* 工程预期投产日期
|
||||
*/
|
||||
|
||||
@@ -74,5 +74,8 @@ public class SupervisionTempLineRunTestPO extends BaseEntity {
|
||||
*/
|
||||
private String testRunTime;
|
||||
|
||||
|
||||
/**
|
||||
* 试运行成功报告地址
|
||||
*/
|
||||
private String testRunReport;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.supervision.pojo.vo.device;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -15,21 +16,31 @@ import lombok.Data;
|
||||
public class SupervisionTempLineDebugVO extends BaseEntity {
|
||||
|
||||
private String id;
|
||||
@ApiModelProperty(value="监测点编号")
|
||||
|
||||
|
||||
@ApiModelProperty(value = "监测点编号")
|
||||
private String lineId;
|
||||
@ApiModelProperty(value="监测点名称")
|
||||
|
||||
@ApiModelProperty(value = "监测点名称")
|
||||
private String lineName;
|
||||
@ApiModelProperty(value="关联干扰源用户id名称")
|
||||
|
||||
@ApiModelProperty(value = "关联干扰源用户id名称")
|
||||
private String userName;
|
||||
@ApiModelProperty(value="接入母线")
|
||||
|
||||
@ApiModelProperty(value = "接入母线")
|
||||
private String connectedBus;
|
||||
@ApiModelProperty(value="监测终端编码")
|
||||
|
||||
@ApiModelProperty(value = "监测终端编码")
|
||||
private String monitoringTerminalCode;
|
||||
@ApiModelProperty(value="监测终端名称")
|
||||
|
||||
@ApiModelProperty(value = "监测终端名称")
|
||||
private String monitoringTerminalName;
|
||||
@ApiModelProperty(value="电网侧变电站")
|
||||
|
||||
@ApiModelProperty(value = "电网侧变电站")
|
||||
private String powerSubstationName;
|
||||
|
||||
private String reason;
|
||||
|
||||
private String processInstanceId;
|
||||
|
||||
|
||||
@@ -47,6 +58,18 @@ public class SupervisionTempLineDebugVO extends BaseEntity {
|
||||
*/
|
||||
private String testRunTime;
|
||||
|
||||
/**
|
||||
* 试运行成功报告地址
|
||||
*/
|
||||
@ApiModelProperty(value = "试运行成功报告地址")
|
||||
private String testRunReport;
|
||||
|
||||
private String createBy;
|
||||
public void setTestRunReport(String testRunReport) {
|
||||
if(StrUtil.isNotBlank(testRunReport)){
|
||||
this.testRunReport = "/"+testRunReport;
|
||||
}else {
|
||||
this.testRunReport = testRunReport;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,12 +58,6 @@
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-oss</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>supervision-boot</finalName>
|
||||
|
||||
@@ -21,6 +21,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 监测点试运行前端控制器
|
||||
@@ -67,8 +69,8 @@ public class SupervisionTempLineRunTestController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/isTestRunStartOrEnd")
|
||||
@ApiOperation("每日判断试运行是否结束")
|
||||
public void isTestRunStartOrEnd(){
|
||||
iSupervisionTempLineRunTestService.isTestRunStartOrEnd();
|
||||
public void isTestRunStartOrEnd(HttpServletResponse response){
|
||||
iSupervisionTempLineRunTestService.isTestRunStartOrEnd(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,9 +71,7 @@ public class UserReportManageController extends BaseController {
|
||||
public HttpResult<Boolean> auditUserReport(@RequestBody @Validated UserReportParam.UserReportUpdate userReportUpdate) {
|
||||
String methodDescribe = getMethodDescribe("auditUserReport");
|
||||
boolean res = userReportPOService.auditUserReport(userReportUpdate);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
|
||||
@@ -46,7 +46,7 @@ public class UserReportRenewalController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, userReportUpdateById, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/addEditor")
|
||||
@ApiOperation("干扰源用户管理更新信息新增功能")
|
||||
public HttpResult<String> addEditor(@RequestBody @Validated UserReportParam userReportParam) {
|
||||
@@ -55,7 +55,7 @@ public class UserReportRenewalController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, s, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/cancel")
|
||||
@ApiOperation("取消")
|
||||
@ApiImplicitParam(name = "cancelReqVO", value = "取消原因", required = true)
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.njcn.supervision.pojo.vo.device.SupervisionTempLineDebugVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/5/17 15:26【需求编号】
|
||||
*
|
||||
@@ -17,8 +16,8 @@ import org.apache.ibatis.annotations.Param;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface SupervisionTempLineDebugPOMapper extends BaseMapper<SupervisionTempLineDebugPO> {
|
||||
Page<SupervisionTempLineDebugVO> page(@Param("page")Page<Object> objectPage, @Param("ew") QueryWrapper<SupervisionDevMainReportVO> queryWrapper);
|
||||
|
||||
Page<SupervisionTempLineDebugVO> page(@Param("page") Page<Object> objectPage, @Param("ew") QueryWrapper<SupervisionDevMainReportVO> queryWrapper);
|
||||
|
||||
Page<SupervisionTempLineDebugVO> pageHasDebug(@Param("page")Page<Object> objectPage, @Param("ew") QueryWrapper<SupervisionDevMainReportVO> queryWrapper);
|
||||
Page<SupervisionTempLineDebugVO> pageHasDebug(@Param("page") Page<Object> objectPage, @Param("ew") QueryWrapper<SupervisionDevMainReportVO> queryWrapper);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
supervision_temp_line_report.Power_Substation_Name,
|
||||
supervision_temp_line_report.line_id lineId,
|
||||
supervision_temp_line_report.line_name lineName,
|
||||
supervision_temp_line_run_test.test_run_report,
|
||||
supervision_temp_line_debug.reason reason,
|
||||
supervision_temp_line_run_test.process_instance_id process_instanceId,
|
||||
supervision_temp_line_run_test.history_instance_id,
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.njcn.supervision.pojo.param.device.SupervisionTempLineRunTestParam;
|
||||
import com.njcn.supervision.pojo.po.device.SupervisionTempLineRunTestPO;
|
||||
import com.njcn.supervision.pojo.vo.device.SupervisionTempLineRunTestVO;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
@@ -21,7 +23,7 @@ public interface ISupervisionTempLineRunTestService extends IBpmService<Supervis
|
||||
|
||||
String updateRunTest(SupervisionTempLineRunTestParam.SupervisionTempLineRunTestUpdateParam supervisionTempLineRunTestParam);
|
||||
|
||||
void isTestRunStartOrEnd();
|
||||
void isTestRunStartOrEnd(HttpServletResponse response);
|
||||
|
||||
SupervisionTempLineRunTestVO getRunTestById(String id);
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ public class LineWarningServiceImpl extends MppServiceImpl<LineWarningMapper, Li
|
||||
private final LineFeignClient lineFeignClient;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final WordUtil2 wordUtil2;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -230,7 +231,7 @@ public class LineWarningServiceImpl extends MppServiceImpl<LineWarningMapper, Li
|
||||
//获取部门名称
|
||||
String deptName = deptFeignClient.getDeptById(param.getDeptId()).getData().getName();
|
||||
param.setDeptName(deptName);
|
||||
WordUtil2 wordUtil2 = new WordUtil2();
|
||||
|
||||
String inputUrl = "file/warningReport.docx";
|
||||
String alarmType = param.getType() == 1 ? "预警" : "告警";
|
||||
String fileName = "电能[告]"+param.getYear()+"年"+param.getNumber()+"号-"+param.getDeptName()+"地市 电能质量技术监督"+alarmType+"单.docx";
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -22,6 +23,7 @@ import com.njcn.device.biz.pojo.dto.LineDTO;
|
||||
import com.njcn.device.pq.api.LineIntegrityClient;
|
||||
import com.njcn.device.pq.pojo.dto.LineDataQualityDTO;
|
||||
import com.njcn.device.pq.pojo.param.LineDataQualityParam;
|
||||
import com.njcn.harmonic.api.ReportFeignClient;
|
||||
import com.njcn.supervision.enums.SupervisionKeyEnum;
|
||||
import com.njcn.supervision.enums.SupervisionUserStatusEnum;
|
||||
import com.njcn.supervision.mapper.device.SupervisionTempLineReportMapper;
|
||||
@@ -38,10 +40,8 @@ import com.njcn.supervision.service.device.ISupervisionTempLineRunTestService;
|
||||
import com.njcn.supervision.service.user.*;
|
||||
import com.njcn.supervision.utils.InstanceUtil;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -49,6 +49,12 @@ import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
||||
/**
|
||||
@@ -77,6 +83,9 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
|
||||
private final UserReportSubstationPOService userReportSubstationPOService;
|
||||
private final UserReportSensitivePOService userReportSensitivePOService;
|
||||
private final IUserReportNormalService iUserReportNormalService;
|
||||
private final ReportFeignClient reportFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addRunTest(SupervisionTempLineRunTestParam supervisionTempLineRunTestParam) {
|
||||
@@ -86,8 +95,8 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
|
||||
List<String> lineIds = supervisionTempLineReportList.stream().map(SupervisionTempLineReport::getId).collect(Collectors.toList());
|
||||
|
||||
List<LineDTO> lineDTOList = commLineClient.getLineDetailBatch(lineIds).getData();
|
||||
if(lineIds.size()!=lineDTOList.size()){
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"请联系管理员检查监测点唯一编号是否匹配");
|
||||
if (lineIds.size() != lineDTOList.size()) {
|
||||
throw new BusinessException(CommonResponseEnum.FAIL, "请联系管理员检查监测点唯一编号是否匹配");
|
||||
}
|
||||
|
||||
//校验
|
||||
@@ -101,37 +110,36 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
|
||||
tempUserIds.addAll(list3.stream().map(UserReportSensitivePO::getId).collect(Collectors.toList()));
|
||||
|
||||
|
||||
|
||||
if(CollectionUtil.isNotEmpty(tempUserIds)){
|
||||
if (CollectionUtil.isNotEmpty(tempUserIds)) {
|
||||
for (int i = tempUserIds.size() - 1; i >= 0; i--) {
|
||||
List<UserReportNormalPO> list1 = iUserReportNormalService.lambdaQuery().eq(UserReportNormalPO::getUserReportId, tempUserIds.get(i)).list();
|
||||
if (CollectionUtil.isNotEmpty(list1)){
|
||||
if (CollectionUtil.isNotEmpty(list1)) {
|
||||
//为空则没有治理工程不需要移除,存在审核未通过的也不要移除,只有全是2的移除
|
||||
list1 = list1.stream().filter(temp->!Objects.equals(temp.getStatus(),2)).collect(Collectors.toList());
|
||||
if(CollectionUtil.isEmpty(list1)){
|
||||
list1 = list1.stream().filter(temp -> !Objects.equals(temp.getStatus(), 2)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(list1)) {
|
||||
tempUserIds.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(tempUserIds)){
|
||||
if (CollectionUtil.isNotEmpty(tempUserIds)) {
|
||||
String userNames = supervisionTempLineReportList.stream()
|
||||
.filter(temp->tempUserIds.contains(temp.getUserId()))
|
||||
.filter(temp -> tempUserIds.contains(temp.getUserId()))
|
||||
.map(SupervisionTempLineReport::getUserName)
|
||||
.collect(Collectors.joining(", "));
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"存在关联干扰源用户:"+userNames+"需要治理通过才可以进行试运行");
|
||||
throw new BusinessException(CommonResponseEnum.FAIL, "存在关联干扰源用户:" + userNames + "需要治理通过才可以进行试运行");
|
||||
}
|
||||
|
||||
|
||||
List<SupervisionTempLineRunTestPO> supervisionTempLineRunTestPOList = this.list(new LambdaQueryWrapper<SupervisionTempLineRunTestPO>().in(SupervisionTempLineRunTestPO::getId,ids).ne(SupervisionTempLineRunTestPO::getStatus,BpmTaskStatusEnum.REJECT.getStatus()));
|
||||
if(CollUtil.isNotEmpty(supervisionTempLineRunTestPOList)){
|
||||
String msg = assMsg(supervisionTempLineReportList,supervisionTempLineRunTestPOList);
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,msg);
|
||||
List<SupervisionTempLineRunTestPO> supervisionTempLineRunTestPOList = this.list(new LambdaQueryWrapper<SupervisionTempLineRunTestPO>().in(SupervisionTempLineRunTestPO::getId, ids).ne(SupervisionTempLineRunTestPO::getStatus, BpmTaskStatusEnum.REJECT.getStatus()));
|
||||
if (CollUtil.isNotEmpty(supervisionTempLineRunTestPOList)) {
|
||||
String msg = assMsg(supervisionTempLineReportList, supervisionTempLineRunTestPOList);
|
||||
throw new BusinessException(CommonResponseEnum.FAIL, msg);
|
||||
}
|
||||
|
||||
List<SupervisionTempLineRunTestPO> poList = new ArrayList<>();
|
||||
for(SupervisionTempLineReport item:supervisionTempLineReportList){
|
||||
for (SupervisionTempLineReport item : supervisionTempLineReportList) {
|
||||
SupervisionTempLineRunTestPO supervisionTempLineRunTestPO = new SupervisionTempLineRunTestPO();
|
||||
supervisionTempLineRunTestPO.setId(item.getId());
|
||||
supervisionTempLineRunTestPO.setLineId(item.getLineId());
|
||||
@@ -141,9 +149,9 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
|
||||
supervisionTempLineRunTestPO.setSuitRate(0.00);
|
||||
supervisionTempLineRunTestPO.setOnlineRate(0.00);
|
||||
supervisionTempLineRunTestPO.setIntegrityRate(0.00);
|
||||
supervisionTempLineRunTestPO.setTestRunTime(supervisionTempLineRunTestParam.getStartTime()+"--"+supervisionTempLineRunTestParam.getEndTime());
|
||||
supervisionTempLineRunTestPO.setTestRunTime(supervisionTempLineRunTestParam.getStartTime() + "--" + supervisionTempLineRunTestParam.getEndTime());
|
||||
supervisionTempLineRunTestPO.setProcessInstanceId("tem暂无");
|
||||
if(Objects.nonNull(supervisionTempLineRunTestParam.getOperateType()) && supervisionTempLineRunTestParam.getOperateType()==1){
|
||||
if (Objects.nonNull(supervisionTempLineRunTestParam.getOperateType()) && supervisionTempLineRunTestParam.getOperateType() == 1) {
|
||||
|
||||
SupervisionTempLineRunTestPO testPo = this.getById(item.getId());
|
||||
String historyInstanceIds = InstanceUtil.dealHistoryId(testPo.getProcessInstanceId(), testPo.getHistoryInstanceId());
|
||||
@@ -162,7 +170,7 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
|
||||
|
||||
supervisionTempLineRunTestParam.setProcessInstanceId(supervisionTempLineRunTestPO.getProcessInstanceId());
|
||||
supervisionTempLineRunTestParam.setHistoryInstanceId(supervisionTempLineRunTestPO.getHistoryInstanceId());
|
||||
BeanUtil.copyProperties(supervisionTempLineRunTestParam,supervisionTempLineRunTestPO);
|
||||
BeanUtil.copyProperties(supervisionTempLineRunTestParam, supervisionTempLineRunTestPO);
|
||||
supervisionTempLineRunTestPO.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
supervisionTempLineRunTestPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
|
||||
@@ -185,66 +193,73 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isTestRunStartOrEnd() {
|
||||
public void isTestRunStartOrEnd(HttpServletResponse response) {
|
||||
LocalDateTime time = LocalDateTime.now();
|
||||
LambdaQueryWrapper<SupervisionTempLineRunTestPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SupervisionTempLineRunTestPO::getTestRunState,1).eq(SupervisionTempLineRunTestPO::getState,DataStateEnum.ENABLE.getCode());
|
||||
lambdaQueryWrapper.eq(SupervisionTempLineRunTestPO::getTestRunState, 1).eq(SupervisionTempLineRunTestPO::getState, DataStateEnum.ENABLE.getCode());
|
||||
List<SupervisionTempLineRunTestPO> supervisionTempLineRunTestPOList = this.list(lambdaQueryWrapper);
|
||||
|
||||
List<SupervisionTempLineRunTestPO> usePoList = new ArrayList<>();
|
||||
for(SupervisionTempLineRunTestPO item : supervisionTempLineRunTestPOList){
|
||||
for (SupervisionTempLineRunTestPO item : supervisionTempLineRunTestPOList) {
|
||||
String endTime = item.getTestRunTime().split("--")[1];
|
||||
LocalDateTime end = LocalDate.parse(endTime, DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)).atTime(23,59,59);
|
||||
if(end.isBefore(time)){
|
||||
LocalDateTime end = LocalDate.parse(endTime, DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)).atTime(23, 59, 59);
|
||||
if (end.isBefore(time)) {
|
||||
//结束时间在当前时间之前,则已经执行完试运行,开始组装审核条件
|
||||
usePoList.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if(CollUtil.isNotEmpty(usePoList)){
|
||||
Map<String,List<SupervisionTempLineRunTestPO>> map = usePoList.stream().collect(Collectors.groupingBy(SupervisionTempLineRunTestPO::getTestRunTime));
|
||||
map.forEach((key,val)->{
|
||||
if (CollUtil.isNotEmpty(usePoList)) {
|
||||
Map<String, List<SupervisionTempLineRunTestPO>> map = usePoList.stream().collect(Collectors.groupingBy(SupervisionTempLineRunTestPO::getTestRunTime));
|
||||
map.forEach((key, val) -> {
|
||||
String startTime = key.split("--")[0];
|
||||
String endTime = key.split("--")[1];
|
||||
List<String> ids = val.stream().map(SupervisionTempLineRunTestPO::getId).collect(Collectors.toList());
|
||||
LineDataQualityParam lineDataQualityParam = LineDataQualityParam.builder().lineIds(ids).beginTime(startTime).endTime(endTime).build();
|
||||
List<LineDataQualityDTO> lineDataQualityDTOList = lineIntegrityClient.getLineDataQuality(lineDataQualityParam).getData();
|
||||
Map<String,LineDataQualityDTO> qualityDTOMap = lineDataQualityDTOList.stream().collect(Collectors.toMap(LineDataQualityDTO::getLineId,Function.identity()));
|
||||
|
||||
for(SupervisionTempLineRunTestPO supervisionTempLineRunTestPO : val){
|
||||
|
||||
|
||||
|
||||
Map<String, LineDataQualityDTO> qualityDTOMap = lineDataQualityDTOList.stream().collect(Collectors.toMap(LineDataQualityDTO::getLineId, Function.identity()));
|
||||
for (SupervisionTempLineRunTestPO supervisionTempLineRunTestPO : val) {
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO();
|
||||
bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(SupervisionKeyEnum.LINE_RUN_TEST.getKey());
|
||||
bpmProcessInstanceCreateReqDTO.setBusinessKey(supervisionTempLineRunTestPO.getId());
|
||||
bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(new HashMap<String, List<String>>());
|
||||
bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(new HashMap<>());
|
||||
bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables);
|
||||
String processInstanceId = bpmProcessFeignClient.createProcessInstance(supervisionTempLineRunTestPO.getCreateBy(),bpmProcessInstanceCreateReqDTO).getData();
|
||||
String processInstanceId = bpmProcessFeignClient.createProcessInstance(supervisionTempLineRunTestPO.getCreateBy(), bpmProcessInstanceCreateReqDTO).getData();
|
||||
// 将工作流的编号,更新到流程单中
|
||||
SupervisionTempLineRunTestPO po = new SupervisionTempLineRunTestPO();
|
||||
po.setId(supervisionTempLineRunTestPO.getId());
|
||||
po.setProcessInstanceId(processInstanceId);
|
||||
po.setStatus(1);
|
||||
po.setTestRunState(2);
|
||||
|
||||
if(CollUtil.isEmpty(lineDataQualityDTOList)){
|
||||
if (qualityDTOMap.containsKey(supervisionTempLineRunTestPO.getId())) {
|
||||
LineDataQualityDTO dto = qualityDTOMap.get(supervisionTempLineRunTestPO.getId());
|
||||
po.setOnlineRate(dto.getOnlineRate());
|
||||
po.setIntegrityRate(dto.getIntegrityRate());
|
||||
po.setSuitRate(dto.getSuitRate());
|
||||
try {
|
||||
startTime = DateUtil.beginOfDay(DateUtil.parse(startTime)).toString();
|
||||
endTime = DateUtil.endOfDay(DateUtil.parse(endTime)).toString();
|
||||
String fileUrl = reportFeignClient.exportWorld(
|
||||
startTime,
|
||||
endTime,
|
||||
0,
|
||||
dto.getLineId(),
|
||||
dto.getLineName(),
|
||||
"",
|
||||
"",
|
||||
true, new MockMultipartFile("file", new byte[0])).getData();
|
||||
po.setTestRunReport(fileUrl);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
} else {
|
||||
po.setOnlineRate(0.00);
|
||||
po.setIntegrityRate(0.00);
|
||||
po.setSuitRate(0.00);
|
||||
}else {
|
||||
po.setOnlineRate(qualityDTOMap.containsKey(supervisionTempLineRunTestPO.getLineId())?qualityDTOMap.get(supervisionTempLineRunTestPO.getLineId()).getOnlineRate():0.00);
|
||||
po.setIntegrityRate(qualityDTOMap.containsKey(supervisionTempLineRunTestPO.getLineId())?qualityDTOMap.get(supervisionTempLineRunTestPO.getLineId()).getIntegrityRate():0.00);
|
||||
po.setSuitRate(qualityDTOMap.containsKey(supervisionTempLineRunTestPO.getLineId())?qualityDTOMap.get(supervisionTempLineRunTestPO.getLineId()).getIntegrityRate():0.00);
|
||||
}
|
||||
|
||||
this.baseMapper.updateById(po);
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -287,7 +302,7 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
|
||||
//准备取消该流程,需要远程调用接口
|
||||
SupervisionTempLineRunTestPO supervisionTempLineRunTestPO = this.baseMapper.selectById(cancelReqVO.getId());
|
||||
//判断是否有权限操作
|
||||
InstanceUtil.judgeUserPower(RequestUtil.getUserIndex(),supervisionTempLineRunTestPO.getCreateBy());
|
||||
InstanceUtil.judgeUserPower(RequestUtil.getUserIndex(), supervisionTempLineRunTestPO.getCreateBy());
|
||||
//取消流程
|
||||
bpmProcessFeignClient.cancelProcessInstanceByStartUser(cancelReqVO);
|
||||
//更新状态
|
||||
@@ -296,12 +311,12 @@ public class SupervisionTempLineRunTestServiceImpl extends ServiceImpl<Supervisi
|
||||
return supervisionTempLineRunTestPO.getId();
|
||||
}
|
||||
|
||||
private String assMsg(List<SupervisionTempLineReport> supervisionTempLineReportList,List<SupervisionTempLineRunTestPO> supervisionTempLineRunTestPOList){
|
||||
private String assMsg(List<SupervisionTempLineReport> supervisionTempLineReportList, List<SupervisionTempLineRunTestPO> supervisionTempLineRunTestPOList) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Map<String,SupervisionTempLineReport> map = supervisionTempLineReportList.stream().collect(Collectors.toMap(SupervisionTempLineReport::getId, Function.identity()));
|
||||
Map<String, SupervisionTempLineReport> map = supervisionTempLineReportList.stream().collect(Collectors.toMap(SupervisionTempLineReport::getId, Function.identity()));
|
||||
List<String> ids = supervisionTempLineRunTestPOList.stream().map(SupervisionTempLineRunTestPO::getId).collect(Collectors.toList());
|
||||
for(String id:ids){
|
||||
if(map.containsKey(id)){
|
||||
for (String id : ids) {
|
||||
if (map.containsKey(id)) {
|
||||
builder.append(map.get(id).getPowerSubstationName()).append("_").append(map.get(id).getLineName()).append(";");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.njcn.supervision.pojo.vo.survey.SurveyTestVO;
|
||||
public interface ISurveyTestService extends IBpmService<SurveyTest> {
|
||||
|
||||
Page<SurveyTestVO> surveyTestPage(SurveyTestParam.SurveyTestQueryParam surveyTestQueryParam);
|
||||
|
||||
Page<SurveyTestVO> pageProblemSurvey(SurveyTestParam.SurveyTestQueryParam surveyTestQueryParam);
|
||||
|
||||
String addSurveyTest(SurveyTestParam surveyTestParam);
|
||||
|
||||
@@ -238,7 +238,7 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
|
||||
public String updateSurveyTest(SurveyTestParam.SurveyTestUpdateParam surveyTestUpdateParam) {
|
||||
SurveyTest surveyTest = this.baseMapper.selectById(surveyTestUpdateParam.getId());
|
||||
//判断是否有权限操作
|
||||
InstanceUtil.judgeUserPower(RequestUtil.getUserIndex(), surveyTest.getCreateBy());
|
||||
InstanceUtil.judgeUserDeptPower(RequestUtil.getDeptIndex(), surveyTest.getDeptId());
|
||||
surveyTestUpdateParam.setStatus(surveyTest.getStatus());
|
||||
surveyTestUpdateParam.setProcessInstanceId(surveyTest.getProcessInstanceId());
|
||||
surveyTestUpdateParam.setHistoryInstanceId(surveyTest.getHistoryInstanceId());
|
||||
@@ -268,7 +268,7 @@ public class SurveyTestServiceImpl extends ServiceImpl<SurveyTestMapper, SurveyT
|
||||
//准备取消该流程,需要远程调用接口
|
||||
SurveyTest surveyTest = this.baseMapper.selectById(cancelReqVO.getId());
|
||||
//判断是否有权限操作
|
||||
InstanceUtil.judgeUserPower(RequestUtil.getUserIndex(), surveyTest.getCreateBy());
|
||||
InstanceUtil.judgeUserDeptPower(RequestUtil.getDeptIndex(), surveyTest.getDeptId());
|
||||
//取消流程
|
||||
bpmProcessFeignClient.cancelProcessInstanceByStartUser(cancelReqVO);
|
||||
//更新状态
|
||||
|
||||
@@ -37,5 +37,10 @@ public interface IUserReportRenewalService extends IBpmService<UserReportRenewal
|
||||
*/
|
||||
String resend(UserReportParam userReportParam);
|
||||
|
||||
/**
|
||||
* 取消功能
|
||||
* @param cancelReqVO
|
||||
* @return
|
||||
*/
|
||||
String cancelUserReportRenewal(BpmProcessInstanceCancelParam cancelReqVO);
|
||||
}
|
||||
|
||||
@@ -114,8 +114,10 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
if (Objects.equals(userReportParam.getSaveOrCheckflag(), "1")) {
|
||||
userReportPO.setStatus(BpmTaskStatusEnum.WAIT.getStatus());
|
||||
} else {
|
||||
if(!Objects.equals(userReportParam.getSaveOrCheckflag(), "0")){
|
||||
userReportPO.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
}
|
||||
}
|
||||
if(ObjectUtil.isNotNull(userReportParam.getDataType())){
|
||||
userReportPO.setDataType(userReportParam.getDataType());
|
||||
if(userReportParam.getDataType()==1){
|
||||
@@ -240,11 +242,12 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
|
||||
@Override
|
||||
public boolean auditUserReport(UserReportParam.UserReportUpdate userReportUpdate) {
|
||||
//判断工程名称是否有重复的
|
||||
checkProjectName(userReportUpdate, true);
|
||||
|
||||
String id = userReportUpdate.getId();
|
||||
UserReportPO byId = this.getById(id);
|
||||
//判断是否有权限操作
|
||||
InstanceUtil.judgeUserPower(RequestUtil.getUserIndex(), byId.getCreateBy());
|
||||
//判断工程名称是否有重复的
|
||||
checkProjectName(userReportUpdate, true);
|
||||
BeanUtils.copyProperties(userReportUpdate, byId);
|
||||
this.updateById(byId);
|
||||
if (CollectionUtil.newArrayList(
|
||||
@@ -1027,7 +1030,8 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
.collect(Collectors.toList());
|
||||
//如果还存在,则说明有人申请过了
|
||||
if (CollectionUtil.isNotEmpty(userReportPOList)) {
|
||||
throw new BusinessException(userReportParam.getProjectName().concat(",该工程已被").concat(userReportPOList.get(0).getReporter()).concat("申请"));
|
||||
UserVO userVO = userFeignClient.getUserById(userReportPOList.get(0).getReporter()).getData();
|
||||
throw new BusinessException(userReportParam.getProjectName().concat(",该工程已被:").concat(userVO.getName()).concat("申请"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,11 +18,12 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.supervision.enums.*;
|
||||
import com.njcn.supervision.mapper.user.UserReportRenewalMapper;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.device.SupervisionDevMainReportPO;
|
||||
import com.njcn.supervision.pojo.po.user.*;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
import com.njcn.supervision.service.user.*;
|
||||
import com.njcn.supervision.utils.InstanceUtil;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -48,6 +49,8 @@ public class UserReportRenewalServiceImpl extends ServiceImpl<UserReportRenewalM
|
||||
|
||||
private final UserReportPOServiceImpl userReportPOService;
|
||||
private final BpmProcessFeignClient bpmProcessFeignClient;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -57,7 +60,8 @@ public class UserReportRenewalServiceImpl extends ServiceImpl<UserReportRenewalM
|
||||
if (BpmTaskStatusEnum.APPROVE.getStatus() == status) {
|
||||
UserReportParam userReportParam = new UserReportParam();
|
||||
userReportParam.setId(businessId);
|
||||
BeanUtil.copyProperties(userReportPO, userReportParam);
|
||||
userReportPO.getUserReportMessageJson().setSaveOrCheckflag("0");
|
||||
BeanUtil.copyProperties(userReportPO.getUserReportMessageJson(), userReportParam);
|
||||
userReportPOService.addUserReport(userReportParam);
|
||||
}
|
||||
this.lambdaUpdate().set(UserReportRenewalPO::getStatus, status).eq(UserReportRenewalPO::getId, businessId).update();
|
||||
@@ -70,15 +74,22 @@ public class UserReportRenewalServiceImpl extends ServiceImpl<UserReportRenewalM
|
||||
public BpmInstanceInfo getInstanceInfo(String businessId) {
|
||||
BpmInstanceInfo bpmInstanceInfo = new BpmInstanceInfo();
|
||||
UserReportRenewalPO userReportPO = this.getById(businessId);
|
||||
if(ObjectUtil.isNotNull(userReportPO)){
|
||||
bpmInstanceInfo.setHistoryInstanceId(userReportPO.getHistoryInstanceId());
|
||||
bpmInstanceInfo.setInstanceSign(userReportPO.getUserReportMessageJson().getProjectName());
|
||||
return bpmInstanceInfo;
|
||||
}
|
||||
return new BpmInstanceInfo();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public UserReportRenewalPO getUserReportUpdateById(String id) {
|
||||
return this.getById(id);
|
||||
UserReportRenewalPO byId = this.getById(id);
|
||||
UserVO userVO = userFeignClient.getUserById(byId.getUserReportMessageJson().getReporter()).getData();
|
||||
byId.getUserReportMessageJson().setReporter(userVO.getName());
|
||||
byId.getUserReportMessageJson().setOrgName(deptFeignClient.getDeptById(byId.getUserReportMessageJson().getOrgId()).getData().getName());
|
||||
return byId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,14 +26,27 @@ public class InstanceUtil {
|
||||
|
||||
/**
|
||||
* 判断用户是否有权限操作
|
||||
*
|
||||
* @param userId 当前用户id
|
||||
* @param createBy 数据创建用户id
|
||||
*/
|
||||
public static void judgeUserPower(String userId,String createBy){
|
||||
if(!userId.equalsIgnoreCase(createBy)){
|
||||
public static void judgeUserPower(String userId, String createBy) {
|
||||
if (!userId.equalsIgnoreCase(createBy)) {
|
||||
throw new BusinessException(SupervisionResponseEnum.NO_POWER);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户是否有权限操作
|
||||
*
|
||||
* @param deptId 当前用户部门id
|
||||
* @param responsibleDeptId 数据创建负责单位id
|
||||
*/
|
||||
public static void judgeUserDeptPower(String deptId, String responsibleDeptId) {
|
||||
if (!deptId.equalsIgnoreCase(responsibleDeptId)) {
|
||||
throw new BusinessException(SupervisionResponseEnum.NO_DEPT_POWER);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user