business/src/main/java/com/ycl/controller/ProjectInfoController.java
@@ -8,6 +8,7 @@ import com.ycl.domain.excel.ProjectExcelTemplate; import com.ycl.domain.form.DocumentInfoForm; import com.ycl.domain.form.ProjectInfoForm; import com.ycl.domain.query.ProjectExportQuery; import com.ycl.domain.query.ProjectInfoQuery; import com.ycl.service.ProjectInfoService; import io.swagger.annotations.Api; @@ -19,6 +20,7 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotEmpty; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** @@ -58,7 +60,7 @@ @DeleteMapping("/{id}") @ApiOperation(value = "ID删除", notes = "ID删除") // @PreAuthorize("hasAuthority('projectInfo:del')") public Result removeById(@PathVariable("id") String id) { public Result removeById(@PathVariable("id") Long id) { return projectInfoService.removeById(id); } @@ -115,10 +117,18 @@ * @return */ @PostMapping("/export/template") public void exportTemplate(HttpServletResponse response, @RequestBody List<String> fieldList ) throws IOException { public void exportTemplate(HttpServletResponse response) throws IOException { List<String> fieldList = new ArrayList<>(); OutputExcelUtils.export(response, "导入模板", "项目信息", null, ProjectExcelTemplate.class ,fieldList); } /** * 项目导出 * @param response * @throws IOException */ @PostMapping("/export") public void export(HttpServletResponse response, ProjectExportQuery query) throws IOException { projectInfoService.export(response, query); } } business/src/main/java/com/ycl/controller/ProjectPlanProgressReportController.java
@@ -40,6 +40,11 @@ return projectPlanProgressReportService.add(form); } @PostMapping("/examine") public Result examine(@RequestBody @Validated(Add.class) ProgressReportResponseVO form) { return projectPlanProgressReportService.examine(form); } @PutMapping @ApiOperation(value = "修改", notes = "修改") @PreAuthorize("hasAuthority('projectPlanProgressReport:edit')") business/src/main/java/com/ycl/domain/entity/ProjectPlanInfo.java
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.ycl.system.domain.base.AbsEntity; import com.ycl.system.domain.base.AbsEntityOnlyIdAndDeleted; import lombok.Data; import java.time.LocalDateTime; @@ -18,7 +19,7 @@ */ @Data @TableName("t_project_plan_info") public class ProjectPlanInfo extends AbsEntity { public class ProjectPlanInfo extends AbsEntityOnlyIdAndDeleted { private static final long serialVersionUID = 1L; @@ -35,23 +36,13 @@ private Integer progressStatus; @TableField("start_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") /** 计划开始时间 */ private Date startTime; @TableField("end_time") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") /** 计划完成时间 */ private Date endTime; /** 创建时间 */ @TableField(exist = false) private Date gmtCreate; /** 修改时间 */ @TableField(exist = false) private Date gmtUpdate; @TableField(exist = false) private Integer deleted; } business/src/main/java/com/ycl/domain/excel/ProjectExcelTemplate.java
@@ -2,6 +2,11 @@ import com.alibaba.excel.annotation.ExcelProperty; import com.fasterxml.jackson.annotation.JsonFormat; import com.ycl.common.enums.business.ImportanceTypeEnum; import com.ycl.common.enums.business.ProjectStatusEnum; import com.ycl.common.enums.business.ProjectTypeEnum; import com.ycl.common.utils.excel.annotation.ExcelEnumFormat; import com.ycl.common.utils.excel.convert.ExcelEnumConvert; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; @@ -36,13 +41,15 @@ /** * 项目类型 */ @ExcelProperty(value = "项目类型") @ExcelProperty(value = "项目类型",converter = ExcelEnumConvert.class) @ExcelEnumFormat(enumClass = ProjectTypeEnum.class,codeField = "type",textField = "desc") private String projectType; /** * 项目状态 */ @ExcelProperty(value = "项目状态") @ExcelProperty(value = "项目状态",converter = ExcelEnumConvert.class) @ExcelEnumFormat(enumClass = ProjectStatusEnum.class,codeField = "type",textField = "desc") private String projectStatus; /** @@ -60,7 +67,8 @@ /** * 重点分类 */ @ExcelProperty(value = "重点分类") @ExcelProperty(value = "重点分类",converter = ExcelEnumConvert.class) @ExcelEnumFormat(enumClass = ImportanceTypeEnum.class,codeField = "type",textField = "desc") private String importanceType; /** business/src/main/java/com/ycl/domain/query/ProjectExportQuery.java
New file @@ -0,0 +1,14 @@ package com.ycl.domain.query; import lombok.Data; import java.util.List; @Data public class ProjectExportQuery { //字段列 private List<String> fieldList; //具体的projectId private List<Long> dataIdList; //是否需要附件 private Boolean requireFile; } business/src/main/java/com/ycl/domain/vo/ProjectPlanInfoItem.java
@@ -14,6 +14,8 @@ @NoArgsConstructor public class ProjectPlanInfoItem { private String title; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date startTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date endTime; } business/src/main/java/com/ycl/domain/vo/ProjectPlanInfoVO.java
@@ -2,6 +2,7 @@ import com.ycl.domain.entity.ProjectPlanInfo; import com.ycl.system.domain.base.AbsEntity; import com.ycl.system.domain.base.AbsVo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -19,7 +20,7 @@ */ @Data @ApiModel(value = "项目计划项响应数据", description = "项目计划项响应数据") public class ProjectPlanInfoVO extends AbsVo { public class ProjectPlanInfoVO extends AbsEntity { /** 项目计划记录id */ @ApiModelProperty("项目计划记录id") business/src/main/java/com/ycl/mapper/ProjectInfoMapper.java
@@ -3,10 +3,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.ycl.domain.entity.ProjectInfo; import com.ycl.domain.excel.ProjectExcelTemplate; import com.ycl.domain.query.ProjectInfoQuery; import com.ycl.domain.vo.ProjectInfoVO; import com.ycl.domain.vo.ProjectVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; /** * 项目管理基础信息表 Mapper 接口 @@ -29,4 +33,7 @@ */ IPage getPage(IPage page, @Param("query") ProjectInfoQuery query); List<ProjectVO> homeCount(); List<ProjectVO> selectProjectDetailByIds(@Param("dataIdList") List<Long> dataIdList); } business/src/main/java/com/ycl/service/ProjectInfoService.java
@@ -5,10 +5,12 @@ import com.ycl.domain.entity.ProjectInfo; import com.ycl.domain.form.DocumentInfoForm; import com.ycl.domain.form.ProjectInfoForm; import com.ycl.domain.query.ProjectExportQuery; import com.ycl.domain.query.ProjectInfoQuery; import com.ycl.domain.vo.IndexCountVO; import com.ycl.domain.vo.IndexDTO; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; @@ -46,7 +48,7 @@ * @param id * @return */ Result removeById(String id); Result removeById(Long id); /** * 分页查询 @@ -77,4 +79,6 @@ Result addDoc(DocumentInfoForm form); Result getManagerFlag(Integer recordId); void export(HttpServletResponse response, ProjectExportQuery query); } business/src/main/java/com/ycl/service/ProjectPlanProgressReportService.java
@@ -64,4 +64,6 @@ * @return */ Result all(); Result examine(ProgressReportResponseVO form); } business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
@@ -1,32 +1,42 @@ package com.ycl.service.impl; import cn.hutool.core.collection.CollUtil; import com.alibaba.excel.EasyExcel; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ycl.common.base.Result; import com.ycl.common.enums.business.FileTypeEnum; import com.ycl.common.enums.business.ImportanceTypeEnum; import com.ycl.common.enums.business.ProjectCategoryEnum; import com.ycl.common.exception.base.BaseException; import com.ycl.common.utils.CopyUtils; import com.ycl.common.utils.DateUtils; import com.ycl.common.utils.SecurityUtils; import com.ycl.domain.entity.File; import com.ycl.domain.entity.ProjectInfo; import com.ycl.common.utils.StringUtils; import com.ycl.common.utils.bean.BeanUtils; import com.ycl.common.utils.excel.OutputExcelUtils; import com.ycl.domain.entity.*; import com.ycl.domain.excel.ProjectExcelTemplate; import com.ycl.domain.form.DocumentInfoForm; import com.ycl.domain.form.ProjectInfoForm; import com.ycl.domain.query.ProjectExportQuery; import com.ycl.domain.query.ProjectInfoQuery; import com.ycl.domain.vo.*; import com.ycl.framework.utils.PageUtil; import com.ycl.mapper.FileMapper; import com.ycl.mapper.ProjectInfoMapper; import com.ycl.mapper.*; import com.ycl.service.FileService; import com.ycl.service.ProjectInfoService; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -41,6 +51,10 @@ public class ProjectInfoServiceImpl extends ServiceImpl<ProjectInfoMapper, ProjectInfo> implements ProjectInfoService { private final ProjectInfoMapper projectInfoMapper; private final ProjectInvestmentFundingMapper investmentFundingMapper; private final ProjectInvestmentInfoMapper investmentInfoMapper; private final ProjectInvestmentPolicyComplianceMapper policyMapper; private final ProjectUnitRegistrationInfoMapper unitRegistrationInfoMapper; private final FileService fileService; private final FileMapper fileMapper; @@ -109,7 +123,6 @@ * @return */ @Override //TODO:待完善 public Result remove(List<String> ids) { baseMapper.deleteBatchIds(ids); return Result.ok("删除成功"); @@ -122,8 +135,18 @@ * @return */ @Override //TODO:待完善 public Result removeById(String id) { @Transactional(rollbackFor = Exception.class) public Result removeById(Long id) { investmentFundingMapper.delete(new QueryWrapper<ProjectInvestmentFunding>().eq("project_id", id)); investmentInfoMapper.delete(new QueryWrapper<ProjectInvestmentInfo>().eq("project_id", id)); policyMapper.delete(new QueryWrapper<ProjectInvestmentPolicyCompliance>().eq("project_id", id)); unitRegistrationInfoMapper.delete(new QueryWrapper<ProjectUnitRegistrationInfo>().eq("project_id", id)); List<String> types = new ArrayList<>(); types.add(FileTypeEnum.PROJECT_INFO.getType()); types.add(FileTypeEnum.INVEST_POLICY.getType()); types.add(FileTypeEnum.DOCUMENT_INFO.getType()); fileMapper.delete(new QueryWrapper<File>().eq("bus_id", id).in("type", types)); baseMapper.deleteById(id); return Result.ok("删除成功"); } @@ -143,6 +166,7 @@ query.setProjectEndTime(DateUtils.getDayEnd(query.getProjectEndTime())); } String projectCategory = query.getProjectCategory(); //实施阶段有两个值放在sql处理 if (ProjectCategoryEnum.RESERVE.getType().equals(projectCategory)) { query.setProjectStatus(ProjectCategoryEnum.RESERVE.getStatus()); query.setReserveOrPrevious(ProjectCategoryEnum.RESERVE.getCode()); @@ -180,10 +204,14 @@ private void copyToProjectVO(ProjectInfoVO vo,ProjectVO projectVO) { //忽略null值的复制 CopyUtils.copyNoNullProperties(vo, projectVO); if(vo.getProjectInvestmentFunding()!=null) CopyUtils.copyNoNullProperties(vo.getProjectInvestmentFunding(),projectVO); if(vo.getProjectInvestmentInfo()!=null) CopyUtils.copyNoNullProperties(vo.getProjectInvestmentInfo(),projectVO); if(vo.getProjectUnitRegistrationInfo()!=null) CopyUtils.copyNoNullProperties(vo.getProjectUnitRegistrationInfo(),projectVO); if(vo.getProjectInvestmentPolicyCompliance()!=null) CopyUtils.copyNoNullProperties(vo.getProjectInvestmentPolicyCompliance(),projectVO); if (vo.getProjectInvestmentInfo() != null) CopyUtils.copyNoNullProperties(vo.getProjectInvestmentInfo(), projectVO); if (vo.getProjectUnitRegistrationInfo() != null) CopyUtils.copyNoNullProperties(vo.getProjectUnitRegistrationInfo(), projectVO); if (vo.getProjectInvestmentPolicyCompliance() != null) CopyUtils.copyNoNullProperties(vo.getProjectInvestmentPolicyCompliance(), projectVO); if (vo.getProjectInvestmentFunding() != null) CopyUtils.copyNoNullProperties(vo.getProjectInvestmentFunding(), projectVO); } /** @@ -229,17 +257,80 @@ // {"type":"省重点项目","count":0,"amount":"0.00","text":"省"}]}} IndexCountVO indexCountVO = new IndexCountVO(); List<IndexProPhaseCountVO> proPhaseCountVO = new ArrayList<>(); proPhaseCountVO.add(new IndexProPhaseCountVO("储备规划阶段", 0, "0.00", "储")); proPhaseCountVO.add(new IndexProPhaseCountVO("项目前期阶段", 0, "0.00", "新")); proPhaseCountVO.add(new IndexProPhaseCountVO("实施阶段", 0, "0.00", "建")); proPhaseCountVO.add(new IndexProPhaseCountVO("竣工投用阶段", 0, "0.00", "竣")); List<IndexImpTypeCountVO> impTypeCountVO = new ArrayList<>(); impTypeCountVO.add(new IndexImpTypeCountVO("一般项目", 0, "0.00", "普")); impTypeCountVO.add(new IndexImpTypeCountVO("县重点项目", 0, "0.00", "县")); impTypeCountVO.add(new IndexImpTypeCountVO("市重点项目", 0, "0.00", "市")); impTypeCountVO.add(new IndexImpTypeCountVO("省重点项目", 0, "0.00", "省")); indexCountVO.setImpTypeCountVO(impTypeCountVO); List<ProjectVO> projectVOS = baseMapper.homeCount(); List<ProjectVO> reserve = new ArrayList<>(); List<ProjectVO> previous = new ArrayList<>(); List<ProjectVO> implement = new ArrayList<>(); List<ProjectVO> finish = new ArrayList<>(); List<ProjectVO> normal = new ArrayList<>(); List<ProjectVO> province = new ArrayList<>(); List<ProjectVO> city = new ArrayList<>(); List<ProjectVO> county = new ArrayList<>(); projectVOS.forEach(item -> { if (ProjectCategoryEnum.RESERVE.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectStatus(), item.getProcessId() != null))) { reserve.add(item); } else if (ProjectCategoryEnum.PREVIOUS.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectStatus(), item.getProcessId() != null))) { previous.add(item); } else if (ProjectCategoryEnum.IMPLEMENT.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectStatus(), item.getProcessId() != null))) { implement.add(item); } else if (ProjectCategoryEnum.FINISH.getDesc().equals(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectStatus(), item.getProcessId() != null))) { finish.add(item); } if (ImportanceTypeEnum.PROVINCIAL_KEY.getType().equals(item.getImportanceType())) { province.add(item); } else if (ImportanceTypeEnum.SUINING_KEY.getType().equals(item.getImportanceType())) { city.add(item); } else if (ImportanceTypeEnum.SHEHONG_KEY.getType().equals(item.getImportanceType())) { county.add(item); } else if (ImportanceTypeEnum.NORMAL.getType().equals(item.getImportanceType())) { normal.add(item); } }); //单位先默认为元 proPhaseCountVO.add(new IndexProPhaseCountVO("储备规划阶段", reserve.size(), reserve.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "储")); proPhaseCountVO.add(new IndexProPhaseCountVO("项目前期阶段", previous.size(), previous.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "新")); proPhaseCountVO.add(new IndexProPhaseCountVO("实施阶段", implement.size(), implement.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "建")); proPhaseCountVO.add(new IndexProPhaseCountVO("竣工投用阶段", finish.size(), finish.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "竣")); indexCountVO.setProPhaseCountVO(proPhaseCountVO); List<IndexImpTypeCountVO> impTypeCountVO = new ArrayList<>(); impTypeCountVO.add(new IndexImpTypeCountVO("一般项目", province.size(), province.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "普")); impTypeCountVO.add(new IndexImpTypeCountVO("县重点项目", city.size(), city.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "县")); impTypeCountVO.add(new IndexImpTypeCountVO("市重点项目", county.size(), county.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "市")); impTypeCountVO.add(new IndexImpTypeCountVO("省重点项目", normal.size(), normal.stream(). filter(item -> !StringUtils.isEmpty(item.getTotalInvestment())) .map(item -> new BigDecimal(item.getTotalInvestment()).setScale(2, RoundingMode.HALF_UP)) .reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal("100000000"), 2, RoundingMode.HALF_UP).toString(), "省")); indexCountVO.setImpTypeCountVO(impTypeCountVO); return indexCountVO; @@ -295,4 +386,30 @@ return Result.ok().data(false); } } @Override public void export(HttpServletResponse response, ProjectExportQuery query) { List<ProjectVO> data = baseMapper.selectProjectDetailByIds(query.getDataIdList()); List<ProjectExcelTemplate> excelList = new ArrayList<>(); //字典作翻译 data.forEach(item->{ ProjectExcelTemplate excel = new ProjectExcelTemplate(); BeanUtils.copyProperties(item,excel); //项目阶段 excel.setProjectPhase(ProjectCategoryEnum.getPhaseByProjectStatus(item.getProjectStatus(),item.getProcessId()!=null)); excelList.add(excel); }); //补充文件的字段 Set<Integer> indexes = OutputExcelUtils.getSelectFields(query.getFieldList(), ProjectExcelTemplate.class); //不需要附件 if(!query.getRequireFile()) { try (ServletOutputStream outputStream = response.getOutputStream()) { EasyExcel.write(outputStream, ProjectExcelTemplate.class).includeColumnIndexes(indexes).sheet("项目列表").doWrite(excelList); } catch (Exception e) { log.error(e.getMessage(), e); throw new BaseException("导出失败:" + e.getMessage()); } } //TODO:需要附件 } } business/src/main/java/com/ycl/service/impl/ProjectPlanExamineRecordServiceImpl.java
@@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; import com.ycl.common.utils.SecurityUtils; import com.ycl.domain.entity.ProjectPlanExamineRecord; import com.ycl.domain.entity.ProjectPlanRecord; import com.ycl.domain.vo.DepartmentApprovalResponseVO; import com.ycl.mapper.ProjectPlanExamineRecordMapper; import com.ycl.mapper.ProjectPlanRecordMapper; import com.ycl.service.ProjectPlanExamineRecordService; import com.ycl.common.base.Result; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -33,6 +35,7 @@ public class ProjectPlanExamineRecordServiceImpl extends ServiceImpl<ProjectPlanExamineRecordMapper, ProjectPlanExamineRecord> implements ProjectPlanExamineRecordService { private final ProjectPlanExamineRecordMapper projectPlanExamineRecordMapper; private final ProjectPlanRecordMapper projectPlanRecordMapper; /** * 添加 @@ -150,10 +153,21 @@ @Override public Result saveExamine(ProjectPlanExamineRecordForm form) { // 判断,如果都同意,则直接更新审批记录 if (null != form.getDepartmentExamine() && null != form.getManageExamine() && form.getDepartmentExamine() == 0 && form.getManageExamine() == 0){ ProjectPlanExamineRecord projectPlanExamineRecord = ProjectPlanExamineRecordForm.getEntityByForm(form, null); projectPlanExamineRecord.setId(form.getId().longValue()); projectPlanExamineRecord.setDepartmentUserId(SecurityUtils.getUserId()); projectPlanExamineRecord.setManagerUserId(SecurityUtils.getUserId()); baseMapper.updateById(projectPlanExamineRecord); } // 否则,将项目记录设置为未上报,并将记录逻辑删除 new LambdaUpdateChainWrapper<>(projectPlanRecordMapper) .eq(ProjectPlanRecord::getId, form.getProjectPlanRecordId()) .set(ProjectPlanRecord::getReportStatus,1); new LambdaUpdateChainWrapper<>(baseMapper) .eq(ProjectPlanExamineRecord::getProjectPlanRecordId, form.getProjectPlanRecordId()) .remove(); return Result.ok("回复成功"); } } business/src/main/java/com/ycl/service/impl/ProjectPlanInfoServiceImpl.java
@@ -139,7 +139,10 @@ return Result.error("请选择要添加的计划项"); }} // 删除原有记录 new LambdaUpdateChainWrapper<>(baseMapper).eq(ProjectPlanInfo::getProjectPlanRecordId, request.getProjectPlanRecordId()).remove(); new LambdaUpdateChainWrapper<>(baseMapper) .eq(ProjectPlanInfo::getProjectPlanRecordId, request.getProjectPlanRecordId()) .set(ProjectPlanInfo::getDeleted, 1) .update(); // 批量插入新记录 List<ProjectPlanInfo> list = new ArrayList<>(); request.getAddList().forEach(item -> { @@ -149,15 +152,19 @@ projectPlanInfo.setProgressStatus(0); projectPlanInfo.setStartTime(item.getStartTime()); projectPlanInfo.setEndTime(item.getEndTime()); projectPlanInfo.setDeleted(0); list.add(projectPlanInfo); }); baseMapper.batchInsert(list); list.stream().forEach(i -> { baseMapper.insert(i); }); // 更新计划记录的投资,以及上报状态 new LambdaUpdateChainWrapper<>(projectPlanRecordMapper) .eq(ProjectPlanRecord::getId, request.getProjectPlanRecordId()) .set(ProjectPlanRecord::getActualInvest, request.getActualInvest()) .set(ProjectPlanRecord::getReportStatus, 0) .update(); // 新增一条审核记录 ProjectPlanExamineRecord item = new ProjectPlanExamineRecord(); item.setProjectPlanRecordId(request.getProjectPlanRecordId().longValue()); @@ -166,8 +173,8 @@ item.setDeleted(0); list.stream().forEach(i -> { item.setProjectPlanInfoId(i.getId().longValue()); // projectPlanExamineRecordMapper.insert(item); projectPlanExamineRecordMapper.insertOne(item); // projectPlanExamineRecordMapper.insertOne(item); }); return Result.ok("添加成功"); } business/src/main/java/com/ycl/service/impl/ProjectPlanProgressReportServiceImpl.java
@@ -68,7 +68,6 @@ baseMapper.insertOne(projectPlanProgressReport); }else { projectPlanProgressReport.setId(form.getProgressReportId()); // baseMapper.updateOne(projectPlanProgressReport); baseMapper.updateById(projectPlanProgressReport); } @@ -182,4 +181,32 @@ .collect(Collectors.toList()); return Result.ok().data(vos); } @Override public Result examine(ProgressReportResponseVO form) { // 更新审批记录 ProjectPlanExamineRecord record = new ProjectPlanExamineRecord(); record.setId(form.getExamineRecordId().longValue()); record.setDepartmentExamine(form.getDepartmentExamine()); record.setDepartmentApproval(form.getDepartmentApproval()); record.setManageExamine(form.getManageExamine()); record.setManageApproval(form.getManageApproval()); projectPlanExamineRecordMapper.updateById(record); // 更新计划项状态 if (form.getDepartmentExamine() == 0 && form.getManageExamine() == 0){ new LambdaUpdateChainWrapper<>(projectPlanInfoMapper) .eq(ProjectPlanInfo::getId, form.getId()) .set(ProjectPlanInfo::getProgressStatus, 3) .update(); }else { new LambdaUpdateChainWrapper<>(projectPlanInfoMapper) .eq(ProjectPlanInfo::getId, form.getId()) .set(ProjectPlanInfo::getProgressStatus, 2) .update(); } return Result.ok("审批成功"); } } business/src/main/resources/mapper/ProjectInfoMapper.xml
@@ -149,8 +149,36 @@ <if test="query.reserveOrPrevious != null and query.reserveOrPrevious == 'previous'"> and TPP.process_instance_id is not null </if> <if test="query.projectCategory == 3"> and (TPI.project_status = 'working' or TPI.project_status = 'stop') </if> </where> order by TPI.gmt_create </select> <select id="homeCount" resultType="com.ycl.domain.vo.ProjectVO"> SELECT TPI.*,TPIF.total_investment,TPP.process_instance_id as processId FROM t_project_info TPI LEFT JOIN t_project_investment_funding TPIF ON TPI.id = TPIF.project_id and TPIF.deleted = 0 LEFT JOIN t_project_process TPP ON TPI.id = TPP.project_id and TPP.deleted = 0 WHERE TPI.deleted = 0 </select> <select id="selectProjectDetailByIds" resultType="com.ycl.domain.vo.ProjectVO"> select * from t_project_info TPI left join t_project_investment_funding TPIF on TPI.id = TPIF.project_id and TPIF.deleted = 0 left join t_project_investment_info TPII on TPI.id = TPII.project_id and TPII.deleted = 0 left join t_project_unit_registration_info TPURI on TPI.id = TPURI.project_id and TPURI.deleted = 0 left join t_project_investment_policy_compliance TPIPC on TPI.id = TPIPC.project_id and TPIPC.deleted = 0 <where> TPI.deleted =0 <if test="dataIdList != null and dataIdList.size > 0"> and TPI.id in <foreach collection="dataIdList" item="id" separator="," open="(" close=")"> #{id} </foreach> </if> </where> </select> </mapper> business/src/main/resources/mapper/ProjectPlanExamineRecordMapper.xml
@@ -145,6 +145,7 @@ WHERE project_plan_record_id = #{projectPlanRecordId} ) AS ranked WHERE rn = 1 AND ranked.deleted = 0 Order by gmt_create DESC </select> <select id="getPlanLog" resultType="com.ycl.domain.vo.DepartmentApprovalResponseVO"> business/src/main/resources/mapper/ProjectPlanInfoMapper.xml
@@ -9,12 +9,13 @@ <result column="progress_status" property="progressStatus" /> <result column="start_time" property="startTime" /> <result column="end_time" property="endTime" /> <result column="deleted" property="deleted" /> </resultMap> <insert id="batchInsert" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> insert into t_project_plan_info(project_plan_record_id, title, progress_status, start_time, end_time) insert into t_project_plan_info(project_plan_record_id, title, progress_status, start_time, end_time, deleted) values <foreach collection="list" item="item" separator=","> (#{item.projectPlanRecordId}, #{item.title}, #{item.progressStatus}, #{item.startTime}, #{item.endTime}) (#{item.projectPlanRecordId}, #{item.title}, #{item.progressStatus}, #{item.startTime}, #{item.endTime}, #{item.deleted}) </foreach> </insert> <insert id="insertOne"> business/src/main/resources/mapper/ProjectPlanProgressReportMapper.xml
@@ -93,7 +93,6 @@ LEFT JOIN t_project_plan_progress_report AS pppr ON pppr.project_plan_info_id = ppi.id RIGHT JOIN t_project_plan_examine_record AS pper ON pper.project_plan_info_id = ppi.id WHERE ppi.id = #{id} ORDER BY pper.gmt_create DESC LIMIT 1 </select> </mapper> common/src/main/java/com/ycl/common/enums/business/ImportanceTypeEnum.java
New file @@ -0,0 +1,31 @@ package com.ycl.common.enums.business; import com.baomidou.mybatisplus.annotation.EnumValue; import com.fasterxml.jackson.annotation.JsonValue; import lombok.Getter; /** * 重点类型枚举 * * @author:flq * @date:2024/11/27 18:21 */ @Getter public enum ImportanceTypeEnum { PROVINCIAL_KEY("provincial_key", "省重点"), SUINING_KEY("suining_key","遂宁市重点"), //县重点 SHEHONG_KEY("shehong_key","射洪市重点"), NORMAL("normal", "一般"); @EnumValue // 标明该字段存入数据库 private final String type; @JsonValue // 标明在转JSON时使用该字段 private final String desc; ImportanceTypeEnum(String type, String desc) { this.type = type; this.desc = desc; } } common/src/main/java/com/ycl/common/enums/business/ProjectStatusEnum.java
New file @@ -0,0 +1,30 @@ package com.ycl.common.enums.business; import com.baomidou.mybatisplus.annotation.EnumValue; import com.fasterxml.jackson.annotation.JsonValue; import lombok.Getter; /** * 项目状态枚举 * * @author:flq * @date:2024/11/27 18:21 */ @Getter public enum ProjectStatusEnum { PENDDING("pendding", "未开工"), WORKING("working","已开工"), FINISH("finish","已竣工"), STOP("stop", "暂停"); @EnumValue // 标明该字段存入数据库 private final String type; @JsonValue // 标明在转JSON时使用该字段 private final String desc; ProjectStatusEnum(String type, String desc) { this.type = type; this.desc = desc; } } common/src/main/java/com/ycl/common/enums/business/ProjectTypeEnum.java
New file @@ -0,0 +1,32 @@ package com.ycl.common.enums.business; import com.baomidou.mybatisplus.annotation.EnumValue; import com.fasterxml.jackson.annotation.JsonValue; import lombok.Getter; /** * 项目类型枚举 * * @author:flq * @date:2024/11/27 18:21 */ @Getter public enum ProjectTypeEnum { HOUSE("house", "房屋建筑"), CITY("city","城市基础设施"), TRANSPORT("transport","交通运输"), WATER("water", "水利"), ENERGY("energy", "能源"), NON_COAL_MINE("non_coal_mine", "非煤矿山"); @EnumValue // 标明该字段存入数据库 private final String type; @JsonValue // 标明在转JSON时使用该字段 private final String desc; ProjectTypeEnum(String type, String desc) { this.type = type; this.desc = desc; } } common/src/main/java/com/ycl/common/utils/excel/OutputExcelUtils.java
@@ -5,6 +5,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ZipUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.ycl.common.utils.excel.convert.ExcelBigNumberConvert; @@ -21,6 +22,7 @@ import java.lang.reflect.Field; import java.net.URLEncoder; import java.nio.file.Files; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -155,8 +157,10 @@ public static <T> @NotNull Set<Integer> getSelectFields(List<String> fieldNames, Class<T> clazz) { Set<Integer> selectedIndexes = new HashSet<>(); if (CollUtil.isNotEmpty(fieldNames)) { // 反射获取字段属性 Field[] declaredFields = clazz.getDeclaredFields(); // 反射获取字段属性,这里只获取easyExcel注解的字段 Field[] declaredFields = Arrays.stream(clazz.getDeclaredFields()) .filter(field -> field.isAnnotationPresent(ExcelProperty.class)) .toArray(Field[]::new); // // 匹配需要导入的字段 for (int i = 0; i < declaredFields.length; i++) { if (fieldNames.contains(declaredFields[i].getName())) {