技术监督管理

用户部门添加省级,市,县层级判断
This commit is contained in:
2023-06-26 09:14:39 +08:00
parent 3855accc61
commit c4cc262964
28 changed files with 1509 additions and 1 deletions

View File

@@ -0,0 +1,57 @@
package com.njcn.process.controller;
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.service.ISupvFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import com.njcn.web.controller.BaseController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/**
* <p>
* 前端控制器
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@RestController
@RequestMapping("/supv/file")
@Api(tags = "技术监督附件控制器")
@RequiredArgsConstructor
public class SupvFileController extends BaseController {
private final ISupvFileService iSupvFileService;
@PostMapping("planUpload")
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPLOAD)
@ApiOperation("监督计划问题附件上传")
public HttpResult<Object> planUpload(@ApiParam(value = "文件", required = true) @RequestPart("files") MultipartFile file, @RequestParam("planId") String planId, @RequestParam("type") Integer type){
String methodDescribe = getMethodDescribe("planUpload");
iSupvFileService.planUpload(file,planId,type);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("detail")
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DOWNLOAD)
@ApiOperation("监督计划问题附件下载")
public HttpResult<Object> detail(HttpServletResponse response, @RequestParam("busId") String busId, @RequestParam("type") Integer type){
String methodDescribe = getMethodDescribe("detail");
iSupvFileService.detail(response,busId,type);
return null;
}
}

View File

@@ -0,0 +1,43 @@
package com.njcn.process.controller;
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.SupvPlanParam;
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.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
/**
* pqs
* 月度统计
* @author cdf
* @date 2023/6/26
*/
@RestController
@RequestMapping("/supv/report")
@Api(tags = "技术监督月统计控制器")
@RequiredArgsConstructor
public class SupvMonthStatisController extends BaseController {
@PostMapping("statisticReport")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiIgnore
public HttpResult<Object> statisticReport(@RequestBody @Validated SupvPlanParam supvPlanParam){
String methodDescribe = getMethodDescribe("statisticReport");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}

View File

@@ -0,0 +1,91 @@
package com.njcn.process.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.SupvPlanParam;
import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.vo.SupvPlanVO;
import com.njcn.process.service.ISupvPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import liquibase.pro.packaged.S;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.njcn.web.controller.BaseController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@RestController
@RequestMapping("/supv/plan")
@Api(tags = "技术监督计划控制器")
@RequiredArgsConstructor
public class SupvPlanController extends BaseController {
private final ISupvPlanService iSupvPlanService;
@PostMapping("addPlan")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("新增技术监督计划")
@ApiImplicitParam(name = "supvPlanParam",value = "请求体",required = true)
public HttpResult<Object> addPlan(@RequestBody @Validated SupvPlanParam supvPlanParam){
String methodDescribe = getMethodDescribe("addPlan");
iSupvPlanService.addPlan(supvPlanParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("updatePlan")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("修改技术监督计划")
@ApiImplicitParam(name = "supvPlanParam",value = "请求体",required = true)
public HttpResult<Object> updatePlan(@RequestBody @Validated SupvPlanParam.UpdateSupvPlanParam supvPlanParam){
String methodDescribe = getMethodDescribe("updatePlan");
iSupvPlanService.updatePlan(supvPlanParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("delPlan")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("删除监督计划")
@ApiImplicitParam(name = "planIds",value = "监督计划索引集合",required = true)
public HttpResult<Object> delPlan(@RequestBody List<String> planIds){
String methodDescribe = getMethodDescribe("delPlan");
iSupvPlanService.delPlan(planIds);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("pagePlan")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("分页查询监督计划")
@ApiImplicitParam(name = "supvPlanParam",value = "请求体",required = true)
public HttpResult<Page<SupvPlanVO>> pagePlan(@RequestBody SupvPlanParam supvPlanParam){
String methodDescribe = getMethodDescribe("pagePlan");
Page<SupvPlanVO> page = iSupvPlanService.pagePlan(supvPlanParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -0,0 +1,90 @@
package com.njcn.process.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.process.pojo.param.SupvProblemParam;
import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.service.ISupvProblemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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.web.controller.BaseController;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@RestController
@RequestMapping("/supv/problem")
@Api(tags = "技术监督实施问题控制器")
@RequiredArgsConstructor
public class SupvProblemController extends BaseController {
private final ISupvProblemService iSupvProblemService;
@PostMapping("addProblem")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("新增技术监督问题")
@ApiImplicitParam(name = "supvProblemParam",value = "请求体",required = true)
public HttpResult<Object> addProblem(@RequestBody @Validated SupvProblemParam supvProblemParam){
String methodDescribe = getMethodDescribe("addProblem");
iSupvProblemService.addProblem(supvProblemParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("updateProblem")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("修改技术监督问题")
@ApiImplicitParam(name = "supvProblemParam",value = "请求体",required = true)
public HttpResult<Object> updateProblem(@RequestBody @Validated SupvProblemParam.UpdateSupvProblemParam supvProblemParam){
String methodDescribe = getMethodDescribe("updateProblem");
iSupvProblemService.updateProblem(supvProblemParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("delProblem")
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("删除监督问题")
@ApiImplicitParam(name = "problemIds",value = "监督问题计划索引集合",required = true)
public HttpResult<Object> delProblem(@RequestBody List<String> problemIds){
String methodDescribe = getMethodDescribe("delProblem");
iSupvProblemService.delProblem(problemIds);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
@PostMapping("pageProblem")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("分页查询监督问题")
@ApiImplicitParam(name = "supvProblemParam",value = "请求体",required = true)
public HttpResult<Page<SupvProblem>> pageProblem(@RequestBody SupvProblemParam supvProblemParam){
String methodDescribe = getMethodDescribe("pageProblem");
if(StrUtil.isBlank(supvProblemParam.getPlanId())){
throw new BusinessException("监督计划索引不可为空");
}
Page<SupvProblem> page = iSupvProblemService.pageProblem(supvProblemParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
}

View File

@@ -0,0 +1,17 @@
package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.process.pojo.po.SupvFile;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface SupvFileMapper extends BaseMapper<SupvFile> {
}

View File

@@ -0,0 +1,21 @@
package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.process.pojo.param.SupvPlanParam;
import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.vo.SupvPlanVO;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface SupvPlanMapper extends BaseMapper<SupvPlan> {
}

View File

@@ -0,0 +1,17 @@
package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.process.pojo.po.SupvProblem;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface SupvProblemMapper extends BaseMapper<SupvProblem> {
}

View File

@@ -0,0 +1,5 @@
<?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.SupvFileMapper">
</mapper>

View File

@@ -0,0 +1,6 @@
<?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.SupvPlanMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?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.SupvProblemMapper">
</mapper>

View File

@@ -0,0 +1,30 @@
package com.njcn.process.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.process.pojo.po.SupvFile;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
/**
* <p>
* 服务类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface ISupvFileService extends IService<SupvFile> {
/**
*
* @author cdf
* @date 2023/6/25
*/
boolean planUpload(MultipartFile file,String planId, Integer type);
String detail(HttpServletResponse response,String busId,Integer type);
}

View File

@@ -0,0 +1,58 @@
package com.njcn.process.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.process.pojo.param.SupvPlanParam;
import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.vo.SupvPlanVO;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface ISupvPlanService extends IService<SupvPlan> {
/**
* 新增技术监督
* @author cdf
* @date 2023/6/21
*/
boolean addPlan(SupvPlanParam supvPlanParam);
/**
* 修改技术监督
* @author cdf
* @date 2023/6/21
*/
boolean updatePlan(SupvPlanParam supvPlanParam);
/**
* 删除技术监督
* @author cdf
* @date 2023/6/21
*/
boolean delPlan(List<String> planIds);
/**
* 分页查询技术监督
* @author cdf
* @date 2023/6/21
*/
Page<SupvPlanVO> pagePlan(SupvPlanParam supvPlanParam);
}

View File

@@ -0,0 +1,51 @@
package com.njcn.process.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.process.pojo.param.SupvProblemParam;
import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.po.SupvProblem;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
public interface ISupvProblemService extends IService<SupvProblem> {
/**
* 新增技术监督问题
* @author cdf
* @date 2023/6/21
*/
boolean addProblem(SupvProblemParam supvProblemParam);
/**
* 修改技术监督问题
* @author cdf
* @date 2023/6/21
*/
boolean updateProblem(SupvProblemParam supvProblemParam);
/**
* 删除技术监督问题
* @author cdf
* @date 2023/6/21
*/
boolean delProblem(List<String> problemIds);
/**
* 分页查询技术监督问题
* @author cdf
* @date 2023/6/21
*/
Page<SupvProblem> pageProblem(SupvProblemParam supvProblemParam);
}

View File

@@ -0,0 +1,64 @@
package com.njcn.process.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.mapper.SupvFileMapper;
import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.service.ISupvFileService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.Objects;
/**
* <p>
* 服务实现类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@Service
@RequiredArgsConstructor
public class SupvFileServiceImpl extends ServiceImpl<SupvFileMapper, SupvFile> implements ISupvFileService {
private final FileStorageUtil fileStorageUtil;
private final SupvFileMapper supvFileMapper;
@Override
public boolean planUpload(MultipartFile file, String planId, Integer type) {
SupvFile supvFile = this.getOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,planId).eq(SupvFile::getType,type));
String url = fileStorageUtil.uploadMultipart(file, OssPath.SURVEY_RESULT);
SupvFile supvFilePO = new SupvFile();
supvFilePO.setAttachmentName(file.getOriginalFilename());
supvFilePO.setFile(url);
if(Objects.nonNull(supvFile)){
fileStorageUtil.deleteFile(supvFile.getFile());
supvFilePO.setId(supvFile.getId());
return this.updateById(supvFilePO);
}
supvFilePO.setAttachmentType("01");
supvFilePO.setBusiId(planId);
supvFilePO.setType(type);
return this.save(supvFilePO);
}
@Override
public String detail(HttpServletResponse response,String busId, Integer type) {
SupvFile supvFile = this.getOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,busId).eq(SupvFile::getType,type));
if(Objects.nonNull(supvFile)){
fileStorageUtil.downloadStream(response,supvFile.getFile());
return null;
}else {
throw new BusinessException("不存在附件");
}
}
}

View File

@@ -0,0 +1,171 @@
package com.njcn.process.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.process.enums.ProcessResponseEnum;
import com.njcn.process.mapper.SupvFileMapper;
import com.njcn.process.mapper.SupvPlanMapper;
import com.njcn.process.pojo.param.SupvPlanParam;
import com.njcn.process.pojo.po.SupvFile;
import com.njcn.process.pojo.po.SupvPlan;
import com.njcn.process.pojo.vo.SupvPlanVO;
import com.njcn.process.service.ISupvFileService;
import com.njcn.process.service.ISupvPlanService;
import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
import com.njcn.web.factory.PageFactory;
import liquibase.pro.packaged.L;
import liquibase.pro.packaged.S;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@Service
@RequiredArgsConstructor
public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> implements ISupvPlanService {
private final DeptFeignClient deptFeignClient;
private final SupvFileMapper supvFileMapper;
@Override
public boolean addPlan(SupvPlanParam supvPlanParam) {
checkParam(supvPlanParam,false);
SupvPlan supvPlan = new SupvPlan();
BeanUtil.copyProperties(supvPlanParam,supvPlan);
supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate()));
supvPlan.setSupvEndTime(PubUtils.localDateFormat(supvPlanParam.getSupvEndTime()));
supvPlan.setSupvStartTime(PubUtils.localDateFormat(supvPlanParam.getSupvStartTime()));
supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime()));
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
supvPlan.setIsUploadHead(0);
this.save(supvPlan);
return true;
}
@Override
public boolean updatePlan(SupvPlanParam supvPlanParam) {
checkParam(supvPlanParam,true);
SupvPlan supvPlan = new SupvPlan();
BeanUtil.copyProperties(supvPlanParam,supvPlan);
supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate()));
supvPlan.setSupvEndTime(PubUtils.localDateFormat(supvPlanParam.getSupvEndTime()));
supvPlan.setSupvStartTime(PubUtils.localDateFormat(supvPlanParam.getSupvStartTime()));
supvPlan.setProblemOcTime(PubUtils.localDateTimeFormat(supvPlanParam.getProblemOcTime()));
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
this.updateById(supvPlan);
return true;
}
@Override
public boolean delPlan(List<String> planIds) {
return this.removeByIds(planIds);
}
@Override
public Page<SupvPlanVO> pagePlan(SupvPlanParam supvPlanParam) {
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if(StrUtil.isNotBlank(supvPlanParam.getSupvOrgId())){
List<String> deptIds = deptChildrenList(supvPlanParam.getSupvOrgId());
lambdaQueryWrapper.in(SupvPlan::getSupvOrgId,deptIds);
}
Map<String,PvTerminalTreeVO> mapCode = deptAllCodeList();
Map<String,PvTerminalTreeVO> mapList = deptAllList();
Page<SupvPlan> page = this.page(new Page<>(PageFactory.getPageNum(supvPlanParam), PageFactory.getPageSize(supvPlanParam)),lambdaQueryWrapper);
List<SupvPlanVO> supvPlanVOList = BeanUtil.copyToList(page.getRecords(),SupvPlanVO.class);
supvPlanVOList.forEach(item->{
PvTerminalTreeVO pvTerminalTreeVO = mapCode.get(item.getSupvOrgId());
item.setSupvOrgName(pvTerminalTreeVO.getName());
item.setCounty(pvTerminalTreeVO.getName());
PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid());
if(Objects.nonNull(pvTerminalTreeOne)){
item.setCity(pvTerminalTreeOne.getName());
}
PvTerminalTreeVO pvTerminalTreeTwo = mapList.get(pvTerminalTreeOne.getPid());
if(Objects.nonNull(pvTerminalTreeTwo)){
item.setProvince(pvTerminalTreeTwo.getName());
}
SupvFile supvFile = supvFileMapper.selectOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,item.getPlanId()).eq(SupvFile::getType,0));
if(Objects.nonNull(supvFile)){
item.setAttachmentName(supvFile.getAttachmentName());
}
});
Page<SupvPlanVO> pageVo = new Page<>();
pageVo.setTotal(page.getTotal());
pageVo.setPages(page.getPages());
pageVo.setSize(page.getSize());
pageVo.setRecords(supvPlanVOList);
return pageVo;
}
private void checkParam(SupvPlanParam supvPlanParam,Boolean updateFlag){
LambdaQueryWrapper<SupvPlan> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvPlan::getWorkPlanName,supvPlanParam.getWorkPlanName());
if(updateFlag) {
if (supvPlanParam instanceof SupvPlanParam.UpdateSupvPlanParam) {
//修改
lambdaQueryWrapper.ne(SupvPlan::getPlanId, ((SupvPlanParam.UpdateSupvPlanParam) supvPlanParam).getPlanId());
}
}
int count = this.count(lambdaQueryWrapper);
if(count>0){
throw new BusinessException(ProcessResponseEnum.SUPV_PLAN_REPEAT);
}
//判断监督对象类型
}
@DS("pms")
private List<String> deptChildrenList(String deptId){
return deptFeignClient.getDepSonSelfCodetByDeptId(deptId).getData();
}
@DS("pms")
private Map<String,PvTerminalTreeVO> deptAllList(){
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
return deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getId, Function.identity()));
}
@DS("pms")
private Map<String,PvTerminalTreeVO> deptAllCodeList(){
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
return deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
}
}

View File

@@ -0,0 +1,66 @@
package com.njcn.process.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.utils.PubUtils;
import com.njcn.process.enums.ProcessResponseEnum;
import com.njcn.process.mapper.SupvProblemMapper;
import com.njcn.process.pojo.param.SupvProblemParam;
import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.pojo.po.SupvProblem;
import com.njcn.process.service.ISupvProblemService;
import com.njcn.web.factory.PageFactory;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author hongawen
* @since 2023-06-21
*/
@Service
public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvProblem> implements ISupvProblemService {
@Override
public boolean addProblem(SupvProblemParam supvProblemParam) {
SupvProblem supvProblem = new SupvProblem();
BeanUtil.copyProperties(supvProblemParam,supvProblem);
supvProblem.setPlanRectificationTime(PubUtils.localDateFormat(supvProblemParam.getPlanRectificationTime()));
supvProblem.setRectificationTime(PubUtils.localDateFormat(supvProblemParam.getRectificationTime()));
this.save(supvProblem);
return true;
}
@Override
public boolean updateProblem(SupvProblemParam supvProblemParam) {
SupvProblem supvProblem = new SupvProblem();
BeanUtil.copyProperties(supvProblemParam,supvProblem);
supvProblem.setPlanRectificationTime(PubUtils.localDateFormat(supvProblemParam.getPlanRectificationTime()));
supvProblem.setRectificationTime(PubUtils.localDateFormat(supvProblemParam.getRectificationTime()));
this.updateById(supvProblem);
return true;
}
@Override
public boolean delProblem(List<String> problemIds) {
return this.removeByIds(problemIds);
}
@Override
public Page<SupvProblem> pageProblem(SupvProblemParam supvProblemParam) {
LambdaQueryWrapper<SupvProblem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SupvProblem::getPlanId,supvProblemParam.getPlanId());
return this.page(new Page<>(PageFactory.getPageNum(supvProblemParam), PageFactory.getPageSize(supvProblemParam)),lambdaQueryWrapper);
}
}