Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d738116968 | ||
|
|
e322eb2413 | ||
|
|
0200607c0c | ||
|
|
a6c536cf45 | ||
|
|
e61269e489 | ||
|
|
01e95e71fb | ||
|
|
b4f4037987 | ||
| a5be610a6a | |||
| f8e88b87d0 | |||
|
|
6ee4da4422 | ||
|
|
20e1b8cce7 | ||
|
|
b3b5e64e07 |
@@ -400,6 +400,7 @@ public class ExcelUtil {
|
||||
* @param pullDowns
|
||||
*/
|
||||
private static void setTopLevel(Workbook workbook, List<PullDown> pullDowns) {
|
||||
if(CollUtil.isNotEmpty(pullDowns)){
|
||||
int num = 0;
|
||||
for (PullDown pullDown : pullDowns) {
|
||||
if (!pullDown.getIsText()) {
|
||||
@@ -437,6 +438,8 @@ public class ExcelUtil {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取根据数值获取列字母(1=A,2=B,3=C,.......,27=AA)
|
||||
*
|
||||
|
||||
@@ -78,7 +78,9 @@ public class Knife4jSwaggerConfig {
|
||||
"com.njcn.cloud.controller",
|
||||
"com.njcn.zlevent.controller",
|
||||
"com.njcn.prepare",
|
||||
"com.njcn.supervision.controller"
|
||||
"com.njcn.supervision.controller",
|
||||
"com.njcn.algorithm",
|
||||
"com.njcn.dataProcess"
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
List<GrantType> grantTypes = new ArrayList<>();
|
||||
|
||||
@@ -1838,11 +1838,11 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
|
||||
private String dealVoltageLevel(String voltage) {
|
||||
float scale = Float.parseFloat(voltage.substring(0, voltage.indexOf("kV")));
|
||||
if (scale < 500) {
|
||||
//if (scale < 500) {
|
||||
return "交流" + voltage;
|
||||
} else {
|
||||
return "直流" + voltage;
|
||||
}
|
||||
//} else {
|
||||
// return "直流" + voltage;
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1802,7 +1802,7 @@
|
||||
line.Name name,
|
||||
pq_line_detail.Num lineNo,
|
||||
s1.Name voltageLevel,
|
||||
pq_line_detail.PT_Phase_Type ptType,
|
||||
pq_line_detail.PT_Type ptType,
|
||||
pq_line_detail.Run_Flag status
|
||||
FROM
|
||||
pq_line_detail
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
pq_device_process.process_no processNo,
|
||||
pq_device.Dev_Key devKey
|
||||
FROM
|
||||
pq_node
|
||||
LEFT JOIN pq_device ON pq_node.Id = pq_device.Node_Id
|
||||
pq_device
|
||||
LEFT JOIN pq_node ON pq_node.Id = pq_device.Node_Id
|
||||
LEFT JOIN pq_line on pq_device.id = pq_line.id
|
||||
LEFT JOIN pq_device_process on pq_device_process.id = pq_device.id
|
||||
LEFT JOIN sys_dict_data s1 ON pq_device.Dev_Type = s1.id
|
||||
|
||||
@@ -25,7 +25,9 @@ public enum SupervisionResponseEnum {
|
||||
NO_USER_REPORT_UPDATE("A00550","常态化干扰源用户管理信息更新失败,不存在该条信息"),
|
||||
NO_DEPT_POWER("A00550","不能操作非自己部门创建的任务"),
|
||||
IMPORT_DEV_ERROR("A00550","导入终端检测失败"),
|
||||
IMPORT_PLAN_ERROR("A00550","导入技术监督计划失败"),
|
||||
IMPORT_DEV_DATA_ERROR("A00550","终端数据为空"),
|
||||
IMPORT_PLAN_DATA_ERROR("A00550","技术监督计划数据为空"),
|
||||
DELETE_TO_BE_SUBMITTED("A00550","流程删除失败,只有待提交信息可删除!"),
|
||||
EXISTENCE_OR_NOT("A00550","信息查询为空,请检查信息是否存在!"),
|
||||
NAME_EXISTS("A00550","名称重复"),
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.njcn.supervision.pojo.dto;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2025/3/27 11:21
|
||||
*/
|
||||
@Data
|
||||
public class SupervisionPlanExcel {
|
||||
|
||||
/**
|
||||
* 负责单位ID
|
||||
*/
|
||||
@Excel(name = "*计划负责单位", width = 30)
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 计划名称
|
||||
*/
|
||||
@Excel(name = "*计划名称", width = 30)
|
||||
private String planName;
|
||||
|
||||
/**
|
||||
* 监督类型
|
||||
*/
|
||||
@Excel(name = "*监督类型", width = 30)
|
||||
private String supvType;
|
||||
|
||||
/**
|
||||
* 监督对象名称
|
||||
*/
|
||||
@Excel(name = "*监督对象名称", width = 30)
|
||||
private String supvObjectName;
|
||||
|
||||
/**
|
||||
* 计划开始时间
|
||||
*/
|
||||
@Excel(name = "*计划开始时间(yyyy/MM/dd)", width = 30,exportFormat = "yyyy/MM/dd")
|
||||
private Date planStartTime;
|
||||
|
||||
/**
|
||||
* 计划结束时间
|
||||
*/
|
||||
@Excel(name = "*计划结束时间(yyyy/MM/dd)", width = 30,exportFormat = "yyyy/MM/dd")
|
||||
private Date planEndTime;
|
||||
|
||||
/**
|
||||
* 0 关联系统内变电站;1 用户手动输入变电站
|
||||
*/
|
||||
@Excel(name = "*是否系统电站", width = 30, replace = {"是_0", "否_1",})
|
||||
private String customSubstationFlag ;
|
||||
|
||||
/**
|
||||
* 变电站台账ID或者用户手动输入的变电站名称
|
||||
*/
|
||||
@Excel(name = "*关联电站一", width = 30)
|
||||
private String substation;
|
||||
|
||||
/**
|
||||
* 变电站台账ID或者用户手动输入的变电站名称
|
||||
*/
|
||||
@Excel(name = "关联电站二", width = 30)
|
||||
private String substation2;
|
||||
|
||||
/**
|
||||
* 变电站台账ID或者用户手动输入的变电站名称
|
||||
*/
|
||||
@Excel(name = "关联电站三", width = 30)
|
||||
private String substation3;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class ExcelMsg extends SupervisionPlanExcel implements Serializable {
|
||||
|
||||
@Excel(name = "错误信息描述", width = 30)
|
||||
private String msg;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,13 +15,17 @@ import com.njcn.supervision.service.survey.ISurveyPlanService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -108,5 +112,25 @@ public class SurveyPlanController extends BaseController {
|
||||
Boolean b = surveyPlanService.deleteSurveyPlan(supervisionId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping(value = "/downloadPlanTemplate", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
@ApiOperation("下载技术监督计划模板")
|
||||
public void downloadPlanTemplate() {
|
||||
surveyPlanService.downloadPlanTemplate();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/importPlanData")
|
||||
@ApiOperation("批量导入技术监督计划")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
public HttpResult<String> importPlanData(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importPlanData");
|
||||
surveyPlanService.importPlanData(file, response);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -357,33 +357,6 @@ public class SupervisionDevMainReportPOServiceImpl extends ServiceImpl<Supervisi
|
||||
List<PullDown> pullDowns = new ArrayList<>();
|
||||
|
||||
PullDown pullDown;
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(0);
|
||||
pullDown.setLastCol(0);
|
||||
pullDown.setIsText(true);
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(10);
|
||||
pullDown.setLastCol(10);
|
||||
pullDown.setIsText(true);
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(11);
|
||||
pullDown.setLastCol(11);
|
||||
pullDown.setIsText(true);
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(20);
|
||||
pullDown.setLastCol(20);
|
||||
pullDown.setIsText(true);
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(1);
|
||||
pullDown.setLastCol(1);
|
||||
|
||||
@@ -6,7 +6,9 @@ import com.njcn.bpm.service.IBpmService;
|
||||
import com.njcn.supervision.pojo.param.survey.SurveyPlanParam;
|
||||
import com.njcn.supervision.pojo.po.survey.SurveyPlan;
|
||||
import com.njcn.supervision.pojo.vo.survey.SurveyPlanVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,4 +32,8 @@ public interface ISurveyPlanService extends IBpmService<SurveyPlan> {
|
||||
SurveyPlanVO getVOById(String id);
|
||||
|
||||
Boolean deleteSurveyPlan(List<String> supervisionId);
|
||||
|
||||
void downloadPlanTemplate();
|
||||
|
||||
void importPlanData(MultipartFile file, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package com.njcn.supervision.service.survey.impl;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelImportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
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.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@@ -20,13 +26,24 @@ import com.njcn.bpm.pojo.param.instance.BpmProcessInstanceCancelParam;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.common.DealStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.device.biz.pojo.dto.SubGetBase;
|
||||
import com.njcn.device.biz.pojo.param.SubstationParam;
|
||||
import com.njcn.device.pms.pojo.excel.PowerGenerationUserExcel;
|
||||
import com.njcn.device.pms.utils.PubUtil;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.poi.excel.PullDown;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.supervision.enums.FlowStatusEnum;
|
||||
import com.njcn.supervision.enums.SupervisionKeyEnum;
|
||||
import com.njcn.supervision.enums.SupervisionResponseEnum;
|
||||
import com.njcn.supervision.mapper.survey.SurveyPlanMapper;
|
||||
import com.njcn.supervision.pojo.dto.SupervisionDevMainReportExcel;
|
||||
import com.njcn.supervision.pojo.dto.SupervisionPlanExcel;
|
||||
import com.njcn.supervision.pojo.param.survey.SurveyPlanParam;
|
||||
import com.njcn.supervision.pojo.po.device.SupervisionDevMainReportPO;
|
||||
import com.njcn.supervision.pojo.po.survey.SurveyPlan;
|
||||
import com.njcn.supervision.pojo.po.survey.SurveyTest;
|
||||
import com.njcn.supervision.pojo.vo.survey.SurveyPlanVO;
|
||||
@@ -35,18 +52,24 @@ import com.njcn.supervision.service.survey.ISurveyPlanService;
|
||||
import com.njcn.supervision.service.survey.ISurveyTestService;
|
||||
import com.njcn.supervision.utils.InstanceUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -62,19 +85,16 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
|
||||
|
||||
@Resource
|
||||
private BpmProcessFeignClient bpmProcessFeignClient;
|
||||
|
||||
@Resource
|
||||
private DeptFeignClient deptFeignClient;
|
||||
|
||||
@Resource
|
||||
private LineFeignClient lineFeignClient;
|
||||
|
||||
@Resource
|
||||
private ISurveyTestService surveyTestService;
|
||||
|
||||
@Resource
|
||||
private DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Resource
|
||||
private CommTerminalGeneralClient commterminalGeneralClient;
|
||||
|
||||
@Override
|
||||
public Page<SurveyPlanVO> surveyPlanPage(SurveyPlanParam.SurveyPlanQueryParam surveyPlanQueryParam) {
|
||||
@@ -125,12 +145,16 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
|
||||
String[] subIds = substation.split(StrPool.COMMA);
|
||||
|
||||
for (String subId : subIds) {
|
||||
String name = lineFeignClient.getSubstationInfo(subId).getData().getName();
|
||||
PollutionSubstationDTO data = lineFeignClient.getSubstationInfo(subId).getData();
|
||||
if (ObjectUtil.isNotNull(data)) {
|
||||
String name = data.getName();
|
||||
subName = subName.concat(StrPool.COMMA).concat(name);
|
||||
}
|
||||
}
|
||||
if(StrUtil.isNotBlank(subName)){
|
||||
subName = subName.substring(1);
|
||||
}
|
||||
|
||||
}
|
||||
record.setSubstation(subName);
|
||||
} else {
|
||||
record.setSubstationName(record.getSubstation());
|
||||
@@ -348,4 +372,185 @@ public class SurveyPlanServiceImpl extends ServiceImpl<SurveyPlanMapper, SurveyP
|
||||
return this.update(new LambdaUpdateWrapper<SurveyPlan>().set(SurveyPlan::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(SurveyPlan::getId, supervisionId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadPlanTemplate() {
|
||||
ExportParams exportParams = new ExportParams("技术监督计划模板数据模板(带*字段均是必填,请严格按照模板标准填入数据)", "技术监督计划信息");
|
||||
//所属供电公司
|
||||
List<DeptDTO> depts = deptFeignClient.getDepSonDetailByDeptId(RequestUtil.getDeptIndex()).getData();
|
||||
List<DictData> supType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPV_TYPE.getCode()).getData();
|
||||
SubstationParam substationParam = new SubstationParam();
|
||||
substationParam.setOrgIds(depts.stream().map(DeptDTO::getId).distinct().collect(Collectors.toList()));
|
||||
List<SubGetBase> data = commterminalGeneralClient.tagOrIdGetSub(substationParam).getData();
|
||||
|
||||
List<PullDown> pullDowns = new ArrayList<>();
|
||||
|
||||
PullDown pullDown;
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(0);
|
||||
pullDown.setLastCol(0);
|
||||
pullDown.setStrings(depts.stream().map(DeptDTO::getName).distinct().collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(2);
|
||||
pullDown.setLastCol(2);
|
||||
pullDown.setStrings(supType.stream().map(DictData::getName).distinct().collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(6);
|
||||
pullDown.setLastCol(6);
|
||||
pullDown.setStrings(Stream.of("是", "否").collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(7);
|
||||
pullDown.setLastCol(7);
|
||||
pullDown.setStrings(data.stream().map(SubGetBase::getName).distinct().collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(8);
|
||||
pullDown.setLastCol(8);
|
||||
pullDown.setStrings(data.stream().map(SubGetBase::getName).distinct().collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(9);
|
||||
pullDown.setLastCol(9);
|
||||
pullDown.setStrings(data.stream().map(SubGetBase::getName).distinct().collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
ExcelUtil.exportExcelPullDown(exportParams, "技术监督计划模板.xlsx", pullDowns, SupervisionPlanExcel.class, new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importPlanData(MultipartFile file, HttpServletResponse response) {
|
||||
List<SupervisionPlanExcel.ExcelMsg> planMsgList = new ArrayList<>();
|
||||
ImportParams params = new ImportParams();
|
||||
//表头
|
||||
params.setHeadRows(1);
|
||||
//标题
|
||||
params.setTitleRows(1);
|
||||
params.setNeedVerify(true);
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
List<SupervisionPlanExcel> planExcels;
|
||||
try {
|
||||
planExcels = ExcelImportUtil.importExcel(file.getInputStream(), SupervisionPlanExcel.class, params);
|
||||
//如果存在非法数据,将不合格的数据导出
|
||||
if (CollUtil.isEmpty(planExcels)) {
|
||||
throw new BusinessException(SupervisionResponseEnum.IMPORT_PLAN_DATA_ERROR);
|
||||
}
|
||||
//各地市
|
||||
List<DeptDTO> deptS = deptFeignClient.getDepSonDetailByDeptId(RequestUtil.getDeptIndex()).getData();
|
||||
List<DictData> supType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPV_TYPE.getCode()).getData();
|
||||
|
||||
SubstationParam substationParam = new SubstationParam();
|
||||
substationParam.setOrgIds(deptS.stream().map(DeptDTO::getId).distinct().collect(Collectors.toList()));
|
||||
List<SubGetBase> data = commterminalGeneralClient.tagOrIdGetSub(substationParam).getData();
|
||||
List<SurveyPlan> info = new ArrayList<>();
|
||||
SurveyPlan po;
|
||||
if (CollectionUtil.isNotEmpty(planExcels)) {
|
||||
for (SupervisionPlanExcel planExcel : planExcels) {
|
||||
po = new SurveyPlan();
|
||||
StringBuilder msg = new StringBuilder();
|
||||
if (StrUtil.isEmpty(planExcel.getDeptId())) {
|
||||
msg.append("计划负责单位不能为空!");
|
||||
} else {
|
||||
List<String> DeptIds = deptS.stream().filter(x -> x.getName().equals(planExcel.getDeptId())).map(DeptDTO::getId).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(DeptIds)) {
|
||||
msg.append("计划负责单位不存在!");
|
||||
} else {
|
||||
po.setDeptId(DeptIds.get(0));
|
||||
}
|
||||
}
|
||||
if (StrUtil.isEmpty(planExcel.getPlanName())) {
|
||||
msg.append("计划名称不能为空!");
|
||||
} else {
|
||||
po.setPlanName(planExcel.getPlanName());
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(planExcel.getSupvType())) {
|
||||
msg.append("监督类型不能为空!");
|
||||
} else {
|
||||
String dicById = PubUtil.getDicById(planExcel.getSupvType(), supType);
|
||||
if (StrUtil.isEmpty(dicById)) {
|
||||
msg.append("监督类型不存在!");
|
||||
} else {
|
||||
po.setSupvType(dicById);
|
||||
}
|
||||
}
|
||||
if (StrUtil.isEmpty(planExcel.getSupvObjectName())) {
|
||||
msg.append("监督对象名称不能为空!");
|
||||
} else {
|
||||
po.setSupvObjectName(planExcel.getSupvObjectName());
|
||||
}
|
||||
try {
|
||||
Date startTime = planExcel.getPlanStartTime();
|
||||
Date endTime = planExcel.getPlanEndTime();
|
||||
po.setPlanStartTime(startTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
|
||||
po.setPlanEndTime(endTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
|
||||
} catch (Exception e) {
|
||||
msg.append("计划时间格式有误!");
|
||||
}
|
||||
|
||||
if (StrUtil.isEmpty(planExcel.getCustomSubstationFlag())) {
|
||||
msg.append("是否系统电站不能为空!");
|
||||
} else {
|
||||
po.setCustomSubstationFlag(Integer.valueOf(planExcel.getCustomSubstationFlag()));
|
||||
}
|
||||
List<String> list = Arrays.asList(planExcel.getSubstation(), planExcel.getSubstation2(), planExcel.getSubstation3())
|
||||
.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
msg.append("关联电站不能为空!");
|
||||
} else {
|
||||
if ("0".equals(planExcel.getCustomSubstationFlag())) {
|
||||
List<String> subIds = data.stream().filter(x -> list.contains(x.getName())).map(SubGetBase::getId).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(subIds)) {
|
||||
msg.append("关联电站不存在!");
|
||||
} else {
|
||||
po.setSubstation(String.join(",", subIds));
|
||||
}
|
||||
} else {
|
||||
po.setSubstation(planExcel.getSubstation());
|
||||
}
|
||||
}
|
||||
String string = msg.toString();
|
||||
if (StrUtil.isNotBlank(string)) {
|
||||
SupervisionPlanExcel.ExcelMsg excelMsg = new SupervisionPlanExcel.ExcelMsg();
|
||||
BeanUtils.copyProperties(planExcel, excelMsg);
|
||||
excelMsg.setMsg(string);
|
||||
planMsgList.add(excelMsg);
|
||||
continue;
|
||||
}
|
||||
po.setStatus(BpmTaskStatusEnum.RUNNING.getStatus());
|
||||
po.setState(DataStateEnum.ENABLE.getCode());
|
||||
info.add(po);
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(info)) {
|
||||
for (SurveyPlan surveyPlan : info) {
|
||||
this.saveOrUpdate(surveyPlan);
|
||||
SurveyPlan plan = this.baseMapper.selectById(surveyPlan.getId());
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>(16);
|
||||
BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO();
|
||||
bpmProcessInstanceCreateReqDTO.setProcessDefinitionKey(SupervisionKeyEnum.SURVEY_PLAN.getKey());
|
||||
bpmProcessInstanceCreateReqDTO.setBusinessKey(plan.getId());
|
||||
bpmProcessInstanceCreateReqDTO.setStartUserSelectAssignees(new HashMap<>(16));
|
||||
bpmProcessInstanceCreateReqDTO.setVariables(processInstanceVariables);
|
||||
String processInstanceId = bpmProcessFeignClient.createProcessInstance(plan.getCreateBy(), bpmProcessInstanceCreateReqDTO).getData();
|
||||
// 将工作流的编号,更新到流程单中
|
||||
plan.setProcessInstanceId(processInstanceId);
|
||||
this.baseMapper.updateById(plan);
|
||||
}
|
||||
}
|
||||
//判断有没有错误信息
|
||||
if (CollectionUtil.isNotEmpty(planMsgList)) {
|
||||
ExcelUtil.exportExcel("失败列表.xlsx", SupervisionPlanExcel.ExcelMsg.class, planMsgList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(SupervisionResponseEnum.IMPORT_PLAN_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ spring:
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
|
||||
@@ -91,7 +91,6 @@
|
||||
<artifactId>cs-device-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
Reference in New Issue
Block a user