1.单位回显,时间范围查询等功能添加
2.干扰源和敏感供用户模板下载和批量导入 3.增加根据code进行树形字典筛选 3.全景展示技术监督接口新增
This commit is contained in:
@@ -2,6 +2,7 @@ package com.njcn.device.pms.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import lombok.SneakyThrows;
|
||||
@@ -76,15 +77,17 @@ public class PubUtil {
|
||||
}
|
||||
|
||||
public static String getDicById(String name, List<DictData> dictData) {
|
||||
//先匹配有没有完全吻合的
|
||||
List<DictData> compareDictDataList = dictData.stream().filter(x -> x.getName().equalsIgnoreCase(name)).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(compareDictDataList)){
|
||||
return compareDictDataList.get(0).getId();
|
||||
}
|
||||
//如果没有匹配到,则判断是否有包含的
|
||||
List<DictData> dictDataList = dictData.stream().filter(x -> x.getName().contains(name)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(dictDataList)) {
|
||||
return dictDataList.get(0).getId();
|
||||
if(StrUtil.isNotBlank(name)){
|
||||
//先匹配有没有完全吻合的
|
||||
List<DictData> compareDictDataList = dictData.stream().filter(x -> x.getName().equalsIgnoreCase(name)).collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(compareDictDataList)){
|
||||
return compareDictDataList.get(0).getId();
|
||||
}
|
||||
//如果没有匹配到,则判断是否有包含的
|
||||
List<DictData> dictDataList = dictData.stream().filter(x -> x.getName().contains(name)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(dictDataList)) {
|
||||
return dictDataList.get(0).getId();
|
||||
}
|
||||
}
|
||||
//实在没有匹配到则返回空
|
||||
return "";
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.njcn.supervision.pojo.dto;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class SensitiveReportExcel implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 对应用户名称
|
||||
*/
|
||||
@Excel(name = "*工程名称", width = 30)
|
||||
@NotBlank(message = "工程名称不能为空")
|
||||
private String projectName;
|
||||
|
||||
@Excel(name = "*用户性质", width = 30, replace = {"新建电网工程_0", "扩建电网工程_1", "新建非线性负荷用户_2", "扩建非线性负荷用户_3", "新建新能源发电站_4", "扩建新能源发电站_5", "_null"})
|
||||
@NotNull(message = "用户性质不能为空")
|
||||
private Integer userType;
|
||||
|
||||
@Excel(name = "*所属地市", width = 30)
|
||||
@NotBlank(message = "所属地市不能为空")
|
||||
private String city;
|
||||
|
||||
@Excel(name = "*归口管理部门", width = 30)
|
||||
@NotBlank(message = "归口管理部门不能为空")
|
||||
private String responsibleDepartment;
|
||||
|
||||
@Excel(name = "*用户状态", width = 30, replace = {"可研_0", "建设_1", "运行_2", "退运_3", "_null"})
|
||||
@NotNull(message = "用户状态不能为空")
|
||||
private Integer userStatus;
|
||||
|
||||
@Excel(name = "*变电站", width = 30)
|
||||
@NotBlank(message = "变电站不能为空")
|
||||
private String substation;
|
||||
|
||||
|
||||
// @Excel(name = "填报人", width = 30)
|
||||
// //@NotBlank(message = "填报人不能为空")
|
||||
// private String reporter;
|
||||
//
|
||||
// @Excel(name = "填报日期(yyyy-MM-dd)", width = 30)
|
||||
// //@NotBlank(message = "填报日期不能为空")
|
||||
// private String reportDate;
|
||||
//
|
||||
// @Excel(name = "填报部门", width = 30)
|
||||
// //@NotBlank(message = "填报部门不能为空")
|
||||
// private String orgId;
|
||||
|
||||
|
||||
@Excel(name = "工程预期投产日期", width = 30)
|
||||
//@NotBlank(message = "工程预期投产日期不能为空")
|
||||
private LocalDate expectedProductionDate;
|
||||
|
||||
@Excel(name = "电压等级", width = 30)
|
||||
//@NotBlank(message = "电压等级不能为空")
|
||||
private String voltageLevel;
|
||||
|
||||
@Excel(name = "预测评估单位", width = 30)
|
||||
//@NotBlank(message = "预测评估单位不能为空")
|
||||
private String evaluationDept;
|
||||
|
||||
@Excel(name = "预测评估结论", width = 30)
|
||||
//@NotBlank(message = "预测评估结论不能为空")
|
||||
private String evaluationConclusion;
|
||||
//----------------------------以上基础数据------------------------------------
|
||||
|
||||
@Excel(name = "PCC点", width = 30)
|
||||
//@NotBlank(message = "PCC点不能为空")
|
||||
private String pccPoint;
|
||||
|
||||
@Excel(name = "基准短路容量(MVA)", width = 30)
|
||||
//@NotBlank(message = "基准短路容量(MVA)不能为空")
|
||||
private BigDecimal baseShortCircuitCapacity;
|
||||
|
||||
@Excel(name = "系统最小短路容量(MVA)", width = 30)
|
||||
//@NotBlank(message = "系统最小短路容量(MVA)不能为空")
|
||||
private BigDecimal minShortCircuitCapacity;
|
||||
|
||||
@Excel(name = "PCC供电设备容量(MVA)", width = 30)
|
||||
//@NotBlank(message = "PCC供电设备容量(MVA)不能为空")
|
||||
private BigDecimal pccEquipmentCapacity;
|
||||
|
||||
@Excel(name = "用户用电协议容量(MVA)", width = 30)
|
||||
//@NotBlank(message = "用户用电协议容量(MVA)不能为空")
|
||||
private BigDecimal userAgreementCapacity;
|
||||
|
||||
@Excel(name = "评估类型", width = 30)
|
||||
//@NotBlank(message = "评估类型不能为空")
|
||||
private String evaluationType;
|
||||
|
||||
@Excel(name = "非线性负荷类型", width = 30)
|
||||
//@NotBlank(message = "非线性负荷类型不能为空")
|
||||
private String nonlinearLoadType;
|
||||
|
||||
@Excel(name = "预测评估审核单位", width = 30)
|
||||
//@NotBlank(message = "预测评估审核单位不能为空")
|
||||
private String evaluationChekDept;
|
||||
|
||||
@Excel(name = "是否需要治理", width = 30, replace = {"否_0", "是_1", "_null"})
|
||||
//@NotBlank(message = "是否需要治理不能为空")
|
||||
private Integer needGovernance;
|
||||
|
||||
@Excel(name = "是否开展背景测试", width = 30, replace = {"否_0", "是_1", "_null"})
|
||||
//@NotBlank(message = "是否开展背景测试不能为空")
|
||||
private Integer backgroundTestPerformed;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class SensitiveReportExcelMsg extends SensitiveReportExcel implements Serializable {
|
||||
@Excel(name = "错误信息描述")
|
||||
private String msg;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.njcn.supervision.pojo.dto;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class SensitiveUserSExcel implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* 对应用户名称
|
||||
*/
|
||||
@Excel(name = "*工程名称", width = 30)
|
||||
@NotBlank(message = "工程名称不能为空")
|
||||
private String projectName;
|
||||
|
||||
@Excel(name = "*所属地市", width = 30)
|
||||
@NotBlank(message = "所属地市不能为空")
|
||||
private String city;
|
||||
|
||||
@Excel(name = "*归口管理部门", width = 30)
|
||||
@NotBlank(message = "归口管理部门不能为空")
|
||||
private String responsibleDepartment;
|
||||
|
||||
@Excel(name = "*用户状态", width = 30, replace = {"可研_0", "建设_1", "运行_2", "退运_3", "_null"})
|
||||
@NotNull(message = "用户状态不能为空")
|
||||
private Integer userStatus;
|
||||
|
||||
@Excel(name = "*变电站", width = 30)
|
||||
@NotBlank(message = "变电站不能为空")
|
||||
private String substation;
|
||||
@Excel(name = "*负荷级别", width = 30)
|
||||
@NotBlank(message = "*负荷级别不能为空")
|
||||
private String loadLevel;
|
||||
|
||||
@Excel(name = "*供电电源情况", width = 30)
|
||||
@NotBlank(message = "*供电电源情况不能为空")
|
||||
private String powerSupplyInfo;
|
||||
|
||||
// @Excel(name = "填报人", width = 30)
|
||||
// //@NotBlank(message = "填报人不能为空")
|
||||
// private String reporter;
|
||||
//
|
||||
// @Excel(name = "填报日期(yyyy-MM-dd)", width = 30)
|
||||
// //@NotBlank(message = "填报日期不能为空")
|
||||
// private String reportDate;
|
||||
//
|
||||
// @Excel(name = "填报部门", width = 30)
|
||||
// //@NotBlank(message = "填报部门不能为空")
|
||||
// private String orgId;
|
||||
|
||||
|
||||
@Excel(name = "工程预期投产日期", width = 30)
|
||||
//@NotBlank(message = "工程预期投产日期不能为空")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate expectedProductionDate;
|
||||
|
||||
@Excel(name = "电压等级", width = 30)
|
||||
//@NotBlank(message = "电压等级不能为空")
|
||||
private String voltageLevel;
|
||||
|
||||
@Excel(name = "预测评估单位", width = 30)
|
||||
//@NotBlank(message = "预测评估单位不能为空")
|
||||
private String evaluationDept;
|
||||
|
||||
@Excel(name = "预测评估结论", width = 30)
|
||||
//@NotBlank(message = "预测评估结论不能为空")
|
||||
private String evaluationConclusion;
|
||||
//----------------------------以上基础数据------------------------------------
|
||||
|
||||
@Excel(name = "PCC点", width = 30)
|
||||
//@NotBlank(message = "PCC点不能为空")
|
||||
private String pccPoint;
|
||||
|
||||
@Excel(name = "是否需要治理", width = 30, replace = {"否_0", "是_1", "_null"})
|
||||
//@NotBlank(message = "是否需要治理不能为空")
|
||||
private Integer needGovernance;
|
||||
|
||||
@Excel(name = "是否开展背景测试", width = 30, replace = {"否_0", "是_1", "_null"})
|
||||
//@NotBlank(message = "是否开展背景测试不能为空")
|
||||
private Integer backgroundTestPerformed;
|
||||
|
||||
@Excel(name = "评估类型", width = 30)
|
||||
//@NotBlank(message = "评估类型不能为空")
|
||||
private String evaluationType;
|
||||
|
||||
@Excel(name = "行业", width = 30)
|
||||
//@NotBlank(message = "行业不能为空")
|
||||
private String industry;
|
||||
|
||||
@Excel(name = "敏感装置名称", width = 30)
|
||||
//@NotBlank(message = "敏感装置名称不能为空")
|
||||
private String deviceName;
|
||||
|
||||
@Excel(name = "供电电源数量", width = 30)
|
||||
//@NotBlank(message = "供电电源数量不能为空")
|
||||
private Integer powerSupplyCount;
|
||||
|
||||
@Excel(name = "敏感电能质量指标", width = 30)
|
||||
//@NotBlank(message = "敏感电能质量指标不能为空")
|
||||
private String energyQualityIndex;
|
||||
|
||||
@Excel(name = "是否开展抗扰度测试", width = 30, replace = {"否_0", "是_1", "_null"})
|
||||
//@NotBlank(message = "是否开展抗扰度测试不能为空")
|
||||
private Integer antiInterferenceTest;
|
||||
|
||||
@Excel(name = "预测评估审核单位", width = 30)
|
||||
//@NotBlank(message = "敏感电能质量指标不能为空")
|
||||
private String evaluationChekDept;
|
||||
|
||||
|
||||
@Excel(name = "供电电源", width = 30)
|
||||
//@NotBlank(message = "供电电源不能为空")
|
||||
private String powerSupply;
|
||||
|
||||
@Excel(name = "接入电压等级", width = 30)
|
||||
//@NotBlank(message = "接入电压等级不能为空")
|
||||
private String supplyVoltageLevel;
|
||||
|
||||
|
||||
@Excel(name = "运维单位", width = 30)
|
||||
//@NotBlank(message = "运维单位不能为空")
|
||||
private String maintenanceUnit;
|
||||
|
||||
// substation_main_wiring_diagram 用户接入变电站主接线示意图地址
|
||||
// sensitive_devices 主要敏感设备清单
|
||||
// anti_interference_report 抗扰度测试报告
|
||||
// power_quality_report 背景电能质量测试报告
|
||||
// feasibility_report 可研报告地址
|
||||
// preliminary_design_description 项目初步设计说明书地址
|
||||
// prediction_evaluation_report 预测评估报告地址
|
||||
// prediction_evaluation_review_opinions 预测评估评审意见报告地址
|
||||
//
|
||||
// additional_attachments 其他附件
|
||||
// state 数据状态
|
||||
// Create_By 创建用户
|
||||
// Create_Time 创建时间
|
||||
// Update_By 更新用户
|
||||
// Update_Time 更新时间
|
||||
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class SensitiveUserExcelMsg extends SensitiveUserSExcel implements Serializable {
|
||||
@Excel(name = "错误信息描述")
|
||||
private String msg;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.supervision.pojo.vo.gridDiagram;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GridDiagramVO {
|
||||
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private String orgName;
|
||||
|
||||
@ApiModelProperty(value = "异常问题总数")
|
||||
private Integer abnormalNum;
|
||||
|
||||
@ApiModelProperty(value = "已关联工单数")
|
||||
private Integer associatedNum;
|
||||
|
||||
@ApiModelProperty(value = "工单转换率")
|
||||
private Float conversionNum;
|
||||
|
||||
@ApiModelProperty(value = "工单总数")
|
||||
private Integer workNum;
|
||||
|
||||
@ApiModelProperty(value = "已处理工单数")
|
||||
private Integer processedNum;
|
||||
|
||||
@ApiModelProperty(value = "工单处置率")
|
||||
private Float disposalNum;
|
||||
|
||||
@Data
|
||||
public static class Info extends GridDiagramVO {
|
||||
|
||||
@ApiModelProperty(value = "在线监测")
|
||||
private Integer onLineNum;
|
||||
|
||||
@ApiModelProperty(value = "用户投诉")
|
||||
private Integer userNum;
|
||||
|
||||
@ApiModelProperty(value = "技术监督计划")
|
||||
private Integer surveyNum;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.supervision.pojo.vo.problem;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -16,7 +17,6 @@ public class SupervisionUserComplaintVO {
|
||||
@ApiModelProperty("id")
|
||||
private String Id;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "用户编号")
|
||||
private String userNumber;
|
||||
|
||||
@@ -38,7 +38,6 @@ public class SupervisionUserComplaintVO {
|
||||
@ApiModelProperty(value = "是否实现检测(0:否;1:是)")
|
||||
private Integer detectionFlag;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "监测点编号")
|
||||
private String monitorNumber;
|
||||
|
||||
@@ -50,7 +49,11 @@ public class SupervisionUserComplaintVO {
|
||||
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty(value = "责任单位id")
|
||||
private String dutyOrgId;
|
||||
|
||||
@ApiModelProperty(value = "责任单位")
|
||||
private String dutyOrgName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -134,6 +134,11 @@ public class UserReportVO {
|
||||
@TableField(value = "`status`")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 数据来源类型 0.正常流程审核入库 1.批量导入
|
||||
*/
|
||||
@ApiModelProperty(value = "数据来源类型 0.正常流程审核入库 1.批量导入")
|
||||
private Integer dataType;
|
||||
|
||||
private String createBy;
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.supervision.controller.gridDiagram;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.supervision.service.gridDiagram.GridDiagramService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.njcn.supervision.pojo.vo.gridDiagram.GridDiagramVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/gridDiagram")
|
||||
@Api(tags = "冀北电网一张图信息展示")
|
||||
@AllArgsConstructor
|
||||
public class GridDiagramController extends BaseController {
|
||||
|
||||
private final GridDiagramService gridDiagramService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getSupervisionData")
|
||||
@ApiOperation("技术监督首页数据展示")
|
||||
public HttpResult<GridDiagramVO> getSupervisionData(@RequestBody StatisticsBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getSupervisionData");
|
||||
GridDiagramVO.Info supervisionData = gridDiagramService.getSupervisionData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, supervisionData, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getSupervisionDetailsData")
|
||||
@ApiOperation("技术监督详细页面展示")
|
||||
public HttpResult<List<GridDiagramVO.Info>> getSupervisionDetailsData(@RequestBody StatisticsBizBaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getSupervisionDetailsData");
|
||||
List<GridDiagramVO.Info> supervisionData = gridDiagramService.getSupervisionDetailsData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, supervisionData, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,9 +19,11 @@ import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
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 org.springframework.web.multipart.MultipartFile;
|
||||
@@ -171,7 +173,25 @@ public class UserReportManageController extends BaseController {
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/downloadSensitiveUserTemplate")
|
||||
@GetMapping(value ="/downloadSensitiveReportTemplate", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
@ApiOperation("下载干扰源用户台账模板")
|
||||
public void downloadSensitiveReportTemplate() {
|
||||
userReportPOService.downloadSensitiveReportTemplate();
|
||||
}
|
||||
@PostMapping(value = "/importSensitiveReportData", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
@ApiOperation("批量导入干扰源用户")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
public HttpResult<String> importSensitiveReportData(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importSensitiveReportData");
|
||||
if (Objects.isNull(userReportPOService.importSensitiveReportData(file, response))) {
|
||||
return null;
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping(value ="/downloadSensitiveUserTemplate", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||
@ApiOperation("下载敏感及重要用户模板")
|
||||
public void downloadSensitiveUserTemplate() {
|
||||
userReportPOService.downloadSensitiveUserTemplate();
|
||||
@@ -181,7 +201,7 @@ public class UserReportManageController extends BaseController {
|
||||
@PostMapping(value = "/importSensitiveUserData")
|
||||
@ApiOperation("批量导入敏感及重要用户")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
|
||||
public HttpResult<String> importSensitiveUserData(@RequestParam("file") MultipartFile file, HttpServletResponse response) {
|
||||
public HttpResult<String> importSensitiveUserData(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
||||
String methodDescribe = getMethodDescribe("importSensitiveUserData");
|
||||
//批量录入暂降数据
|
||||
if (Objects.isNull(userReportPOService.importSensitiveUserData(file, response))) {
|
||||
|
||||
@@ -9,12 +9,7 @@
|
||||
supervision_warning_leaflet.leaflet_no,
|
||||
supervision_warning_leaflet.problem_type,
|
||||
supervision_warning_leaflet.problem_id,
|
||||
(case problem_type
|
||||
when 1 then null
|
||||
when 2 then null
|
||||
when 3 then (select duty_Org_Id FROM supervision_user_complaint where id=problem_id)
|
||||
when 4 then (select dept_id FROM supervision_survey_test where id=problem_id)
|
||||
else null end ) as duty_Org_Id,
|
||||
supervision_warning_leaflet.dept_id as duty_Org_Id,
|
||||
supervision_warning_leaflet.leaflet_type,
|
||||
supervision_warning_leaflet.id,
|
||||
supervision_warning_leaflet.STATUS,
|
||||
@@ -38,12 +33,7 @@
|
||||
supervision_warning_leaflet.leaflet_no,
|
||||
supervision_warning_leaflet.problem_type,
|
||||
supervision_warning_leaflet.problem_id,
|
||||
(case problem_type
|
||||
when 1 then null
|
||||
when 2 then null
|
||||
when 3 then (select duty_Org_Id FROM supervision_user_complaint where id=problem_id)
|
||||
when 4 then (select dept_id FROM supervision_survey_test where id=problem_id)
|
||||
else null end ) as duty_Org_Id,
|
||||
supervision_warning_leaflet.dept_id as duty_Org_Id,
|
||||
supervision_warning_leaflet.leaflet_type,
|
||||
supervision_warning_leaflet.STATUS,
|
||||
supervision_warning_leaflet.id,
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
|
||||
<select id="getPage" resultType="com.njcn.supervision.pojo.vo.problem.SupervisionUserComplaintVO">
|
||||
select
|
||||
*
|
||||
|
||||
*
|
||||
from supervision_user_complaint supervision_user_complaint WHERE ${ew.sqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -46,6 +46,7 @@
|
||||
supervision_user_report.voltage_level,
|
||||
supervision_user_report.project_name,
|
||||
supervision_user_report.evaluation_dept,
|
||||
supervision_user_report.data_type,
|
||||
supervision_user_report.evaluation_conclusion,
|
||||
supervision_user_report.process_instance_id,
|
||||
supervision_user_report.history_instance_id,
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.supervision.service.gridDiagram;
|
||||
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.supervision.pojo.vo.gridDiagram.GridDiagramVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GridDiagramService {
|
||||
|
||||
/**
|
||||
* 技术监督首页数据展示
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
GridDiagramVO.Info getSupervisionData(StatisticsBizBaseParam param);
|
||||
|
||||
/**
|
||||
* 技术监督详细页面展示
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<GridDiagramVO.Info> getSupervisionDetailsData(StatisticsBizBaseParam param);
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.njcn.supervision.service.gridDiagram.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||
import com.njcn.supervision.pojo.po.leaflet.WarningLeaflet;
|
||||
import com.njcn.supervision.pojo.po.problem.SupervisionUserComplaintPO;
|
||||
import com.njcn.supervision.pojo.po.survey.SurveyTest;
|
||||
import com.njcn.supervision.pojo.vo.gridDiagram.GridDiagramVO;
|
||||
import com.njcn.supervision.service.gridDiagram.GridDiagramService;
|
||||
import com.njcn.supervision.service.leaflet.IWarningLeafletService;
|
||||
import com.njcn.supervision.service.problem.SupervisionUserComplaintPOService;
|
||||
import com.njcn.supervision.service.survey.ISurveyTestService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.web.utils.WebUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2024/6/13 14:53
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GridDiagramServiceImpl implements GridDiagramService {
|
||||
|
||||
private final SupervisionUserComplaintPOService userComplaintPOService;
|
||||
private final ISurveyTestService surveyTestService;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
private final IWarningLeafletService warningLeafletService;
|
||||
|
||||
|
||||
@Override
|
||||
public GridDiagramVO.Info getSupervisionData(StatisticsBizBaseParam param) {
|
||||
GridDiagramVO.Info info = new GridDiagramVO.Info();
|
||||
List<String> deptIds = deptFeignClient.getDepSonIdByDeptId(param.getId()).getData();
|
||||
return supervisionDetailsAdd(null, deptIds, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GridDiagramVO.Info> getSupervisionDetailsData(StatisticsBizBaseParam param) {
|
||||
List<GridDiagramVO.Info> info = new ArrayList<>();
|
||||
GridDiagramVO vo = new GridDiagramVO();
|
||||
//获取包括当前部门的后代所有部门信息
|
||||
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(param.getId(), WebUtil.filterDeptType()).getData();
|
||||
List<DeptDTO> directDeptInfos = deptInfos.stream()
|
||||
.filter(deptDTO -> deptDTO.getPid().equals(param.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(directDeptInfos)) {
|
||||
//没有直接子部门,获取当前部门所有信息
|
||||
List<DeptDTO> dept = deptInfos.stream()
|
||||
.filter(deptDTO -> deptDTO.getId().equals(param.getId()))
|
||||
.collect(Collectors.toList());
|
||||
info.add(supervisionDetailsAdd(dept.get(0), Collections.singletonList(param.getId()), param));
|
||||
} else {
|
||||
for (DeptDTO deptDTO : directDeptInfos) {
|
||||
//筛选上级部门pids包含该id的所有部门
|
||||
List<DeptDTO> descendantDeptDTO = deptInfos.stream()
|
||||
.filter(d -> d.getPids().contains(deptDTO.getId()))
|
||||
.collect(Collectors.toList());
|
||||
//形成需要查询监测点的部门索引
|
||||
List<String> indexes = descendantDeptDTO.stream()
|
||||
.map(DeptDTO::getId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
indexes.add(deptDTO.getId());
|
||||
info.add(supervisionDetailsAdd(deptDTO, indexes, param));
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param deptDTO 子集部门
|
||||
* @param ids 子集下所有部门信息
|
||||
* @param baseParam 查询条件
|
||||
* @return
|
||||
*/
|
||||
private GridDiagramVO.Info supervisionDetailsAdd(DeptDTO deptDTO, List<String> ids, StatisticsBizBaseParam baseParam) {
|
||||
GridDiagramVO.Info gridDiagramVO = new GridDiagramVO.Info();
|
||||
if(ObjectUtil.isNotNull(deptDTO)){
|
||||
gridDiagramVO.setOrgName(deptDTO.getName());
|
||||
}
|
||||
//todo 在线监测问题
|
||||
int onLineNum = 0;
|
||||
|
||||
gridDiagramVO.setOnLineNum(onLineNum);
|
||||
//用户投诉问题(添加出来就是有问题的)
|
||||
List<SupervisionUserComplaintPO> userComplaintList = userComplaintPOService.list(new LambdaQueryWrapper<SupervisionUserComplaintPO>()
|
||||
.in(SupervisionUserComplaintPO::getDutyOrgId, ids)
|
||||
.eq(SupervisionUserComplaintPO::getState, 1)
|
||||
.ge(StrUtil.isNotBlank(baseParam.getStartTime()), SupervisionUserComplaintPO::getCreateTime, DateUtil.beginOfDay(DateUtil.parse(baseParam.getStartTime())))
|
||||
.le(StrUtil.isNotBlank(baseParam.getEndTime()), SupervisionUserComplaintPO::getCreateTime, DateUtil.endOfDay(DateUtil.parse(baseParam.getEndTime())))
|
||||
);
|
||||
gridDiagramVO.setUserNum(userComplaintList.size());
|
||||
//计划问题(有问题的单子)
|
||||
List<SurveyTest> surveyTestList = surveyTestService.list(new LambdaQueryWrapper<SurveyTest>()
|
||||
.in(SurveyTest::getDeptId, ids)
|
||||
.eq(SurveyTest::getState, 1)
|
||||
.eq(SurveyTest::getProblemFlag, 1)
|
||||
.ge(StrUtil.isNotBlank(baseParam.getStartTime()), SurveyTest::getCreateTime, DateUtil.beginOfDay(DateUtil.parse(baseParam.getStartTime())))
|
||||
.le(StrUtil.isNotBlank(baseParam.getEndTime()), SurveyTest::getCreateTime, DateUtil.endOfDay(DateUtil.parse(baseParam.getEndTime())))
|
||||
);
|
||||
gridDiagramVO.setSurveyNum(surveyTestList.size());
|
||||
|
||||
|
||||
gridDiagramVO.setAbnormalNum(userComplaintList.size() + surveyTestList.size());
|
||||
//根据问题单id查询已关联工单
|
||||
List<String> problemIds = userComplaintList.stream().map(SupervisionUserComplaintPO::getId).collect(Collectors.toList());
|
||||
problemIds.addAll(surveyTestList.stream().map(SurveyTest::getId).collect(Collectors.toList()));
|
||||
if (CollUtil.isNotEmpty(problemIds)) {
|
||||
List<WarningLeaflet> list = warningLeafletService.list(new LambdaQueryWrapper<WarningLeaflet>()
|
||||
.in(WarningLeaflet::getProblemId, problemIds)
|
||||
.in(WarningLeaflet::getState, 1)
|
||||
);
|
||||
gridDiagramVO.setAssociatedNum(list.size());
|
||||
gridDiagramVO.setConversionNum(list.size() == 0 ? 0.0f : NumberUtil.round(list.size() * 100.0 / gridDiagramVO.getAbnormalNum(), 2).floatValue());
|
||||
List<String> handleList = list.stream().filter(x -> x.getStatus() == 2).map(WarningLeaflet::getId).collect(Collectors.toList());
|
||||
gridDiagramVO.setWorkNum(list.size());
|
||||
gridDiagramVO.setProcessedNum(handleList.size());
|
||||
gridDiagramVO.setDisposalNum(handleList.size() == 0 ? 0.0f : NumberUtil.round(handleList.size() * 100.0 / list.size(), 2).floatValue());
|
||||
|
||||
} else {
|
||||
gridDiagramVO.setAssociatedNum(0);
|
||||
gridDiagramVO.setConversionNum(0.0f);
|
||||
gridDiagramVO.setWorkNum(0);
|
||||
gridDiagramVO.setProcessedNum(0);
|
||||
gridDiagramVO.setDisposalNum(0.0f);
|
||||
}
|
||||
return gridDiagramVO;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ public class WarningLeafletServiceImpl extends ServiceImpl<WarningLeafletMapper,
|
||||
if (CollUtil.isNotEmpty(deptIds)) {
|
||||
List<Dept> data = deptFeignClient.getDeptInfoListByIds(deptIds).getData();
|
||||
Map<String, String> deptMap = data.stream().collect(Collectors.toMap(Dept::getId, Dept::getName));
|
||||
warningLeafletVOPage.getRecords().stream().peek(x -> {
|
||||
warningLeafletVOPage.getRecords().stream().forEach(x -> {
|
||||
if (deptMap.containsKey(x.getDutyOrgId())) {
|
||||
x.setDutyOrgName(deptMap.get(x.getDutyOrgId()));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.supervision.service.problem.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
@@ -14,10 +15,13 @@ import com.njcn.supervision.enums.ProblemTypeEnum;
|
||||
import com.njcn.supervision.mapper.problem.SupervisionUserComplaintPOMapper;
|
||||
import com.njcn.supervision.pojo.param.problem.SupervisionUserComplaintParam;
|
||||
import com.njcn.supervision.pojo.po.problem.SupervisionUserComplaintPO;
|
||||
import com.njcn.supervision.pojo.vo.leaflet.WarningLeafletVO;
|
||||
import com.njcn.supervision.pojo.vo.problem.SupervisionUserComplaintVO;
|
||||
import com.njcn.supervision.service.leaflet.IWarningLeafletService;
|
||||
import com.njcn.supervision.service.problem.SupervisionUserComplaintPOService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -25,7 +29,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -41,6 +47,7 @@ public class SupervisionUserComplaintPOServiceImpl extends ServiceImpl<Supervisi
|
||||
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final IWarningLeafletService warningLeafletService;
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -69,6 +76,18 @@ public class SupervisionUserComplaintPOServiceImpl extends ServiceImpl<Supervisi
|
||||
.eq("supervision_user_complaint.state",DataStateEnum.ENABLE.getCode())
|
||||
.orderByDesc("supervision_user_complaint.Update_Time");
|
||||
Page<SupervisionUserComplaintVO> page = this.baseMapper.getPage(new Page<>(PageFactory.getPageNum(supervisionUserComplaintQueryParam), PageFactory.getPageSize(supervisionUserComplaintQueryParam)), supervisionUserComplaintQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(page.getRecords())) {
|
||||
List<String> deptIds = page.getRecords().stream().distinct().map(SupervisionUserComplaintVO::getDutyOrgId).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(deptIds)) {
|
||||
List<Dept> data = deptFeignClient.getDeptInfoListByIds(deptIds).getData();
|
||||
Map<String, String> deptMap = data.stream().collect(Collectors.toMap(Dept::getId, Dept::getName));
|
||||
page.getRecords().stream().forEach(x -> {
|
||||
if (deptMap.containsKey(x.getDutyOrgId())) {
|
||||
x.setDutyOrgName(deptMap.get(x.getDutyOrgId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,4 +50,8 @@ public interface UserReportPOService extends IBpmService<UserReportPO> {
|
||||
void downloadSensitiveUserTemplate();
|
||||
|
||||
String importSensitiveUserData(MultipartFile file, HttpServletResponse response);
|
||||
|
||||
void downloadSensitiveReportTemplate();
|
||||
|
||||
String importSensitiveReportData(MultipartFile file, HttpServletResponse response);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,10 @@ 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.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -29,14 +32,15 @@ import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.supervision.enums.*;
|
||||
import com.njcn.supervision.mapper.device.SupervisionTempLineReportMapper;
|
||||
import com.njcn.supervision.mapper.user.UserReportPOMapper;
|
||||
import com.njcn.supervision.pojo.dto.SensitiveReportExcel;
|
||||
import com.njcn.supervision.pojo.dto.SensitiveUserExcel;
|
||||
import com.njcn.supervision.pojo.dto.SensitiveUserSExcel;
|
||||
import com.njcn.supervision.pojo.param.user.UserReportParam;
|
||||
import com.njcn.supervision.pojo.po.device.SupervisionTempLineReport;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportPO;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportProjectPO;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSensitivePO;
|
||||
import com.njcn.supervision.pojo.po.user.UserReportSubstationPO;
|
||||
import com.njcn.supervision.pojo.vo.survey.SurveyPlanVO;
|
||||
import com.njcn.supervision.pojo.vo.user.UserReportVO;
|
||||
import com.njcn.supervision.service.user.UserReportPOService;
|
||||
import com.njcn.supervision.service.user.UserReportProjectPOService;
|
||||
@@ -44,8 +48,10 @@ import com.njcn.supervision.service.user.UserReportSensitivePOService;
|
||||
import com.njcn.supervision.service.user.UserReportSubstationPOService;
|
||||
import com.njcn.supervision.utils.InstanceUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
@@ -86,6 +92,7 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
private final SupervisionTempLineReportMapper supervisionTempLineReportMapper;
|
||||
private final LineFeignClient lineFeignClient;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -164,15 +171,15 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
public String updateUserReport(UserReportParam.UserReportUpdate userReportParam) {
|
||||
UserReportPO userReportPO = this.baseMapper.selectById(userReportParam.getId());
|
||||
//判断是否有权限操作
|
||||
InstanceUtil.judgeUserPower(RequestUtil.getUserIndex(),userReportPO.getCreateBy());
|
||||
if(Objects.equals(userReportPO.getStatus(), BpmTaskStatusEnum.APPROVE.getStatus())){
|
||||
InstanceUtil.judgeUserPower(RequestUtil.getUserIndex(), userReportPO.getCreateBy());
|
||||
if (Objects.equals(userReportPO.getStatus(), BpmTaskStatusEnum.APPROVE.getStatus())) {
|
||||
throw new BusinessException("当前流程以完成审批,无法重新发起");
|
||||
}
|
||||
|
||||
//处理历史流程id列表
|
||||
String historyInstanceIds = InstanceUtil.dealHistoryId(userReportPO.getProcessInstanceId(), userReportPO.getHistoryInstanceId());
|
||||
|
||||
BeanUtil.copyProperties(userReportParam,userReportPO);
|
||||
BeanUtil.copyProperties(userReportParam, userReportPO);
|
||||
|
||||
if (
|
||||
CollectionUtil.newArrayList(
|
||||
@@ -205,7 +212,6 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 发起 BPM 流程
|
||||
Map<String, Object> processInstanceVariables = new HashMap<>();
|
||||
BpmProcessInstanceCreateReqDTO bpmProcessInstanceCreateReqDTO = new BpmProcessInstanceCreateReqDTO();
|
||||
@@ -270,20 +276,23 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
List<String> colleaguesIds = userFeignClient.getColleaguesIdByUserId(RequestUtil.getUserIndex()).getData();
|
||||
userReportVOQueryWrapper.in("supervision_user_report.create_by", colleaguesIds)
|
||||
.eq("supervision_user_report.state", DataStateEnum.ENABLE.getCode())
|
||||
.eq("supervision_user_report.data_type",0);
|
||||
.eq("supervision_user_report.data_type", 0);
|
||||
if (Objects.nonNull(userReportQueryParam)) {
|
||||
if (StrUtil.isNotBlank(userReportQueryParam.getCity())) {
|
||||
//查询所有区域下的数据
|
||||
userReportVOQueryWrapper.in("supervision_user_report.city", userReportQueryParam.getCity());
|
||||
}
|
||||
if(Objects.nonNull(userReportQueryParam.getStatus())){
|
||||
if (Objects.nonNull(userReportQueryParam.getStatus())) {
|
||||
userReportVOQueryWrapper.eq("supervision_user_report.status", userReportQueryParam.getStatus());
|
||||
}
|
||||
userReportVOQueryWrapper.like(StringUtils.isNotBlank(userReportQueryParam.getProjectName()), "supervision_user_report.project_name", userReportQueryParam.getProjectName());
|
||||
//添加上时间范围
|
||||
// userReportVOQueryWrapper.between("supervision_user_report.Create_Time",
|
||||
// DateUtil.beginOfDay(DateUtil.parse(userReportQueryParam.getSearchBeginTime())),
|
||||
// DateUtil.endOfDay(DateUtil.parse(userReportQueryParam.getSearchEndTime())));
|
||||
if(StrUtil.isNotBlank(userReportQueryParam.getSearchBeginTime())&&StrUtil.isNotBlank(userReportQueryParam.getSearchEndTime())){
|
||||
userReportVOQueryWrapper.between("supervision_user_report.expected_production_date",
|
||||
DateUtil.beginOfDay(DateUtil.parse(userReportQueryParam.getSearchBeginTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(userReportQueryParam.getSearchEndTime())));
|
||||
}
|
||||
userReportVOQueryWrapper.orderByDesc("supervision_user_report.Update_Time");
|
||||
}
|
||||
userReportVOQueryWrapper.orderByDesc("supervision_user_report.create_time");
|
||||
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(userReportQueryParam), PageFactory.getPageSize(userReportQueryParam)), userReportVOQueryWrapper);
|
||||
@@ -364,7 +373,7 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
|
||||
List<UserReportPO> list = this.lambdaQuery()
|
||||
.eq(UserReportPO::getStatus, 2)
|
||||
.eq(UserReportPO::getDataType,0)
|
||||
.eq(UserReportPO::getDataType, 0)
|
||||
.in(CollectionUtil.isNotEmpty(data), UserReportPO::getOrgId, data)
|
||||
.list();
|
||||
List<UserReportVO> collect = list.stream().map(temp -> {
|
||||
@@ -397,7 +406,12 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
userReportVOQueryWrapper.eq("data_type", userReportQueryParam.getDataType());
|
||||
}
|
||||
userReportVOQueryWrapper.like(StringUtils.isNotBlank(userReportQueryParam.getProjectName()), "supervision_user_report.project_name", userReportQueryParam.getProjectName());
|
||||
|
||||
if(StrUtil.isNotBlank(userReportQueryParam.getSearchBeginTime())&&StrUtil.isNotBlank(userReportQueryParam.getSearchEndTime())){
|
||||
userReportVOQueryWrapper.between("supervision_user_report.expected_production_date",
|
||||
DateUtil.beginOfDay(DateUtil.parse(userReportQueryParam.getSearchBeginTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(userReportQueryParam.getSearchEndTime())));
|
||||
}
|
||||
userReportVOQueryWrapper.orderByDesc("supervision_user_report.Update_Time");
|
||||
}
|
||||
userReportVOQueryWrapper.orderByDesc("supervision_user_report.create_time");
|
||||
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(userReportQueryParam), PageFactory.getPageSize(userReportQueryParam)), userReportVOQueryWrapper);
|
||||
@@ -421,7 +435,7 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateUserStatus(String lineId, Integer userStatus) {
|
||||
SupervisionTempLineReport supervisionTempLineReport = supervisionTempLineReportMapper.selectById(lineId);
|
||||
if(Objects.nonNull(supervisionTempLineReport)) {
|
||||
if (Objects.nonNull(supervisionTempLineReport)) {
|
||||
String userId = supervisionTempLineReport.getUserId();
|
||||
UserReportPO userReportPO = this.baseMapper.selectById(userId);
|
||||
//如果目前的干扰源用户状态>userStatus则不修改,如果将干扰源用户状态改为3退运,则必须其下的监测点都退运才能修改
|
||||
@@ -481,55 +495,108 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
|
||||
@Override
|
||||
public void downloadSensitiveUserTemplate() {
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setSheetName("敏感及重要用户");
|
||||
ExportParams exportParams = new ExportParams("敏感及重要用户数据模板(带*字段均是必填,请严格按照模板标准填入数据)", "敏感及重要用户数据信息");
|
||||
//所属地市
|
||||
List<DictData> jiBeiArea = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.JIBEI_AREA.getCode()).getData();
|
||||
//电压等级
|
||||
List<DictData> devVoltage = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
//评估单位
|
||||
List<DictData> evaluationDept;
|
||||
evaluationDept = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVALUATION_DEPT.getCode()).getData();
|
||||
//评估类型
|
||||
List<DictData> evaluationType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVALUATION_TYPE.getCode()).getData();
|
||||
//指标类型
|
||||
List<DictData> indicatorType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.INDICATOR_TYPE.getCode()).getData();
|
||||
//行业类型
|
||||
List<DictData> industryType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.INDUSTRY_TYPE_JB.getCode()).getData();
|
||||
//负荷级别
|
||||
List<DictData> loadLevel = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LOAD_LEVEL.getCode()).getData();
|
||||
//供电电源情况
|
||||
List<DictData> supplyCondition = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPPLY_CONDITION.getCode()).getData();
|
||||
|
||||
List<PullDown> pullDowns = new ArrayList<>();
|
||||
|
||||
|
||||
PullDown pullDown;
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(2);
|
||||
pullDown.setLastCol(2);
|
||||
pullDown.setFirstCol(1);
|
||||
pullDown.setLastCol(1);
|
||||
pullDown.setStrings(jiBeiArea.stream().filter(x -> !x.getName().equals("风光储")&&!x.getName().equals("超高压")).map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(3);
|
||||
pullDown.setLastCol(3);
|
||||
pullDown.setStrings(Stream.of("可研", "建设", "运行", "退运").collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(4);
|
||||
pullDown.setLastCol(4);
|
||||
pullDown.setFirstCol(6);
|
||||
pullDown.setLastCol(6);
|
||||
pullDown.setStrings(devVoltage.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(5);
|
||||
pullDown.setLastCol(5);
|
||||
pullDown.setFirstCol(7);
|
||||
pullDown.setLastCol(7);
|
||||
pullDown.setStrings(evaluationDept.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(12);
|
||||
pullDown.setLastCol(12);
|
||||
pullDown.setStrings(evaluationType.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(13);
|
||||
pullDown.setLastCol(13);
|
||||
pullDown.setStrings(industryType.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(8);
|
||||
pullDown.setLastCol(8);
|
||||
pullDown.setFirstCol(16);
|
||||
pullDown.setLastCol(16);
|
||||
pullDown.setStrings(indicatorType.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(22);
|
||||
pullDown.setLastCol(22);
|
||||
pullDown.setStrings(supplyCondition.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(20);
|
||||
pullDown.setLastCol(20);
|
||||
pullDown.setStrings(devVoltage.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(9);
|
||||
pullDown.setLastCol(9);
|
||||
pullDown.setFirstCol(21);
|
||||
pullDown.setLastCol(21);
|
||||
pullDown.setStrings(loadLevel.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(10);
|
||||
pullDown.setLastCol(10);
|
||||
pullDown.setStrings(supplyCondition.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDown.setStrings(Stream.of("否", "是").collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
ExcelUtil.exportExcelPullDownOne(exportParams, "敏感及重要用户模板.xlsx", pullDowns, SensitiveUserExcel.class, new ArrayList<>());
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(11);
|
||||
pullDown.setLastCol(11);
|
||||
pullDown.setStrings(Stream.of("否", "是").collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(17);
|
||||
pullDown.setLastCol(17);
|
||||
pullDown.setStrings(Stream.of("否", "是").collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
ExcelUtil.exportExcelPullDown(exportParams, "敏感及重要用户模板.xlsx", pullDowns, SensitiveUserSExcel.class, new ArrayList<>());
|
||||
|
||||
}
|
||||
|
||||
@@ -538,13 +605,13 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
public String importSensitiveUserData(MultipartFile file, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setHeadRows(1);//表头
|
||||
// params.setTitleRows(1);//标题
|
||||
params.setTitleRows(1);//标题
|
||||
params.setNeedVerify(true);
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
List<SensitiveUserExcel> sensitiveUserExcels;
|
||||
List<SensitiveUserSExcel> sensitiveUserExcels;
|
||||
try {
|
||||
ExcelImportResult<SensitiveUserExcel> sensitiveUserExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SensitiveUserExcel.class, params);
|
||||
ExcelImportResult<SensitiveUserSExcel> sensitiveUserExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SensitiveUserSExcel.class, params);
|
||||
//如果存在非法数据,将不合格的数据导出
|
||||
if (sensitiveUserExcelExcelImportResult.isVerifyFail()) {
|
||||
PoiUtil.exportFileByWorkbook(sensitiveUserExcelExcelImportResult.getFailWorkbook(), "非法用户数据.xlsx", response);
|
||||
@@ -555,72 +622,300 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(SupervisionResponseEnum.IMPORT_SENSITIVE_USER_ERROR);
|
||||
}
|
||||
//电压等级
|
||||
List<DictData> devVoltage = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
//指标类型
|
||||
List<DictData> indicatorType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.INDICATOR_TYPE.getCode()).getData();
|
||||
//评估类型
|
||||
List<DictData> evaluationType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVALUATION_TYPE.getCode()).getData();
|
||||
//行业类型
|
||||
List<DictData> industryType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.INDUSTRY_TYPE_JB.getCode()).getData();
|
||||
//负荷级别
|
||||
List<DictData> loadLevel = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.LOAD_LEVEL.getCode()).getData();
|
||||
//供电电源情况
|
||||
List<DictData> supplyCondition = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPPLY_CONDITION.getCode()).getData();
|
||||
|
||||
//执行批量导入敏感及重要用户,入库过程中会进行数据校验
|
||||
List<SensitiveUserExcel.SensitiveUserExcelMsg> sensitiveUserExcelMsgs = new ArrayList<>();
|
||||
List<SensitiveUserSExcel.SensitiveUserExcelMsg> sensitiveUserExcelMsgs = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(sensitiveUserExcels)) {
|
||||
for (SensitiveUserExcel sensitiveUserExcel : sensitiveUserExcels) {
|
||||
for (SensitiveUserSExcel userExcel : sensitiveUserExcels) {
|
||||
//先判断当前用户是否已经存在
|
||||
LambdaQueryWrapper<UserReportPO> userReportPOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userReportPOLambdaQueryWrapper.eq(UserReportPO::getProjectName, sensitiveUserExcel.getProjectName())
|
||||
userReportPOLambdaQueryWrapper.eq(UserReportPO::getProjectName, userExcel.getProjectName())
|
||||
.eq(UserReportPO::getState, DataStateEnum.ENABLE.getCode());
|
||||
int count = this.count(userReportPOLambdaQueryWrapper);
|
||||
if (count > 0) {
|
||||
// if(sensitiveUserExcel.getOverlay() == 1){
|
||||
//
|
||||
// }else{
|
||||
//该用户已经录入
|
||||
SensitiveUserExcel.SensitiveUserExcelMsg sensitiveUserExcelMsg = new SensitiveUserExcel.SensitiveUserExcelMsg();
|
||||
BeanUtils.copyProperties(sensitiveUserExcel, sensitiveUserExcelMsg);
|
||||
SensitiveUserSExcel.SensitiveUserExcelMsg sensitiveUserExcelMsg = new SensitiveUserSExcel.SensitiveUserExcelMsg();
|
||||
BeanUtils.copyProperties(userExcel, sensitiveUserExcelMsg);
|
||||
sensitiveUserExcelMsg.setMsg("该用户已录入!");
|
||||
sensitiveUserExcelMsgs.add(sensitiveUserExcelMsg);
|
||||
// }
|
||||
continue;
|
||||
}
|
||||
//处理通用信息
|
||||
UserReportPO userReportPO = new UserReportPO();
|
||||
userReportPO.setReporter(RequestUtil.getUserIndex());
|
||||
userReportPO.setReportDate(LocalDate.now());
|
||||
userReportPO.setOrgId(RequestUtil.getDeptIndex());
|
||||
userReportPO.setCity(sensitiveUserExcel.getCity());
|
||||
userReportPO.setUserType(UserNatureEnum.SENSITIVE_USER.getCode());
|
||||
if(Objects.nonNull(sensitiveUserExcel.getUserStatus())){
|
||||
userReportPO.setUserStatus(sensitiveUserExcel.getUserStatus());
|
||||
}else{
|
||||
userReportPO.setUserStatus(SupervisionUserStatusEnum.PRODUCT.getCode());
|
||||
//处理通用信息
|
||||
UserReportPO userReportPO = new UserReportPO();
|
||||
userReportPO.setReporter(RequestUtil.getUserIndex());
|
||||
userReportPO.setReportDate(LocalDate.now());
|
||||
userReportPO.setOrgId(RequestUtil.getDeptIndex());
|
||||
userReportPO.setExpectedProductionDate(userExcel.getExpectedProductionDate());
|
||||
userReportPO.setUserType(UserNatureEnum.SENSITIVE_USER.getCode());
|
||||
//所属地市
|
||||
userReportPO.setCity(userExcel.getCity());
|
||||
userReportPO.setResponsibleDepartment(userExcel.getResponsibleDepartment());
|
||||
userReportPO.setUserStatus(userExcel.getUserStatus());
|
||||
userReportPO.setSubstation(userExcel.getSubstation());
|
||||
userReportPO.setVoltageLevel(PubUtil.getDicById(userExcel.getVoltageLevel(), devVoltage));
|
||||
userReportPO.setProjectName(userExcel.getProjectName());
|
||||
userReportPO.setEvaluationDept(userExcel.getEvaluationDept());
|
||||
userReportPO.setEvaluationConclusion(userExcel.getEvaluationConclusion());
|
||||
userReportPO.setDataType(1);
|
||||
userReportPO.setStatus(2);
|
||||
userReportPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.baseMapper.insert(userReportPO);
|
||||
//处理敏感用户的信息
|
||||
UserReportSensitivePO userReportSensitivePO = new UserReportSensitivePO();
|
||||
userReportSensitivePO.setId(userReportPO.getId());
|
||||
userReportSensitivePO.setPccPoint(userExcel.getPccPoint());
|
||||
userReportSensitivePO.setDeviceName(userExcel.getDeviceName());
|
||||
userReportSensitivePO.setPowerSupplyCount(userExcel.getPowerSupplyCount());
|
||||
userReportSensitivePO.setEnergyQualityIndex(PubUtil.getDicById(userExcel.getEnergyQualityIndex(), indicatorType));
|
||||
userReportSensitivePO.setEvaluationType(PubUtil.getDicById(userExcel.getEvaluationType(), evaluationType));
|
||||
userReportSensitivePO.setAntiInterferenceTest(userExcel.getAntiInterferenceTest()+"");
|
||||
userReportSensitivePO.setEvaluationChekDept(userExcel.getEvaluationChekDept());
|
||||
userReportSensitivePO.setNeedGovernance(userExcel.getNeedGovernance());
|
||||
userReportSensitivePO.setBackgroundTestPerformed(userExcel.getBackgroundTestPerformed());
|
||||
// userReportSensitivePO.setSubstationMainWiringDiagram();
|
||||
// userReportSensitivePO.setSensitiveDevices();
|
||||
// userReportSensitivePO.setAntiInterferenceReport();
|
||||
// userReportSensitivePO.setPowerQualityReport();
|
||||
// userReportSensitivePO.setFeasibilityReport();
|
||||
// userReportSensitivePO.setPreliminaryDesignDescription();
|
||||
// userReportSensitivePO.setPredictionEvaluationReport();
|
||||
// userReportSensitivePO.setPredictionEvaluationReviewOpinions();
|
||||
// userReportSensitivePO.setAdditionalAttachments();
|
||||
if (StrUtil.isNotBlank(userExcel.getIndustry())) {
|
||||
userReportSensitivePO.setIndustry(PubUtil.getDicById(userExcel.getIndustry(), industryType));
|
||||
}
|
||||
userReportSensitivePO.setMaintenanceUnit(userExcel.getMaintenanceUnit());
|
||||
userReportSensitivePO.setPowerSupply(userExcel.getPowerSupply());
|
||||
if (StrUtil.isNotBlank(userExcel.getSupplyVoltageLevel())) {
|
||||
userReportSensitivePO.setSupplyVoltageLevel(PubUtil.getDicById(userExcel.getSupplyVoltageLevel(), devVoltage));
|
||||
}
|
||||
if (StrUtil.isNotBlank(userExcel.getLoadLevel())) {
|
||||
userReportSensitivePO.setLoadLevel(PubUtil.getDicById(userExcel.getLoadLevel(), loadLevel));
|
||||
}
|
||||
if (StrUtil.isNotBlank(userExcel.getPowerSupplyInfo())) {
|
||||
userReportSensitivePO.setPowerSupplyInfo(PubUtil.getDicById(userExcel.getPowerSupplyInfo(), supplyCondition));
|
||||
}
|
||||
userReportSensitivePO.setState(DataStateEnum.ENABLE.getCode());
|
||||
userReportSensitivePOService.save(userReportSensitivePO);
|
||||
}
|
||||
userReportPO.setSubstation(sensitiveUserExcel.getSubstation());
|
||||
//电压等级需要特殊处理下
|
||||
if (StrUtil.isNotBlank(sensitiveUserExcel.getVoltageLevel())) {
|
||||
userReportPO.setVoltageLevel(PubUtil.getDicById(sensitiveUserExcel.getVoltageLevel(), devVoltage));
|
||||
}
|
||||
}
|
||||
//判断有没有错误信息
|
||||
if (CollectionUtil.isNotEmpty(sensitiveUserExcelMsgs)) {
|
||||
ExcelUtil.exportExcel("失败列表.xlsx", SensitiveUserSExcel.SensitiveUserExcelMsg.class, sensitiveUserExcelMsgs);
|
||||
return null;
|
||||
}
|
||||
return CommonResponseEnum.SUCCESS.getCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadSensitiveReportTemplate() {
|
||||
ExportParams exportParams = new ExportParams("干扰源用户数据模板(带*字段均是必填,请严格按照模板标准填入数据)", "干扰源用户数据信息");
|
||||
//所属地市
|
||||
List<DictData> jiBeiArea = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.JIBEI_AREA.getCode()).getData();
|
||||
//主要非线性设备类型-冀北
|
||||
List<SysDicTreePO> treeVOS = dictTreeFeignClient.queryByCodeList(DicDataTypeEnum.Major_Nonlinear_Device.getCode()).getData();
|
||||
//电压等级
|
||||
List<DictData> devVoltage = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
//评估单位
|
||||
List<DictData> evaluationDept = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVALUATION_DEPT.getCode()).getData();
|
||||
//评估类型
|
||||
List<DictData> evaluationType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVALUATION_TYPE.getCode()).getData();
|
||||
|
||||
Map<String, String> treeString = getTreeString("", treeVOS.get(0).getChildren());
|
||||
|
||||
List<PullDown> pullDowns = new ArrayList<>();
|
||||
PullDown pullDown;
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(1);
|
||||
pullDown.setLastCol(1);
|
||||
pullDown.setStrings(Stream.of("新建电网工程", "扩建电网工程", "新建非线性负荷用户", "扩建非线性负荷用户", "新建新能源发电站", "扩建新能源发电站").collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(2);
|
||||
pullDown.setLastCol(2);
|
||||
pullDown.setStrings(jiBeiArea.stream().filter(x -> !"风光储".equals(x.getName())&&!"超高压".equals(x.getName())).map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(4);
|
||||
pullDown.setLastCol(4);
|
||||
pullDown.setStrings(Stream.of("可研", "建设", "运行", "退运").collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(7);
|
||||
pullDown.setLastCol(7);
|
||||
pullDown.setStrings(devVoltage.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(8);
|
||||
pullDown.setLastCol(8);
|
||||
pullDown.setStrings(evaluationDept.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(15);
|
||||
pullDown.setLastCol(15);
|
||||
pullDown.setStrings(evaluationType.stream().map(DictData::getName).collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(16);
|
||||
pullDown.setLastCol(16);
|
||||
pullDown.setStrings(treeString.keySet().stream().collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(18);
|
||||
pullDown.setLastCol(18);
|
||||
pullDown.setStrings(Stream.of("否", "是").collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
pullDown = new PullDown();
|
||||
pullDown.setFirstCol(19);
|
||||
pullDown.setLastCol(19);
|
||||
pullDown.setStrings(Stream.of("否", "是").collect(Collectors.toList()));
|
||||
pullDowns.add(pullDown);
|
||||
|
||||
ExcelUtil.exportExcelPullDown(exportParams, "干扰源用户用户模板.xlsx", pullDowns, SensitiveReportExcel.class, new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String importSensitiveReportData(MultipartFile file, HttpServletResponse response) {
|
||||
ImportParams params = new ImportParams();
|
||||
params.setHeadRows(1);//表头
|
||||
params.setTitleRows(1);//标题
|
||||
params.setNeedVerify(true);
|
||||
params.setStartSheetIndex(0);
|
||||
params.setSheetNum(1);
|
||||
List<SensitiveReportExcel> sensitiveUserExcels;
|
||||
try {
|
||||
ExcelImportResult<SensitiveReportExcel> sensitiveUserExcelExcelImportResult = ExcelImportUtil.importExcelMore(file.getInputStream(), SensitiveReportExcel.class, params);
|
||||
//如果存在非法数据,将不合格的数据导出
|
||||
if (sensitiveUserExcelExcelImportResult.isVerifyFail()) {
|
||||
PoiUtil.exportFileByWorkbook(sensitiveUserExcelExcelImportResult.getFailWorkbook(), "非法用户数据.xlsx", response);
|
||||
return null;
|
||||
} else {
|
||||
sensitiveUserExcels = sensitiveUserExcelExcelImportResult.getList();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(SupervisionResponseEnum.IMPORT_SENSITIVE_USER_ERROR);
|
||||
}
|
||||
//主要非线性设备类型-冀北
|
||||
List<SysDicTreePO> treeVOS = dictTreeFeignClient.queryByCodeList(DicDataTypeEnum.Major_Nonlinear_Device.getCode()).getData();
|
||||
//电压等级
|
||||
List<DictData> devVoltage = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
|
||||
Map<String, String> treeString = getTreeString("", treeVOS.get(0).getChildren());
|
||||
//评估类型
|
||||
List<DictData> evaluationType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.EVALUATION_TYPE.getCode()).getData();
|
||||
|
||||
//执行批量导入敏感及重要用户,入库过程中会进行数据校验
|
||||
List<SensitiveReportExcel.SensitiveReportExcelMsg> sensitiveUserExcelMsgs = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(sensitiveUserExcels)) {
|
||||
for (SensitiveReportExcel reportExcel : sensitiveUserExcels) {
|
||||
//先判断当前用户是否已经存在
|
||||
LambdaQueryWrapper<UserReportPO> userReportPOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
userReportPOLambdaQueryWrapper.eq(UserReportPO::getProjectName, reportExcel.getProjectName())
|
||||
.eq(UserReportPO::getState, DataStateEnum.ENABLE.getCode());
|
||||
int count = this.count(userReportPOLambdaQueryWrapper);
|
||||
if (count > 0) {
|
||||
//该用户已经录入
|
||||
SensitiveReportExcel.SensitiveReportExcelMsg sensitiveUserExcelMsg = new SensitiveReportExcel.SensitiveReportExcelMsg();
|
||||
BeanUtils.copyProperties(reportExcel, sensitiveUserExcelMsg);
|
||||
sensitiveUserExcelMsg.setMsg("该用户已录入!");
|
||||
sensitiveUserExcelMsgs.add(sensitiveUserExcelMsg);
|
||||
} else {
|
||||
//处理通用信息
|
||||
UserReportPO userReportPO = new UserReportPO();
|
||||
userReportPO.setReporter(RequestUtil.getUserIndex());
|
||||
userReportPO.setReportDate(LocalDate.now());
|
||||
userReportPO.setOrgId(RequestUtil.getDeptIndex());
|
||||
userReportPO.setExpectedProductionDate(reportExcel.getExpectedProductionDate());
|
||||
userReportPO.setUserType(reportExcel.getUserType());
|
||||
//所属地市
|
||||
userReportPO.setCity(reportExcel.getCity());
|
||||
userReportPO.setResponsibleDepartment(reportExcel.getResponsibleDepartment());
|
||||
userReportPO.setUserStatus(reportExcel.getUserStatus());
|
||||
userReportPO.setSubstation(reportExcel.getSubstation());
|
||||
userReportPO.setVoltageLevel(PubUtil.getDicById(reportExcel.getVoltageLevel(), devVoltage));
|
||||
userReportPO.setProjectName(reportExcel.getProjectName());
|
||||
userReportPO.setEvaluationDept(reportExcel.getEvaluationDept());
|
||||
userReportPO.setEvaluationConclusion(reportExcel.getEvaluationConclusion());
|
||||
userReportPO.setDataType(1);
|
||||
userReportPO.setStatus(2);
|
||||
userReportPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.baseMapper.insert(userReportPO);
|
||||
if (CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_POWER_GRID.getCode(),
|
||||
UserNatureEnum.EXTEND_POWER_GRID.getCode()
|
||||
).contains(userReportPO.getUserType())) {
|
||||
//电网工程类用户额外数据
|
||||
UserReportProjectPO userReportProjectPO = new UserReportProjectPO();
|
||||
userReportProjectPO.setId(userReportPO.getId());
|
||||
if(ObjectUtil.isNotEmpty(reportExcel.getNonlinearLoadType())){
|
||||
userReportProjectPO.setAgreementCapacity(reportExcel.getUserAgreementCapacity().doubleValue());
|
||||
}
|
||||
if(StrUtil.isNotBlank(reportExcel.getNonlinearLoadType())){
|
||||
userReportProjectPO.setNonlinearDeviceType(treeString.containsKey(reportExcel.getNonlinearLoadType()) ? treeString.get(reportExcel.getNonlinearLoadType()) : null);
|
||||
}
|
||||
|
||||
userReportProjectPO.setNeedGovernance(reportExcel.getNeedGovernance());
|
||||
userReportProjectPO.setBackgroundTestPerformed(reportExcel.getBackgroundTestPerformed());
|
||||
// userReportProjectPO.setFeasibilityReport();
|
||||
// userReportProjectPO.setPreliminaryDesignDescription();
|
||||
// userReportProjectPO.setPredictionEvaluationReport();
|
||||
// userReportProjectPO.setPredictionEvaluationReviewOpinions();
|
||||
// userReportProjectPO.setAdditionalAttachments();
|
||||
userReportProjectPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
userReportProjectPOService.saveOrUpdate(userReportProjectPO);
|
||||
}
|
||||
if (CollectionUtil.newArrayList(
|
||||
UserNatureEnum.BUILD_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.EXTEND_NON_LINEAR_LOAD.getCode(),
|
||||
UserNatureEnum.BUILD_NEW_ENERGY_POWER_STATION.getCode(),
|
||||
UserNatureEnum.EXTEND_NEW_ENERGY_POWER_STATION.getCode()
|
||||
).contains(userReportPO.getUserType())) {
|
||||
//非线性负荷用户 & 新能源发电站用户
|
||||
UserReportSubstationPO userReportSubstationPO = new UserReportSubstationPO();
|
||||
userReportSubstationPO.setId(userReportPO.getId());
|
||||
userReportSubstationPO.setPccPoint(reportExcel.getPccPoint());
|
||||
userReportSubstationPO.setBaseShortCircuitCapacity(reportExcel.getBaseShortCircuitCapacity());
|
||||
userReportSubstationPO.setMinShortCircuitCapacity(reportExcel.getMinShortCircuitCapacity());
|
||||
userReportSubstationPO.setPccEquipmentCapacity(reportExcel.getPccEquipmentCapacity());
|
||||
userReportSubstationPO.setUserAgreementCapacity(reportExcel.getUserAgreementCapacity());
|
||||
userReportSubstationPO.setEvaluationType(PubUtil.getDicById(reportExcel.getEvaluationType(), evaluationType));
|
||||
if(StrUtil.isNotBlank(reportExcel.getNonlinearLoadType())){
|
||||
userReportSubstationPO.setNonlinearLoadType(treeString.containsKey(reportExcel.getNonlinearLoadType()) ? treeString.get(reportExcel.getNonlinearLoadType()) : null);
|
||||
}
|
||||
userReportSubstationPO.setEvaluationChekDept(reportExcel.getEvaluationChekDept());
|
||||
userReportSubstationPO.setNeedGovernance(reportExcel.getNeedGovernance());
|
||||
userReportSubstationPO.setBackgroundTestPerformed(reportExcel.getBackgroundTestPerformed());
|
||||
// userReportSubstationPO.setSubstationMainWiringDiagram();
|
||||
// userReportSubstationPO.setFeasibilityReport();
|
||||
// userReportSubstationPO.setPreliminaryDesignDescription();
|
||||
// userReportSubstationPO.setPredictionEvaluationReport();
|
||||
// userReportSubstationPO.setPredictionEvaluationReviewOpinions();
|
||||
// userReportSubstationPO.setAdditionalAttachments();
|
||||
userReportSubstationPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
userReportSubstationPOService.saveOrUpdate(userReportSubstationPO);
|
||||
}
|
||||
}
|
||||
userReportPO.setProjectName(sensitiveUserExcel.getProjectName());
|
||||
userReportPO.setDataType(1);
|
||||
userReportPO.setStatus(2);
|
||||
userReportPO.setState(DataStateEnum.ENABLE.getCode());
|
||||
this.baseMapper.insert(userReportPO);
|
||||
//处理敏感用户的信息
|
||||
UserReportSensitivePO userReportSensitivePO = new UserReportSensitivePO();
|
||||
userReportSensitivePO.setId(userReportPO.getId());
|
||||
if (StrUtil.isNotBlank(sensitiveUserExcel.getIndustry())) {
|
||||
userReportSensitivePO.setIndustry(PubUtil.getDicById(sensitiveUserExcel.getIndustry(), industryType));
|
||||
}
|
||||
userReportSensitivePO.setMaintenanceUnit(sensitiveUserExcel.getMaintenanceUnit());
|
||||
userReportSensitivePO.setPowerSupply(sensitiveUserExcel.getPowerSupply());
|
||||
if (StrUtil.isNotBlank(sensitiveUserExcel.getSupplyVoltageLevel())) {
|
||||
userReportSensitivePO.setSupplyVoltageLevel(PubUtil.getDicById(sensitiveUserExcel.getSupplyVoltageLevel(), devVoltage));
|
||||
}
|
||||
if (StrUtil.isNotBlank(sensitiveUserExcel.getLoadLevel())) {
|
||||
userReportSensitivePO.setLoadLevel(PubUtil.getDicById(sensitiveUserExcel.getLoadLevel(), loadLevel));
|
||||
}
|
||||
if (StrUtil.isNotBlank(sensitiveUserExcel.getPowerSupplyInfo())) {
|
||||
userReportSensitivePO.setPowerSupplyInfo(PubUtil.getDicById(sensitiveUserExcel.getPowerSupplyInfo(), supplyCondition));
|
||||
}
|
||||
userReportSensitivePO.setState(DataStateEnum.ENABLE.getCode());
|
||||
userReportSensitivePOService.save(userReportSensitivePO);
|
||||
}
|
||||
}
|
||||
//判断有没有错误信息
|
||||
@@ -631,6 +926,20 @@ public class UserReportPOServiceImpl extends ServiceImpl<UserReportPOMapper, Use
|
||||
return CommonResponseEnum.SUCCESS.getCode();
|
||||
}
|
||||
|
||||
public Map<String,String> getTreeString(String name, List<SysDicTreePO> treeVOS) {
|
||||
Map<String,String> info = new LinkedHashMap<>();
|
||||
for (SysDicTreePO sysMenuDtoChild : treeVOS) {
|
||||
if (sysMenuDtoChild.getLevel() == 3) {
|
||||
name = sysMenuDtoChild.getId()+"-"+sysMenuDtoChild.getName();
|
||||
}
|
||||
if (CollUtil.isNotEmpty(sysMenuDtoChild.getChildren())) {
|
||||
info.putAll(getTreeString(name, sysMenuDtoChild.getChildren()));
|
||||
} else {
|
||||
info.put(name.split("-")[1],name.split("-")[0]);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有字段为null的属性名
|
||||
|
||||
@@ -23,16 +23,19 @@ public interface DictTreeFeignClient {
|
||||
HttpResult<SysDicTreePO> queryById(@RequestParam("id") String id);
|
||||
|
||||
@PostMapping("/queryByCode")
|
||||
HttpResult<DictTreeVO> queryByCode(@RequestParam("code") String code) ;
|
||||
HttpResult<DictTreeVO> queryByCode(@RequestParam("code") String code);
|
||||
|
||||
@PostMapping("/query")
|
||||
HttpResult<List<DictTreeVO>> query(@RequestParam("pid") String pid) ;
|
||||
HttpResult<List<DictTreeVO>> query(@RequestParam("pid") String pid);
|
||||
|
||||
@PostMapping("/queryByCodeList")
|
||||
HttpResult<List<SysDicTreePO>> queryByCodeList(@RequestParam("code") String code);
|
||||
|
||||
@GetMapping("/queryAll")
|
||||
HttpResult<List<SysDicTreePO>> queryAll() ;
|
||||
HttpResult<List<SysDicTreePO>> queryAll();
|
||||
|
||||
@GetMapping("/queryAllByType")
|
||||
HttpResult<List<SysDicTreePO>> queryAllByType(@RequestParam("type")Integer type) ;
|
||||
HttpResult<List<SysDicTreePO>> queryAllByType(@RequestParam("type")Integer type);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class DictTreeFeignClientFallbackFactory implements FallbackFactory<DictT
|
||||
public DictTreeFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if(cause.getCause() instanceof BusinessException){
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
exceptionEnum = SystemEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
@@ -36,36 +36,43 @@ public class DictTreeFeignClientFallbackFactory implements FallbackFactory<DictT
|
||||
return new DictTreeFeignClient() {
|
||||
@Override
|
||||
public HttpResult<SysDicTreePO> queryById(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据字典id获取字典数据",cause.toString());
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据字典id获取字典数据", cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<DictTreeVO> queryByCode(String code) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据字典code获取字典树数据",cause.toString());
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据字典code获取字典树数据", cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<DictTreeVO>> query(String pid) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据字典pid获取字典树数据",cause.toString());
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据字典pid获取字典树数据", cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<SysDicTreePO>> queryByCodeList(String code) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "根据字典code获取字典树数据", cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<SysDicTreePO>> queryAll() {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取所有字典树数据",cause.toString());
|
||||
log.error("{}异常,降级处理,异常为:{}", "获取所有字典树数据", cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<SysDicTreePO>> queryAllByType(Integer type) {
|
||||
log.error("{}异常,降级处理,异常为:{}","分类获取所有字典树数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum); }
|
||||
log.error("{}异常,降级处理,异常为:{}", "分类获取所有字典树数据", cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<SysDicTreePO>> queryTree() {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取树形数据",cause.toString());
|
||||
log.error("{}异常,降级处理,异常为:{}", "获取树形数据", cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -136,6 +136,10 @@ public enum DicDataTypeEnum {
|
||||
LOAD_LEVEL("负荷级别","load_level"),
|
||||
SUPPLY_CONDITION("供电电源情况","supply_condition"),
|
||||
|
||||
JIBEI_AREA("供电电源情况","jibei_area"),
|
||||
Major_Nonlinear_Device("主要非线性设备类型","Major_Nonlinear_Device"),
|
||||
EVALUATION_DEPT("主要非线性设备类型","evaluation_dept"),
|
||||
EVALUATION_TYPE("评估类型","Evaluation_Type"),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
FROM openjdk:8-jdk-alpine
|
||||
FROM eclipse-temurin:8-jdk-ubi9-minimal
|
||||
MAINTAINER hongawen_13914774158@163.com
|
||||
ENV JAVA_OPTS="-Xms1024m -Xmx1024m"
|
||||
# 挂载时区的目录
|
||||
VOLUME /usr/share/zoneinfo
|
||||
# 设置时区为上海
|
||||
ENV TZ=Asia/Shanghai
|
||||
# 设置时区信息
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
ADD target/systemboot.jar systemboot.jar
|
||||
ENTRYPOINT ["java","-jar","/systemboot.jar"]
|
||||
ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /systemboot.jar
|
||||
EXPOSE 10207
|
||||
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \&& echo 'Asia/Shanghai' >/etc/timezone
|
||||
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \&& echo 'Asia/Shanghai' >/etc/timezone
|
||||
@@ -90,6 +90,16 @@ public class DictTreeController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/queryByCodeList")
|
||||
@ApiOperation("根据Code查询字典树")
|
||||
public HttpResult<List<SysDicTreePO>> queryByCodeList(@RequestParam("code") String code) {
|
||||
String methodDescribe = getMethodDescribe("queryByCodeList");
|
||||
List<SysDicTreePO> result = sysDicTreePOService.queryByCodeList(code);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
|
||||
@PostMapping("/queryByCode")
|
||||
@ApiOperation("根据Code查询字典树")
|
||||
|
||||
@@ -8,44 +8,53 @@ import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/6/9 14:00【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface SysDicTreePOService extends IService<SysDicTreePO>{
|
||||
public interface SysDicTreePOService extends IService<SysDicTreePO> {
|
||||
|
||||
|
||||
boolean addDictTree(DictTreeParam dictTreeParam);
|
||||
boolean addDictTree(DictTreeParam dictTreeParam);
|
||||
|
||||
List<DictTreeVO> queryByPid(String pid);
|
||||
List<DictTreeVO> queryByPid(String pid);
|
||||
|
||||
DictTreeVO queryByCode(String code);
|
||||
DictTreeVO queryByCode(String code);
|
||||
|
||||
List<DictTreeVO> queryByid(String id);
|
||||
List<DictTreeVO> queryByid(String id);
|
||||
|
||||
/**
|
||||
* 根据id查询字典数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SysDicTreePO queryById(String id);
|
||||
/**
|
||||
* 根据id查询字典数据
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SysDicTreePO queryById(String id);
|
||||
|
||||
/**
|
||||
* 查询所有树形字典
|
||||
* @author cdf
|
||||
* @date 2023/12/18
|
||||
*/
|
||||
List<SysDicTreePO> queryAll();
|
||||
/**
|
||||
* 查询所有树形字典
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/12/18
|
||||
*/
|
||||
List<SysDicTreePO> queryAll();
|
||||
|
||||
/**
|
||||
* 分类查询所有树形字典
|
||||
* @author cdf
|
||||
* @date 2023/12/18
|
||||
*/
|
||||
List<SysDicTreePO> queryAllByType(Integer type);
|
||||
/**
|
||||
* 分类查询所有树形字典
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/12/18
|
||||
*/
|
||||
List<SysDicTreePO> queryAllByType(Integer type);
|
||||
|
||||
List<SysDicTreePO> queryTree();
|
||||
List<SysDicTreePO> queryTree();
|
||||
|
||||
/**
|
||||
* 根据code查询自动树
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
List<SysDicTreePO> queryByCodeList(String code);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.system.pojo.param.DictTreeParam;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -21,7 +22,6 @@ import com.njcn.system.service.SysDicTreePOService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/6/9 14:00【需求编号】
|
||||
*
|
||||
@@ -29,23 +29,23 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class SysDicTreePOServiceImpl extends ServiceImpl<SysDicTreePOMapper, SysDicTreePO> implements SysDicTreePOService{
|
||||
public class SysDicTreePOServiceImpl extends ServiceImpl<SysDicTreePOMapper, SysDicTreePO> implements SysDicTreePOService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean addDictTree(DictTreeParam dictTreeParam) {
|
||||
SysDicTreePO sysDicTreePO = new SysDicTreePO();
|
||||
BeanUtils.copyProperties(dictTreeParam, sysDicTreePO);
|
||||
if(!Objects.equals(sysDicTreePO.getPid(), "0")){
|
||||
if (!Objects.equals(sysDicTreePO.getPid(), "0")) {
|
||||
QueryWrapper<SysDicTreePO> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
queryWrapper.eq("id", sysDicTreePO.getPid());
|
||||
SysDicTreePO instance = this.baseMapper.selectOne(queryWrapper);
|
||||
|
||||
|
||||
sysDicTreePO.setPids(instance.getPids()+","+instance.getId());
|
||||
sysDicTreePO.setPids(instance.getPids() + "," + instance.getId());
|
||||
|
||||
}else{
|
||||
} else {
|
||||
sysDicTreePO.setPids("0");
|
||||
}
|
||||
sysDicTreePO.setStatus(0);
|
||||
@@ -58,7 +58,7 @@ public class SysDicTreePOServiceImpl extends ServiceImpl<SysDicTreePOMapper, Sys
|
||||
public List<DictTreeVO> queryByPid(String pid) {
|
||||
List<DictTreeVO> collect = new ArrayList<>();
|
||||
LambdaQueryWrapper<SysDicTreePO> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysDicTreePO::getPid, pid).eq(SysDicTreePO::getStatus,"0");
|
||||
query.eq(SysDicTreePO::getPid, pid).eq(SysDicTreePO::getStatus, "0");
|
||||
List<SysDicTreePO> resultList = this.list(query);
|
||||
|
||||
SysDicTreePO byId = this.getById(pid);
|
||||
@@ -67,7 +67,7 @@ public class SysDicTreePOServiceImpl extends ServiceImpl<SysDicTreePOMapper, Sys
|
||||
collect = resultList.stream().map(temp -> {
|
||||
DictTreeVO resultVO = new DictTreeVO();
|
||||
BeanUtils.copyProperties(temp, resultVO);
|
||||
resultVO.setPname(Objects.nonNull(byId)?byId.getName():"最高级");
|
||||
resultVO.setPname(Objects.nonNull(byId) ? byId.getName() : "最高级");
|
||||
return resultVO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class SysDicTreePOServiceImpl extends ServiceImpl<SysDicTreePOMapper, Sys
|
||||
public DictTreeVO queryByCode(String code) {
|
||||
LambdaQueryWrapper<SysDicTreePO> query = new LambdaQueryWrapper<>();
|
||||
query.clear();
|
||||
query.eq(SysDicTreePO::getCode, code).eq(SysDicTreePO::getStatus,"0");
|
||||
query.eq(SysDicTreePO::getCode, code).eq(SysDicTreePO::getStatus, "0");
|
||||
SysDicTreePO result = this.getOne(query);
|
||||
|
||||
if (result != null) {
|
||||
@@ -92,13 +92,13 @@ public class SysDicTreePOServiceImpl extends ServiceImpl<SysDicTreePOMapper, Sys
|
||||
|
||||
@Override
|
||||
public List<DictTreeVO> queryByid(String id) {
|
||||
List<DictTreeVO> dictTreeVOS=this.baseMapper.queryByid(id);
|
||||
List<DictTreeVO> dictTreeVOS = this.baseMapper.queryByid(id);
|
||||
return dictTreeVOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysDicTreePO queryById(String id) {
|
||||
return this.lambdaQuery().eq(SysDicTreePO::getId,id).eq(SysDicTreePO::getStatus,0).one();
|
||||
return this.lambdaQuery().eq(SysDicTreePO::getId, id).eq(SysDicTreePO::getStatus, 0).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,7 +111,7 @@ public class SysDicTreePOServiceImpl extends ServiceImpl<SysDicTreePOMapper, Sys
|
||||
@Override
|
||||
public List<SysDicTreePO> queryAllByType(Integer type) {
|
||||
LambdaQueryWrapper<SysDicTreePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysDicTreePO::getStatus, 0).eq(SysDicTreePO::getType,type);
|
||||
lambdaQueryWrapper.eq(SysDicTreePO::getStatus, 0).eq(SysDicTreePO::getType, type);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -119,14 +119,30 @@ public class SysDicTreePOServiceImpl extends ServiceImpl<SysDicTreePOMapper, Sys
|
||||
public List<SysDicTreePO> queryTree() {
|
||||
LambdaQueryWrapper<SysDicTreePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SysDicTreePO::getStatus, 0);
|
||||
List<SysDicTreePO> sysDicTreePOList = this.list(lambdaQueryWrapper);
|
||||
List<SysDicTreePO> parent = sysDicTreePOList.stream().filter(item->item.getPid().equals("0") && !item.getCode().equals("Device_Unit")).peek(item->{item.setLevel(0);item.setChildren(getChildren(item,sysDicTreePOList));}).collect(Collectors.toList());
|
||||
return parent;
|
||||
List<SysDicTreePO> sysDicTreePOList = this.list(lambdaQueryWrapper);
|
||||
List<SysDicTreePO> parent = sysDicTreePOList.stream().filter(item -> item.getPid().equals("0") && !item.getCode().equals("Device_Unit")).peek(item -> {
|
||||
item.setLevel(0);
|
||||
item.setChildren(getChildren(item, sysDicTreePOList));
|
||||
}).collect(Collectors.toList());
|
||||
return parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysDicTreePO> queryByCodeList(String code) {
|
||||
List<SysDicTreePO> sysDicTreePOList = this.list(new LambdaQueryWrapper<SysDicTreePO>().eq(SysDicTreePO::getStatus, 0));
|
||||
List<SysDicTreePO> parent = sysDicTreePOList.stream().filter(item -> item.getCode().equals(code)).peek(item -> {
|
||||
item.setLevel(0);
|
||||
item.setChildren(getChildren(item, sysDicTreePOList));
|
||||
}).collect(Collectors.toList());
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
private List<SysDicTreePO> getChildren(SysDicTreePO sysDicTreePO,List<SysDicTreePO> all){
|
||||
return all.stream().filter(item->item.getPid().equals(sysDicTreePO.getId())).peek(item->{item.setLevel(sysDicTreePO.getLevel()+1);item.setChildren(getChildren(item,all));}).collect(Collectors.toList());
|
||||
private List<SysDicTreePO> getChildren(SysDicTreePO sysDicTreePO, List<SysDicTreePO> all) {
|
||||
return all.stream().filter(item -> item.getPid().equals(sysDicTreePO.getId())).peek(item -> {
|
||||
item.setLevel(sysDicTreePO.getLevel() + 1);
|
||||
item.setChildren(getChildren(item, all));
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user