普测计划模块联调修改

This commit is contained in:
huangzj
2022-12-06 15:36:15 +08:00
parent 428703b7cb
commit f9733d0fe1
12 changed files with 146 additions and 53 deletions

View File

@@ -16,7 +16,6 @@ import java.util.List;
* @author clam
* @version V1.0.0
*/
@ApiModel(value="com-njcn-process-pojo-param-RGeneralSurveyPlanAddParm")
@Data
public class RGeneralSurveyPlanAddParm {

View File

@@ -1,7 +1,6 @@
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;
@@ -17,7 +16,6 @@ import java.util.Date;
* @author clam
* @version V1.0.0
*/
@ApiModel(value="com-njcn-process-pojo-param-RGeneralSurveyPlanAddParm")
@Data
public class RGeneralSurveyPlanQueryParm {
@@ -37,6 +35,10 @@ public class RGeneralSurveyPlanQueryParm {
@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="计划状态(0:新建 1:待审核 2:审核未通过 3:已发布 4:已完成)")
private String status;

View File

@@ -1,6 +1,5 @@
package com.njcn.process.pojo.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -15,7 +14,6 @@ import javax.validation.constraints.NotNull;
* @author clam
* @version V1.0.0
*/
@ApiModel(value="com-njcn-process-pojo-param-RGeneralSurveyPlanAddParm")
@Data
public class RGeneralSurveyPlandetailQueryParm {

View File

@@ -26,6 +26,7 @@ public class SurveyPlanQuestionQueryParm {
@ApiModelProperty(value="计划开始时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
@NotNull(message="计划开始时间不能为空!")
private Date planStartTime;
@ApiModelProperty(value="计划名称")

View File

@@ -22,9 +22,9 @@ public class SurveyResultUploadParam {
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
private String planId;
@ApiModelProperty(name = "files",value = "普测结果报告",required = true)
@ApiModelProperty(name = "file",value = "普测结果报告",required = true)
@NotNull(message = "普测结果报告")
private MultipartFile[] files;
private MultipartFile[] file;

View File

@@ -104,10 +104,17 @@ public class RGeneralSurveyPlanDetail {
@ApiModelProperty(value="离线监测点id")
private String measurementPointId;
/**
* 是否实现监测(0:否 1:是)
*/
@TableField(value = "is_survey")
@ApiModelProperty(value="是否生成问题(0:否 1:是)")
private Integer isSurvey;
/**
* 是否生成问题(0:否 1:是)
*/
@TableField(value = "is_problem")
@ApiModelProperty(value="是否生成问题(0:否 1:是)")
private Byte isProblem;
private Integer isProblem;
}

View File

@@ -17,12 +17,14 @@ import java.util.List;
* @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 orgName;
@ApiModelProperty(value="普测计划编号")
private String planNo;
@@ -45,11 +47,11 @@ public class RGeneralSurveyPlanVO {
private Long busCount;
@ApiModelProperty(value="计划状态(0:新建 1:待审核 2:审核未通过 3:已发布 4:已完成)")
private int status;
private Integer status;
@TableField(value = "is_file_upload")
@ApiModelProperty(value="文件是否上传(0:否 1:是)")
private Byte isFileUpload;
private Integer isFileUpload;
/**
* 上传文件数量
@@ -116,6 +118,13 @@ public class RGeneralSurveyPlanVO {
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private Date generalSurveyTime;
/**
* 是否实现监测(0:否 1:是)
*/
@TableField(value = "is_survey")
@ApiModelProperty(value="是否生成问题(0:否 1:是)")
private Integer isSurvey;
/**
* 测试负责人
*/

View File

@@ -1,4 +1,4 @@
package com.njcn.process.pojo.po;
package com.njcn.process.pojo.vo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;

View File

@@ -9,9 +9,11 @@ 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.minio.bo.MinIoUploadResDTO;
import com.njcn.poi.util.PoiUtil;
import com.njcn.process.pojo.param.*;
import com.njcn.process.pojo.po.SurveyPlanExcel;
import com.njcn.process.pojo.po.RGeneralSurveyPlanPO;
import com.njcn.process.pojo.vo.SurveyPlanExcel;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanDetailOnQuestionVO;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanVO;
import com.njcn.process.service.RGeneralSurveyPlanDetailService;
@@ -29,6 +31,8 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Description:
@@ -68,16 +72,7 @@ public class RGeneralSurveyPlanController extends BaseController {
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")
@@ -86,7 +81,7 @@ public class RGeneralSurveyPlanController extends BaseController {
public HttpResult<IPage<RGeneralSurveyPlanVO>> queryPlan(@Validated @RequestBody RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm){
String methodDescribe = getMethodDescribe("queryPlan");
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm);
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm, Stream.of ("0","1","2","3").collect (Collectors.toList ()));
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rGeneralSurveyPlanVOS, methodDescribe);
}
@@ -97,7 +92,7 @@ public class RGeneralSurveyPlanController extends BaseController {
public HttpResult<IPage<RGeneralSurveyPlanVO>> queryPlanAudit(@Validated @RequestBody RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm){
String methodDescribe = getMethodDescribe("queryPlanAudit");
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm);
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm, Stream.of ("1").collect (Collectors.toList ()));
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rGeneralSurveyPlanVOS, methodDescribe);
}
@@ -108,7 +103,7 @@ public class RGeneralSurveyPlanController extends BaseController {
public HttpResult<IPage<RGeneralSurveyPlanVO>> queryPlanResult(@Validated @RequestBody RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm){
String methodDescribe = getMethodDescribe("queryPlanResult");
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm);
IPage<RGeneralSurveyPlanVO> rGeneralSurveyPlanVOS = rGeneralSurveyPlanPOService.query (rGeneralSurveyPlanQueryParm, Stream.of ("3","4").collect (Collectors.toList ()));
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rGeneralSurveyPlanVOS, methodDescribe);
}
@@ -143,9 +138,9 @@ public class RGeneralSurveyPlanController extends BaseController {
@PostMapping("/surveyResultDownload")
@ApiOperation("下载普测结果报告")
@ApiImplicitParam(name = "planNo", value = "计划号", required = true)
public HttpResult<List<String>> surveyResultDownload(@RequestParam("planNo") String planNo ){
public HttpResult<List<MinIoUploadResDTO>> surveyResultDownload(@RequestParam("planNo") String planNo ){
String methodDescribe = getMethodDescribe("surveyResultDownload");
List<String> downloadUrls = rGeneralSurveyPlanPOService.surveyResultDownload(planNo);
List<MinIoUploadResDTO> downloadUrls = rGeneralSurveyPlanPOService.surveyResultDownload(planNo);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, downloadUrls, methodDescribe);
@@ -184,6 +179,19 @@ public class RGeneralSurveyPlanController extends BaseController {
}
@ResponseBody
@ApiOperation("普测计划名称查询")
@PostMapping(value = "querySurveyPlanName")
@ApiImplicitParam(name = "questionQueryParm", value = "普测计划名称查询参数", required = true)
public HttpResult<List<RGeneralSurveyPlanPO>> querySurveyPlanName(@Validated @RequestBody SurveyPlanQuestionQueryParm questionQueryParm) {
String methodDescribe = getMethodDescribe("querySurveyPlanName");
List<RGeneralSurveyPlanPO> list= rGeneralSurveyPlanPOService.querySurveyPlanName(questionQueryParm);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

View File

@@ -19,18 +19,23 @@ import java.util.List;
* @version V1.0.0
*/
public interface RGeneralSurveyPlanDetailMapper extends MppBaseMapper<RGeneralSurveyPlanDetail> {
@Select ("SELECT\n" +
@Select ({"<script>",
"SELECT\n" +
"\ta.plan_name as planName,\n" +
"\tb.voltage_level as voltageLevel,\n" +
"\tb.sub_id as subId,\n" +
"\tb.sub_name as subName,\n" +
"\tb.busbar_id as busbarId,\n" +
"\tb.busbar_name as busbarName\n" +
"\tb.busbar_name as busbarName, b.measurement_point_id as measurementPointId\n" +
"FROM\n" +
"\tr_general_survey_plan a\n" +
"INNER JOIN r_general_survey_plan_detail b ON a.plan_no = b.plan_no\n" +
"WHERE\n" +
"\ta.org_no = #{questionQueryParm.orgNo} and a.plan_name LIKE CONCAT('%', #{questionQueryParm.planName}, '%')\n" +
"AND DATE_FORMAT(a.upload_time, '%Y%m') = DATE_FORMAT(#{questionQueryParm.planStartTime}, '%Y%m')")
"\ta.org_no = #{questionQueryParm.orgNo} " +
"<when test='questionQueryParm.planName!=null and questionQueryParm.planName!=\"\"'>",
"and a.plan_name = #{questionQueryParm.planName}\n" +
"</when>",
"AND DATE_FORMAT(a.upload_time, '%Y%m') = DATE_FORMAT(#{questionQueryParm.planStartTime}, '%Y%m')",
"</script>"})
List<RGeneralSurveyPlanDetailOnQuestionVO> querySurveyPlanOnQuestion(@Param("questionQueryParm") SurveyPlanQuestionQueryParm questionQueryParm);
}

View File

@@ -2,12 +2,13 @@ package com.njcn.process.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.jeffreyning.mybatisplus.service.IMppService;
import com.njcn.minio.bo.MinIoUploadResDTO;
import com.njcn.process.pojo.param.RGeneralSurveyPlanAddParm;
import com.njcn.process.pojo.param.RGeneralSurveyPlanQueryParm;
import com.njcn.process.pojo.param.SurveyPlanQuestionQueryParm;
import com.njcn.process.pojo.param.SurveyResultUploadParam;
import com.njcn.process.pojo.po.RGeneralSurveyPlanPO;
import com.njcn.process.pojo.po.SurveyPlanExcel;
import com.njcn.process.pojo.vo.SurveyPlanExcel;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanDetailOnQuestionVO;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanVO;
@@ -39,7 +40,7 @@ public interface RGeneralSurveyPlanPOService extends IMppService<RGeneralSurveyP
* @Author: clam
* @Date: 2022/11/15
*/
IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm);
IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm,List<String> statusList);
/**
* @Description: surveyResultUpload
* @Param: [surveyResultUploadParam]
@@ -55,11 +56,11 @@ public interface RGeneralSurveyPlanPOService extends IMppService<RGeneralSurveyP
* @Author: clam
* @Date: 2022/11/18
*/
List<String> surveyResultDownload(String planNo);
List<MinIoUploadResDTO> surveyResultDownload(String planNo);
/**
* @Description: exportSurveyPlan
* @Param: []
* @return: java.util.List<com.njcn.process.pojo.po.SurveyPlanExcel>
* @return: java.util.List<com.njcn.process.pojo.vo.SurveyPlanExcel>
* @Author: clam
* @Date: 2022/11/21
*/
@@ -72,4 +73,12 @@ public interface RGeneralSurveyPlanPOService extends IMppService<RGeneralSurveyP
* @Date: 2022/11/30
*/
List<RGeneralSurveyPlanDetailOnQuestionVO> querySurveyPlanOnQuestion(SurveyPlanQuestionQueryParm questionQueryParm);
/**
* @Description: 更具questionQueryParm查计划名称
* @Param: [questionQueryParm]
* @return: java.util.List<com.njcn.process.pojo.param.SurveyPlanQuestionQueryParm>
* @Author: clam
* @Date: 2022/12/1
*/
List<RGeneralSurveyPlanPO> querySurveyPlanName(SurveyPlanQuestionQueryParm questionQueryParm);
}

View File

@@ -1,6 +1,7 @@
package com.njcn.process.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
@@ -17,11 +18,13 @@ import com.njcn.process.pojo.param.SurveyPlanQuestionQueryParm;
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.po.SurveyPlanExcel;
import com.njcn.process.pojo.vo.SurveyPlanExcel;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanDetailOnQuestionVO;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanVO;
import com.njcn.process.service.RGeneralSurveyPlanDetailService;
import com.njcn.process.service.RGeneralSurveyPlanPOService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -31,6 +34,7 @@ import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -60,6 +64,10 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
@Resource
private MinIoUtils minIoUtils;
private @Autowired
DeptFeignClient deptFeignClient;
@Resource
private MinIoProperties minIoProperties;
/**
@@ -74,15 +82,16 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
@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);
boolean b = this.saveOrUpdate (rGeneralSurveyPlanPO);
List<RGeneralSurveyPlanAddParm.RGeneralSurveyPlanDetailAddParm> rGeneralSurveyPlanDetailAddParm = rGeneralSurveyPlanAddParm.getRGeneralSurveyPlanDetailAddParm ( );
QueryWrapper<RGeneralSurveyPlanDetail> queryWrapper = new QueryWrapper ();
queryWrapper.lambda ().eq (RGeneralSurveyPlanDetail::getPlanNo, rGeneralSurveyPlanAddParm.getPlanNo ());
boolean remove = rGeneralSurveyPlanDetailService.remove (queryWrapper);
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetailList = new ArrayList<> ();
rGeneralSurveyPlanDetailAddParm.forEach (temp->{
RGeneralSurveyPlanDetail rGeneralSurveyPlanDetail = new RGeneralSurveyPlanDetail();
@@ -91,9 +100,9 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
rGeneralSurveyPlanDetail.setGeneralSurveyLeader(rGeneralSurveyPlanAddParm.getLeader ());
rGeneralSurveyPlanDetailList.add (rGeneralSurveyPlanDetail);
});
flag = rGeneralSurveyPlanDetailService.saveOrUpdateBatchByMultiId (rGeneralSurveyPlanDetailList,5);
boolean b1 = rGeneralSurveyPlanDetailService.saveOrUpdateBatchByMultiId (rGeneralSurveyPlanDetailList, 5);
return flag;
return b&&remove&&b1;
}
/**
@@ -105,13 +114,15 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
* @Date: 2022/11/15
*/
@Override
public IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm) {
public IPage<RGeneralSurveyPlanVO> query(RGeneralSurveyPlanQueryParm rGeneralSurveyPlanQueryParm,List<String> statusList ) {
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 ());
List<String> data = deptFeignClient.getDepSonIdtByDeptId (rGeneralSurveyPlanQueryParm.getOrgNo ()).getData ( );
queryWrapper.in (RGeneralSurveyPlanPO::getOrgNo, data);
}
if (!StringUtils.isEmpty (rGeneralSurveyPlanQueryParm. getStatus ())) {
queryWrapper.eq (RGeneralSurveyPlanPO::getStatus, rGeneralSurveyPlanQueryParm.getStatus ());
@@ -120,14 +131,27 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
queryWrapper.eq (RGeneralSurveyPlanPO::getIsFileUpload, rGeneralSurveyPlanQueryParm.getIsFileUpload ());
}
if (!Objects.isNull (rGeneralSurveyPlanQueryParm.getPlanStartTime ())) {
queryWrapper.eq (RGeneralSurveyPlanPO::getPlanStartTime, rGeneralSurveyPlanQueryParm.getPlanStartTime ());
queryWrapper.ge (RGeneralSurveyPlanPO::getPlanStartTime, rGeneralSurveyPlanQueryParm.getPlanStartTime ());
}
if (!Objects.isNull (rGeneralSurveyPlanQueryParm.getPlanEndTime ())) {
queryWrapper.le (RGeneralSurveyPlanPO::getPlanEndTime, rGeneralSurveyPlanQueryParm.getPlanEndTime ());
}
queryWrapper.in (RGeneralSurveyPlanPO::getStatus, statusList);
queryWrapper.orderByAsc (RGeneralSurveyPlanPO::getStatus).orderByDesc (RGeneralSurveyPlanPO::getPlanCreateTime);
List<RGeneralSurveyPlanPO> rGeneralSurveyPlanPOS = rGeneralSurveyPlanPOMapper.selectPage (page,queryWrapper).getRecords ();
if(CollectionUtils.isEmpty (rGeneralSurveyPlanPOS)){
return returnpage;
}
//部门处理根据部门code取名称
List<PvTerminalTreeVO> dept = deptFeignClient.allDeptList().getData();
Map<String, String> pvTerminalTreeVOMap = dept.stream().
collect(Collectors.
toMap(PvTerminalTreeVO::getId,
PvTerminalTreeVO::getName));
List<String> collect = rGeneralSurveyPlanPOS.stream ( ).map (RGeneralSurveyPlanPO::getPlanNo).collect (Collectors.toList ( ));
LambdaQueryWrapper<RGeneralSurveyPlanDetail> lambdaQueryWrapper = new LambdaQueryWrapper<> ();
lambdaQueryWrapper.in (RGeneralSurveyPlanDetail::getPlanNo, collect);
@@ -136,8 +160,6 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
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 ( );
@@ -154,6 +176,7 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
BeanUtils.copyProperties (surveyPlanDetail, rGeneralSurveyPlanDetailVO);
return rGeneralSurveyPlanDetailVO;
}).collect (Collectors.toList ( ));
rGeneralSurveyPlanVO.setOrgName(pvTerminalTreeVOMap.get(temp.getOrgNo())); //单位名称
rGeneralSurveyPlanVO.setRGeneralSurveyPlanDetailVOList (collect1);
rGeneralSurveyPlanVOList.add (rGeneralSurveyPlanVO);
@@ -179,8 +202,8 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
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]);
for (int i = 0; i < surveyResultUploadParam.getFile ( ).length; i++) {
MinIoUploadResDTO minIoUploadResDTO = fileToMinio(surveyResultUploadParam.getFile ( )[i]);
filePath=filePath+minIoUploadResDTO.getMinFileName ()+";";
fileCount++;
}
@@ -202,7 +225,7 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
* @Date: 2022/11/18
*/
@Override
public List<String> surveyResultDownload(String planNo) {
public List<MinIoUploadResDTO> surveyResultDownload(String planNo) {
RGeneralSurveyPlanPO rGeneralSurveyPlanPO = new RGeneralSurveyPlanPO();
rGeneralSurveyPlanPO.setPlanNo (planNo);
rGeneralSurveyPlanPO = this.selectByMultiId (rGeneralSurveyPlanPO);
@@ -211,8 +234,9 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
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);
List<MinIoUploadResDTO> collect = Stream.of (split).map (temp -> {
MinIoUploadResDTO dto = new MinIoUploadResDTO("",minIoUtils.getObjectUrl (minIoProperties.getBucket ( ), temp, 7 * 24 * 60 * 60));
return dto ;
}).collect (Collectors.toList ( ));
return collect;
}
@@ -220,7 +244,7 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
/**
* @Description: exportSurveyPlan
* @Param: []
* @return: java.util.List<com.njcn.process.pojo.po.SurveyPlanExcel>
* @return: java.util.List<com.njcn.process.pojo.vo.SurveyPlanExcel>
* @Author: clam
* @Date: 2022/11/21
*/
@@ -233,6 +257,13 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
LambdaQueryWrapper<RGeneralSurveyPlanDetail> lambdaQueryWrapper = new LambdaQueryWrapper<> ();
lambdaQueryWrapper.in (RGeneralSurveyPlanDetail::getPlanNo, planIdList);
List<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetails = rGeneralSurveyPlanDetailMapper.selectList (lambdaQueryWrapper);
//部门处理根据部门code取名称
List<PvTerminalTreeVO> dept = deptFeignClient.allDeptList().getData();
Map<String, String> pvTerminalTreeVOMap = dept.stream().
collect(Collectors.
toMap(PvTerminalTreeVO::getId,
PvTerminalTreeVO::getName));
rGeneralSurveyPlanPOS.forEach (temp->{
SurveyPlanExcel surveyPlanExcel = new SurveyPlanExcel();
BeanUtils.copyProperties (temp, surveyPlanExcel);
@@ -246,6 +277,7 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
map (RGeneralSurveyPlanDetail::getSubId).distinct ( ).count ( );
surveyPlanExcel.setBusCount (Busbarcount);
surveyPlanExcel.setSubCount (Subcount);
surveyPlanExcel.setOrgNo (pvTerminalTreeVOMap.get (surveyPlanExcel.getOrgNo ()));
surveyPlanExcels.add (surveyPlanExcel);
});
@@ -268,6 +300,29 @@ public class RGeneralSurveyPlanPOServiceImpl extends MppServiceImpl<RGeneralSurv
return rGeneralSurveyPlanDetailOnQuestionVOS;
}
/**
* @param questionQueryParm
* @Description: 更具questionQueryParm查计划名称
* @Param: [questionQueryParm]
* @return: java.util.List<com.njcn.process.pojo.param.SurveyPlanQuestionQueryParm>
* @Author: clam
* @Date: 2022/12/1
*/
@Override
public List<RGeneralSurveyPlanPO> querySurveyPlanName(SurveyPlanQuestionQueryParm questionQueryParm) {
List<String> data = deptFeignClient.getDepSonIdtByDeptId (questionQueryParm.getOrgNo ()).getData ( );
QueryWrapper<RGeneralSurveyPlanPO> queryWrapper = new QueryWrapper<> ();
queryWrapper.select ("plan_name").
in ("org_no", data).
eq ("DATE_FORMAT(upload_time, '%Y-%m')", new SimpleDateFormat ("yyyy-MM").
format (questionQueryParm.getPlanStartTime ()));
List<RGeneralSurveyPlanPO> list = this.list (queryWrapper);
return list;
}
/**
* 上传文件到Minio
*