This commit is contained in:
2025-11-11 13:18:42 +08:00
parent 6b7e38fef6
commit 92b95dd86d
4 changed files with 41 additions and 5 deletions

View File

@@ -118,4 +118,11 @@ public interface IPqMonitorService extends IService<PqMonitor> {
* @return
*/
boolean removeByDevId(String devId);
/**
* 根据被检设备id和监测点编号获取监测点信息
* @param id 被检设备id
* @param monitorNum 监测点编号
*/
PqMonitor getByDevAndNum(String id, int monitorNum);
}

View File

@@ -432,4 +432,16 @@ public class PqMonitorServiceImpl extends ServiceImpl<PqMonitorMapper, PqMonitor
wrapper.eq("pq_monitor.Dev_Id", devId);
return this.remove(wrapper);
}
@Override
public PqMonitor getByDevAndNum(String devId, int monitorNum) {
QueryWrapper<PqMonitor> wrapper = new QueryWrapper<>();
wrapper.eq("pq_monitor.Dev_Id", devId)
.eq("pq_monitor.Num", monitorNum);
List<PqMonitor> pqMonitors = this.list(wrapper);
if(CollUtil.isNotEmpty(pqMonitors)){
return pqMonitors.get(0);
}
return null;
}
}

View File

@@ -39,6 +39,8 @@ import com.njcn.gather.device.service.IPqDevService;
import com.njcn.gather.device.service.IPqDevSubService;
import com.njcn.gather.err.pojo.po.PqErrSys;
import com.njcn.gather.err.service.IPqErrSysService;
import com.njcn.gather.monitor.pojo.po.PqMonitor;
import com.njcn.gather.monitor.service.IPqMonitorService;
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
import com.njcn.gather.plan.pojo.po.AdPlan;
@@ -179,6 +181,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
private final ISysUserService sysUserService;
private final IPqErrSysService pqErrSysService;
private final IAdPlanTestConfigService adPlanTestConfigService;
private final IPqMonitorService pqMonitorService;
@Resource
private RestTemplateUtil restTemplateUtil;
@@ -820,6 +823,13 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
pqDevVO.getGdName() != null ? pqDevVO.getGdName() : "未知供电公司",
pqDevVO.getSubName() != null ? pqDevVO.getSubName() : "未知电站",
pqDevVO.getName() != null ? pqDevVO.getName() : "未知设备");
// 判断是否需要在报告上输出水印
String leader = baseModelDataMap.get(BaseReportKeyEnum.AUDIT_BY.getKey());
String loginName = RequestUtil.getLoginNameByToken();
SysUser user = sysUserService.getUserByLoginName(loginName);
if (!leader.equals(user.getName())) {
System.out.println("当前用户是审核人,需要添加水印为:非正式");
}
Docx4jUtil.cleanBlankPagesAndRedundantPageBreaks(baseModelDocument);
baseModelDocument.save(new File(dirPath.concat(File.separator).concat(fileName)));
this.updateDevAndPlanState(devId, devReportParam.getPlanId());
@@ -1157,7 +1167,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
// 插入回路号前,先换个页
todoInsertList.add(Docx4jUtil.createPageBreakParagraph());
// 回路标题
todoInsertList.add(getContrastLineTitle(contentMap, monitorNum, stepIndex, factory));
todoInsertList.add(getContrastLineTitle(contentMap, monitorNum, stepIndex, factory, pqDevVO));
int scriptIndex = 1;
for (ContrastTestResult contrastTestResult : contrastTestResults) {
// 比如电压 V
@@ -2016,7 +2026,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
// 委托方
String delegate = pqDevVO.getDelegate();
if (StrUtil.isNotBlank(delegate)) {
DictData delegateDictData = dictDataService.getDictDataById(pqDevVO.getManufacturer());
DictData delegateDictData = dictDataService.getDictDataById(pqDevVO.getDelegate());
if (ObjectUtil.isNotNull(delegateDictData)) {
baseModelMap.put(BaseReportKeyEnum.DELEGATE.getKey(), delegateDictData.getName());
} else {
@@ -2392,16 +2402,21 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
/**
* 创建回路标题到报告中
*/
private P getContrastLineTitle(Map<String, List<Docx4jUtil.HeadingContent>> contentMap, int monitorNum, int index, ObjectFactory factory) {
private P getContrastLineTitle(Map<String, List<Docx4jUtil.HeadingContent>> contentMap, int monitorNum, int index, ObjectFactory factory, PqDevVO pqDevVO) {
PqMonitor pqMonitor = pqMonitorService.getByDevAndNum(pqDevVO.getId(), monitorNum);
String monitorInfoName = "";
if (StrUtil.isNotBlank(pqDevVO.getSubName()) && Objects.nonNull(pqMonitor)) {
monitorInfoName = "(" + pqDevVO.getSubName() + "-" + pqMonitor.getName() + ")";
}
List<Docx4jUtil.HeadingContent> headingContents = contentMap.get(PowerIndexEnum.LINE_TITLE.getKey());
// 如果contentMap中有指定内容创建大纲级别为2的标题
if (CollUtil.isNotEmpty(headingContents)) {
return Docx4jUtil.createTitle(factory, 2, index + ".测量回路" + monitorNum,
return Docx4jUtil.createTitle(factory, 2, index + ".测量回路" + monitorNum + monitorInfoName,
"SimSun", 30, true);
}
// 没有模板配置时,创建默认样式段落
P titleParagraph = factory.createP();
Docx4jUtil.createTitle(factory, titleParagraph, "测量回路" + monitorNum,
Docx4jUtil.createTitle(factory, titleParagraph, "测量回路" + monitorNum + monitorInfoName,
28, true);
return titleParagraph;
}