Selaa lähdekoodia

20220930
项目登记

sunruiqi 2 vuotta sitten
vanhempi
commit
04fa16765b
12 muutettua tiedostoa jossa 201 lisäystä ja 21 poistoa
  1. 23 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/controller/ProjectListController.java
  2. 13 1
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/domain/ProgramProjectListInfo.java
  3. 5 1
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/mapper/ProjectListMapper.java
  4. 22 3
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/mapper/xml/ProjectListMapper.xml
  5. 35 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/service/ProjectListService.java
  6. 45 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/service/dto/ExportFileDto.java
  7. 4 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/service/dto/ProjectListDto.java
  8. 5 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/domain/ReimbursementTypeInfo.java
  9. 2 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/mapper/ReimbursementTypeMapper.java
  10. 10 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/mapper/xml/ReimbursementTypeMapper.xml
  11. 35 16
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/service/ReimbursementTypeService.java
  12. 2 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/service/dto/ReimbursementTypeDto.java

+ 23 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/controller/ProjectListController.java

@@ -1,12 +1,20 @@
 package com.jeeplus.test.program.configuration.projectList.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jeeplus.common.utils.ResponseUtil;
+import com.jeeplus.core.excel.utils.EasyPoiUtil;
+import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.test.program.configuration.projectList.domain.ProgramProjectListInfo;
 import com.jeeplus.test.program.configuration.projectList.service.ProjectListService;
 import com.jeeplus.test.program.configuration.projectList.service.dto.ContractDto;
+import com.jeeplus.test.program.configuration.projectList.service.dto.ExportFileDto;
 import com.jeeplus.test.program.configuration.projectList.service.dto.ProjectListDto;
+import com.jeeplus.test.projectRecords.domain.Project;
+import com.jeeplus.test.projectRecords.service.dto.FileUploadListDTO;
+import com.jeeplus.test.projectRecords.service.dto.ProjectDTO;
+import com.jeeplus.test.projectRecords.service.mapstruct.ProjectWrapper;
 import com.jeeplus.test.workContract.domain.WorkContractInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -14,6 +22,8 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 @Api(tags ="项目列表管理")
 @RestController
@@ -106,5 +116,18 @@ public class ProjectListController {
         return ResponseEntity.ok (list);
     }
 
+    /**
+     * 导出
+     *
+     * @param info
+     * @param response
+     * @throws Exception
+     */
+    @GetMapping("/exportFile")
+    @ApiOperation(value = "导出")
+    public void exportFileUploadList(ProgramProjectListInfo info, HttpServletResponse response) throws Exception {
+        List<ExportFileDto> infos = projectListService.exportList(info);
+        EasyPoiUtil.exportExcel(infos, "项目登记列表信息",  "项目登记列表信息", ExportFileDto.class, "", response );
+    }
 
 }

+ 13 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/domain/ProgramProjectListInfo.java

@@ -1,5 +1,6 @@
 package com.jeeplus.test.program.configuration.projectList.domain;
 
+import cn.afterturn.easypoi.excel.annotation.Excel;
 import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.jeeplus.core.domain.BaseEntity;
@@ -26,6 +27,7 @@ public class ProgramProjectListInfo {
      */
     @TableField(fill = FieldFill.INSERT)
     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @Excel(name = "创建时间", width = 30, orderNum = "6")
     private Date createDate;
 
     /**
@@ -59,6 +61,7 @@ public class ProgramProjectListInfo {
     /**
      * 合同名称
      */
+    @Excel(name = "合同名称", width = 30, orderNum = "3")
     @Query(tableColumn = "a.contract_name")
     private String contractName;
 
@@ -67,6 +70,7 @@ public class ProgramProjectListInfo {
      */
     private String client;
 
+    @Excel(name = "委托方", width = 30, orderNum = "5")
     @Query(tableColumn = "a.client_name")
     private String clientName;
 
@@ -77,17 +81,21 @@ public class ProgramProjectListInfo {
     /**
      * 项目名称
      */
+    @Excel(name = "项目名称", width = 30, orderNum = "1")
     @Query(tableColumn = "a.name")
     private String name;
 
     /**
      * 项目编号
      */
+    @Excel(name = "项目编号", width = 20, orderNum = "2")
     @Query(tableColumn = "a.no")
     private String no;
 
     private String projectType;
 
+    private String approvalNo;
+
     private String company;
 
     private String projectMould;
@@ -107,9 +115,12 @@ public class ProgramProjectListInfo {
     /**
      * 项目经理(项目责任人)
      */
-    @Query(tableColumn = "a.projectManager")
     private String projectManager;
 
+    @Excel(name = "项目经理", width = 20, orderNum = "4")
+    @Query(tableColumn = "c.name")
+    private String projectManagerName;
+
     private String reportType;
 
     private String industry;
@@ -179,6 +190,7 @@ public class ProgramProjectListInfo {
     /**
      * 状态
      */
+    @Excel(name = "状态", width = 20, orderNum = "7")
     @Query(tableColumn = "a.status")
     private String status;
 

+ 5 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/mapper/ProjectListMapper.java

@@ -5,12 +5,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.jeeplus.test.oss.domain.WorkAttachment;
 import com.jeeplus.test.program.configuration.projectList.domain.ProgramProjectListInfo;
 import com.jeeplus.test.program.configuration.projectList.service.dto.ContractDto;
+import com.jeeplus.test.program.configuration.projectList.service.dto.ExportFileDto;
 import com.jeeplus.test.workContract.domain.WorkContractInfo;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 public interface ProjectListMapper extends BaseMapper<ProgramProjectListInfo> {
 
     IPage<WorkContractInfo> findContractPageList(Page<WorkContractInfo> page, @Param("dto") ContractDto dto);
@@ -18,4 +20,6 @@ public interface ProjectListMapper extends BaseMapper<ProgramProjectListInfo> {
     void updateStatusById(@Param("id")String id, @Param("status")String status);
 
     IPage<ProgramProjectListInfo> findPageList(Page<ProgramProjectListInfo> page, @Param(Constants.WRAPPER) QueryWrapper<ProgramProjectListInfo> wrapper);
+
+    List<ExportFileDto> findList(@Param(Constants.WRAPPER) QueryWrapper<ProgramProjectListInfo> wrapper);
 }

+ 22 - 3
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/mapper/xml/ProjectListMapper.xml

@@ -59,9 +59,9 @@
 
     <select id="findPageList" resultType="com.jeeplus.test.program.configuration.projectList.domain.ProgramProjectListInfo">
         SELECT
-            a.id,
-            b.name AS create_by,
-            a.create_date,
+           a.id,
+           b.name AS create_by,
+           a.create_date,
            a.update_by,
            a.update_date,
            a.del_flag,
@@ -74,6 +74,7 @@
            a.name,
            a.no,
            a.project_type,
+           a.approval_no,
            a.company,
            a.project_mould,
            a.property_holder,
@@ -83,6 +84,7 @@
            a.year_num,
            a.check_year,
            a.project_manager,
+           c.name AS project_manager_name,
            a.report_type,
            a.industry,
            a.enterprise_type,
@@ -117,6 +119,23 @@
         FROM
             program_project_list_info a
             LEFT JOIN sys_user b ON a.create_by = b.id
+            LEFT JOIN sys_user c ON a.project_manager = c.id
+            ${ew.customSqlSegment}
+            ORDER BY a.update_date DESC
+    </select>
+
+    <select id="findList" resultType="com.jeeplus.test.program.configuration.projectList.service.dto.ExportFileDto">
+        SELECT
+           (DATE_FORMAT(a.create_date,'%Y-%m-%d')) AS create_date,
+           a.contract_name,
+           a.client_name,
+           a.name,
+           a.no,
+           a.project_manager_name,
+           a.status
+        FROM
+            program_project_list_info a
+            LEFT JOIN sys_user b ON a.create_by = b.id
             ${ew.customSqlSegment}
             ORDER BY a.update_date DESC
     </select>

+ 35 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/service/ProjectListService.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.DictUtils;
 import com.jeeplus.sys.utils.StringUtils;
 import com.jeeplus.sys.utils.UserUtils;
 import com.jeeplus.test.mould.service.SerialnumTplService;
@@ -19,6 +20,7 @@ import com.jeeplus.test.program.configuration.projectList.mapper.ProjectLinkMapp
 import com.jeeplus.test.program.configuration.projectList.mapper.ProjectListMapper;
 import com.jeeplus.test.program.configuration.projectList.mapper.ProjectMemberMapper;
 import com.jeeplus.test.program.configuration.projectList.service.dto.ContractDto;
+import com.jeeplus.test.program.configuration.projectList.service.dto.ExportFileDto;
 import com.jeeplus.test.program.configuration.projectList.service.dto.ProjectListDto;
 import com.jeeplus.test.workContract.domain.WorkContractInfo;
 import com.jeeplus.test.workContract.mapper.WorkContractInfoMapper;
@@ -214,4 +216,37 @@ public class ProjectListService {
         IPage<ProgramProjectListInfo> pageList = projectListMapper.findPageList(page, wrapper);
         return pageList;
     }
+
+    public List<ExportFileDto> exportList(ProgramProjectListInfo info) throws Exception{
+        QueryWrapper<ProgramProjectListInfo> wrapper = QueryWrapperGenerator.buildQueryCondition(info, ProgramProjectListInfo.class);
+        wrapper.eq("a.del_flag", "0");
+        if (info.getCreateDates() != null) {
+            wrapper.between("a.create_date", info.getCreateDates()[0], info.getCreateDates()[1]);
+        }
+        List<ExportFileDto> list = projectListMapper.findList(wrapper);
+        // 状态值处理
+        if (CollectionUtils.isNotEmpty(list)) {
+            for(ExportFileDto i : list) {
+                if ("0".equals(i.getStatus())) {
+                    i.setStatus("未登记");
+                }
+                if ("1".equals(i.getStatus())) {
+                    i.setStatus("暂存");
+                }
+                if ("2".equals(i.getStatus())) {
+                    i.setStatus("登记中");
+                }
+                if ("3".equals(i.getStatus())) {
+                    i.setStatus("撤回");
+                }
+                if ("4".equals(i.getStatus())) {
+                    i.setStatus("驳回");
+                }
+                if ("5".equals(i.getStatus())) {
+                    i.setStatus("登记完成");
+                }
+            }
+        }
+        return list;
+    }
 }

+ 45 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/service/dto/ExportFileDto.java

@@ -0,0 +1,45 @@
+package com.jeeplus.test.program.configuration.projectList.service.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+@Data
+public class ExportFileDto {
+
+    /**
+     * 创建日期
+     */
+    @Excel(name = "创建时间", width = 30, orderNum = "6")
+    private String createDate;
+
+    /**
+     * 合同名称
+     */
+    @Excel(name = "合同名称", width = 30, orderNum = "3")
+    private String contractName;
+
+    @Excel(name = "委托方", width = 30, orderNum = "5")
+    private String clientName;
+
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称", width = 30, orderNum = "1")
+    private String name;
+
+    /**
+     * 项目编号
+     */
+    @Excel(name = "项目编号", width = 20, orderNum = "2")
+    private String no;
+
+    @Excel(name = "项目经理", width = 20, orderNum = "4")
+    private String projectManagerName;
+
+    /**
+     * 状态
+     */
+    @Excel(name = "状态", width = 20, orderNum = "7")
+    private String status;
+
+}

+ 4 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/service/dto/ProjectListDto.java

@@ -36,6 +36,8 @@ public class ProjectListDto extends BaseEntity {
 
     private String projectType;
 
+    private String approvalNo;
+
     private String company;
 
     private String projectMould;
@@ -54,6 +56,8 @@ public class ProjectListDto extends BaseEntity {
 
     private String projectManager;
 
+    private String projectManagerName;
+
     private String reportType;
 
     private String industry;

+ 5 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/domain/ReimbursementTypeInfo.java

@@ -10,6 +10,11 @@ import lombok.Data;
 public class ReimbursementTypeInfo extends BaseEntity {
 
     /**
+     * 层级
+     */
+    private String level;
+
+    /**
      * 报销类型名称
      */
     @Query

+ 2 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/mapper/ReimbursementTypeMapper.java

@@ -15,4 +15,6 @@ public interface ReimbursementTypeMapper extends BaseMapper<ReimbursementTypeInf
     Integer checkNameIsExist(@Param("name") String name, @Param("parentId") String parentId);
 
     Integer getNo(@Param("parentId") String parentId);
+
+    Integer getLevel(@Param("parentId") String parentId);
 }

+ 10 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/mapper/xml/ReimbursementTypeMapper.xml

@@ -22,4 +22,14 @@
 			del_flag = 0
 			AND parent_id = #{parentId}
 	</select>
+
+	<select id="getLevel" resultType="java.lang.Integer">
+		SELECT
+			(MAX(level) + 1) AS `level`
+		FROM
+			reimbursement_type_info
+		WHERE
+			del_flag = 0
+			AND id = #{parentId}
+	</select>
 </mapper>

+ 35 - 16
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/service/ReimbursementTypeService.java

@@ -22,13 +22,13 @@ public class ReimbursementTypeService {
 
     public List<ReimbursementTypeInfo> list(ReimbursementTypeInfo info) {
         LambdaQueryWrapper<ReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(BaseEntity::getDelFlag, 0);
         if (StringUtils.isNotEmpty(info.getName())) {
             wrapper.like(ReimbursementTypeInfo::getName, info.getName());
         }
         if (StringUtils.isNotEmpty(info.getNo())) {
             wrapper.like(ReimbursementTypeInfo::getNo, info.getNo());
         }
+        wrapper.eq(BaseEntity::getDelFlag, 0);
         wrapper.orderByAsc(ReimbursementTypeInfo::getNo);
         return mapper.selectList(wrapper);
     }
@@ -66,8 +66,8 @@ public class ReimbursementTypeService {
         info.setUpdateBy(userDto.getId());
         info.setUpdateDate(new Date());
         info.setDelFlag(0);
-        // 生成序号
-        info.setNo(getNo(info.getParentId()));
+        // 生成序号/层级
+        getNo(info);
         mapper.insert(info);
         return "操作完成";
     }
@@ -87,27 +87,46 @@ public class ReimbursementTypeService {
     }
 
     /**
-     * 生成序号
-     * @param parentId
+     * 生成序号/层级
+     * @param info
      * @return
      */
-    public String getNo(String parentId) {
-        Integer no = mapper.getNo(parentId);
+    public ReimbursementTypeInfo getNo(ReimbursementTypeInfo info) {
+        ReimbursementTypeInfo parentInfo = null;
+        if (!"0".equals(info.getParentId())) {
+            //根据parentId查询父节点信息
+            LambdaQueryWrapper<ReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(BaseEntity::getDelFlag, 0);
+            wrapper.eq(BaseEntity::getId, info.getParentId());
+            parentInfo = mapper.selectOne(wrapper);
+        }
+        //查询序号
+        Integer no = mapper.getNo(info.getParentId());
         // 该层级下有数据,正常返回序号值
         if (no != null) {
-            return no.toString();
+            info.setNo(no.toString());
         } else {
-            // 该层级无数据,根据parentId查询父节点信息
-            LambdaQueryWrapper<ReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
-            wrapper.eq(BaseEntity::getDelFlag, 0);
-            wrapper.eq(BaseEntity::getId, parentId);
-            ReimbursementTypeInfo info = mapper.selectOne(wrapper);
             // 父节点存在,根据父节点序号生成;不存在,则表示无上级层级,从1开始
-            if (info != null) {
-                return info.getNo() + "01";
+            if (parentInfo != null) {
+                info.setNo(parentInfo.getNo() + "01");
+            } else {
+                info.setNo("1");
+            }
+        }
+        // 生成层级
+        //查询层级
+        Integer level = mapper.getLevel(info.getParentId());
+        if (level != null) {
+            info.setLevel(level.toString());
+        } else {
+            // 父节点存在,根据父节点level生成,不存在,则表示无上级层级,从1开始
+            if (parentInfo != null) {
+                Integer i = Integer.parseInt(parentInfo.getLevel())+1;
+                info.setLevel(i.toString());
             } else {
-                return "1";
+                info.setLevel("1");
             }
         }
+        return info;
     }
 }

+ 2 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/service/dto/ReimbursementTypeDto.java

@@ -6,6 +6,8 @@ import lombok.Data;
 @Data
 public class ReimbursementTypeDto extends BaseEntity {
 
+    private String level;
+
     private String name;
 
     private String no;