business/src/main/java/com/ycl/domain/excel/ProjectExcelTemplate.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
business/src/main/java/com/ycl/domain/query/ProjectInfoQuery.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
business/src/main/java/com/ycl/domain/vo/ProjectInfoVO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
business/src/main/java/com/ycl/domain/vo/ProjectVO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
business/src/main/java/com/ycl/service/impl/ProjectInvestmentPolicyComplianceServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
business/src/main/resources/mapper/ProjectInfoMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
common/src/main/java/com/ycl/common/utils/CopyUtils.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
common/src/main/java/com/ycl/common/utils/DateUtils.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
business/src/main/java/com/ycl/domain/excel/ProjectExcelTemplate.java
New file @@ -0,0 +1,655 @@ package com.ycl.domain.excel; import com.alibaba.excel.annotation.ExcelProperty; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.math.BigDecimal; import java.util.Date; /** * 导出模板类 * * @Author: ljx * @CreateTime: 2024-10-18 10:19 */ @Data public class ProjectExcelTemplate { private static final long serialVersionUID = 1L; /* 项目管理基础信息表 */ /** * 项目名称 */ @ExcelProperty(value = "项目名称") private String projectName; /** * 项目代码 */ @ExcelProperty(value = "项目代码") private String projectCode; /** * 项目类型 */ @ExcelProperty(value = "项目类型") private String projectType; /** * 项目状态 */ @ExcelProperty(value = "项目状态") private String projectStatus; /** * 资金类型 */ @ExcelProperty(value = "资金类型") private String fundType; /** * 投资类别 */ @ExcelProperty(value = "投资类别") private String investType; /** * 重点分类 */ @ExcelProperty(value = "重点分类") private String importanceType; /** * 项目阶段 */ @ExcelProperty(value = "项目阶段") private String projectPhase; /** * 标签 */ @ExcelProperty(value = "标签") private String tag; /** * 主管部门 */ @ExcelProperty(value = "主管部门") private String competentDepartment; /** * 项目归属地 */ @ExcelProperty(value = "项目归属地") private String projectLocation; /** * 经度 */ @ExcelProperty(value = "经度") private String longitude; /** * 纬度 */ @ExcelProperty(value = "纬度") private String latitude; /** * 管理归口 */ @ExcelProperty(value = "管理归口") private String managementCentralization; /** * 项目申报阶段 */ @ExcelProperty(value = "项目申报阶段") private String projectApplicationPhase; /** * 项目审批类型 */ @ExcelProperty(value = "项目审批类型") private String projectApprovalType; /** * 投资目录 */ @ExcelProperty(value = "投资目录") private String investmentCatalogue; /** * 审批计划书 */ @ExcelProperty(value = "审批计划书(附件名)") private String approvalPlan; /** * 是否立项 */ @ExcelProperty(value = "是否立项") private String isSetProject; /** * 成立时间 */ @ExcelProperty(value = "成立时间") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date setTime; /** * 赋码状态 */ @ExcelProperty(value = "赋码状态") private String assignmentStatus; /** * 行政区划 */ @ExcelProperty(value = "行政区划") private String area; /** * 中标时间 */ @ExcelProperty(value = "中标时间") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date winTime; /** * 中标单位 */ @ExcelProperty(value = "中标单位") private String winUnit; /** * 中标金额 */ @ExcelProperty(value = "中标金额") private String winAmount; /** * 详细地址 */ @ExcelProperty(value = "详细地址") private String address; /** * 建设内容 */ @ExcelProperty(value = "建设内容") private String content; /** * 联系方式 */ @ExcelProperty(value = "联系方式") private String contact; /** * 项目业主单位 */ @ExcelProperty(value = "项目业主单位") private String projectOwnerUnit; /** * 计划开工时间 */ @ExcelProperty(value = "计划开工时间") private Date planStartTime; /** * 计划竣工时间 */ @ExcelProperty(value = "计划竣工时间") private Date planCompleteTime; /** * 项目联系人 */ @ExcelProperty(value = "项目联系人") private String projectContactPerson; /** * 本年计划投资 */ @ExcelProperty(value = "本年计划投资") private BigDecimal yearInvestAmount; /* 投资项目基础信息表 */ /** * 建设地点是否跨域 */ @ExcelProperty(value = "建设地点是否跨域") private String beCrossRegion; /** * 项目建设地点 */ @ExcelProperty(value = "建设地点") private String constructionLocation; /** * 建设详细地址 */ @ExcelProperty(value = "建设详细地址") private String detailedAddress; /** * 是否是补码项目 */ @ExcelProperty(value = "是否是补码项目") private String beCompensationProject; /** * 补码原因 */ @ExcelProperty(value = "补码原因") private String compensationReason; /** * 计划开工时间 */ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ExcelProperty(value = "计划开工时间") private Date plannedStartDate; /** * 拟建成时间 */ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @ExcelProperty(value = "拟建成时间") private Date expectedCompletionDate; /** * 国标行业分类 */ @ExcelProperty(value = "国标行业分类") private String nationalIndustryClassification; /** * 所属行业分类 */ @ExcelProperty(value = "所属行业分类") private String industryClassification; /** * 项目建设性质 */ @ExcelProperty(value = "项目建设性质") private String projectNature; /** * 项目属性 */ @ExcelProperty(value = "项目属性") private String projectAttribute; /** * 是否使用土地 */ @ExcelProperty(value = "是否使用土地") private String useEarth; /** * 主要建设内容及规模 */ @ExcelProperty(value = "主要建设内容及规模") private String contentScale; /** * 建管平台代码 */ @ExcelProperty(value = "建管平台代码") private String code; /* 项目投资及资金来源 */ /** * 项目总投资额 */ @ExcelProperty(value = "项目总投资额") private String totalInvestment; /** * 项目本金 */ @ExcelProperty(value = "项目本金") private String principal; /** * 政府投资总额 */ @ExcelProperty(value = "政府投资总额") private String governmentInvestmentTotal; /** * 中央投资总额 */ @ExcelProperty(value = "中央投资总额") private String centralInvestmentTotal; /** * 中央预算投资 */ @ExcelProperty(value = "中央预算投资") private String centralBudgetInvestment; /** * 中央财政 */ @ExcelProperty(value = "中央财政") private String centralFiscalInvestment; /** * 中央专项债券筹集的专项建设资金 */ @ExcelProperty(value = "中央专项债券筹集的专项建设资金") private String centralSpecialBondInvestment; /** * 中央专项建设基金 */ @ExcelProperty(value = "中央专项建设基金") private String centralSpecialFundInvestment; /** * 省级投资总额 */ @ExcelProperty(value = "省级投资总额") private String provincialInvestmentTotal; /** * 省预算内投资 */ @ExcelProperty(value = "省预算内投资") private String provincialBudgetInvestment; /** * 省财政性建设投资 */ @ExcelProperty(value = "省财政性建设投资") private String provincialFiscalInvestment; /** * 省专项建设资金 */ @ExcelProperty(value = "省专项建设资金") private String provincialSpecialFundInvestment; /** * 市(州)投资总额 */ @ExcelProperty(value = "市(州)投资总额") private String cityInvestmentTotal; /** * 市(州)预算内投资 */ @ExcelProperty(value = "市(州)预算内投资") private String cityBudgetInvestment; /** * 市(州)财政性投资 */ @ExcelProperty(value = "市(州)财政性投资") private String cityFiscalInvestment; /** * 市(州)专项资金 */ @ExcelProperty(value = "市(州)专项资金") private String citySpecialFundInvestment; /** * 县(市、区)投资总额 */ @ExcelProperty(value = "县(市、区)投资总额") private String countyInvestmentTotal; /** * 县(市、区)预算内投资 */ @ExcelProperty(value = "县(市、区)预算内投资") private String countyBudgetInvestment; /** * 县(市、区)财政性建设资金 */ @ExcelProperty(value = "县(市、区)财政性建设资金") private String countyFiscalInvestment; /** * 县(市、区)专项资金 */ @ExcelProperty(value = "县(市、区)专项资金") private String countySpecialFundInvestment; /** * 国内贷款总额 */ @ExcelProperty(value = "国内贷款总额") private String domesticLoanTotal; /** * 银行贷款 */ @ExcelProperty(value = "银行贷款") private String bankLoan; /** * 外商投资总额 */ @ExcelProperty(value = "外商投资总额") private String foreignInvestmentTotal; /** * 企业自筹总额 */ @ExcelProperty(value = "企业自筹总额") private String enterpriseSelfRaisedTotal; /** * 其他投资总额 */ @ExcelProperty(value = "其他投资总额") private String otherInvestmentTotal; /* 项目(法人)单位登记信息表 */ // /** // * 项目总投资额(根据前面的数据填充) // */ // private BigDecimal totalInvestment; /** * 项目单位 */ @ExcelProperty(value = "项目单位") private String projectUnit; /** * 项目单位类型 */ @ExcelProperty(value = "项目单位类型") private String projectUnitType; /** * 登记注册类型 */ @ExcelProperty(value = "登记注册类型") private String registrationType; /** * 控股情况 */ @ExcelProperty(value = "控股情况") private String holdingSituation; /** * 证照类型 */ @ExcelProperty(value = "证照类型") private String certificateType; /** * 证照号码 */ @ExcelProperty(value = "证照号码") private String certificateNumber; /** * 注册地址 */ @ExcelProperty(value = "注册地址") private String registeredAddress; /** * 注册资金 */ @ExcelProperty(value = "注册资金") private BigDecimal registeredCapital; /** * 法人代表 */ @ExcelProperty(value = "法人代表") private String legal_representative; /** * 固定电话 */ @ExcelProperty(value = "固定电话") private String fixedPhone; /** * 法人身份证 */ @ExcelProperty(value = "法人身份证") private String legalPersonIdcard; // /** // * 项目联系人(根据前面的数据填充) // */ // private String projectContactPerson; /** * 移动电话 */ @ExcelProperty(value = "移动电话") private String phone; /** * 联系人身份证 */ @ExcelProperty(value = "联系人身份证") private String contactIdcard; /** * 微信号 */ @ExcelProperty(value = "微信号") private String wechat; /** * 联系人通讯地址 */ @ExcelProperty(value = "联系人通讯地址") private String contactAddress; /** * 邮政编码 */ @ExcelProperty(value = "邮政编码") private String postCode; /** * 电子邮箱 */ @ExcelProperty(value = "电子邮箱") private String email; /* 投资项目产业政策符合情况表 */ /** * 符合产业政策附件 */ @ExcelProperty(value = "符合产业政策(附件名)") private String policyComplianceAttachment; /** * 是否属于《产业结构调整指导目录》下的项目 */ @ExcelProperty(value = "属于《产业结构调整指导目录》下的项目") private String belongsToIndustryAdjustmentDirectory; /** * 是否属于未列入《产业结构调整指导目录》的允许类项目 */ @ExcelProperty(value = "属于未列入《产业结构调整指导目录》的允许类项目") private String belongsToAllowedProjects; /** * 是否属于《西部地区鼓励类产业目录》的项目 */ @ExcelProperty(value = "属于《西部地区鼓励类产业目录》的项目") private String belongsToWesternEncouragedDirectory; /** * 是否不属于产业政策禁止投资建设或实行核准、审批管理的项目 */ @ExcelProperty(value = "不属于产业政策禁止投资建设或实行核准、审批管理的项目") private String notBannedOrControlledProject; /** * 填报信息是否真实 */ @ExcelProperty(value = "填报信息是否真实") private String informationIsTrue; /** * 专项规划复合情况 */ @ExcelProperty(value = "专项规划复合情况") private String specialPlanningCompliance; /** * 项目能耗情况 */ @ExcelProperty(value = "项目能耗情况") private String energyConsumption; /** * 项目年综合能源消费量(标准煤当量值) */ @ExcelProperty(value = "项目年综合能源消费量(标准煤当量值)") private BigDecimal annualEnergyConsumption; /** * 项目年电力消耗量(标准煤当量值) */ @ExcelProperty(value = "项目年电力消耗量(标准煤当量值)") private BigDecimal annualElectricityConsumption; /* 相关文书 */ @ExcelProperty(value = "相关文书(附件名)") private String documents; } business/src/main/java/com/ycl/domain/query/ProjectInfoQuery.java
@@ -1,8 +1,12 @@ package com.ycl.domain.query; import com.fasterxml.jackson.annotation.JsonFormat; import com.ycl.system.domain.base.AbsQuery; import io.swagger.annotations.ApiModel; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; /** * 项目管理基础信息表查询 @@ -13,5 +17,35 @@ @Data @ApiModel(value = "ProjectInfo查询参数", description = "项目管理基础信息表查询参数") public class ProjectInfoQuery extends AbsQuery { //项目类别 private String projectCategory; //项目名称 private String projectName; //项目代码 private String projectCode; //项目类型 private String projectType; //重点分类 private String importanceType; //项目标签 private String tag; //项目状态 private String projectStatus; //项目码 private String projectColorCode; //关联状态 private String assignmentStatus; //资金类型 private String fundType; //项目阶段 private String projectPhase; //投资类别 private String investType; //行政区划 private String area; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date projectStartTime; @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date projectEndTime; } business/src/main/java/com/ycl/domain/vo/ProjectInfoVO.java
@@ -67,7 +67,7 @@ /** 主管部门(对应审批部门id) */ @ApiModelProperty("主管部门(对应审批部门id)") private List<Long> competentDepartmentList; private String competentDepartment; /** 行政区域 */ @ApiModelProperty("行政区域") private String area; @@ -75,7 +75,7 @@ /** 管理归口 (0基本建设(发改), 1更新改造(经信), 2单纯购置(发改), 3信息化(发改), 4其他投资) */ @ApiModelProperty("管理归口 (0基本建设(发改), 1更新改造(经信), 2单纯购置(发改), 3信息化(发改), 4其他投资)") private List<String> managementCentralizationList; private String managementCentralization; /** 项目审批类型 */ @ApiModelProperty("项目审批类型") private String projectApprovalType; @@ -160,6 +160,11 @@ @ApiModelProperty("文件") private List<File> fileList; private ProjectInvestmentInfoVO projectInvestmentInfo; private ProjectInvestmentFundingVO projectInvestmentFunding; private ProjectUnitRegistrationInfoVO projectUnitRegistrationInfo; private ProjectInvestmentPolicyComplianceVO projectInvestmentPolicyCompliance; public static ProjectInfoVO getVoByEntity(@NonNull ProjectInfo entity, ProjectInfoVO vo) { if(vo == null) { vo = new ProjectInfoVO(); @@ -180,5 +185,20 @@ } return vo; } //转换字符串集合字段 public static void transform(@NonNull ProjectInfoVO vo) { //主管部门转成list String competentDepartment = vo.getCompetentDepartment(); if(!StringUtils.isBlank(competentDepartment)){ List<Long> list = Arrays.stream(competentDepartment.split(",")) .map(Long::parseLong) .collect(Collectors.toList()); vo.setCompetentDepartmentList(list); } //管理归口转换 String managementCentralization = vo.getManagementCentralization(); if(!StringUtils.isBlank(managementCentralization)){ vo.setManagementCentralizationList(Arrays.asList(managementCentralization.split(","))); } } } business/src/main/java/com/ycl/domain/vo/ProjectVO.java
New file @@ -0,0 +1,15 @@ package com.ycl.domain.vo; import com.ycl.domain.excel.ProjectExcelTemplate; import lombok.Data; import java.util.List; @Data public class ProjectVO extends ProjectExcelTemplate { private Long id; /** 状态码 */ private String projectColorCode; private List<Long> competentDepartmentList; private List<String> managementCentralizationList; } business/src/main/java/com/ycl/service/impl/ProjectInfoServiceImpl.java
@@ -5,6 +5,8 @@ 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.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; @@ -42,6 +44,7 @@ private final ProjectInfoMapper projectInfoMapper; private final FileService fileService; private final FileMapper fileMapper; /** * 添加 * @@ -59,7 +62,7 @@ baseMapper.insert(entity); //添加文件 List<File> fileList = form.getFileList(); fileList.forEach(item->{ fileList.forEach(item -> { item.setBusId(entity.getId()); item.setType(FileTypeEnum.PROJECT_INFO); }); @@ -79,20 +82,21 @@ ProjectInfo entity = baseMapper.selectById(form.getId()); // 为空抛IllegalArgumentException,做全局异常处理 Assert.notNull(entity, "记录不存在"); ProjectInfoForm.getEntityByForm(form,entity); ProjectInfoForm.getEntityByForm(form, entity); Long userId = SecurityUtils.getUserId(); entity.setUpdateBy(userId); //更新项目信息 baseMapper.updateById(entity); List<File> fileList = form.getFileList(); fileList.forEach(item->{ fileList.forEach(item -> { item.setId(null); item.setBusId(entity.getId()); item.setType(FileTypeEnum.PROJECT_INFO); }); //删除原有文件 QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); fileQueryWrapper.eq("type",FileTypeEnum.PROJECT_INFO.getType()); fileQueryWrapper.eq("bus_id",entity.getId()); fileQueryWrapper.eq("type", FileTypeEnum.PROJECT_INFO.getType()); fileQueryWrapper.eq("bus_id", entity.getId()); fileMapper.delete(fileQueryWrapper); //替换成现有 fileService.saveBatch(fileList); @@ -133,17 +137,33 @@ */ @Override public Result page(ProjectInfoQuery query) { IPage<ProjectInfo> page = PageUtil.getPage(query, ProjectInfo.class); if (query.getProjectStartTime() != null) { query.setProjectStartTime(DateUtils.getDayStart(query.getProjectStartTime())); } if (query.getProjectEndTime() != null) { query.setProjectEndTime(DateUtils.getDayEnd(query.getProjectEndTime())); } IPage<ProjectInfoVO> page = PageUtil.getPage(query, ProjectInfoVO.class); baseMapper.getPage(page, query); List<ProjectInfo> records = page.getRecords(); List<ProjectInfoVO> list = records.stream() .map(entity -> { ProjectInfoVO vo = ProjectInfoVO.getVoByEntity(entity, null); List<ProjectInfoVO> records = page.getRecords(); List<ProjectVO> list = new ArrayList<>(); records.forEach(vo -> { ProjectInfoVO.transform(vo); vo.setProjectColorCode("green"); return vo; }) .collect(Collectors.toList()); ProjectVO projectVO = new ProjectVO(); copyToProjectVO(vo,projectVO); list.add(projectVO); }); return Result.ok().data(list).total(page.getTotal()); } 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); } /** @@ -158,8 +178,8 @@ Assert.notNull(entity, "记录不存在"); ProjectInfoVO vo = ProjectInfoVO.getVoByEntity(entity, null); QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); fileQueryWrapper.eq("type",FileTypeEnum.PROJECT_INFO.getType()); fileQueryWrapper.eq("bus_id",vo.getId()); fileQueryWrapper.eq("type", FileTypeEnum.PROJECT_INFO.getType()); fileQueryWrapper.eq("bus_id", vo.getId()); List<File> files = fileMapper.selectList(fileQueryWrapper); vo.setFileList(files); return Result.ok().data(vo); @@ -216,8 +236,8 @@ 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); 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); @@ -226,14 +246,15 @@ @Override public Result addDoc(DocumentInfoForm form) { List<File> fileList = form.getFileList(); fileList.forEach(item->{ fileList.forEach(item -> { item.setId(null); 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()); fileQueryWrapper.eq("type", FileTypeEnum.DOCUMENT_INFO.getType()); fileQueryWrapper.eq("bus_id", form.getProjectId()); fileMapper.delete(fileQueryWrapper); //替换成现有 fileService.saveBatch(fileList); business/src/main/java/com/ycl/service/impl/ProjectInvestmentPolicyComplianceServiceImpl.java
@@ -56,6 +56,7 @@ //添加文件 List<File> fileList = form.getFileList(); fileList.forEach(item->{ item.setId(null); item.setBusId(entity.getId()); item.setType(FileTypeEnum.INVEST_POLICY); }); @@ -80,6 +81,7 @@ baseMapper.updateById(entity); List<File> fileList = form.getFileList(); fileList.forEach(item->{ item.setId(null); item.setBusId(entity.getId()); item.setType(FileTypeEnum.INVEST_POLICY); }); business/src/main/resources/mapper/ProjectInfoMapper.xml
@@ -3,44 +3,15 @@ <mapper namespace="com.ycl.mapper.ProjectInfoMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.ycl.domain.entity.ProjectInfo"> <id column="id" property="id"/> <result column="project_name" property="projectName" /> <result column="project_code" property="projectCode" /> <result column="content" property="content" /> <result column="project_type" property="projectType" /> <result column="project_status" property="projectStatus" /> <result column="fund_type" property="fundType" /> <result column="invest_type" property="investType" /> <result column="project_phase" property="projectPhase" /> <result column="tag" property="tag" /> <result column="competent_department" property="competentDepartment" /> <result column="area" property="area" /> <result column="management_centralization" property="managementCentralization" /> <result column="project_approval_type" property="projectApprovalType" /> <result column="importance_type" property="importanceType" /> <result column="year" property="year" /> <result column="year_invest_amount" property="yearInvestAmount" /> <result column="create_project_time" property="createProjectTime" /> <result column="plan_start_time" property="planStartTime" /> <result column="plan_complete_time" property="planCompleteTime" /> <result column="win_unit" property="winUnit" /> <result column="win_amount" property="winAmount" /> <result column="win_time" property="winTime" /> <result column="project_address" property="projectAddress" /> <result column="longitude" property="longitude" /> <result column="latitude" property="latitude" /> <result column="project_owner_unit" property="projectOwnerUnit" /> <result column="project_contact_person" property="projectContactPerson" /> <result column="contact" property="contact" /> <result column="gmt_create" property="gmtCreate" /> <result column="gmt_update" property="gmtUpdate" /> <result column="update_by" property="updateBy" /> <result column="create_by" property="createBy" /> <resultMap id="resultMap" type="com.ycl.domain.vo.ProjectInfoVO" autoMapping="true"> <association property="projectInvestmentInfo" javaType="com.ycl.domain.vo.ProjectInvestmentInfoVO" autoMapping="true" columnPrefix="TPII_"/> <association property="projectInvestmentFunding" javaType="com.ycl.domain.vo.ProjectInvestmentFundingVO" autoMapping="true" columnPrefix="TPIF_"/> <association property="projectUnitRegistrationInfo" javaType="com.ycl.domain.vo.ProjectUnitRegistrationInfoVO" autoMapping="true" columnPrefix="TPURI_"/> <association property="projectInvestmentPolicyCompliance" javaType="com.ycl.domain.vo.ProjectInvestmentPolicyComplianceVO" autoMapping="true" columnPrefix="TPIPC_"/> </resultMap> <select id="getById" resultMap="BaseResultMap"> <select id="getById" resultType="com.ycl.domain.entity.ProjectInfo"> SELECT TPI.project_name, TPI.project_code, @@ -82,45 +53,100 @@ </select> <select id="getPage" resultMap="BaseResultMap"> <select id="getPage" resultMap="resultMap"> SELECT TPI.project_name, TPI.project_code, TPI.content, TPI.project_type, TPI.project_status, TPI.fund_type, TPI.invest_type, TPI.project_phase, TPI.tag, TPI.competent_department, TPI.area, TPI.management_centralization, TPI.project_approval_type, TPI.importance_type, TPI.year, TPI.year_invest_amount, TPI.create_project_time, TPI.plan_start_time, TPI.plan_complete_time, TPI.win_unit, TPI.win_amount, TPI.win_time, TPI.project_address, TPI.longitude, TPI.latitude, TPI.project_owner_unit, TPI.project_contact_person, TPI.contact, TPI.gmt_create, TPI.gmt_update, TPI.update_by, TPI.create_by, TPI.id TPI.*, TPIF.total_investment as TPIF_totalInvestment, TPIF.principal as TPIF_principal,TPIF.government_investment_total as TPIF_government_investment_total,TPIF.central_investment_total as TPIF_central_investment_total, TPIF.central_budget_investment as TPIF_central_budget_investment,TPIF.central_fiscal_investment as TPIF_central_fiscal_investment, TPIF.central_special_bond_investment as TPIF_central_special_bond_investment,TPIF.central_special_fund_investment as TPIF_central_special_fund_investment, TPIF.provincial_investment_total as TPIF_provincial_investment_total,TPIF.provincial_budget_investment as TPIF_provincial_budget_investment, TPIF.provincial_fiscal_investment as TPIF_provincial_fiscal_investment,TPIF.provincial_special_fund_investment as TPIF_provincial_special_fund_investment, TPIF.city_investment_total as TPIF_city_investment_total,TPIF.city_budget_investment as TPIF_city_budget_investment,TPIF.city_fiscal_investment as TPIF_city_fiscal_investment, TPIF.city_special_fund_investment as TPIF_city_special_fund_investment,TPIF.county_investment_total as TPIF_county_investment_total,TPIF.county_budget_investment as TPIF_county_budget_investment, TPIF.county_fiscal_investment as TPIF_county_fiscal_investment,TPIF.county_special_fund_investment as TPIF_county_special_fund_investment, TPIF.domestic_loan_total as TPIF_domestic_loan_total,TPIF.bank_loan as TPIF_bank_loan,TPIF.foreign_investment_total as TPIF_foreign_investment_total, TPIF.enterprise_self_raised_total as TPIF_enterprise_self_raised_total,TPIF.other_investment_total as TPIF_other_investment_total, TPII.be_cross_region as TPII_be_cross_region,TPII.construction_location as TPII_construction_location, TPII.detailed_address as TPII_detailed_address,TPII.be_compensation_project as TPII_be_compensation_project,TPII.compensation_reason as TPII_compensation_reason, TPII.planned_start_date as TPII_planned_start_date,TPII.expected_completion_date as TPII_expected_completion_date, TPII.national_industry_classification as TPII_national_industry_classification,TPII.industry_classification as TPII_industry_classification,TPII.project_nature as TPII_project_nature, TPII.project_attribute as TPII_project_attribute,TPII.use_earth as TPII_use_earth,TPII.content_scale as TPII_content_scale,TPII.code as TPII_code, TPIPC.belongs_to_industry_adjustment_directory as TPIPC_belongs_to_industry_adjustment_directory,TPIPC.belongs_to_western_encouraged_directory as TPIPC_belongs_to_western_encouraged_directory, TPIPC.not_banned_or_controlled_project as TPIPC_not_banned_or_controlled_project,TPIPC.information_is_true as TPIPC_information_is_true, TPIPC.special_planning_compliance as TPIPC_special_planning_compliance,TPIPC.annual_energy_consumption as TPIPC_annual_energy_consumption,TPIPC.annual_electricity_consumption as TPIPC_annual_electricity_consumption, TPIPC.energy_check as TPIPC_energy_check,TPIPC.no_only_check_type as TPIPC_no_only_check_type,TPIPC.remarks as TPIPC_remarks, TPURI.total_investment as TPURI_total_investment, TPURI.project_unit as TPURI_project_unit, TPURI.project_unit_type as TPURI_project_unit_type, TPURI.registration_type as TPURI_registration_type, TPURI.holding_situation as TPURI_holding_situation, TPURI.certificate_type as TPURI_certificate_type, TPURI.certificate_number as TPURI_certificate_number, TPURI.registered_address as TPURI_registered_address, TPURI.registered_capital as TPURI_registered_capital, TPURI.legal_representative as TPURI_legal_representative, TPURI.fixed_phone as TPURI_fixed_phone, TPURI.legal_person_idcard as TPURI_legal_person_idcard, TPURI.project_contact_person as TPURI_project_contact_person, TPURI.phone as TPURI_phone, TPURI.contact_idcard as TPURI_contact_idcard, TPURI.wechat as TPURI_wechat, TPURI.contact_address as TPURI_contact_address, TPURI.post_code as TPURI_post_code, TPURI.email as TPURI_email FROM t_project_info TPI WHERE 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_investment_policy_compliance TPIPC ON TPI.id = TPIPC.project_id and TPIPC.deleted = 0 LEFT JOIN t_project_unit_registration_info TPURI ON TPI.id = TPURI.project_id and TPURI.deleted = 0 <where> TPI.deleted = 0 <if test="query.projectCategory !=null and query.projectCategory!=''"> and TPI.project_phase = #{query.projectCategory} </if> <if test="query.projectName !=null and query.projectName!=''"> and TPI.project_name like concat('%',#{query.projectName},'%') </if> <if test="query.projectCode !=null and query.projectCode!=''"> and TPI.project_code like concat('%',#{query.projectCode},'%') </if> <if test="query.projectType !=null and query.projectType!=''"> and TPI.project_type = #{query.projectType} </if> <if test="query.importanceType !=null and query.importanceType!=''"> and TPI.importance_type = #{query.importanceType} </if> <if test="query.tag !=null and query.tag!=''"> and TPI.tag like concat('%',#{query.tag},'%') </if> <if test="query.projectStatus !=null and query.projectStatus!=''"> and TPI.project_status = #{query.projectStatus} </if> <if test="query.projectPhase !=null and query.projectPhase!=''"> and TPI.project_phase = #{query.projectPhase} </if> <!-- <if test=" assignmentStatus !=null and assignmentStatus!=''">--> <!-- and TPI.project_phase = #{projectPhase}--> <!-- </if>--> <if test="query.fundType !=null and query.fundType!=''"> and TPI.fund_type = #{query.fundType} </if> <if test="query.projectPhase !=null and query.projectPhase!=''"> and TPI.project_phase = #{query.projectPhase} </if> <if test="query.investType !=null and query.investType!=''"> and TPI.invest_type = #{query.investType} </if> <if test="query.area !=null and query.area!=''"> and TPI.area = #{query.area} </if> <if test="query.projectStartTime !=null and query.projectEndTime !=null"> and TPI.create_project_time between #{query.projectStartTime} and #{query.projectEndTime} </if> </where> order by gmt_create </select> </mapper> common/src/main/java/com/ycl/common/utils/CopyUtils.java
New file @@ -0,0 +1,48 @@ package com.ycl.common.utils; import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; import java.beans.PropertyDescriptor; import java.util.HashSet; import java.util.Objects; import java.util.Set; /** * 自定义复制工具类 */ public class CopyUtils { /** * 所有为空值的属性都不copy * * @param source * @param target */ public static void copyNoNullProperties(Object source, Object target) { BeanUtils.copyProperties(source, target, getNullField(source)); } /** * 获取属性中为空的字段 * * @param target * @return */ private static String[] getNullField(Object target) { BeanWrapper beanWrapper = new BeanWrapperImpl(target); PropertyDescriptor[] propertyDescriptors = beanWrapper.getPropertyDescriptors(); Set<String> notNullFieldSet = new HashSet<>(); if (propertyDescriptors.length > 0) { for (PropertyDescriptor p : propertyDescriptors) { String name = p.getName(); Object value = beanWrapper.getPropertyValue(name); if (Objects.isNull(value)) { notNullFieldSet.add(name); } } } String[] notNullField = new String[notNullFieldSet.size()]; return notNullFieldSet.toArray(notNullField); } } common/src/main/java/com/ycl/common/utils/DateUtils.java
@@ -1,6 +1,7 @@ package com.ycl.common.utils; import java.lang.management.ManagementFactory; import java.sql.Timestamp; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDate; @@ -9,7 +10,10 @@ import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.Date; import java.util.Objects; import org.apache.commons.lang3.time.DateFormatUtils; import org.springframework.lang.Nullable; /** * 时间工具类 @@ -188,4 +192,35 @@ ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); return Date.from(zdt.toInstant()); } /** * 获取某天的开始时间 * * @param date * @return 2023-01-01 00:00:00 */ public static Date getDayStart(@Nullable Date date) { if (Objects.isNull(date)) { date = new Date(); } LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.of("GMT+8")); LocalDateTime of = LocalDateTime.of(localDateTime.getYear(), localDateTime.getMonth(), localDateTime.getDayOfMonth(), 0, 0, 0); return Timestamp.valueOf(of); } /** * 获取某天的结束时间 * * @param date * @return 2023-01-01 23:59:59 */ public static Date getDayEnd(@Nullable Date date) { if (Objects.isNull(date)) { date = new Date(); } LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); LocalDateTime of = LocalDateTime.of(localDateTime.getYear(), localDateTime.getMonth(), localDateTime.getDayOfMonth(), 23, 59, 59); return Timestamp.valueOf(of); } }