普测计划模块代码提交

This commit is contained in:
huangzj
2022-11-18 11:22:46 +08:00
parent 1124d4ffac
commit bb23fcf761
19 changed files with 1164 additions and 1 deletions

View File

@@ -19,6 +19,8 @@ public enum ProcessResponseEnum {
UPLOAD_FILE_ERROR("A00551","上传文件服务器错误,请检查数据"), UPLOAD_FILE_ERROR("A00551","上传文件服务器错误,请检查数据"),
ARCHIVE_ERROR("A00552","不满足归档调节,操作失败!"), ARCHIVE_ERROR("A00552","不满足归档调节,操作失败!"),
PROCESS_ERROR("A00553","当前流程未审核通过,操作失败!"), PROCESS_ERROR("A00553","当前流程未审核通过,操作失败!"),
DOWNLOAD_FILE_ERROR("A00554","下载文件URL不存在请检查数据"),
; ;
private final String code; private final String code;

View File

@@ -91,7 +91,12 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>com.github.jeffreyning</groupId>
<artifactId>mybatisplus-plus</artifactId>
<version>1.5.1-RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@@ -1,5 +1,6 @@
package com.njcn.process; package com.njcn.process;
import com.github.jeffreyning.mybatisplus.conf.EnableMPP;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
@@ -16,6 +17,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@MapperScan("com.njcn.**.mapper") @MapperScan("com.njcn.**.mapper")
@EnableFeignClients(basePackages = "com.njcn") @EnableFeignClients(basePackages = "com.njcn")
@SpringBootApplication(scanBasePackages = "com.njcn") @SpringBootApplication(scanBasePackages = "com.njcn")
@EnableMPP
public class ProcessApplication { public class ProcessApplication {
public static void main(String[] args) { public static void main(String[] args) {

View File

@@ -0,0 +1,124 @@
package com.njcn.process.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.process.pojo.param.RGeneralSurveyPlanAddParm;
import com.njcn.process.pojo.param.RGeneralSurveyPlanQueryParm;
import com.njcn.process.pojo.param.RGeneralSurveyPlandetailQueryParm;
import com.njcn.process.pojo.param.SurveyResultUploadParam;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanVO;
import com.njcn.process.service.RGeneralSurveyPlanDetailService;
import com.njcn.process.service.RGeneralSurveyPlanPOService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 14:50【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Slf4j
@RestController
@RequestMapping("/rGeneralSurveyPlan")
@Api(tags = "普测计划管理")
@AllArgsConstructor
public class RGeneralSurveyPlanController extends BaseController {
private final RGeneralSurveyPlanPOService rGeneralSurveyPlanPOService;
private @Autowired
RGeneralSurveyPlanDetailService rGeneralSurveyPlanDetailService;
/**
* 查询所有数据
* @author qijian
* @date 2022/11/11
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/addPlan")
@ApiOperation("新增普测计划")
@ApiImplicitParam(name = "rGeneralSurveyPlanAddParm", value = "新增普测计划参数", required = true)
public HttpResult<Boolean> addPlan(@RequestBody RGeneralSurveyPlanAddParm rGeneralSurveyPlanAddParm){
String methodDescribe = getMethodDescribe("addPlan");
Boolean addFlag = rGeneralSurveyPlanPOService.addPlan(rGeneralSurveyPlanAddParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, addFlag, methodDescribe);
}
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
// @PostMapping("/updatePlan")
// @ApiOperation("新增普测计划")
// @ApiImplicitParam(name = "rGeneralSurveyPlanAddParm", value = "新增普测计划参数", required = true)
// public HttpResult<Boolean> updatePlan(@RequestBody RGeneralSurveyPlanAddParm rGeneralSurveyPlanAddParm){
// String methodDescribe = getMethodDescribe("addPlan");
//
//// Boolean addFlag = rGeneralSurveyPlanPOService.updatePlan(rGeneralSurveyPlanAddParm);
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, addFlag, methodDescribe);
// }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryPlan")
@ApiOperation("查询普测计划")
@ApiImplicitParam(name = "rGeneralSurveyPlanQueryParm", value = "普测计划查询参数", required = true)
public HttpResult<IPage<RGeneralSurveyPlanVO>> queryPlan(@Validated @RequestBody RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm){
String methodDescribe = getMethodDescribe("queryPlan");
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rGeneralSurveyPlanVOS, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryPlandetail")
@ApiOperation("根据planNO查询普测计划详情")
@ApiImplicitParam(name = "rGeneralSurveyPlandetailQueryParm", value = "普测计划详情查询参数", required = true)
public HttpResult<IPage<RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO>> queryPlandetail(@Validated @RequestBody RGeneralSurveyPlandetailQueryParm rGeneralSurveyPlandetailQueryParm){
String methodDescribe = getMethodDescribe("queryPlandetail");
IPage<RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO> rGeneralSurveyPlanDetailVOIPage = rGeneralSurveyPlanDetailService.queryPlandetail (rGeneralSurveyPlandetailQueryParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rGeneralSurveyPlanDetailVOIPage, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType= OperateType.UPLOAD)
@PostMapping("/surveyResultUpload")
@ApiOperation("上传普测结果报告")
// @ApiImplicitParam(name = "surveyResultUploadParam", value = "实体参数", required = true)
public HttpResult<Boolean> surveyResultUpload( @Validated SurveyResultUploadParam surveyResultUploadParam){
String methodDescribe = getMethodDescribe("surveyResultUpload");
boolean res = rGeneralSurveyPlanPOService.surveyResultUpload(surveyResultUploadParam);
if(res){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
}
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType= OperateType.DOWNLOAD)
@PostMapping("/surveyResultDownload")
@ApiOperation("下载普测结果报告")
@ApiImplicitParam(name = "planNo", value = "计划号", required = true)
public HttpResult<List<String>> surveyResultDownload(@RequestParam("planNo") String planNo ){
String methodDescribe = getMethodDescribe("surveyResultDownload");
List<String> downloadUrls = rGeneralSurveyPlanPOService.surveyResultDownload(planNo);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, downloadUrls, methodDescribe);
}
}

View File

@@ -0,0 +1,16 @@
package com.njcn.process.mapper;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.process.pojo.po.RGeneralSurveyPlanDetail;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 11:28【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface RGeneralSurveyPlanDetailMapper extends MppBaseMapper<RGeneralSurveyPlanDetail> {
}

View File

@@ -0,0 +1,16 @@
package com.njcn.process.mapper;
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.njcn.process.pojo.po.RGeneralSurveyPlanPO;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 11:24【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface RGeneralSurveyPlanPOMapper extends MppBaseMapper<RGeneralSurveyPlanPO> {
}

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.process.mapper.RGeneralSurveyPlanDetailMapper">
<resultMap id="BaseResultMap" type="com.njcn.process.pojo.po.RGeneralSurveyPlanDetail">
<!--@mbg.generated-->
<!--@Table r_general_survey_plan_detail-->
<id column="plan_no" jdbcType="VARCHAR" property="planNo" />
<result column="general_survey_start_time" jdbcType="DATE" property="generalSurveyStartTime" />
<result column="general_survey_end_time" jdbcType="DATE" property="generalSurveyEndTime" />
<result column="general_survey_time" jdbcType="DATE" property="generalSurveyTime" />
<result column="general_survey_leader" jdbcType="VARCHAR" property="generalSurveyLeader" />
<result column="sub_id" jdbcType="VARCHAR" property="subId" />
<result column="sub_name" jdbcType="VARCHAR" property="subName" />
<result column="voltage_level" jdbcType="VARCHAR" property="voltageLevel" />
<result column="busbar_id" jdbcType="VARCHAR" property="busbarId" />
<result column="busbar_name" jdbcType="VARCHAR" property="busbarName" />
<result column="measurement_point_id" jdbcType="VARCHAR" property="measurementPointId" />
<result column="is_problem" jdbcType="TINYINT" property="isProblem" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
plan_no, general_survey_start_time, general_survey_end_time, general_survey_time,
general_survey_leader, sub_id, sub_name, voltage_level, busbar_id, busbar_name, measurement_point_id,
is_problem
</sql>
</mapper>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.njcn.process.mapper.RGeneralSurveyPlanPOMapper">
<resultMap id="BaseResultMap" type="com.njcn.process.pojo.po.RGeneralSurveyPlanPO">
<!--@mbg.generated-->
<!--@Table r_general_survey_plan-->
<id column="org_no" jdbcType="VARCHAR" property="orgNo" />
<id column="plan_no" jdbcType="VARCHAR" property="planNo" />
<result column="plan_name" jdbcType="VARCHAR" property="planName" />
<result column="plan_create_time" jdbcType="DATE" property="planCreateTime" />
<result column="plan_start_time" jdbcType="DATE" property="planStartTime" />
<result column="plan_end_time" jdbcType="DATE" property="planEndTime" />
<result column="plan_complate_time" jdbcType="DATE" property="planComplateTime" />
<result column="leader" jdbcType="VARCHAR" property="leader" />
<result column="status" jdbcType="TINYINT" property="status" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="is_file_upload" jdbcType="TINYINT" property="isFileUpload" />
<result column="file_count" jdbcType="INTEGER" property="fileCount" />
<result column="file_path" jdbcType="VARCHAR" property="filePath" />
<result column="upload_time" jdbcType="DATE" property="uploadTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
org_no, plan_no, plan_name, plan_create_time, plan_start_time, plan_end_time, plan_complate_time,
leader, `status`, description, is_file_upload, file_count, file_path, upload_time
</sql>
</mapper>

View File

@@ -0,0 +1,97 @@
package com.njcn.process.pojo.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 15:20【需求编号】
*
* @author clam
* @version V1.0.0
*/
@ApiModel(value="com-njcn-process-pojo-param-RGeneralSurveyPlanAddParm")
@Data
public class RGeneralSurveyPlanAddParm {
@ApiModelProperty(value="单位ID")
private String orgNo;
@ApiModelProperty(value="普测计划编号")
private String planNo;
@ApiModelProperty(value="普测计划名称")
private String planName;
@ApiModelProperty(value="计划开始时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date planStartTime;
@ApiModelProperty(value="计划结束时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date planEndTime;
@ApiModelProperty(value="计划负责人")
private String leader;
@ApiModelProperty(value="详细情况")
private String description;
@ApiModelProperty(value="计划详细情况母线相关")
private List<RGeneralSurveyPlanDetailAddParm> rGeneralSurveyPlanDetailAddParm;
@Data
@ApiModel(value="计划详细情况母线相关")
public static class RGeneralSurveyPlanDetailAddParm{
@ApiModelProperty(value="变电站ID")
private String subId;
@ApiModelProperty(value="变电站名称")
private String subName;
@ApiModelProperty(value="变电站电压等级")
private String voltageLevel;
@ApiModelProperty(value="母线ID")
private String busbarId;
@ApiModelProperty(value="母线名称")
private String busbarName;
@ApiModelProperty(value="离线监测点id")
private String measurementPointId;
/**
* 测试开始时间
*/
@ApiModelProperty(value="测试开始时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date generalSurveyStartTime;
/**
* 测试结束时间
*/
@ApiModelProperty(value="测试结束时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date generalSurveyEndTime;
/**
* 测试日期
*/
@ApiModelProperty(value="测试日期")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date generalSurveyTime;
/**
* 测试负责人
*/
@ApiModelProperty(value="测试负责人")
private String generalSurveyLeader;
}
}

View File

@@ -0,0 +1,47 @@
package com.njcn.process.pojo.param;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 15:20【需求编号】
*
* @author clam
* @version V1.0.0
*/
@ApiModel(value="com-njcn-process-pojo-param-RGeneralSurveyPlanAddParm")
@Data
public class RGeneralSurveyPlanQueryParm {
@NotNull(message="当前页不能为空!")
@Min(value = 1, message = "当前页不能为0")
@ApiModelProperty(value = "当前页",name = "currentPage",dataType ="Integer",required = true)
private Integer currentPage;
/**显示条数*/
@NotNull(message="显示条数不能为空!")
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
private Integer pageSize;
@ApiModelProperty(value="单位ID")
private String orgNo;
@ApiModelProperty(value="计划开始时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date planStartTime;
@ApiModelProperty(value="计划状态(0:新建 1:待审核 2:审核未通过 3:已发布 4:已完成)")
private String status;
@ApiModelProperty(value="文件是否上传(0:否 1:是)")
private String isFileUpload;
}

View File

@@ -0,0 +1,36 @@
package com.njcn.process.pojo.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 15:20【需求编号】
*
* @author clam
* @version V1.0.0
*/
@ApiModel(value="com-njcn-process-pojo-param-RGeneralSurveyPlanAddParm")
@Data
public class RGeneralSurveyPlandetailQueryParm {
@NotNull(message="当前页不能为空!")
@Min(value = 1, message = "当前页不能为0")
@ApiModelProperty(value = "当前页",name = "currentPage",dataType ="Integer",required = true)
private Integer currentPage;
/**显示条数*/
@NotNull(message="显示条数不能为空!")
@ApiModelProperty(value = "显示条数",name = "pageSize",dataType ="Integer",required = true)
private Integer pageSize;
@ApiModelProperty(value="普测计划编号")
private String planNo;
}

View File

@@ -0,0 +1,31 @@
package com.njcn.process.pojo.param;
import com.njcn.web.constant.ValidMessage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 未建档干扰源用户入网上传Param
*
* @author qijian
* @version 1.0.0
* @createTime 2022/11/11 10:34
*/
@Data
public class SurveyResultUploadParam {
@ApiModelProperty(name = "planId",required = true)
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
private String planId;
@ApiModelProperty(name = "files",value = "普测结果报告",required = true)
@NotNull(message = "普测结果报告")
private MultipartFile[] files;
}

View File

@@ -0,0 +1,113 @@
package com.njcn.process.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 11:28【需求编号】
*
* @author clam
* @version V1.0.0
*/
/**
* 普测计划详情表
*/
@ApiModel(value="com-njcn-process-pojo-po-RGeneralSurveyPlanDetail")
@Data
@TableName(value = "r_general_survey_plan_detail")
public class RGeneralSurveyPlanDetail {
/**
* 普测计划编号
*/
@MppMultiId(value = "plan_no")
@ApiModelProperty(value="普测计划编号")
private String planNo;
/**
* 母线ID
*/
@MppMultiId(value = "busbar_id")
@ApiModelProperty(value="母线ID")
private String busbarId;
/**
* 测试开始时间
*/
@TableField(value = "general_survey_start_time")
@ApiModelProperty(value="测试开始时间")
private Date generalSurveyStartTime;
/**
* 测试结束时间
*/
@TableField(value = "general_survey_end_time")
@ApiModelProperty(value="测试结束时间")
private Date generalSurveyEndTime;
/**
* 测试日期
*/
@TableField(value = "general_survey_time")
@ApiModelProperty(value="测试日期")
private Date generalSurveyTime;
/**
* 测试负责人
*/
@TableField(value = "general_survey_leader")
@ApiModelProperty(value="测试负责人")
private String generalSurveyLeader;
/**
* 变电站ID
*/
@TableField(value = "sub_id")
@ApiModelProperty(value="变电站ID")
private String subId;
/**
* 变电站名称
*/
@TableField(value = "sub_name")
@ApiModelProperty(value="变电站名称")
private String subName;
/**
* 变电站电压等级
*/
@TableField(value = "voltage_level")
@ApiModelProperty(value="变电站电压等级")
private String voltageLevel;
/**
* 母线名称
*/
@TableField(value = "busbar_name")
@ApiModelProperty(value="母线名称")
private String busbarName;
/**
* 离线监测点id
*/
@TableField(value = "measurement_point_id")
@ApiModelProperty(value="离线监测点id")
private String measurementPointId;
/**
* 是否生成问题(0:否 1:是)
*/
@TableField(value = "is_problem")
@ApiModelProperty(value="是否生成问题(0:否 1:是)")
private Byte isProblem;
}

View File

@@ -0,0 +1,126 @@
package com.njcn.process.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 11:24【需求编号】
*
* @author clam
* @version V1.0.0
*/
/**
* 普测计划表
*/
@ApiModel(value="com-njcn-process-pojo-po-RGeneralSurveyPlanPO")
@Data
@TableName(value = "r_general_survey_plan")
public class RGeneralSurveyPlanPO {
/**
* 单位ID
*/
@TableField(value = "org_no")
@ApiModelProperty(value="单位ID")
private String orgNo;
/**
* 普测计划编号
*/
@MppMultiId(value = "plan_no")
@ApiModelProperty(value="普测计划编号")
private String planNo;
/**
* 普测计划名称
*/
@TableId(value = "plan_name")
@ApiModelProperty(value="普测计划名称")
private String planName;
/**
* 计划生成时间
*/
@TableField(value = "plan_create_time")
@ApiModelProperty(value="计划生成时间")
private Date planCreateTime = new Date();
/**
* 计划开始时间
*/
@TableField(value = "plan_start_time")
@ApiModelProperty(value="计划开始时间")
private Date planStartTime;
/**
* 计划结束时间
*/
@TableField(value = "plan_end_time")
@ApiModelProperty(value="计划结束时间")
private Date planEndTime;
/**
* 实际完成时间
*/
@TableField(value = "plan_complate_time")
@ApiModelProperty(value="实际完成时间")
private Date planComplateTime;
/**
* 计划负责人
*/
@TableField(value = "leader")
@ApiModelProperty(value="计划负责人")
private String leader;
/**
* 计划状态(0:新建 1:待审核 2:审核未通过 3:已发布 4:已完成)
*/
@TableField(value = "status")
@ApiModelProperty(value="计划状态(0:新建 1:待审核 2:审核未通过 3:已发布 4:已完成)")
private int status;
/**
* 详情
*/
@TableField(value = "description")
@ApiModelProperty(value="详情")
private String description;
/**
* 文件是否上传(0:否 1:是)
*/
@TableField(value = "is_file_upload")
@ApiModelProperty(value="文件是否上传(0:否 1:是)")
private Integer isFileUpload;
/**
* 上传文件数量
*/
@TableField(value = "file_count")
@ApiModelProperty(value="上传文件数量")
private Integer fileCount ;
/**
* 文件路径
*/
@TableField(value = "file_path")
@ApiModelProperty(value="文件路径")
private String filePath;
/**
* 上传时间
*/
@TableField(value = "upload_time")
@ApiModelProperty(value="上传时间")
private Date uploadTime;
}

View File

@@ -0,0 +1,127 @@
package com.njcn.process.pojo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 15:20【需求编号】
*
* @author clam
* @version V1.0.0
*/
@ApiModel(value="com-njcn-process-pojo-param-RGeneralSurveyPlanAddParm")
@Data
public class RGeneralSurveyPlanVO {
@ApiModelProperty(value="单位ID")
private String orgNo;
@ApiModelProperty(value="普测计划编号")
private String planNo;
@ApiModelProperty(value="普测计划名称")
private String planName;
@ApiModelProperty(value="计划开始时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date planStartTime;
@ApiModelProperty(value="计划结束时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date planEndTime;
@ApiModelProperty(value="变电站数量")
private Long subCount;
@ApiModelProperty(value="母线数量")
private Long busCount;
@ApiModelProperty(value="计划状态(0:新建 1:待审核 2:审核未通过 3:已发布 4:已完成)")
private int status;
@TableField(value = "is_file_upload")
@ApiModelProperty(value="文件是否上传(0:否 1:是)")
private Byte isFileUpload;
/**
* 上传文件数量
*/
@TableField(value = "file_count")
@ApiModelProperty(value="上传文件数量")
private Integer fileCount;
/**
* 文件路径
*/
@TableField(value = "file_path")
@ApiModelProperty(value="文件路径")
private String filePath;
/**
* 上传时间
*/
@TableField(value = "upload_time")
@ApiModelProperty(value="上传时间")
private Date uploadTime;
@ApiModelProperty(value="计划详细情况母线相关")
private List<RGeneralSurveyPlanDetailVO> rGeneralSurveyPlanDetailVOList;
@Data
@ApiModel(value="计划详细情况母线相关")
public static class RGeneralSurveyPlanDetailVO{
@ApiModelProperty(value="变电站ID")
private String subId;
@ApiModelProperty(value="变电站名称")
private String subName;
@ApiModelProperty(value="变电站电压等级")
private String voltageLevel;
@ApiModelProperty(value="母线ID")
private String busbarId;
@ApiModelProperty(value="母线名称")
private String busbarName;
@ApiModelProperty(value="离线监测点id")
private String measurementPointId;
/**
* 测试开始时间
*/
@ApiModelProperty(value="测试开始时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date generalSurveyStartTime;
/**
* 测试结束时间
*/
@ApiModelProperty(value="测试结束时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date generalSurveyEndTime;
/**
* 测试日期
*/
@ApiModelProperty(value="测试日期")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date generalSurveyTime;
/**
* 测试负责人
*/
@ApiModelProperty(value="测试负责人")
private String generalSurveyLeader;
}
}

View File

@@ -0,0 +1,29 @@
package com.njcn.process.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.process.pojo.param.RGeneralSurveyPlandetailQueryParm;
import com.njcn.process.pojo.po.RGeneralSurveyPlanDetail;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanVO;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 11:28【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface RGeneralSurveyPlanDetailService extends IMppService<RGeneralSurveyPlanDetail> {
/**
* @Description: 根据planNO查询普测计划详情
* @Param: [rGeneralSurveyPlandetailQueryParm]
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.njcn.process.pojo.vo.RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO>
* @Author: clam
* @Date: 2022/11/15
*/
IPage<RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO> queryPlandetail(RGeneralSurveyPlandetailQueryParm rGeneralSurveyPlandetailQueryParm);
}

View File

@@ -0,0 +1,56 @@
package com.njcn.process.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.process.pojo.param.RGeneralSurveyPlanAddParm;
import com.njcn.process.pojo.param.RGeneralSurveyPlanQueryParm;
import com.njcn.process.pojo.param.SurveyResultUploadParam;
import com.njcn.process.pojo.po.RGeneralSurveyPlanPO;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanVO;
import java.util.List;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 11:24【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface RGeneralSurveyPlanPOService extends IMppService<RGeneralSurveyPlanPO>{
/**
* @Description: addPlan
* @Param: [rGeneralSurveyPlanAddParm]
* @return: java.lang.Boolean
* @Author: clam
* @Date: 2022/11/14
*/
Boolean addPlan(RGeneralSurveyPlanAddParm rGeneralSurveyPlanAddParm);
/**
* @Description: query
* @Param: [rGeneralSurveyPlanQueryParm]
* @return: java.util.List<com.njcn.process.pojo.vo.RGeneralSurveyPlanVO>
* @Author: clam
* @Date: 2022/11/15
*/
IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm);
/**
* @Description: surveyResultUpload
* @Param: [surveyResultUploadParam]
* @return: boolean
* @Author: clam
* @Date: 2022/11/18
*/
boolean surveyResultUpload(SurveyResultUploadParam surveyResultUploadParam);
/**
* @Description: surveyResultDownload
* @Param: [planNo]
* @return: java.util.List<java.lang.String>
* @Author: clam
* @Date: 2022/11/18
*/
List<String> surveyResultDownload(String planNo);
}

View File

@@ -0,0 +1,51 @@
package com.njcn.process.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.process.mapper.RGeneralSurveyPlanDetailMapper;
import com.njcn.process.pojo.param.RGeneralSurveyPlandetailQueryParm;
import com.njcn.process.pojo.po.RGeneralSurveyPlanDetail;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanVO;
import com.njcn.process.service.RGeneralSurveyPlanDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 11:28【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class RGeneralSurveyPlanDetailServiceImpl extends MppServiceImpl<RGeneralSurveyPlanDetailMapper, RGeneralSurveyPlanDetail> implements RGeneralSurveyPlanDetailService{
private @Autowired
RGeneralSurveyPlanDetailMapper rGeneralSurveyPlanDetailMapper;
/**
* @param rGeneralSurveyPlandetailQueryParm
* @Description: 根据planNO查询普测计划详情
* @Param: [rGeneralSurveyPlandetailQueryParm]
* @return: com.baomidou.mybatisplus.core.metadata.IPage<com.njcn.process.pojo.vo.RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO>
* @Author: clam
* @Date: 2022/11/15
*/
@Override
public IPage<RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO> queryPlandetail(RGeneralSurveyPlandetailQueryParm rGeneralSurveyPlandetailQueryParm) {
IPage<RGeneralSurveyPlanDetail> page = new Page<> (rGeneralSurveyPlandetailQueryParm.getCurrentPage(), rGeneralSurveyPlandetailQueryParm.getPageSize());
LambdaQueryWrapper<RGeneralSurveyPlanDetail> lambdaQueryWrapper = new LambdaQueryWrapper<> ();
lambdaQueryWrapper.eq (RGeneralSurveyPlanDetail::getPlanNo, rGeneralSurveyPlandetailQueryParm.getPlanNo ());
IPage<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetailIPage = rGeneralSurveyPlanDetailMapper.selectPage (page, lambdaQueryWrapper);
return rGeneralSurveyPlanDetailIPage.convert (temp-> BeanUtil.copyProperties (temp, RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO.class));
}
}

View File

@@ -0,0 +1,232 @@
package com.njcn.process.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.minio.bo.MinIoUploadResDTO;
import com.njcn.minio.config.MinIoProperties;
import com.njcn.minio.utils.MinIoUtils;
import com.njcn.process.enums.ProcessResponseEnum;
import com.njcn.process.mapper.RGeneralSurveyPlanDetailMapper;
import com.njcn.process.mapper.RGeneralSurveyPlanPOMapper;
import com.njcn.process.pojo.param.RGeneralSurveyPlanAddParm;
import com.njcn.process.pojo.param.RGeneralSurveyPlanQueryParm;
import com.njcn.process.pojo.param.SurveyResultUploadParam;
import com.njcn.process.pojo.po.RGeneralSurveyPlanDetail;
import com.njcn.process.pojo.po.RGeneralSurveyPlanPO;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanVO;
import com.njcn.process.service.RGeneralSurveyPlanDetailService;
import com.njcn.process.service.RGeneralSurveyPlanPOService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
*
* Description:
* 接口文档访问地址http://serverIP:port/swagger-ui.html
* Date: 2022/11/11 11:24【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurveyPlanPOMapper, RGeneralSurveyPlanPO> implements RGeneralSurveyPlanPOService{
private @Autowired
RGeneralSurveyPlanDetailService rGeneralSurveyPlanDetailService;
private @Autowired
RGeneralSurveyPlanPOMapper rGeneralSurveyPlanPOMapper;
private @Autowired
RGeneralSurveyPlanDetailMapper rGeneralSurveyPlanDetailMapper;
@Resource
private MinIoUtils minIoUtils;
@Resource
private MinIoProperties minIoProperties;
/**
* @param rGeneralSurveyPlanAddParm
* @Description: addPlan
* @Param: [rGeneralSurveyPlanAddParm]
* @return: java.lang.Boolean
* @Author: clam
* @Date: 2022/11/14
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean addPlan(RGeneralSurveyPlanAddParm rGeneralSurveyPlanAddParm) {
Boolean flag =true;
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = new RGeneralSurveyPlanPO ();
BeanUtils.copyProperties (rGeneralSurveyPlanAddParm,rGeneralSurveyPlanPO);
/*todo 后期与工作流绑定*/
rGeneralSurveyPlanPO.setStatus (0);
flag = this.saveOrUpdate (rGeneralSurveyPlanPO);
List<RGeneralSurveyPlanAddParm.RGeneralSurveyPlanDetailAddParm> rGeneralSurveyPlanDetailAddParm = rGeneralSurveyPlanAddParm.getRGeneralSurveyPlanDetailAddParm ( );
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetailList = new ArrayList<> ();
rGeneralSurveyPlanDetailAddParm.forEach (temp->{
RGeneralSurveyPlanDetail rGeneralSurveyPlanDetail = new RGeneralSurveyPlanDetail();
BeanUtils.copyProperties (temp, rGeneralSurveyPlanDetail);
rGeneralSurveyPlanDetail.setPlanNo (rGeneralSurveyPlanAddParm.getPlanNo ());
rGeneralSurveyPlanDetail.setGeneralSurveyLeader(rGeneralSurveyPlanAddParm.getLeader ());
rGeneralSurveyPlanDetailList.add (rGeneralSurveyPlanDetail);
});
flag = rGeneralSurveyPlanDetailService.saveOrUpdateBatchByMultiId (rGeneralSurveyPlanDetailList,5);
return flag;
}
/**
* @param rGeneralSurveyPlanQueryParm
* @Description: query
* @Param: [rGeneralSurveyPlanQueryParm]
* @return: java.util.List<com.njcn.process.pojo.vo.RGeneralSurveyPlanVO>
* @Author: clam
* @Date: 2022/11/15
*/
@Override
public IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm) {
IPage<RGeneralSurveyPlanPO> page = new Page<> (rGeneralSurveyPlanQueryParm.getCurrentPage(), rGeneralSurveyPlanQueryParm.getPageSize());
IPage<RGeneralSurveyPlanVO> returnpage = new Page<> (rGeneralSurveyPlanQueryParm.getCurrentPage(), rGeneralSurveyPlanQueryParm.getPageSize());
LambdaQueryWrapper<RGeneralSurveyPlanPO> queryWrapper = new LambdaQueryWrapper<> ();
if (!StringUtils.isEmpty (rGeneralSurveyPlanQueryParm.getOrgNo ())) {
queryWrapper.eq (RGeneralSurveyPlanPO::getOrgNo, rGeneralSurveyPlanQueryParm.getOrgNo ());
}
if (!StringUtils.isEmpty (rGeneralSurveyPlanQueryParm. getStatus ())) {
queryWrapper.eq (RGeneralSurveyPlanPO::getStatus, rGeneralSurveyPlanQueryParm.getStatus ());
}
if (!StringUtils.isEmpty (rGeneralSurveyPlanQueryParm.getIsFileUpload ())) {
queryWrapper.eq (RGeneralSurveyPlanPO::getIsFileUpload, rGeneralSurveyPlanQueryParm.getIsFileUpload ());
}
if (!Objects.isNull (rGeneralSurveyPlanQueryParm.getPlanStartTime ())) {
queryWrapper.eq (RGeneralSurveyPlanPO::getPlanStartTime, rGeneralSurveyPlanQueryParm.getPlanStartTime ());
}
queryWrapper.orderByAsc (RGeneralSurveyPlanPO::getStatus).orderByDesc (RGeneralSurveyPlanPO::getPlanCreateTime);
List<RGeneralSurveyPlanPO> rGeneralSurveyPlanPOS = rGeneralSurveyPlanPOMapper.selectPage (page,queryWrapper).getRecords ();
if(CollectionUtils.isEmpty (rGeneralSurveyPlanPOS)){
return returnpage;
}
List<String> collect = rGeneralSurveyPlanPOS.stream ( ).map (RGeneralSurveyPlanPO::getPlanNo).collect (Collectors.toList ( ));
LambdaQueryWrapper<RGeneralSurveyPlanDetail> lambdaQueryWrapper = new LambdaQueryWrapper<> ();
lambdaQueryWrapper.in (RGeneralSurveyPlanDetail::getPlanNo, collect);
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetails = rGeneralSurveyPlanDetailMapper.selectList (lambdaQueryWrapper);
List<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOList = new ArrayList<> ();
rGeneralSurveyPlanPOS.forEach (temp ->{
RGeneralSurveyPlanVO rGeneralSurveyPlanVO = new RGeneralSurveyPlanVO();
BeanUtils.copyProperties (temp, rGeneralSurveyPlanVO);
Stream<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetailStream = rGeneralSurveyPlanDetails.stream ( ).
filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( )));
long Busbarcount = rGeneralSurveyPlanDetails.stream ( ).
filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( ))).
map (RGeneralSurveyPlanDetail::getBusbarId).distinct ( ).count ( );
long Subcount = rGeneralSurveyPlanDetails.stream ( ).
filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( ))).
map (RGeneralSurveyPlanDetail::getSubId).distinct ( ).count ( );
rGeneralSurveyPlanVO.setBusCount (Busbarcount);
rGeneralSurveyPlanVO.setSubCount (Subcount);
List<RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO> collect1 = rGeneralSurveyPlanDetails.stream ( ).
filter (surveyPlanDetail -> Objects.equals (surveyPlanDetail.getPlanNo ( ), temp.getPlanNo ( ))).
map (surveyPlanDetail -> {
RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO rGeneralSurveyPlanDetailVO = new RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO ( );
BeanUtils.copyProperties (surveyPlanDetail, rGeneralSurveyPlanDetailVO);
return rGeneralSurveyPlanDetailVO;
}).collect (Collectors.toList ( ));
rGeneralSurveyPlanVO.setRGeneralSurveyPlanDetailVOList (collect1);
rGeneralSurveyPlanVOList.add (rGeneralSurveyPlanVO);
});
returnpage.setRecords (rGeneralSurveyPlanVOList);
return returnpage;
}
/**
* @param surveyResultUploadParam
* @Description: surveyResultUpload
* @Param: [surveyResultUploadParam]
* @return: boolean
* @Author: clam
* @Date: 2022/11/18
*/
@Override
public boolean surveyResultUpload(SurveyResultUploadParam surveyResultUploadParam) {
boolean result = true;
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = new RGeneralSurveyPlanPO();
rGeneralSurveyPlanPO.setPlanNo (surveyResultUploadParam.getPlanId ());
rGeneralSurveyPlanPO = this.selectByMultiId (rGeneralSurveyPlanPO);
String filePath =rGeneralSurveyPlanPO.getFilePath ();
Integer fileCount = rGeneralSurveyPlanPO.getFileCount ( );
Optional.ofNullable (fileCount).orElse (0);
for (int i = 0; i < surveyResultUploadParam.getFiles ( ).length; i++) {
MinIoUploadResDTO minIoUploadResDTO = fileToMinio(surveyResultUploadParam.getFiles ( )[i]);
filePath=filePath+minIoUploadResDTO.getMinFileName ()+";";
fileCount++;
}
rGeneralSurveyPlanPO.setStatus (4);
rGeneralSurveyPlanPO.setFileCount (fileCount);
rGeneralSurveyPlanPO.setFilePath (filePath);
rGeneralSurveyPlanPO.setIsFileUpload (1);
rGeneralSurveyPlanPO.setUploadTime (new Date ());
this.saveOrUpdateByMultiId (rGeneralSurveyPlanPO);
return result;
}
/**
* @param planNo
* @Description: surveyResultDownload
* @Param: [surveyResultUploadParam]
* @return: java.util.List<java.lang.String>
* @Author: clam
* @Date: 2022/11/18
*/
@Override
public List<String> surveyResultDownload(String planNo) {
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = new RGeneralSurveyPlanPO();
rGeneralSurveyPlanPO.setPlanNo (planNo);
rGeneralSurveyPlanPO = this.selectByMultiId (rGeneralSurveyPlanPO);
String filePath = rGeneralSurveyPlanPO.getFilePath ( );
if(StringUtils.isEmpty (filePath)){
throw new BusinessException(ProcessResponseEnum.DOWNLOAD_FILE_ERROR);
}
String[] split = filePath.substring (0, filePath.length ( ) - 1).split (";");
List<String> collect = Stream.of (split).map (temp -> {
return minIoUtils.getObjectUrl (minIoProperties.getBucket ( ), temp, 7 * 24 * 60 * 60);
}).collect (Collectors.toList ( ));
return collect;
}
/**
* 上传文件到Minio
*
* @param file 文件
* @return 成功标记
*/
private MinIoUploadResDTO fileToMinio(MultipartFile file) {
try {
//把名称存入数据
MinIoUploadResDTO upload = minIoUtils.upload(file, minIoProperties.getBucket(), "surveyresult/");
return upload;
} catch (Exception e) {
throw new BusinessException (ProcessResponseEnum.UPLOAD_FILE_ERROR);
}
}
}