business/src/main/java/com/ycl/controller/ProjectInfoController.java
@@ -4,6 +4,7 @@ import com.ycl.common.group.Add; import com.ycl.common.group.Update; import com.ycl.common.utils.ProjectCodeGenerator; import com.ycl.domain.form.DocumentInfoForm; import com.ycl.domain.form.ProjectInfoForm; import com.ycl.domain.query.ProjectInfoQuery; import com.ycl.service.ProjectInfoService; @@ -37,7 +38,12 @@ public Result add(@RequestBody @Validated(Add.class) ProjectInfoForm form) { return projectInfoService.add(form); } @PostMapping("/document") @ApiOperation(value = "添加相关文件", notes = "添加相关文件") // @PreAuthorize("hasAuthority('projectInfo:add')") public Result addDoc(@RequestBody @Validated(Add.class) DocumentInfoForm form) { return projectInfoService.addDoc(form); } @PutMapping @ApiOperation(value = "修改", notes = "修改") // @PreAuthorize("hasAuthority('projectInfo:edit')") @@ -72,7 +78,12 @@ public Result detail(@PathVariable("id") Integer id) { return projectInfoService.detail(id); } @GetMapping("/document/{id}") @ApiOperation(value = "相关文件详情", notes = "相关文件详情") // @PreAuthorize("hasAuthority('projectInfo:detail')") public Result docDetail(@PathVariable("id") Integer id) { return projectInfoService.docDetail(id); } @GetMapping("/list") // @PreAuthorize("hasAuthority('projectInfo:list')") @ApiOperation(value = "列表", notes = "列表") business/src/main/java/com/ycl/domain/entity/ProjectInvestmentPolicyCompliance.java
@@ -23,37 +23,25 @@ /** 项目id */ private Long projectId; @TableField("policy_compliance_attachment") /** 符合产业政策附件 */ private String policyComplianceAttachment; @TableField("belongs_to_industry_adjustment_directory") /** 是否属于《产业结构调整指导目录》下的项目 */ private String belongsToIndustryAdjustmentDirectory; @TableField("belongs_to_allowed_projects") /** 是否属于未列入《产业结构调整指导目录》的允许类项目 */ private String belongsToAllowedProjects; private Boolean belongsToIndustryAdjustmentDirectory; @TableField("belongs_to_western_encouraged_directory") /** 是否属于《西部地区鼓励类产业目录》的项目 */ private Integer belongsToWesternEncouragedDirectory; private Boolean belongsToWesternEncouragedDirectory; @TableField("not_banned_or_controlled_project") /** 是否不属于产业政策禁止投资建设或实行核准、审批管理的项目 */ private Integer notBannedOrControlledProject; private Boolean notBannedOrControlledProject; @TableField("information_is_true") /** 填报信息是否真实 */ private Integer informationIsTrue; private Boolean informationIsTrue; @TableField("special_planning_compliance") /** 专项规划复合情况 */ private String specialPlanningCompliance; @TableField("energy_consumption") /** 项目能耗情况 */ private String energyConsumption; @TableField("annual_energy_consumption") /** 项目年综合能源消费量(标准煤当量值) */ @@ -65,11 +53,11 @@ @TableField("energy_check") /** 节能审查(1需要,0不需要) */ private String energyCheck; private Boolean energyCheck; @TableField("no_only_check_type") /** 不再单独进行节能审查的类型 */ private String noOnlyCheckType; private Integer noOnlyCheckType; @TableField("remarks") /** 备注 */ business/src/main/java/com/ycl/domain/form/DocumentInfoForm.java
New file @@ -0,0 +1,12 @@ package com.ycl.domain.form; import com.ycl.domain.entity.File; import lombok.Data; import java.util.List; @Data public class DocumentInfoForm { private List<File> fileList; private Long projectId; } business/src/main/java/com/ycl/domain/form/ProjectInvestmentPolicyComplianceForm.java
@@ -2,16 +2,18 @@ import com.ycl.common.group.Update; import com.ycl.common.group.Add; import com.ycl.domain.entity.File; import com.ycl.system.domain.base.AbsForm; import com.ycl.domain.entity.ProjectInvestmentPolicyCompliance; import org.springframework.beans.BeanUtils; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import org.springframework.lang.NonNull; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.Date; import java.util.List; /** * 投资项目产业政策符合情况表表单 @@ -27,7 +29,7 @@ private Long projectId; @ApiModelProperty("符合产业政策附件") private String policyComplianceAttachment; private List<File> fileList; @ApiModelProperty("是否属于《产业结构调整指导目录》下的项目") private Boolean belongsToIndustryAdjustmentDirectory; @@ -47,9 +49,6 @@ @ApiModelProperty("专项规划复合情况") private String specialPlanningCompliance; @ApiModelProperty("项目能耗情况") private String energyConsumption; @ApiModelProperty("项目年综合能源消费量(标准煤当量值)") private String annualEnergyConsumption; @@ -57,10 +56,10 @@ private String annualElectricityConsumption; @ApiModelProperty("节能审查(1需要,0不需要)") private String energyCheck; private Boolean energyCheck; @ApiModelProperty("不再单独进行节能审查的类型") private String noOnlyCheckType; private Integer noOnlyCheckType; @ApiModelProperty("备注") private String remarks; business/src/main/java/com/ycl/domain/vo/ProjectInvestmentPolicyComplianceVO.java
@@ -1,5 +1,6 @@ package com.ycl.domain.vo; import com.ycl.domain.entity.File; import com.ycl.system.domain.base.AbsVo; import com.ycl.domain.entity.ProjectInvestmentPolicyCompliance; import java.util.List; @@ -26,15 +27,11 @@ /** 符合产业政策附件 */ @ApiModelProperty("符合产业政策附件") private String policyComplianceAttachment; private List<File> fileList; /** 是否属于《产业结构调整指导目录》下的项目 */ @ApiModelProperty("是否属于《产业结构调整指导目录》下的项目") private Boolean belongsToIndustryAdjustmentDirectory; /** 是否属于未列入《产业结构调整指导目录》的允许类项目 */ @ApiModelProperty("是否属于未列入《产业结构调整指导目录》的允许类项目") private Boolean belongsToAllowedProjects; /** 是否属于《西部地区鼓励类产业目录》的项目 */ @ApiModelProperty("是否属于《西部地区鼓励类产业目录》的项目") @@ -46,15 +43,11 @@ /** 填报信息是否真实 */ @ApiModelProperty("填报信息是否真实") private Integer informationIsTrue; private Boolean informationIsTrue; /** 专项规划复合情况 */ @ApiModelProperty("专项规划复合情况") private String specialPlanningCompliance; /** 项目能耗情况 */ @ApiModelProperty("项目能耗情况") private String energyConsumption; /** 项目年综合能源消费量(标准煤当量值) */ @ApiModelProperty("项目年综合能源消费量(标准煤当量值)") @@ -66,11 +59,11 @@ /** 节能审查(1需要,0不需要) */ @ApiModelProperty("节能审查(1需要,0不需要)") private String energyCheck; private Boolean energyCheck; /** 不再单独进行节能审查的类型 */ @ApiModelProperty("不再单独进行节能审查的类型") private String noOnlyCheckType; private Integer noOnlyCheckType; /** 备注 */ @ApiModelProperty("备注") business/src/main/java/com/ycl/service/ProjectInfoService.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ycl.common.base.Result; import com.ycl.domain.entity.ProjectInfo; import com.ycl.domain.form.DocumentInfoForm; import com.ycl.domain.form.ProjectInfoForm; import com.ycl.domain.query.ProjectInfoQuery; import com.ycl.domain.vo.IndexCountVO; @@ -70,4 +71,8 @@ IndexCountVO getIndexCount(IndexDTO indexDTO); Map<String,Integer> countExceptionProject(IndexDTO indexDTO); Result docDetail(Integer id); Result addDoc(DocumentInfoForm form); } business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
@@ -8,6 +8,7 @@ import com.ycl.common.utils.SecurityUtils; import com.ycl.domain.entity.File; import com.ycl.domain.entity.ProjectInfo; import com.ycl.domain.form.DocumentInfoForm; import com.ycl.domain.form.ProjectInfoForm; import com.ycl.domain.query.ProjectInfoQuery; import com.ycl.domain.vo.*; @@ -81,7 +82,8 @@ ProjectInfoForm.getEntityByForm(form,entity); Long userId = SecurityUtils.getUserId(); entity.setUpdateBy(userId); //更新项目信息 baseMapper.updateById(entity); List<File> fileList = form.getFileList(); fileList.forEach(item->{ item.setBusId(entity.getId()); @@ -94,8 +96,6 @@ fileMapper.delete(fileQueryWrapper); //替换成现有 fileService.saveBatch(fileList); //更新项目信息 baseMapper.updateById(entity); return Result.ok("修改成功"); } @@ -211,4 +211,32 @@ map.put("processExceptionProject", 0); return map; } @Override public Result docDetail(Integer id) { DocumentInfoForm documentInfoForm = new DocumentInfoForm(); QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); fileQueryWrapper.eq("type",FileTypeEnum.DOCUMENT_INFO.getType()); fileQueryWrapper.eq("bus_id",id); List<File> files = fileMapper.selectList(fileQueryWrapper); documentInfoForm.setFileList(files); return Result.ok().data(documentInfoForm); } @Override public Result addDoc(DocumentInfoForm form) { List<File> fileList = form.getFileList(); fileList.forEach(item->{ item.setBusId(form.getProjectId()); item.setType(FileTypeEnum.DOCUMENT_INFO); }); //删除原有文件 QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); fileQueryWrapper.eq("type",FileTypeEnum.DOCUMENT_INFO.getType()); fileQueryWrapper.eq("bus_id",form.getProjectId()); fileMapper.delete(fileQueryWrapper); //替换成现有 fileService.saveBatch(fileList); return Result.ok(); } } business/src/main/java/com/ycl/service/impl/ProjectInvestmentFundingServiceImpl.java
@@ -46,6 +46,7 @@ entity.setCreateBy(userId); entity.setUpdateBy(userId); baseMapper.insert(entity); //避免新增一个后重复新增返回id给前端判断 return Result.ok("添加成功").data(entity.getId()); } @@ -111,8 +112,10 @@ QueryWrapper<ProjectInvestmentFunding> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("project_id",id); ProjectInvestmentFunding entity = baseMapper.selectOne(queryWrapper); Assert.notNull(entity, "记录不存在"); ProjectInvestmentFundingVO vo = ProjectInvestmentFundingVO.getVoByEntity(entity, null); ProjectInvestmentFundingVO vo =new ProjectInvestmentFundingVO(); if(entity!=null){ vo = ProjectInvestmentFundingVO.getVoByEntity(entity, null); } return Result.ok().data(vo); } business/src/main/java/com/ycl/service/impl/ProjectInvestmentInfoServiceImpl.java
@@ -45,6 +45,7 @@ entity.setUpdateBy(userId); baseMapper.insert(entity); //避免新增一个后重复新增返回id给前端判断 return Result.ok("添加成功").data(entity.getId()); } @@ -110,8 +111,10 @@ QueryWrapper<ProjectInvestmentInfo> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("project_id",id); ProjectInvestmentInfo entity = baseMapper.selectOne(queryWrapper); Assert.notNull(entity, "记录不存在"); ProjectInvestmentInfoVO vo = ProjectInvestmentInfoVO.getVoByEntity(entity, null); ProjectInvestmentInfoVO vo = new ProjectInvestmentInfoVO(); if(entity!=null) { vo = ProjectInvestmentInfoVO.getVoByEntity(entity, null); } return Result.ok().data(vo); } business/src/main/java/com/ycl/service/impl/ProjectInvestmentPolicyComplianceServiceImpl.java
@@ -1,8 +1,16 @@ package com.ycl.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.ycl.common.enums.business.FileTypeEnum; import com.ycl.common.utils.SecurityUtils; import com.ycl.domain.entity.File; import com.ycl.domain.entity.ProjectInvestmentPolicyCompliance; import com.ycl.domain.entity.ProjectUnitRegistrationInfo; import com.ycl.domain.vo.ProjectUnitRegistrationInfoVO; import com.ycl.mapper.FileMapper; import com.ycl.mapper.ProjectInvestmentPolicyComplianceMapper; import com.ycl.service.FileService; import com.ycl.service.ProjectInvestmentPolicyComplianceService; import com.ycl.common.base.Result; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -13,6 +21,7 @@ import lombok.RequiredArgsConstructor; import com.ycl.framework.utils.PageUtil; import org.springframework.beans.BeanUtils; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import java.util.List; @@ -29,17 +38,30 @@ public class ProjectInvestmentPolicyComplianceServiceImpl extends ServiceImpl<ProjectInvestmentPolicyComplianceMapper, ProjectInvestmentPolicyCompliance> implements ProjectInvestmentPolicyComplianceService { private final ProjectInvestmentPolicyComplianceMapper projectInvestmentPolicyComplianceMapper; private final FileService fileService; private final FileMapper fileMapper; /** * 添加 * @param form * @return */ @Override @Transactional(rollbackFor = Exception.class) public Result add(ProjectInvestmentPolicyComplianceForm form) { ProjectInvestmentPolicyCompliance entity = ProjectInvestmentPolicyComplianceForm.getEntityByForm(form, null); Long userId = SecurityUtils.getUserId(); entity.setCreateBy(userId); entity.setUpdateBy(userId); baseMapper.insert(entity); return Result.ok("添加成功"); //添加文件 List<File> fileList = form.getFileList(); fileList.forEach(item->{ item.setBusId(entity.getId()); item.setType(FileTypeEnum.INVEST_POLICY); }); fileService.saveBatch(fileList); //避免新增一个后重复新增返回id给前端判断 return Result.ok("添加成功").data(entity.getId()); } /** @@ -50,11 +72,24 @@ @Override public Result update(ProjectInvestmentPolicyComplianceForm form) { ProjectInvestmentPolicyCompliance entity = baseMapper.selectById(form.getId()); // 为空抛IllegalArgumentException,做全局异常处理 Assert.notNull(entity, "记录不存在"); BeanUtils.copyProperties(form, entity); Long userId = SecurityUtils.getUserId(); entity.setUpdateBy(userId); baseMapper.updateById(entity); List<File> fileList = form.getFileList(); fileList.forEach(item->{ item.setBusId(entity.getId()); item.setType(FileTypeEnum.INVEST_POLICY); }); //删除原有文件 QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); fileQueryWrapper.eq("type",FileTypeEnum.INVEST_POLICY.getType()); fileQueryWrapper.eq("bus_id",entity.getId()); fileMapper.delete(fileQueryWrapper); //替换成现有 fileService.saveBatch(fileList); return Result.ok("修改成功"); } @@ -99,8 +134,18 @@ */ @Override public Result detail(Integer id) { ProjectInvestmentPolicyComplianceVO vo = baseMapper.getById(id); Assert.notNull(vo, "记录不存在"); QueryWrapper<ProjectInvestmentPolicyCompliance> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("project_id", id); ProjectInvestmentPolicyCompliance entity = baseMapper.selectOne(queryWrapper); ProjectInvestmentPolicyComplianceVO vo = new ProjectInvestmentPolicyComplianceVO(); if (entity != null) { vo = ProjectInvestmentPolicyComplianceVO.getVoByEntity(entity, null); QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); fileQueryWrapper.eq("type",FileTypeEnum.INVEST_POLICY.getType()); fileQueryWrapper.eq("bus_id",vo.getId()); List<File> files = fileMapper.selectList(fileQueryWrapper); vo.setFileList(files); } return Result.ok().data(vo); } business/src/main/java/com/ycl/service/impl/ProjectUnitRegistrationInfoServiceImpl.java
@@ -1,7 +1,11 @@ package com.ycl.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.ycl.common.utils.SecurityUtils; import com.ycl.domain.entity.ProjectInvestmentInfo; import com.ycl.domain.entity.ProjectUnitRegistrationInfo; import com.ycl.domain.vo.ProjectInvestmentInfoVO; import com.ycl.mapper.ProjectUnitRegistrationInfoMapper; import com.ycl.service.ProjectUnitRegistrationInfoService; import com.ycl.common.base.Result; @@ -32,18 +36,25 @@ /** * 添加 * * @param form * @return */ @Override public Result add(ProjectUnitRegistrationInfoForm form) { ProjectUnitRegistrationInfo entity = ProjectUnitRegistrationInfoForm.getEntityByForm(form, null); Long userId = SecurityUtils.getUserId(); entity.setCreateBy(userId); entity.setUpdateBy(userId); baseMapper.insert(entity); return Result.ok("添加成功"); //避免新增一个后重复新增返回id给前端判断 return Result.ok("添加成功").data(entity.getId()); } /** * 修改 * * @param form * @return */ @@ -54,12 +65,15 @@ // 为空抛IllegalArgumentException,做全局异常处理 Assert.notNull(entity, "记录不存在"); BeanUtils.copyProperties(form, entity); Long userId = SecurityUtils.getUserId(); entity.setUpdateBy(userId); baseMapper.updateById(entity); return Result.ok("修改成功"); } /** * 批量删除 * * @param ids * @return */ @@ -71,6 +85,7 @@ /** * id删除 * * @param id * @return */ @@ -82,6 +97,7 @@ /** * 分页查询 * * @param query * @return */ @@ -94,18 +110,25 @@ /** * 根据id查找 * * @param id * @return */ @Override public Result detail(Integer id) { ProjectUnitRegistrationInfoVO vo = baseMapper.getById(id); Assert.notNull(vo, "记录不存在"); QueryWrapper<ProjectUnitRegistrationInfo> queryWrapper = new QueryWrapper<>(); queryWrapper.eq("project_id", id); ProjectUnitRegistrationInfo entity = baseMapper.selectOne(queryWrapper); ProjectUnitRegistrationInfoVO vo = new ProjectUnitRegistrationInfoVO(); if (entity != null) { vo = ProjectUnitRegistrationInfoVO.getVoByEntity(entity, null); } return Result.ok().data(vo); } /** * 列表 * * @return */ @Override business/src/main/resources/mapper/ProjectInvestmentPolicyComplianceMapper.xml
@@ -5,21 +5,18 @@ <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.ycl.domain.vo.ProjectInvestmentPolicyComplianceVO"> <result column="project_id" property="projectId" /> <result column="policy_compliance_attachment" property="policyComplianceAttachment" /> <result column="belongs_to_industry_adjustment_directory" property="belongsToIndustryAdjustmentDirectory" /> <result column="belongs_to_allowed_projects" property="belongsToAllowedProjects" /> <result column="belongs_to_western_encouraged_directory" property="belongsToWesternEncouragedDirectory" /> <result column="not_banned_or_controlled_project" property="notBannedOrControlledProject" /> <result column="information_is_true" property="informationIsTrue" /> <result column="special_planning_compliance" property="specialPlanningCompliance" /> <result column="energy_consumption" property="energyConsumption" /> <result column="annual_energy_consumption" property="annualEnergyConsumption" /> <result column="annual_electricity_consumption" property="annualElectricityConsumption" /> <result column="energy_check" property="energyCheck" /> <result column="no_only_check_type" property="noOnlyCheckType" /> <result column="remarks" property="remarks" /> <result column="gmt_create_time" property="gmtCreateTime" /> <result column="gmt_update_time" property="gmtUpdateTime" /> <result column="gmt_create" property="gmtCreate" /> <result column="gmt_update" property="gmtUpdate" /> <result column="create_by" property="createBy" /> <result column="update_by" property="updateBy" /> </resultMap> @@ -33,21 +30,18 @@ <select id="getById" resultMap="BaseResultMap"> SELECT TPIPC.project_id, TPIPC.policy_compliance_attachment, TPIPC.belongs_to_industry_adjustment_directory, TPIPC.belongs_to_allowed_projects, TPIPC.belongs_to_western_encouraged_directory, TPIPC.not_banned_or_controlled_project, TPIPC.information_is_true, TPIPC.special_planning_compliance, TPIPC.energy_consumption, TPIPC.annual_energy_consumption, TPIPC.annual_electricity_consumption, TPIPC.energy_check, TPIPC.no_only_check_type, TPIPC.remarks, TPIPC.gmt_create_time, TPIPC.gmt_update_time, TPIPC.gmt_create, TPIPC.gmt_update, TPIPC.create_by, TPIPC.update_by, TPIPC.id @@ -61,21 +55,18 @@ <select id="getPage" resultMap="BaseResultMap"> SELECT TPIPC.project_id, TPIPC.policy_compliance_attachment, TPIPC.belongs_to_industry_adjustment_directory, TPIPC.belongs_to_allowed_projects, TPIPC.belongs_to_western_encouraged_directory, TPIPC.not_banned_or_controlled_project, TPIPC.information_is_true, TPIPC.special_planning_compliance, TPIPC.energy_consumption, TPIPC.annual_energy_consumption, TPIPC.annual_electricity_consumption, TPIPC.energy_check, TPIPC.no_only_check_type, TPIPC.remarks, TPIPC.gmt_create_time, TPIPC.gmt_update_time, TPIPC.gmt_create, TPIPC.gmt_update, TPIPC.create_by, TPIPC.update_by, TPIPC.id common/src/main/java/com/ycl/common/enums/business/FileTypeEnum.java
@@ -12,8 +12,9 @@ */ @Getter public enum FileTypeEnum { PROJECT_INFO("project_info", "项目基本信息"); PROJECT_INFO("project_info", "项目基本信息"), INVEST_POLICY("invest_policy","投资项目产业政策符合情况"), DOCUMENT_INFO("document_info","相关文件"); @EnumValue // 标明该字段存入数据库 private final String type;