谐波普测模块修改

This commit is contained in:
huangzj
2023-03-15 18:46:18 +08:00
parent c29e445933
commit 61216a0b37
25 changed files with 1192 additions and 178 deletions

View File

@@ -13,21 +13,23 @@ import com.njcn.minioss.bo.MinIoUploadResDTO;
import com.njcn.poi.util.PoiUtil;
import com.njcn.process.pojo.param.*;
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.pojo.po.RSurveyPlanConfigPO;
import com.njcn.process.pojo.vo.*;
import com.njcn.process.service.RGeneralSurveyPlanDetailService;
import com.njcn.process.service.RGeneralSurveyPlanPOService;
import com.njcn.process.service.impl.RSurveyPlanConfigService;
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 lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@@ -52,8 +54,10 @@ public class RGeneralSurveyPlanController extends BaseController {
private final RGeneralSurveyPlanPOService rGeneralSurveyPlanPOService;
private @Autowired
private final
RGeneralSurveyPlanDetailService rGeneralSurveyPlanDetailService;
private final
RSurveyPlanConfigService rSurveyPlanConfigService;
/**
* @Description: 新增/修改普测计划
* @Param: [rGeneralSurveyPlanAddParm]
@@ -72,7 +76,80 @@ public class RGeneralSurveyPlanController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, addFlag, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/addPlanCycle")
@ApiOperation("设置普测周期")
@ApiImplicitParam(name = "cycleNum", value = "普测周期", required = true)
public HttpResult<RSurveyCycleVO> addPlanCycle(@RequestParam("cycleNum") Integer cycleNum ){
String methodDescribe = getMethodDescribe("addPlanCycle");
RSurveyCycleVO rSurveyCycleVO = rGeneralSurveyPlanPOService.addPlanCycle(cycleNum);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rSurveyCycleVO, methodDescribe);
}
@ResponseBody
@ApiOperation("excel批量导入电站信息")
@PostMapping(value = "importSubStatation")
public HttpResult<String> importSubStatation(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
String methodDescribe = getMethodDescribe("importSubStatation");
rGeneralSurveyPlanPOService.importSubStatation(file, response);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/initDetpStataionTree")
@ApiOperation("初始化部门")
@ApiImplicitParam(name = "orgId", value = "部门号", required = true)
public HttpResult<List<DeptSubstationVO>> initDetpStataionTree(@RequestParam("orgId") String orgId ){
String methodDescribe = getMethodDescribe("initDetpStataionTree");
List<DeptSubstationVO> list = rGeneralSurveyPlanPOService.initDetpStataionTree ( orgId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/addPlanConfig")
@ApiOperation("增加普测计划参数")
@ApiImplicitParam(name = "rSurveyPlanConfigVOList", value = "", required = true)
public HttpResult<Boolean> addPlanConfig(@Validated @RequestBody List<RSurveyPlanConfigVO> rSurveyPlanConfigVOList){
String methodDescribe = getMethodDescribe("querySubStatation");
double sum = rSurveyPlanConfigVOList.stream ( ).mapToDouble (RSurveyPlanConfigVO::getProportion).sum ( );
if(sum>1){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.MATH_ERROR, false, methodDescribe);
}
List<RSurveyPlanConfigPO> collect = rSurveyPlanConfigVOList.stream ( ).map (temp -> {
RSurveyPlanConfigPO rs = new RSurveyPlanConfigPO ( );
BeanUtils.copyProperties (temp, rs);
return rs;
}).collect (Collectors.toList ( ));
boolean b = rSurveyPlanConfigService.saveOrUpdateBatchByMultiId (collect, 500);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryPlanConfig")
@ApiOperation("查询普测计划参数")
public HttpResult<List<RSurveyPlanConfigVO>> queryPlanConfig(){
String methodDescribe = getMethodDescribe("queryPlanConfig");
List<RSurveyPlanConfigPO> list = rSurveyPlanConfigService.list ( );
List<RSurveyPlanConfigVO> collect = list.stream ( ).map (temp -> {
RSurveyPlanConfigVO rs = new RSurveyPlanConfigVO ( );
BeanUtils.copyProperties (temp, rs);
return rs;
}).collect (Collectors.toList ( ));
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, collect, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/querySubStatation")
@ApiOperation("电站勾选接口")
@ApiImplicitParam(name = "statetionNum", value = "电站数量", required = true)
public HttpResult<RGeneralSurveyPlanAddParm> querySubStatation(@RequestParam("statetionNum") Integer statetionNum ){
String methodDescribe = getMethodDescribe("querySubStatation");
RGeneralSurveyPlanAddParm rGeneralSurveyPlanAddParm = rGeneralSurveyPlanPOService.querySubStatation (statetionNum);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rGeneralSurveyPlanAddParm, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/queryPlan")
@@ -118,16 +195,16 @@ public class RGeneralSurveyPlanController extends BaseController {
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)
// @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);
// }