Browse Source

项目登记功能

lizhenhao 2 years ago
parent
commit
7a52fcfc35

+ 4 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/projectRecords/domain/CwProjectRecords.java

@@ -3,6 +3,7 @@ package com.jeeplus.test.cw.projectRecords.domain;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.jeeplus.core.domain.BaseEntity;
 import com.jeeplus.core.domain.BaseEntity;
 import com.jeeplus.core.query.Query;
 import com.jeeplus.core.query.Query;
+import com.jeeplus.core.query.QueryType;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.util.Date;
 import java.util.Date;
@@ -25,11 +26,13 @@ public class CwProjectRecords extends BaseEntity {
     /**
     /**
      * 项目编号
      * 项目编号
      */
      */
+    @Query(tableColumn = "a.project_number", type = QueryType.LIKE)
     private String projectNumber;
     private String projectNumber;
 
 
     /**
     /**
      * 项目名称
      * 项目名称
      */
      */
+    @Query(tableColumn = "a.project_name", type = QueryType.LIKE)
     private String projectName;
     private String projectName;
 
 
     /**
     /**
@@ -77,7 +80,7 @@ public class CwProjectRecords extends BaseEntity {
     /**
     /**
      * 状态
      * 状态
      */
      */
-    @Query
+    @Query(tableColumn = "a.status", type = QueryType.EQ)
     private String status;
     private String status;
 
 
 }
 }

+ 60 - 16
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/projectRecords/mapper/xml/CwProjectRecordsMapper.xml

@@ -15,17 +15,19 @@
 
 
         <result property="projectNumber" column="project_number" jdbcType="VARCHAR"/>
         <result property="projectNumber" column="project_number" jdbcType="VARCHAR"/>
         <result property="projectName" column="project_name" jdbcType="VARCHAR"/>
         <result property="projectName" column="project_name" jdbcType="VARCHAR"/>
-        <result property="officeDTO.id" column="office_id" jdbcType="VARCHAR"/>
+        <result property="officeId" column="office_id" jdbcType="VARCHAR"/>
         <result property="projectMoney" column="project_money" jdbcType="VARCHAR"/>
         <result property="projectMoney" column="project_money" jdbcType="VARCHAR"/>
         <result property="auditYear" column="audit_year" jdbcType="VARCHAR"/>
         <result property="auditYear" column="audit_year" jdbcType="VARCHAR"/>
         <result property="planStartDate" column="plan_start_date" jdbcType="TIMESTAMP"/>
         <result property="planStartDate" column="plan_start_date" jdbcType="TIMESTAMP"/>
         <result property="planEndDate" column="plan_end_date" jdbcType="TIMESTAMP"/>
         <result property="planEndDate" column="plan_end_date" jdbcType="TIMESTAMP"/>
-        <result property="projectMaster.id" column="project_master_id" jdbcType="VARCHAR"/>
-        <result property="projectLeader.id" column="project_leader_id" jdbcType="VARCHAR"/>
+        <result property="projectMasterId" column="project_master_id" jdbcType="VARCHAR"/>
+        <result property="projectLeaderId" column="project_leader_id" jdbcType="VARCHAR"/>
         <result property="procInsId" column="proc_ins_id" jdbcType="VARCHAR"/>
         <result property="procInsId" column="proc_ins_id" jdbcType="VARCHAR"/>
         <result property="processDefinitionId" column="process_definition_id" jdbcType="VARCHAR"/>
         <result property="processDefinitionId" column="process_definition_id" jdbcType="VARCHAR"/>
         <result property="status" column="status" jdbcType="VARCHAR"/>
         <result property="status" column="status" jdbcType="VARCHAR"/>
-        <collection property="cwProjectClientInfoDTOList" ofType="com.jeeplus.test.cw.projectRecords.service.dto.CwProjectClientInfoDTO" column="id" select="getProjectClient"></collection>
+        <result property="createBy.name" column="user_name" jdbcType="VARCHAR"/>
+        <result property="projectMasterName" column="project_master_name" jdbcType="VARCHAR"/>
+        <collection property="cwProjectClientInfoDTOList" ofType="com.jeeplus.test.cw.workClientInfo.service.dto.CwWorkClientBaseDTO" column="id" select="getProjectClient"></collection>
         <collection property="workAttachmentDtoList" ofType="com.jeeplus.test.workContract.service.dto.WorkAttachmentDto" column="id" select="getFileList"></collection>
         <collection property="workAttachmentDtoList" ofType="com.jeeplus.test.workContract.service.dto.WorkAttachmentDto" column="id" select="getFileList"></collection>
     </resultMap>
     </resultMap>
 
 
@@ -86,17 +88,51 @@
     <sql id="Project_Client_List">
     <sql id="Project_Client_List">
         cw_pci.project_id,
         cw_pci.project_id,
         cw_pci.client_id,
         cw_pci.client_id,
-        cw_wcb.no as "clientNumber",
-        cw_wcb.name as "clientName",
-        cw_wcb.company_level as "companyLevel",
+        cw_wcb.no as clientNumber,
+        cw_wcb.name as clientName,
+        cw_wcb.company_level as companyLevel
+    </sql>
+    <sql id="Client_Column_List">
+        cw_wcb.id,
+        cw_wcb.create_by,
+        cw_wcb.create_date,
+        cw_wcb.update_by,
+        cw_wcb.update_date,
+        cw_wcb.del_flag,
+        cw_wcb.remarks,
+        cw_wcb.no,
+        cw_wcb.name,
+        cw_wcb.abbreviation,
+        cw_wcb.english_name,
+        cw_wcb.type,
+        cw_wcb.usc_code,
+        cw_wcb.sc_type,
+        cw_wcb.manage_level_type,
+        cw_wcb.one_up_company,
+        cw_wcb.company_level,
+        cw_wcb.business_scope,
+        cw_wcb.key_responsibilities,
+        cw_wcb.industry,
+        cw_wcb.affiliation,
+        cw_wcb.organization_type,
+        cw_wcb.report_type,
+        cw_wcb.one_up_office,
+        cw_wcb.registration_cert,
+        cw_wcb.approving_bodies,
+        cw_wcb.office_id,
+        cw_wcb.proc_ins_id,
+        cw_wcb.process_definition_id,
+        cw_wcb.status,
+        cw_wcb.agree_date,
+        cw_wcb.agree_user_id
     </sql>
     </sql>
 
 
-    <select id="getProjectClient" resultType="com.jeeplus.test.cw.workClientInfo.service.dto.CwWorkClientTypeDTO">
+    <select id="getProjectClient" resultType="com.jeeplus.test.cw.workClientInfo.service.dto.CwWorkClientBaseDTO">
         select
         select
-        <include refid="Project_Client_List"></include>
+        <include refid="Client_Column_List"></include>
         from cw_project_client_info cw_pci
         from cw_project_client_info cw_pci
-        left join cw_work_client_base cw_wcb on cw_wcb.id = cw_pci.client_id
-        where cw_wct.del_flag = '0' and cw_pci.project_id = #{id}
+        left join cw_work_client_base cw_wcb on cw_wcb.id = cw_pci.client_id and cw_wcb.del_flag = '0'
+        where cw_pci.project_id = #{id}
     </select>
     </select>
 
 
 
 
@@ -112,20 +148,28 @@
 
 
     <select id="findList" resultMap="BaseResultMap">
     <select id="findList" resultMap="BaseResultMap">
         select
         select
-        <include refid="Base_Column_List"></include>
-        from cw_work_client_base a
+        <include refid="Base_Column_List"></include>,
+        su.name as user_name,
+        su2.name as project_master_name
+        from cw_project_records a
+        left join sys_user su on su.id = a.create_by and su.del_flag = '0'
+        left join sys_user su2 on su2.id = a.project_master_id and su2.del_flag = '0'
         ${ew.customSqlSegment}
         ${ew.customSqlSegment}
     </select>
     </select>
 
 
     <select id="queryById" resultMap="BaseResultMap">
     <select id="queryById" resultMap="BaseResultMap">
         select
         select
-        <include refid="Base_Column_List"></include>
-        from cw_work_client_base a
+        <include refid="Base_Column_List"></include>,
+        su.name as user_name,
+        su2.name as project_master_name
+        from cw_project_records a
+        left join sys_user su on su.id = a.create_by and su.del_flag = '0'
+        left join sys_user su2 on su2.id = a.project_master_id and su2.del_flag = '0'
         where a.del_flag = '0' and a.id = ${id}
         where a.del_flag = '0' and a.id = ${id}
     </select>
     </select>
 
 
     <delete id="deleteProjectClientInfoByProjectId">
     <delete id="deleteProjectClientInfoByProjectId">
-        delete from cw_project_client_info from project_id = #{projectId}
+        delete from cw_project_client_info where project_id = #{projectId}
     </delete>
     </delete>
 
 
     <insert id="insertProjectClientInfoList">
     <insert id="insertProjectClientInfoList">

+ 36 - 4
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/projectRecords/service/CwProjectRecordsService.java

@@ -1,5 +1,7 @@
 package com.jeeplus.test.cw.projectRecords.service;
 package com.jeeplus.test.cw.projectRecords.service;
 
 
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ArrayUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -7,6 +9,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
 import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.core.query.QueryWrapperGenerator;
+import com.jeeplus.sys.domain.User;
+import com.jeeplus.sys.mapper.UserMapper;
 import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.utils.StringUtils;
 import com.jeeplus.sys.utils.StringUtils;
 import com.jeeplus.sys.utils.UserUtils;
 import com.jeeplus.sys.utils.UserUtils;
@@ -15,6 +19,7 @@ import com.jeeplus.test.cw.projectRecords.mapper.CwProjectRecordsMapper;
 import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectClientInfoDTO;
 import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectClientInfoDTO;
 import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectRecordsDTO;
 import com.jeeplus.test.cw.projectRecords.service.dto.CwProjectRecordsDTO;
 import com.jeeplus.test.cw.projectRecords.service.mapstruct.CwProjectRecordsWrapper;
 import com.jeeplus.test.cw.projectRecords.service.mapstruct.CwProjectRecordsWrapper;
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwWorkClientBaseDTO;
 import com.jeeplus.test.mould.service.SerialnumTplService;
 import com.jeeplus.test.mould.service.SerialnumTplService;
 import com.jeeplus.test.oss.service.OssService;
 import com.jeeplus.test.oss.service.OssService;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.ResponseEntity;
@@ -22,7 +27,9 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.List;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * 财务项目登记service
  * 财务项目登记service
@@ -40,6 +47,8 @@ public class CwProjectRecordsService extends ServiceImpl<CwProjectRecordsMapper,
 
 
     @Resource
     @Resource
     private SerialnumTplService serialnumTplService;
     private SerialnumTplService serialnumTplService;
+    @Resource
+    private UserMapper userMapper;
 
 
     /**
     /**
      * 差选项目列表信息
      * 差选项目列表信息
@@ -52,6 +61,20 @@ public class CwProjectRecordsService extends ServiceImpl<CwProjectRecordsMapper,
         QueryWrapper<CwProjectRecords> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( CwProjectRecordsWrapper.INSTANCE.toEntity(cwProjectRecordsDTO), CwProjectRecords.class );
         QueryWrapper<CwProjectRecords> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( CwProjectRecordsWrapper.INSTANCE.toEntity(cwProjectRecordsDTO), CwProjectRecords.class );
         queryWrapper.eq("a.del_flag","0");
         queryWrapper.eq("a.del_flag","0");
         queryWrapper.orderByDesc("a.create_date");
         queryWrapper.orderByDesc("a.create_date");
+        if (ObjectUtil.isNotEmpty(cwProjectRecordsDTO)) {
+            if (ArrayUtil.isNotEmpty(cwProjectRecordsDTO.getCreateDates())) {
+                queryWrapper.between("a.create_date", cwProjectRecordsDTO.getCreateDates()[0], cwProjectRecordsDTO.getCreateDates()[1]);
+            }
+            if (StringUtils.isNotBlank(cwProjectRecordsDTO.getProjectMasterName())) {
+                List<User> userList = userMapper.selectList(new QueryWrapper<User>().lambda().like(User::getName, cwProjectRecordsDTO.getProjectMasterName()));
+                List<String> ids = userList.stream().distinct().map(User::getId).collect(Collectors.toList());
+                if (CollectionUtil.isNotEmpty(ids)) {
+                    queryWrapper.in("a.create_by", ids);
+                } else {
+                    return new Page<>();
+                }
+            }
+        }
         IPage<CwProjectRecordsDTO> list = cwProjectRecordsMapper.findList(page, queryWrapper);
         IPage<CwProjectRecordsDTO> list = cwProjectRecordsMapper.findList(page, queryWrapper);
         return list;
         return list;
     }
     }
@@ -81,19 +104,28 @@ public class CwProjectRecordsService extends ServiceImpl<CwProjectRecordsMapper,
             cwProjectRecordsDTO.setProjectNumber(serialNum);
             cwProjectRecordsDTO.setProjectNumber(serialNum);
         }
         }
         CwProjectRecords cwProjectRecords = CwProjectRecordsWrapper.INSTANCE.toEntity(cwProjectRecordsDTO);
         CwProjectRecords cwProjectRecords = CwProjectRecordsWrapper.INSTANCE.toEntity(cwProjectRecordsDTO);
+        if (ObjectUtil.isNotEmpty(cwProjectRecords)) {
+            if (StringUtils.isBlank(cwProjectRecords.getCreateBy())) {
+                cwProjectRecords.setCreateBy(UserUtils.getCurrentUserDTO().getId());
+            }
+        }
         this.saveOrUpdate(cwProjectRecords);
         this.saveOrUpdate(cwProjectRecords);
         if (ObjectUtil.isNotEmpty(cwProjectRecordsDTO)) {
         if (ObjectUtil.isNotEmpty(cwProjectRecordsDTO)) {
             // 附件
             // 附件
             ossService.saveOrUpdateFileList(cwProjectRecordsDTO.getWorkAttachmentDtoList(),cwProjectRecords.getId(),"cw_project_records");
             ossService.saveOrUpdateFileList(cwProjectRecordsDTO.getWorkAttachmentDtoList(),cwProjectRecords.getId(),"cw_project_records");
             // 被服务单位
             // 被服务单位
             //根据项目id删除原有的被服务单位数据信息
             //根据项目id删除原有的被服务单位数据信息
-            cwProjectRecordsMapper.deleteProjectClientInfoByProjectId(cwProjectRecordsDTO.getId());
+            cwProjectRecordsMapper.deleteProjectClientInfoByProjectId(cwProjectRecords.getId());
 
 
             if(null != cwProjectRecordsDTO.getCwProjectClientInfoDTOList() && cwProjectRecordsDTO.getCwProjectClientInfoDTOList().size()>0){
             if(null != cwProjectRecordsDTO.getCwProjectClientInfoDTOList() && cwProjectRecordsDTO.getCwProjectClientInfoDTOList().size()>0){
                 //根据项目id添加新的被服务单位信息
                 //根据项目id添加新的被服务单位信息
-                List<CwProjectClientInfoDTO> cwProjectClientInfoDTOList = cwProjectRecordsDTO.getCwProjectClientInfoDTOList();
-                for (CwProjectClientInfoDTO projectClientInfo : cwProjectClientInfoDTOList) {
-                    projectClientInfo.setProjectId(cwProjectRecordsDTO.getId());
+                List<CwWorkClientBaseDTO> cwWorkClientBaseDTOList = cwProjectRecordsDTO.getCwProjectClientInfoDTOList();
+                List<CwProjectClientInfoDTO> cwProjectClientInfoDTOList = new ArrayList<>();
+                for (CwWorkClientBaseDTO c : cwWorkClientBaseDTOList) {
+                    CwProjectClientInfoDTO cwProjectClientInfoDTO = new CwProjectClientInfoDTO();
+                    cwProjectClientInfoDTO.setProjectId(cwProjectRecords.getId());
+                    cwProjectClientInfoDTO.setClientId(c.getId());
+                    cwProjectClientInfoDTOList.add(cwProjectClientInfoDTO);
                 }
                 }
                 //对数据进行批量插入
                 //对数据进行批量插入
                 cwProjectRecordsMapper.insertProjectClientInfoList(cwProjectClientInfoDTOList);
                 cwProjectRecordsMapper.insertProjectClientInfoList(cwProjectClientInfoDTOList);

+ 24 - 8
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/projectRecords/service/dto/CwProjectRecordsDTO.java

@@ -1,12 +1,15 @@
 package com.jeeplus.test.cw.projectRecords.service.dto;
 package com.jeeplus.test.cw.projectRecords.service.dto;
 
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.jeeplus.core.query.Query;
 import com.jeeplus.core.query.Query;
 import com.jeeplus.core.query.QueryType;
 import com.jeeplus.core.query.QueryType;
 import com.jeeplus.core.service.dto.BaseDTO;
 import com.jeeplus.core.service.dto.BaseDTO;
 import com.jeeplus.sys.service.dto.OfficeDTO;
 import com.jeeplus.sys.service.dto.OfficeDTO;
 import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwWorkClientBaseDTO;
 import com.jeeplus.test.workContract.service.dto.WorkAttachmentDto;
 import com.jeeplus.test.workContract.service.dto.WorkAttachmentDto;
 import lombok.Data;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
@@ -40,8 +43,7 @@ public class CwProjectRecordsDTO extends BaseDTO {
     /**
     /**
      * 项目所属部门
      * 项目所属部门
      */
      */
-    @Query(type = QueryType.EQ, tableColumn = "su.office.id", javaField = "officeDTO.id")
-    private OfficeDTO officeDTO;
+    private String officeId;
 
 
     /**
     /**
      * 项目金额
      * 项目金额
@@ -56,36 +58,40 @@ public class CwProjectRecordsDTO extends BaseDTO {
     /**
     /**
      * 项目计划开始时间
      * 项目计划开始时间
      */
      */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date planStartDate;
     private Date planStartDate;
 
 
     /**
     /**
      * 项目计划结束时间
      * 项目计划结束时间
      */
      */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
     private Date planEndDate;
     private Date planEndDate;
 
 
     /**
     /**
      * 项目经理
      * 项目经理
      */
      */
-    @Query(tableColumn = "a.project_master", javaField = "master.id", type = QueryType.EQ)
-    private UserDTO projectMaster;
+    private String projectMasterId;
 
 
     /**
     /**
      * 现场负责人
      * 现场负责人
      */
      */
-    @Query(tableColumn = "a.project_leader", javaField = "leader.id", type = QueryType.EQ)
-    private UserDTO projectLeader;
+    private String projectLeaderId;
 
 
     /**
     /**
      * 流程id
      * 流程id
      */
      */
     private String procInsId;
     private String procInsId;
 
 
+    /**
+     *
+     */
     private String processDefinitionId;
     private String processDefinitionId;
 
 
     /**
     /**
      * 状态
      * 状态
      */
      */
-    @Query
     private String status;
     private String status;
 
 
 
 
@@ -97,5 +103,15 @@ public class CwProjectRecordsDTO extends BaseDTO {
     /**
     /**
      * 被服务单位信息
      * 被服务单位信息
      */
      */
-    private List<CwProjectClientInfoDTO> cwProjectClientInfoDTOList;
+    private List<CwWorkClientBaseDTO> cwProjectClientInfoDTOList;
+
+    /**
+     * 项目经理姓名
+     */
+    private String projectMasterName;
+
+    /**
+     * 时间查询
+     */
+    private String[] createDates;
 }
 }