技术监督管理
用户部门添加省级,市,县层级判断
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -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("不存在附件");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user