lizhenhao %!s(int64=2) %!d(string=hai) anos
pai
achega
e2f57f8eb0
Modificáronse 30 ficheiros con 2509 adicións e 108 borrados
  1. 5 0
      jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/sys/service/dto/OfficeDTO.java
  2. 42 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/constant/enums/ProjectStatusEnum.java
  3. 38 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/constant/enums/ProjectTypeEnum.java
  4. 38 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/constant/enums/YesOrNoEnum.java
  5. 920 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/controller/ProjectController.java
  6. 246 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/domain/Project.java
  7. 33 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/mapper/ProjectMapper.java
  8. 257 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/mapper/xml/ProjectMapper.xml
  9. 187 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/service/ProjectService.java
  10. 34 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/service/dto/FileUploadListDTO.java
  11. 282 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/service/dto/ProjectDTO.java
  12. 14 0
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/service/mapstruct/ProjectWrapper.java
  13. 2 2
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workClientInfo/controller/WorkClientController.java
  14. 15 15
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workClientInfo/mapper/xml/WorkClientInfoMapper.xml
  15. 2 39
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workContract/domain/WorkContractInfo.java
  16. 7 7
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workContract/mapper/xml/WorkContractBorrowMapper.xml
  17. 25 25
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workContract/mapper/xml/WorkContractInfoMapper.xml
  18. 8 8
      jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workContract/service/WorkContractService.java
  19. BIN=BIN
      jeeplus-modules/jeeplus-assess/src/main/resources/dot/发票明细导入模板.xlsx
  20. BIN=BIN
      jeeplus-modules/jeeplus-assess/src/main/resources/dot/职位导入模板.xlsx
  21. BIN=BIN
      jeeplus-modules/jeeplus-assess/src/main/resources/dot/项目导入模板.xlsx
  22. 2 2
      jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/mapper/xml/TemplateMapper.xml
  23. 18 1
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/OfficeController.java
  24. 45 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/UserController.java
  25. 7 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/OfficeMapper.java
  26. 17 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/UserMapper.java
  27. 40 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/OfficeMapper.xml
  28. 49 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/UserMapper.xml
  29. 158 9
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/service/OfficeService.java
  30. 18 0
      jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/service/UserService.java

+ 5 - 0
jeeplus-api/jeeplus-system-api/src/main/java/com/jeeplus/sys/service/dto/OfficeDTO.java

@@ -110,4 +110,9 @@ public class OfficeDTO extends TreeDTO <OfficeDTO> {
      */
     private boolean disabled = false;
 
+    /**
+     * 是否可用
+     */
+    private boolean typeFlag = false;
+
 }

+ 42 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/constant/enums/ProjectStatusEnum.java

@@ -0,0 +1,42 @@
+package com.jeeplus.assess.projectRecords.constant.enums;
+
+/**
+ * 项目状态
+ */
+public enum ProjectStatusEnum {
+    STAGING ("1", "暂存"),
+    TOTRIAL ("2", "送审"),
+    RETRACT ("3", "撤回"),
+    OVERRULE ("4", "驳回"),
+    FINISH ("5", "完成"),
+    INVALID ("6", "作废"),
+    DELETE ("7", "删除");
+
+    /**
+     *  项目状态值
+     */
+    private String value;
+
+    /**
+     * 项目状态标签
+     */
+    private String label;
+
+    private ProjectStatusEnum(String value, String label) {
+        this.value = value;
+        this.label = label;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    @Override
+    public String toString() {
+        return this.value;
+    }
+}

+ 38 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/constant/enums/ProjectTypeEnum.java

@@ -0,0 +1,38 @@
+package com.jeeplus.assess.projectRecords.constant.enums;
+
+/**
+ * 项目类型
+ */
+public enum ProjectTypeEnum {
+
+    ASSESS ("1", "评估项目"),
+    CONSULTATION ("2", "咨询项目");
+
+    /**
+     *  项目类型值
+     */
+    private String value;
+
+    /**
+     * 项目类型标签
+     */
+    private String label;
+
+    private ProjectTypeEnum(String value, String label) {
+        this.value = value;
+        this.label = label;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    @Override
+    public String toString() {
+        return this.value;
+    }
+}

+ 38 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/constant/enums/YesOrNoEnum.java

@@ -0,0 +1,38 @@
+package com.jeeplus.assess.projectRecords.constant.enums;
+
+/**
+ * 是否枚举
+ */
+public enum YesOrNoEnum {
+
+    YES ("1", "是"),
+    NO ("0", "否");
+
+    /**
+     *  枚举值
+     */
+    private String value;
+
+    /**
+     * 枚举标签
+     */
+    private String label;
+
+    private YesOrNoEnum(String value, String label) {
+        this.value = value;
+        this.label = label;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    @Override
+    public String toString() {
+        return this.value;
+    }
+}

+ 920 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/controller/ProjectController.java

@@ -0,0 +1,920 @@
+package com.jeeplus.assess.projectRecords.controller;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
+import com.jeeplus.aop.demo.annotation.DemoMode;
+import com.jeeplus.common.excel.ExcelOptions;
+import com.jeeplus.common.excel.ExportMode;
+import com.jeeplus.core.excel.EasyPoiUtil;
+import com.jeeplus.core.query.QueryWrapperGenerator;
+import com.jeeplus.logging.annotation.ApiLog;
+import com.jeeplus.pubmodules.oss.service.dto.WorkAttachmentDto;
+import com.jeeplus.sys.service.dto.RoleDTO;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.UserUtils;
+import com.jeeplus.pubmodules.oss.domain.WorkAttachment;
+import com.jeeplus.pubmodules.oss.service.OssService;
+import com.jeeplus.assess.projectRecords.constant.enums.ProjectStatusEnum;
+import com.jeeplus.assess.projectRecords.constant.enums.ProjectTypeEnum;
+import com.jeeplus.assess.projectRecords.constant.enums.YesOrNoEnum;
+import com.jeeplus.assess.projectRecords.domain.Project;
+import com.jeeplus.assess.projectRecords.service.ProjectService;
+import com.jeeplus.sys.service.UserService;
+import com.jeeplus.assess.projectRecords.service.dto.FileUploadListDTO;
+import com.jeeplus.assess.projectRecords.service.dto.ProjectDTO;
+import com.jeeplus.assess.projectRecords.service.mapstruct.ProjectWrapper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateUtils;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Type;
+import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
+
+
+/**
+ * 项目Controller
+ *
+ * @author lizhenhao
+ * @version 2022-08-02
+ */
+@Api("项目管理")
+@RestController
+@RequestMapping(value = "/sys/project")
+public class ProjectController {
+
+    @Autowired
+    private ProjectService projectService;
+
+    @Autowired
+    private UserService userService;
+
+    @Resource
+    private OssService ossService;
+
+    private int successNum;
+
+    @ApiLog("查询项目列表")
+    @PreAuthorize("hasAuthority('sys:project:list')")
+    @GetMapping("list")
+    public ResponseEntity<IPage<Project>> data(Project project, Page<Project> page) throws Exception {
+        QueryWrapper<Project> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( project, Project.class );
+        IPage<Project> result = projectService.selectPage (page,queryWrapper);
+        UserDTO currentUserDTO = UserUtils.getCurrentUserDTO();
+        Boolean bmzrRoleFlag = false;
+        if(null != currentUserDTO.getRoleDTOList() && currentUserDTO.getRoleDTOList().size()>0){
+            for (RoleDTO roleDTO : currentUserDTO.getRoleDTOList()) {
+                if("bmzr".equals(roleDTO.getEnName())){
+                    bmzrRoleFlag = true;
+                    break;
+                }
+            }
+        }
+        List<Project> list = result.getRecords();
+        for (Project info: list) {
+            info = changeBigDecimalEntity(info);
+            if((StringUtils.isNotBlank(info.getProjectHeadId()) && info.getProjectHeadId().equals(currentUserDTO.getId()))
+                    || bmzrRoleFlag){
+                info.setPermissionFlag(true);
+            }else{
+                info.setPermissionFlag(false);
+            }
+        }
+        return ResponseEntity.ok (result);
+    }
+
+    /**
+     * 查询项目数据
+     * @param id
+     * @return
+     */
+    @ApiLog("查询项目详情")
+    @PreAuthorize ("hasAnyAuthority('sys:project:view','sys:project:add','sys:project:edit')")
+    @GetMapping("queryById")
+    public ResponseEntity queryById(@RequestParam("id") String id) {
+        Project userProject = projectService.selectByProjectId ( id );
+        userProject = changeBigDecimalEntity(userProject);
+        return ResponseEntity.ok (userProject);
+    }
+
+    /**
+     * 保存项目信息
+     * @param projectDTO
+     * @return
+     */
+    @ApiLog("保存项目")
+    @PreAuthorize ("hasAnyAuthority('sys:project:add','sys:project:edit')")
+    @PostMapping("save")
+    public ResponseEntity save(@Valid @RequestBody ProjectDTO projectDTO){
+        //新增或编辑表单保存
+        Project project = ProjectWrapper.INSTANCE.toEntity (projectDTO);
+        Project pro = projectService.projectDtoToDate(project,projectDTO);
+        pro.setItemType(projectDTO.getItemType());
+        if(StringUtils.isNotBlank(projectDTO.getProjectHead())){
+            UserDTO projectHead = userService.get(projectDTO.getProjectHead());
+            if(null == projectHead || StringUtils.isBlank(projectHead.getId())){
+                return ResponseEntity.badRequest().body("项目负责人不存在,请重新输入");
+            }
+            pro.setProjectHead(projectHead.getId());
+        }
+
+        /*if(StringUtils.isNotBlank(projectDTO.getEvaluationPersonOne())){
+
+            UserDTO evaluationPersonOne = userService.get(projectDTO.getEvaluationPersonOne());
+            if(null == evaluationPersonOne || StringUtils.isBlank(evaluationPersonOne.getId())){
+                return ResponseEntity.badRequest().body("签字评估师1不存在,请重新输入");
+            }
+            pro.setEvaluationPersonOne(evaluationPersonOne.getId());
+        }*/
+
+        /*if(StringUtils.isNotBlank(projectDTO.getEvaluationPersonTwo())){
+
+            UserDTO evaluationPersonTwo = userService.get(projectDTO.getEvaluationPersonTwo());
+            if(null == evaluationPersonTwo || StringUtils.isBlank(evaluationPersonTwo.getId())){
+                return ResponseEntity.badRequest().body("签字评估师2不存在,请重新输入");
+            }
+            pro.setEvaluationPersonTwo(evaluationPersonTwo.getId());
+        }*/
+
+        if(StringUtils.isBlank(projectDTO.getId())){
+
+            //判断一下文号是否存在
+            if(StringUtils.isNotBlank(projectDTO.getDocumentNum())){
+                if(ObjectUtil.isNotEmpty(projectService.selectByDocumentNum(projectDTO))){
+                    return ResponseEntity.badRequest().body("不可使用已存在的文号");
+                }
+            }
+            //文件状态
+            if (CollectionUtil.isNotEmpty(projectDTO.getWorkAttachments())) {
+                pro.setFileUploadType("1");
+            } else {
+                pro.setFileUploadType("0");
+            }
+
+            projectService.save(pro);//新增
+        }else{
+
+            //判断一下文号是否存在
+            if(StringUtils.isNotBlank(projectDTO.getDocumentNum())){
+                Project userProjects = projectService.selectByDocumentNum(projectDTO);
+                if(ObjectUtil.isNotEmpty(userProjects)){
+                    if(!projectDTO.getId().equals(userProjects.getId())){
+                        return ResponseEntity.badRequest().body("不可使用已存在的文号");
+                    }
+                }
+            }
+            LambdaUpdateWrapper<Project> wrapper = projectService.getLambdaUpdateWrapper(projectDTO);
+            if (CollectionUtil.isNotEmpty(projectDTO.getWorkAttachments())) {
+                wrapper.set(Project::getFileUploadType, "1");
+            } else {
+                wrapper.set(Project::getFileUploadType, "0");
+            }
+            projectService.update (pro,wrapper);//修改
+        }
+        //项目id处理
+        List<WorkAttachmentDto> workAttachmentDtos = new ArrayList<>();
+        List<WorkAttachment> workAttachments = projectDTO.getWorkAttachments();
+        workAttachments.stream().forEach(ite -> {
+            WorkAttachmentDto w = new WorkAttachmentDto();
+            w.setBy(ite.getCreateById());
+            w.setName(ite.getAttachmentName());
+            String fileSize = ite.getFileSize();
+            String[] split = fileSize.split("\\.");
+            w.setSize(split[0]);
+            w.setUrl(ite.getUrl());
+            workAttachmentDtos.add(w);
+        });
+        ossService.saveOrUpdateFileList(workAttachmentDtos,pro.getId(),"projectRecords");
+        return ResponseEntity.ok ("保存项目成功");
+    }
+
+    /**
+     * 删除项目
+     * @param ids
+     * @return
+     */
+    @ApiLog("删除项目")
+    @PreAuthorize ("hasAuthority('sys:project:del')")
+    @DeleteMapping("delete")
+    public ResponseEntity delete(String ids) {
+        String idArray[] =ids.split(",");
+        projectService.removeByIds (Lists.newArrayList (idArray));
+        return ResponseEntity.ok ("删除项目成功");
+    }
+
+    /**
+     * 导入项目数据
+     *
+     * @return
+     */
+    @DemoMode
+    @PreAuthorize("hasAnyAuthority('sys:project:import')")
+    @PostMapping("import")
+    @ApiOperation(value = "导入项目数据excel")
+    public ResponseEntity importFile(MultipartFile file) throws IOException{
+        //用来计数的,计算导入了多少条数据
+        this.successNum = 0;
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        ArrayList<Project> arrayList = new ArrayList<>();
+        HashMap<String,String> hashMap = new HashMap<>();
+
+        //这里通过WorkbookFactory.create的方式来创建workBook,并没有用HSSFWorkbook和XSSFWorkbook,因为这两个局限性太大了,只能通过后缀来进行判断excel的版本
+        //workBook在这里我主要用来判断是否存在“项目明细表”或“咨询报告”的sheet页,不存在会向用户抛提示
+        Workbook workBook = WorkbookFactory.create(file.getInputStream());
+
+        List<ProjectDTO> listA = new ArrayList<>();
+        List<ProjectDTO> listB = new ArrayList<>();
+        //判断是否存在“项目明细表”sheet页
+        int sheetIndexAs = workBook.getSheetIndex("项目明细表");
+        if(sheetIndexAs != -1){
+            //获取评估项目sheet
+            listA = EasyPoiUtil.importSheetExcel(file, 1, 1, sheetIndexAs,1, ProjectDTO.class);
+            //去除excel中的空行
+            listA = getExcelList(listA);
+            //导入前检测数据
+            String resultA = importDecide(listA, sdf, arrayList, hashMap, successNum, ProjectTypeEnum.ASSESS.getValue());
+            if(StringUtils.isNotBlank(resultA)){
+                //有返回值,说明导入的数据不正确。向用户抛提示
+                return ResponseEntity.badRequest().body  (resultA);
+            }
+        }
+        //判断是否存在“咨询报告”sheet页
+        int sheetIndexCo = workBook.getSheetIndex("咨询报告");
+        if(sheetIndexCo != -1){
+            //咨询项目sheet
+            listB = EasyPoiUtil.importSheetExcel(file, 1, 1, sheetIndexCo,1, ProjectDTO.class);
+            //去除excel中的空行
+            listB = getExcelList(listB);
+            //导入前检测数据
+            String resultB = importDecide(listB, sdf, arrayList, hashMap, successNum, ProjectTypeEnum.CONSULTATION.getValue());
+            if(StringUtils.isNotBlank(resultB)){
+                //有返回值,说明导入的数据不正确。向用户抛提示
+                return ResponseEntity.badRequest().body  (resultB);
+            }
+        }
+        //如果两个sheet页都不存在,说明这个导入的文件不符合要求
+        if(sheetIndexAs == -1 && sheetIndexCo == -1){
+            return ResponseEntity.badRequest().body  ("导入文件格式不正确,建议根据模板来进行数据的导入");
+        }
+        //判断文件中是否有重复的文号
+        /*if(hashMap.size() != listA.size() + listB.size()){
+            return ResponseEntity.badRequest().body  ("文件中存在重复的文号或者多个空文号");
+        }*/
+        //导入数据
+        projectService.saveBatch(arrayList);
+
+        return ResponseEntity.ok("已成功导入 " + successNum + " 条数据");
+    }
+    public String importDecide(List<ProjectDTO> list, SimpleDateFormat sdf, ArrayList<Project> arrayList, HashMap<String,String> hashMap, int successNum, String itemType){
+
+        for (ProjectDTO project : list) {
+            if(ObjectUtil.isEmpty(project)){
+                continue;
+            }
+            try {
+                if(StringUtils.isNotBlank(project.getEvaluationReportDateUi())){
+                    //EvaluationReportDateUi字段接到的数据符合"yyyy/MM/dd"时间格式的话,正常执行。
+                    //不符合的话,就会有异常,进到catch
+                    String format = sdf.format(DateUtils.parseDate(project.getEvaluationReportDateUi(), new String[]{"yyyy/MM/dd"}));
+                    //符合要求的时间格式,则会将数据转换为时间格式存到EvaluationReportDate字段中,并且将项目状态设置为”已完成“
+                    project.setEvaluationReportDate(sdf.parse(format));
+                    project.setStatus(ProjectStatusEnum.FINISH.getValue());
+                }
+            }catch (Exception e){
+                if(StringUtils.isNotBlank(project.getEvaluationReportDateUi())){
+                    if(project.getEvaluationReportDateUi().contains("报告已作废")){
+                        //当EvaluationReportDateUi字段接收到的值包含”报告已作废“时,项目状态为”作废“,并且将值放到AssessReportMessage字段中
+                        project.setStatus(ProjectStatusEnum.INVALID.getValue());
+                        project.setAssessReportMessage(project.getEvaluationReportDateUi());
+                    }else{
+                        //当EvaluationReportDateUi字段接收到的值不包含”报告已作废“时,项目状态为”暂存“,并且将值放到AssessReportMessage字段中
+                        project.setStatus(ProjectStatusEnum.STAGING.getValue());
+                        project.setAssessReportMessage(project.getEvaluationReportDateUi());
+                    }
+                }else{
+                    //当EvaluationReportDateUi字段接收到的值为空时,项目状态为”暂存“
+                    project.setStatus(ProjectStatusEnum.STAGING.getValue());
+                }
+            }
+
+            try {
+                if(StringUtils.isNotBlank(project.getEvaluationBaseDateUi())){
+                    String format = sdf.format(DateUtils.parseDate(project.getEvaluationBaseDateUi(), new String[]{"yyyy/MM/dd"}));
+                    project.setEvaluationBaseDate(sdf.parse(format));
+                }
+            }catch (Exception e){
+                if(StringUtils.isNotBlank(project.getEvaluationBaseDateUi())){
+                    project.setAssessBaseMessage(project.getEvaluationBaseDateUi());
+                }
+
+            }
+
+            try {
+                if(StringUtils.isNotBlank(project.getInvoiceDateUi())){
+                    String format = sdf.format(DateUtils.parseDate(project.getInvoiceDateUi(), new String[]{"yyyy/MM/dd"}));
+                    project.setInvoiceDate(sdf.parse(format));
+                }
+            }catch (Exception e){
+                if(StringUtils.isNotBlank(project.getInvoiceDateUi())){
+                    project.setInvoiceMessage(project.getInvoiceDateUi());
+                }
+
+            }
+
+            try {
+                if(StringUtils.isNotBlank(project.getReimbursementDateUi())){
+                    String format = sdf.format(DateUtils.parseDate(project.getReimbursementDateUi(), new String[]{"yyyy/MM/dd"}));
+                    project.setReimbursementDate(sdf.parse(format));
+                }
+            }catch (Exception e){
+                e.printStackTrace();
+            }
+
+            //项目负责人、签字评估师1、签字评估师2 关联user表的id
+            if(StringUtils.isNotBlank(project.getProjectHead())){
+                String id = userService.getUserIdByName(project.getProjectHead());
+                if(StringUtils.isNotBlank(id)){
+                    project.setProjectHead(id);
+                }else{
+                    return "文件中有项目负责人无法找到,请修改为在档人员,或者不填写";
+                }
+            }else{
+                return "文件中有项目负责人为空,请重新填写";
+            }
+
+            /*if(StringUtils.isNotBlank(project.getEvaluationPersonOne())){
+                String id = userService.getUserIdByName(project.getEvaluationPersonOne());
+                if(ObjectUtil.isNotEmpty(id)){
+                    project.setEvaluationPersonOne(id);
+                }else{
+                    return "文件中有签字评估师无法找到,请修改为在档人员,或者不填写";
+                }
+            }*/
+
+            /*if(StringUtils.isNotBlank(project.getEvaluationPersonTwo())){
+                String id = userService.getUserIdByName(project.getEvaluationPersonTwo());
+                if(ObjectUtil.isNotEmpty(id)){
+                    project.setEvaluationPersonTwo(id);
+                }else{
+                    return "文件中有签字评估师无法找到,请修改为在档人员,或者不填写";
+                }
+            }*/
+
+            //文号的问题
+            if(StringUtils.isNotBlank(project.getDocumentNum())) {
+                Project userProject = projectService.selectByDocumentNum(project);
+                if(ObjectUtil.isNotEmpty(userProject)){
+                    return "文件中存在已在档的文号";
+                }
+            }/*else{
+                return "文件中存在空的文号,文号不允许为空";
+            }*/
+
+            //当前处理人
+            if(StringUtils.isNotBlank(project.getCurrentDisposePerson())){
+                String id = userService.getUserIdByName(project.getCurrentDisposePerson());
+                if(StringUtils.isNotBlank(id)){
+                    project.setCurrentDisposePerson(id);
+                }else{
+                    return "文件中有当前处理人无法找到,请修改为在档人员,或者不填写";
+                }
+            }
+
+            //年份的问题
+            if(StringUtils.isBlank(project.getYear())) {
+                return "文件中存在空年份,请填写年份信息";
+            }
+
+            //是否开票
+            if(YesOrNoEnum.YES.getLabel().equals(project.getIsInvoice())){
+                project.setIsInvoice(YesOrNoEnum.YES.getValue());
+            }else if(YesOrNoEnum.NO.getLabel().equals(project.getIsInvoice())){
+                project.setIsInvoice(YesOrNoEnum.NO.getValue());
+            }
+
+            //合同是否存档
+            if(YesOrNoEnum.YES.getLabel().equals(project.getIsContractArchive())){
+                project.setIsContractArchive(YesOrNoEnum.YES.getValue());
+            }else if(YesOrNoEnum.NO.getLabel().equals(project.getIsContractArchive())){
+                project.setIsContractArchive(YesOrNoEnum.NO.getValue());
+            }
+
+            //底稿是否完好
+            if(YesOrNoEnum.YES.getLabel().equals(project.getIsPapersIntact())){
+                project.setIsPapersIntact(YesOrNoEnum.YES.getValue());
+            }else if(YesOrNoEnum.NO.getLabel().equals(project.getIsPapersIntact())){
+                project.setIsPapersIntact(YesOrNoEnum.NO.getValue());
+            }
+
+            //底稿是否归档
+            if(YesOrNoEnum.YES.getLabel().equals(project.getIsPapersArchive())){
+                project.setIsPapersArchive(YesOrNoEnum.YES.getValue());
+            }else if(YesOrNoEnum.NO.getLabel().equals(project.getIsPapersArchive())){
+                project.setIsPapersArchive(YesOrNoEnum.NO.getValue());
+            }
+
+            //外勤是否已经报销
+            if(YesOrNoEnum.YES.getLabel().equals(project.getIsOpsReimbursement())){
+                project.setIsOpsReimbursement(YesOrNoEnum.YES.getValue());
+            }else if(YesOrNoEnum.NO.getLabel().equals(project.getIsOpsReimbursement())){
+                project.setIsOpsReimbursement(YesOrNoEnum.NO.getValue());
+            }
+
+            //是否已经报销提成
+            if(YesOrNoEnum.YES.getLabel().equals(project.getIsCommissionReimbursement())){
+                project.setIsCommissionReimbursement(YesOrNoEnum.YES.getValue());
+            }else if(YesOrNoEnum.NO.getLabel().equals(project.getIsCommissionReimbursement())){
+                project.setIsCommissionReimbursement(YesOrNoEnum.NO.getValue());
+            }
+
+            hashMap.put(project.getDocumentNum(),null);
+
+            //金额字段保留两位小数  四舍五入
+            project = changeBigDecimal(project);
+
+            Project userProject = ProjectWrapper.INSTANCE.toEntity(project);
+            //项目类型 1.评估项目  2.咨询项目
+            userProject.setItemType(itemType);
+            arrayList.add(userProject);
+            this.successNum++;
+        }
+
+        return null;
+    }
+
+    /**
+     * 金额字段保留两位小数  四舍五入
+     * @param project
+     * @return
+     */
+    public ProjectDTO changeBigDecimal(ProjectDTO project) {
+        //未报销金额
+        if(StringUtils.isNotBlank(project.getUnreimbursedAmount())){
+            try{
+            BigDecimal b = new BigDecimal(project.getUnreimbursedAmount()).setScale(2, BigDecimal.ROUND_HALF_UP);
+            project.setUnreimbursedAmount(b.toString());
+            }catch (Exception e) {
+                project.setUnreimbursedAmount("");
+            }
+        }
+        //已报销金额
+        if(StringUtils.isNotBlank(project.getReimbursementAmount())){
+            try{
+            BigDecimal b = new BigDecimal(project.getReimbursementAmount()).setScale(2, BigDecimal.ROUND_HALF_UP);
+            project.setReimbursementAmount(b.toString());
+            }catch (Exception e) {
+                project.setReimbursementAmount("");
+            }
+        }
+        //预估/实际收费(万元)
+        if(StringUtils.isNotBlank(project.getActualCharges())){
+            try{
+            BigDecimal b = new BigDecimal(project.getActualCharges()).setScale(2, BigDecimal.ROUND_HALF_UP);
+            project.setActualCharges(b.toString());
+            }catch (Exception e) {
+                project.setActualCharges("");
+            }
+        }
+        //报告收费(元)
+        if(StringUtils.isNotBlank(project.getReportCharges())){
+            try{
+            BigDecimal b = new BigDecimal(project.getReportCharges()).setScale(2, BigDecimal.ROUND_HALF_UP);
+            project.setReportCharges(b.toString());
+            }catch (Exception e) {
+                project.setReportCharges("");
+            }
+        }
+        //租金评估(万/年)
+        if(StringUtils.isNotBlank(project.getRentEvaluation())){
+            try{
+            BigDecimal b = new BigDecimal(project.getRentEvaluation()).setScale(2, BigDecimal.ROUND_HALF_UP);
+            project.setRentEvaluation(b.toString());
+            }catch (Exception e) {
+                project.setRentEvaluation("");
+            }
+        }
+        //净资产评估
+        if(StringUtils.isNotBlank(project.getNetAssetsEvaluation())){
+            try{
+            BigDecimal b = new BigDecimal(project.getNetAssetsEvaluation()).setScale(2, BigDecimal.ROUND_HALF_UP);
+            project.setNetAssetsEvaluation(b.toString());
+            }catch (Exception e) {
+                project.setNetAssetsEvaluation("");
+            }
+        }
+        //固定资产评估(万元)
+        if(StringUtils.isNotBlank(project.getFixedAssetsEvaluation())){
+            try{
+                BigDecimal b = new BigDecimal(project.getFixedAssetsEvaluation()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                project.setFixedAssetsEvaluation(b.toString());
+            }catch (Exception e) {
+                project.setFixedAssetsEvaluation("");
+            }
+        }
+        //废旧物资评估(万元)
+        if(StringUtils.isNotBlank(project.getWaystEvaluation())){
+            try{
+            BigDecimal b = new BigDecimal(project.getWaystEvaluation()).setScale(2, BigDecimal.ROUND_HALF_UP);
+            project.setWaystEvaluation(b.toString());
+            }catch (Exception e) {
+                project.setWaystEvaluation("");
+            }
+        }
+        return project;
+    }
+
+    /**
+     * 金额字段保留两位小数  四舍五入
+     * 实体类domain用
+     * @param project
+     * @return
+     */
+    public Project changeBigDecimalEntity(Project project) {
+        //未报销金额
+        try{
+            if(StringUtils.isNotBlank(project.getUnreimbursedAmount())){
+                BigDecimal b = new BigDecimal(project.getUnreimbursedAmount()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                project.setUnreimbursedAmount(b.toString());
+            }
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        //已报销金额
+        try{
+            if(StringUtils.isNotBlank(project.getReimbursementAmount())){
+                BigDecimal b = new BigDecimal(project.getReimbursementAmount()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                project.setReimbursementAmount(b.toString());
+            }
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+        //预估/实际收费(万元)
+        try{
+            if(StringUtils.isNotBlank(project.getActualCharges())){
+                BigDecimal b = new BigDecimal(project.getActualCharges()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                project.setActualCharges(b.toString());
+            }
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+        //报告收费(元)
+        try{
+            if(StringUtils.isNotBlank(project.getReportCharges())){
+                BigDecimal b = new BigDecimal(project.getReportCharges()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                project.setReportCharges(b.toString());
+            }
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+        //租金评估(万/年)
+        try{
+            if(StringUtils.isNotBlank(project.getRentEvaluation())){
+                BigDecimal b = new BigDecimal(project.getRentEvaluation()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                project.setRentEvaluation(b.toString());
+            }
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+        //净资产评估
+        try{
+            if(StringUtils.isNotBlank(project.getNetAssetsEvaluation())){
+                BigDecimal b = new BigDecimal(project.getNetAssetsEvaluation()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                project.setNetAssetsEvaluation(b.toString());
+            }
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+        //固定资产评估(万元)
+        try{
+            if(StringUtils.isNotBlank(project.getFixedAssetsEvaluation())){
+                BigDecimal b = new BigDecimal(project.getFixedAssetsEvaluation()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                project.setFixedAssetsEvaluation(b.toString());
+            }
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+        //废旧物资评估(万元)
+        try{
+            if(StringUtils.isNotBlank(project.getWaystEvaluation())){
+                BigDecimal b = new BigDecimal(project.getWaystEvaluation()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                project.setWaystEvaluation(b.toString());
+            }
+        }catch (Exception e) {
+            e.printStackTrace();
+        }
+        return project;
+    }
+
+    /**
+     * 下载项目导入模板
+     *
+     * @param response
+     * @return
+     */
+    @GetMapping("import/template")
+    @PreAuthorize("hasAnyAuthority('sys:project:export')")
+    @ApiOperation(value = "下载模板")
+    public void importFileTemplate(HttpServletResponse response, HttpServletRequest request) {
+        try {
+            InputStream inputStream = this.getClass().getResourceAsStream("/dot/项目导入模板.xlsx");
+            //强制下载不打开
+            response.setContentType("application/force-download");
+            OutputStream out = response.getOutputStream();
+            //使用URLEncoder来防止文件名乱码或者读取错误
+            response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode("project_template.xlsx", "UTF-8"));
+            int b = 0;
+            byte[] buffer = new byte[1000000];
+            while (b != -1) {
+                b = inputStream.read(buffer);
+                if (b != -1) out.write(buffer, 0, b);
+            }
+            inputStream.close();
+            out.close();
+            out.flush();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     * 导出项目数据
+     *
+     * @param userProjectDTO
+     * @param page
+     * @param response
+     * @throws Exception
+     */
+    @ApiLog("导出项目数据")
+    @PreAuthorize("hasAnyAuthority('sys:project:export')")
+    @GetMapping("export")
+    @ApiOperation(value = "导出项目excel")
+    public void exportFile(ProjectDTO userProjectDTO, Page <ProjectDTO> page, ExcelOptions options, HttpServletResponse response) throws Exception {
+        String fileName = options.getFilename ( );
+        Project project = ProjectWrapper.INSTANCE.toEntity (userProjectDTO);
+        QueryWrapper<Project> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( project, Project.class );
+        Page <Project> userProjectPage = pageAToPageB(page);
+        List <Project> result = new ArrayList<>();
+        List <ProjectDTO> userProjectDTOList = new ArrayList<>();
+        if ( ExportMode.current.equals ( options.getMode ( ) ) ) {
+            result = projectService.selectPage ( userProjectPage, queryWrapper ).getRecords ( );
+        } else if ( ExportMode.selected.equals ( options.getMode ( ) ) ) {
+            result = projectService.selectPage ( userProjectPage, queryWrapper ).getRecords().stream ( ).filter ( reimbursement ->
+                    options.getSelectIds ( ).contains ( reimbursement.getId ( ) )
+            ).collect ( Collectors.toList ( ) );
+        } else {
+            userProjectPage.setSize ( -1 );
+            userProjectPage.setCurrent ( 0 );
+            result = projectService.selectPage ( userProjectPage, queryWrapper ).getRecords ( );
+        }
+        result.stream().forEach(item->{
+            ProjectDTO projectDTO = ProjectWrapper.INSTANCE.toDTO(item);
+            userProjectDTOList.add(projectDTO);
+        });
+
+        SimpleDateFormat formatter=new SimpleDateFormat("yyyy/MM/dd");
+        List <ProjectDTO> collect = userProjectDTOList.stream().map(item -> {
+            return isChange(item,formatter);
+        }).collect(Collectors.toList());
+        if(ProjectTypeEnum.ASSESS.getValue().equals(userProjectDTO.getItemType())){
+            EasyPoiUtil.exportExcel ( collect, "2021年资产评估项目备查登记表",  "项目明细表", ProjectDTO.class, fileName, response );
+        }
+        if(ProjectTypeEnum.CONSULTATION.getValue().equals(userProjectDTO.getItemType())){
+            EasyPoiUtil.exportExcel ( collect, "2021年资产评估项目备查登记表",  "咨询报告", ProjectDTO.class, fileName, response );
+        }
+    }
+
+    public Page<Project> pageAToPageB(Page<ProjectDTO> page){
+
+        Page<Project> pageB = new Page<>();
+        pageB.setCurrent(page.getCurrent());
+        pageB.setSize(page.getSize());
+        pageB.setOrders(page.getOrders());
+
+        return pageB;
+    }
+
+    public ProjectDTO isChange(ProjectDTO userProjectDTO, SimpleDateFormat formatter){
+
+        if(StringUtils.isNotBlank(userProjectDTO.getIsInvoice())){
+            //是否开票
+            if(YesOrNoEnum.YES.getValue().equals(userProjectDTO.getIsInvoice())){
+                userProjectDTO.setIsInvoice(YesOrNoEnum.YES.getLabel());
+            }else if(YesOrNoEnum.NO.getValue().equals(userProjectDTO.getIsInvoice())){
+                userProjectDTO.setIsInvoice(YesOrNoEnum.NO.getLabel());
+            }
+        }
+
+
+        if(StringUtils.isNotBlank(userProjectDTO.getIsContractArchive())) {
+            //合同是否存档
+            if (YesOrNoEnum.YES.getValue().equals(userProjectDTO.getIsContractArchive())) {
+                userProjectDTO.setIsContractArchive(YesOrNoEnum.YES.getLabel());
+            } else if (YesOrNoEnum.NO.getValue().equals(userProjectDTO.getIsContractArchive())) {
+                userProjectDTO.setIsContractArchive(YesOrNoEnum.NO.getLabel());
+            }
+        }
+
+        if(StringUtils.isNotBlank(userProjectDTO.getIsPapersIntact())) {
+            //底稿是否完好
+            if (YesOrNoEnum.YES.getValue().equals(userProjectDTO.getIsPapersIntact())) {
+                userProjectDTO.setIsPapersIntact(YesOrNoEnum.YES.getLabel());
+            } else if (YesOrNoEnum.NO.getValue().equals(userProjectDTO.getIsPapersIntact())) {
+                userProjectDTO.setIsPapersIntact(YesOrNoEnum.NO.getLabel());
+            }
+        }
+
+        if(StringUtils.isNotBlank(userProjectDTO.getIsPapersArchive())) {
+            //底稿是否归档
+            if (YesOrNoEnum.YES.getValue().equals(userProjectDTO.getIsPapersArchive())) {
+                userProjectDTO.setIsPapersArchive(YesOrNoEnum.YES.getLabel());
+            } else if (YesOrNoEnum.NO.getValue().equals(userProjectDTO.getIsPapersArchive())) {
+                userProjectDTO.setIsPapersArchive(YesOrNoEnum.NO.getLabel());
+            }
+        }
+
+        if(StringUtils.isNotBlank(userProjectDTO.getIsOpsReimbursement())) {
+            //外勤是否已经报销
+            if (YesOrNoEnum.YES.getValue().equals(userProjectDTO.getIsOpsReimbursement())) {
+                userProjectDTO.setIsOpsReimbursement(YesOrNoEnum.YES.getLabel());
+            } else if (YesOrNoEnum.NO.getValue().equals(userProjectDTO.getIsOpsReimbursement())) {
+                userProjectDTO.setIsOpsReimbursement(YesOrNoEnum.NO.getLabel());
+            }
+        }
+
+        if(StringUtils.isNotBlank(userProjectDTO.getIsCommissionReimbursement())) {
+            //是否已经报销提成
+            if (YesOrNoEnum.YES.getValue().equals(userProjectDTO.getIsCommissionReimbursement())) {
+                userProjectDTO.setIsCommissionReimbursement(YesOrNoEnum.YES.getLabel());
+            } else if (YesOrNoEnum.NO.getValue().equals(userProjectDTO.getIsCommissionReimbursement())) {
+                userProjectDTO.setIsCommissionReimbursement(YesOrNoEnum.NO.getLabel());
+            }
+        }
+
+
+        //评估报告日
+        if(ObjectUtil.isNotEmpty(userProjectDTO.getEvaluationReportDate())){
+            String time=formatter.format(userProjectDTO.getEvaluationReportDate());
+            userProjectDTO.setEvaluationReportDateUi(time);
+        }else{
+            if(StringUtils.isNotBlank(userProjectDTO.getAssessReportMessage())){
+                userProjectDTO.setEvaluationReportDateUi(userProjectDTO.getAssessReportMessage());
+            }
+        }
+        //评估基准日
+        if(ObjectUtil.isNotEmpty(userProjectDTO.getEvaluationBaseDate())){
+            String time=formatter.format(userProjectDTO.getEvaluationBaseDate());
+            userProjectDTO.setEvaluationBaseDateUi(time);
+        }else{
+            if(StringUtils.isNotBlank(userProjectDTO.getAssessBaseMessage())){
+                userProjectDTO.setEvaluationBaseDateUi(userProjectDTO.getAssessBaseMessage());
+            }
+        }
+        //开票日期
+        if(ObjectUtil.isNotEmpty(userProjectDTO.getInvoiceDate())){
+            String time=formatter.format(userProjectDTO.getInvoiceDate());
+            userProjectDTO.setInvoiceDateUi(time);
+        }else{
+            if(StringUtils.isNotBlank(userProjectDTO.getInvoiceMessage())){
+                userProjectDTO.setInvoiceDateUi(userProjectDTO.getInvoiceMessage());
+            }
+        }
+        //报销日期
+        if(ObjectUtil.isNotEmpty(userProjectDTO.getReimbursementDate())){
+            String time=formatter.format(userProjectDTO.getReimbursementDate());
+            userProjectDTO.setReimbursementDateUi(time);
+        }
+        return userProjectDTO;
+    }
+
+    public ArrayList<ProjectDTO> getExcelList(List<ProjectDTO> list){
+
+        ArrayList<ProjectDTO> projectDTOS = new ArrayList<>();
+
+        list.stream().forEach(item->{
+            if(!objectCheckIsNull(item)){
+                projectDTOS.add(item);
+            }
+        });
+
+        return projectDTOS;
+    }
+
+    /**
+     * 检查一个对象的所有属性值是否都是null
+     * @param object
+     * @return
+     */
+    public boolean objectCheckIsNull(Object object) {
+        boolean flag = true; //定义返回结果,默认为true
+
+        if (Objects.isNull(object)) {
+            flag = true;
+        } else {
+            Class clazz = (Class) object.getClass(); // 得到类对象
+            Field fields[] = clazz.getDeclaredFields(); // 得到所有属性
+            for (Field field : fields) {
+                if("serialVersionUID".equals(field.getName())){
+                    continue;
+                }
+                field.setAccessible(true);
+                Object fieldValue = null;
+                try {
+                    fieldValue = field.get(object); //得到属性值
+                    Type fieldType = field.getGenericType();//得到属性类型
+                    String fieldName = field.getName(); // 得到属性名
+                } catch (Exception e){}
+                if (fieldValue != null) {  //只要有一个属性值不为null 就返回false 表示对象不为null
+                    flag = false;
+                    break;
+                }
+            }
+        }
+
+        return flag;
+    }
+
+    @GetMapping("proportion")
+    @ApiOperation(value = "项目完成比例")
+    public String proportion(Project project) throws Exception{
+        QueryWrapper<Project> queryWrapper = QueryWrapperGenerator.buildQueryCondition(project, Project.class);
+        return projectService.proportion(queryWrapper);
+    }
+
+    /**
+     * 导出项目数据
+     *
+     * @param projectDTO
+     * @param response
+     * @throws Exception
+     */
+    @GetMapping("exportFileUploadList")
+    @ApiOperation(value = "导出项目文件上传比例excel")
+    public void exportFileUploadList(ProjectDTO projectDTO, HttpServletResponse response) throws Exception {
+        Project project = ProjectWrapper.INSTANCE.toEntity (projectDTO);
+        QueryWrapper<Project> queryWrapper = QueryWrapperGenerator.buildQueryCondition( project, Project.class );
+        List<FileUploadListDTO> list = projectService.exportFileUploadList(projectDTO);
+        //完成比例导出文档添加汇总列
+        AtomicReference<Integer> totalNum = new AtomicReference<>(0);
+        AtomicReference<Integer> endNum = new AtomicReference<>(0);
+        list.stream().forEach(item->{
+            totalNum.updateAndGet(v -> v + item.getAllNum());
+            endNum.updateAndGet(v -> v + item.getNum());
+        });
+        DecimalFormat df = new DecimalFormat("0.00");
+        String s = df.format((float) endNum.get() * 100 / (float) totalNum.get());
+        FileUploadListDTO fileUploadListDTO = new FileUploadListDTO();
+        fileUploadListDTO.setName("汇总");
+        fileUploadListDTO.setAllNum(totalNum.get());
+        fileUploadListDTO.setNum(endNum.get());
+        fileUploadListDTO.setProportion(s+"%");
+        list.add(fileUploadListDTO);
+
+        if(ProjectTypeEnum.ASSESS.getValue().equals(projectDTO.getItemType())){
+            if(StringUtils.isNotBlank(projectDTO.getYear())){
+                EasyPoiUtil.exportExcel(list, projectDTO.getYear() + "年评估项目上传比例报告",  "评估项目上传比例报告", FileUploadListDTO.class, "", response );
+            }else{
+                EasyPoiUtil.exportExcel(list, "评估项目上传比例报告",  "评估项目上传比例报告", FileUploadListDTO.class, "", response );
+            }
+        }
+        if(ProjectTypeEnum.CONSULTATION.getValue().equals(projectDTO.getItemType())){
+            if(StringUtils.isNotBlank(projectDTO.getYear())){
+                EasyPoiUtil.exportExcel(list, projectDTO.getYear() + "年咨询项目上传比例报告",  "咨询项目上传比例报告", FileUploadListDTO.class, "", response );
+            }else{
+                EasyPoiUtil.exportExcel(list, "咨询项目上传比例报告",  "咨询项目上传比例报告", FileUploadListDTO.class, "", response );
+            }
+        }
+    }
+}

+ 246 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/domain/Project.java

@@ -0,0 +1,246 @@
+package com.jeeplus.assess.projectRecords.domain;
+
+import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.core.query.Query;
+import com.jeeplus.core.query.QueryType;
+import com.jeeplus.sys.service.dto.OfficeDTO;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+/**
+ * sys_user_project
+ * @author 
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("project_records")
+public class Project extends BaseEntity {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 客户名称
+     */
+    @Query
+    private String customerName;
+
+    /**
+     * 年份
+     */
+    @Query
+    private String year;
+
+    /**
+     * 项目名称
+     */
+    @Query
+    private String projectName;
+
+    /**
+     * 评估目的
+     */
+    private String evaluationObjective;
+
+    /**
+     * 项目类型
+     */
+    private String projectType;
+
+    /**
+     * 评估基准日
+     */
+    private Date evaluationBaseDate;
+
+    /**
+     * 评估报告日
+     */
+    private Date evaluationReportDate;
+
+    /**
+     * 协议号
+     */
+    @Query
+    private String protocolNum;
+
+    /**
+     * 文号
+     */
+    @Query
+    private String documentNum;
+
+    /**
+     * 项目负责人
+     */
+    @Query
+    private String projectHead;
+    private String projectHeadId;
+
+    /**
+     * 废旧物资评估(万元)
+     */
+    private String waystEvaluation;
+
+    /**
+     * 固定资产评估(万元)
+     */
+    private String fixedAssetsEvaluation;
+
+    /**
+     * 净资产评估
+     */
+    private String netAssetsEvaluation;
+
+    /**
+     * 租金评估(万/年)
+     */
+    private String rentEvaluation;
+
+    /**
+     * 司法鉴定
+     */
+    private String forensics;
+
+    /**
+     * 报告收费(元)
+     */
+    private String reportCharges;
+
+    /**
+     * 当前处理人
+     */
+    private String currentDisposePerson;
+
+    /**
+     * 是否开票
+     */
+    private String isInvoice;
+
+    /**
+     * 开票日期
+     */
+    private Date invoiceDate;
+
+    /**
+     * 预估/实际收费(元)
+     */
+    private String actualCharges;
+
+    /**
+     * 合同是否存档
+     */
+    private String isContractArchive;
+
+    /**
+     * 底稿是否完好
+     */
+    private String isPapersIntact;
+
+    /**
+     * 底稿是否归档
+     */
+    private String isPapersArchive;
+
+    /**
+     * 报销外勤天数
+     */
+    private String opsAmount;
+
+    /**
+     * 外勤是否已经报销
+     */
+    private String isOpsReimbursement;
+
+    /**
+     * 已报销金额
+     */
+    private String reimbursementAmount;
+
+    /**
+     * 未报销金额
+     */
+    private String unreimbursedAmount;
+
+    /**
+     * 报销单号
+     */
+    private String reimbursementNum;
+
+    /**
+     * 报销日期
+     */
+    private Date reimbursementDate;
+
+    /**
+     * 签字评估师1
+     */
+    private String evaluationPersonOne;
+
+    /**
+     * 签字评估师2
+     */
+    private String evaluationPersonTwo;
+
+    /**
+     * 项目状态
+     */
+    private String status;
+
+    /**
+     * 评估报告日message
+     */
+    private String assessReportMessage;
+
+    /**
+     * 评估基准日message
+     */
+    private String assessBaseMessage;
+
+    /**
+     * 开票日期message
+     */
+    private String invoiceMessage;
+
+    /**
+     * 是否已经报销提成
+     */
+    private String isCommissionReimbursement;
+
+    /**
+     * 1、评估项目 2、咨询项目
+     */
+    @Query(type = QueryType.EQ)
+    private String itemType;
+
+    /**
+     * 文件上传状态(0未完成1已完成)
+     */
+    @Query
+    private String fileUploadType;
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 归属公司
+     * tableColumn 数据库中sql查询使用到的值
+     * javaField 实体类中对应的字段
+     */
+    @Query(type = QueryType.EQ, tableColumn = "su.company_id", javaField = "companyDTO.id")
+    private OfficeDTO companyDTO;
+
+    /**
+     * 归属部门
+     */
+    @Query(type = QueryType.EQ, tableColumn = "su.office.id", javaField = "officeDTO.id")
+    private OfficeDTO officeDTO;
+
+    private Boolean permissionFlag; //登陆人修改权限
+}

+ 33 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/mapper/ProjectMapper.java

@@ -0,0 +1,33 @@
+package com.jeeplus.assess.projectRecords.mapper;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.assess.projectRecords.domain.Project;
+import com.jeeplus.assess.projectRecords.service.dto.FileUploadListDTO;
+import com.jeeplus.assess.projectRecords.service.dto.ProjectDTO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface ProjectMapper extends BaseMapper<Project> {
+
+    public Project selectByDocumentNum(ProjectDTO projectDTO);
+
+    public Project selectByProjectId(@Param("projectId") String projectId);
+
+    public IPage<Project> selectPage(Page<Project> page, @Param("project") Project project);
+
+    public IPage<Project> findList(Page<Project> page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper);
+
+    public Integer proportion(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);
+
+    public List<FileUploadListDTO> projectAllList(ProjectDTO projectDTO);
+
+    public List<FileUploadListDTO> projectList(ProjectDTO projectDTO);
+}

+ 257 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/mapper/xml/ProjectMapper.xml

@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jeeplus.assess.projectRecords.mapper.ProjectMapper">
+  <resultMap id="BaseResultMap" type="com.jeeplus.assess.projectRecords.domain.Project">
+    <id column="id" jdbcType="VARCHAR" property="id" />
+    <result column="create_by_id" jdbcType="VARCHAR" property="createById" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_by_id" jdbcType="VARCHAR" property="updateById" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+    <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
+    <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
+    <result column="project_name" jdbcType="VARCHAR" property="projectName" />
+    <result column="evaluation_objective" jdbcType="VARCHAR" property="evaluationObjective" />
+    <result column="project_type" jdbcType="VARCHAR" property="projectType" />
+    <result column="evaluation_base_date" jdbcType="TIMESTAMP" property="evaluationBaseDate" />
+    <result column="evaluation_report_date" jdbcType="TIMESTAMP" property="evaluationReportDate" />
+    <result column="protocol_num" jdbcType="VARCHAR" property="protocolNum" />
+    <result column="document_num" jdbcType="VARCHAR" property="documentNum" />
+    <result column="project_head" jdbcType="VARCHAR" property="projectHead" />
+    <result column="wayst_evaluation" jdbcType="VARCHAR" property="waystEvaluation" />
+    <result column="fixed_assets_evaluation" jdbcType="VARCHAR" property="fixedAssetsEvaluation" />
+    <result column="net_assets_evaluation" jdbcType="VARCHAR" property="netAssetsEvaluation" />
+    <result column="rent_evaluation" jdbcType="VARCHAR" property="rentEvaluation" />
+    <result column="forensics" jdbcType="VARCHAR" property="forensics" />
+    <result column="report_charges" jdbcType="VARCHAR" property="reportCharges" />
+    <result column="current_dispose_person" jdbcType="VARCHAR" property="currentDisposePerson" />
+    <result column="is_invoice" jdbcType="VARCHAR" property="isInvoice" />
+    <result column="invoice_date" jdbcType="TIMESTAMP" property="invoiceDate" />
+    <result column="actual_charges" jdbcType="VARCHAR" property="actualCharges" />
+    <result column="is_contract_archive" jdbcType="VARCHAR" property="isContractArchive" />
+    <result column="is_papers_intact" jdbcType="VARCHAR" property="isPapersIntact" />
+    <result column="is_papers_archive" jdbcType="VARCHAR" property="isPapersArchive" />
+    <result column="ops_amount" jdbcType="VARCHAR" property="opsAmount" />
+    <result column="is_ops_reimbursement" jdbcType="VARCHAR" property="isOpsReimbursement" />
+    <result column="reimbursement_amount" jdbcType="VARCHAR" property="reimbursementAmount" />
+    <result column="unreimbursed_amount" jdbcType="VARCHAR" property="unreimbursedAmount" />
+    <result column="reimbursement_num" jdbcType="VARCHAR" property="reimbursementNum" />
+    <result column="reimbursement_date" jdbcType="TIMESTAMP" property="reimbursementDate" />
+    <result column="evaluation_person_one" jdbcType="VARCHAR" property="evaluationPersonOne" />
+    <result column="evaluation_person_two" jdbcType="VARCHAR" property="evaluationPersonTwo" />
+    <result column="status" jdbcType="VARCHAR" property="status" />
+    <result column="assess_report_message" jdbcType="VARCHAR" property="assessReportMessage" />
+    <result column="assess_base_message" jdbcType="VARCHAR" property="assessBaseMessage" />
+    <result column="invoice_message" jdbcType="VARCHAR" property="invoiceMessage" />
+    <result column="is_commission_reimbursement" jdbcType="VARCHAR" property="isCommissionReimbursement" />
+    <result column="item_type" jdbcType="VARCHAR" property="itemType" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, create_by_id, create_time, update_by_id, update_time, remarks, del_flag, customer_name,
+    project_name, evaluation_objective, project_type, evaluation_base_date, evaluation_report_date,
+    protocol_num, document_num, project_head, wayst_evaluation, fixed_assets_evaluation,
+    net_assets_evaluation, rent_evaluation, forensics, report_charges, current_dispose_person,
+    is_invoice, invoice_date, actual_charges, is_contract_archive, is_papers_intact,
+    is_papers_archive, ops_amount, is_ops_reimbursement, reimbursement_amount, unreimbursed_amount,
+    reimbursement_num, reimbursement_date, evaluation_person_one, evaluation_person_two,
+    `status`, assess_report_message, assess_base_message, invoice_message, is_commission_reimbursement,
+    item_type
+  </sql>
+
+  <sql id="to_list">
+    pr.id,
+    pr.create_by_id,
+    pr.create_time,
+    pr.update_by_id,
+    pr.update_time,
+    pr.remarks,
+    pr.del_flag,
+    pr.customer_name,
+    pr.project_name,
+    pr.year,
+    pr.evaluation_objective,
+    pr.project_type,
+    pr.evaluation_base_date,
+    pr.evaluation_report_date,
+    pr.protocol_num,
+    pr.document_num,
+    pr.wayst_evaluation,
+    pr.fixed_assets_evaluation,
+    pr.net_assets_evaluation,
+    pr.rent_evaluation,
+    pr.forensics,
+    pr.report_charges,
+    pr.current_dispose_person,
+    pr.is_invoice,
+    pr.invoice_date,
+    pr.actual_charges,
+    pr.is_contract_archive,
+    pr.is_papers_intact,
+    pr.is_papers_archive,
+    pr.ops_amount,
+    pr.is_ops_reimbursement,
+    pr.reimbursement_amount,
+    pr.unreimbursed_amount,
+    pr.reimbursement_num,
+    pr.reimbursement_date,
+    pr.`status`,
+    pr.assess_report_message,
+    pr.assess_base_message,
+    pr.invoice_message,
+    pr.is_commission_reimbursement,
+    pr.item_type,
+    pr.file_upload_type
+  </sql>
+
+
+  <select id="selectByDocumentNum" resultType="com.jeeplus.assess.projectRecords.domain.Project">
+    select
+    <include refid="Base_Column_List"></include>
+    from
+    project_records
+    <where>
+      del_flag = '0' and document_num = #{documentNum}
+      <if test="id != null and id != ''">
+        and id = #{id}
+      </if>
+    </where>
+  </select>
+
+  <select id="selectByProjectId" resultType="com.jeeplus.assess.projectRecords.domain.Project">
+    select
+    <include refid="to_list"></include>,
+    su1.id as projectHead,
+    pr.evaluation_person_one,
+    pr.evaluation_person_two
+--     su2.id as evaluationPersonOne,
+--     su3.id as evaluationPersonTwo
+    from project_records pr
+    left join sys_user su1 on pr.project_head = su1.id
+    left join sys_user su2 on pr.evaluation_person_one = su2.id
+    left join sys_user su3 on pr.evaluation_person_two = su3.id
+    where pr.del_flag = '0' and pr.id = #{projectId}
+  </select>
+
+  <select id="selectPage" resultType="com.jeeplus.assess.projectRecords.domain.Project">
+    select
+    <include refid="to_list"></include>,
+    su1.name as projectHead,
+    su1.id as projectHeadId,
+    pr.evaluation_person_one,
+    pr.evaluation_person_two
+--     su2.name as evaluationPersonOne,
+--     su3.name as evaluationPersonTwo
+    from project_records pr
+    left join sys_user su1 on pr.project_head = su1.id
+    left join sys_user su2 on pr.evaluation_person_one = su2.id
+    left join sys_user su3 on pr.evaluation_person_two = su3.id
+    <where >
+      pr.del_flag = '0'
+      <if test="project.customerName != null and project.customerName != ''">
+        and pr.customer_name like concat('%',#{project.customerName},'%')
+      </if>
+      <if test="project.projectName != null and project.projectName != ''">
+        and pr.project_name like concat('%',#{project.projectName},'%')
+      </if>
+      <if test="project.itemType != null and project.itemType != ''">
+        and pr.item_type = #{project.itemType}
+      </if>
+    </where>
+    order by pr.create_time desc
+  </select>
+
+  <select id="findList" resultType="com.jeeplus.assess.projectRecords.domain.Project">
+    select
+    <include refid="to_list"></include>,
+    su1.name as projectHead,
+    su1.id as projectHeadId,
+    pr.evaluation_person_one,
+    pr.evaluation_person_two
+--     su2.name as evaluationPersonOne,
+--     su3.name as evaluationPersonTwo
+    from project_records pr
+    left join sys_user su on pr.project_head = su.id
+    left join sys_user su1 on pr.project_head = su1.id
+    left join sys_user su2 on pr.evaluation_person_one = su2.id
+    left join sys_user su3 on pr.evaluation_person_two = su3.id
+    ${ew.customSqlSegment}
+    order by pr.create_time desc
+  </select>
+
+  <select id="proportion" resultType="java.lang.Integer">
+    SELECT
+        count(1)
+    FROM
+        project_records pr
+    left join sys_user su on pr.project_head = su.id
+    ${ew.customSqlSegment}
+  </select>
+
+  <select id="projectAllList" resultType="com.jeeplus.assess.projectRecords.service.dto.FileUploadListDTO">
+    SELECT
+        su.`name`,
+        COUNT(1) AS allNum
+    FROM
+        project_records pr
+        LEFT JOIN sys_user su ON pr.project_head = su.id
+    <where>
+      su.del_flag=0
+      and pr.del_flag=0
+      and pr.item_type = #{itemType}
+      <if test="year != null and year != ''">
+        and pr.year = #{year}
+      </if>
+      <if test="customerName != null and customerName != ''">
+        and pr.customer_name like concat('%',#{customerName},'%')
+      </if>
+      <if test="protocolNum != null and protocolNum != ''">
+        and pr.protocol_num like concat('%',#{protocolNum},'%')
+      </if>
+      <if test="projectName != null and projectName != ''">
+        and pr.project_name like concat('%',#{projectName},'%')
+      </if>
+      <if test="documentNum != null and documentNum != ''">
+        and pr.document_num like concat('%',#{documentNum},'%')
+      </if>
+      <if test="projectHead != null and projectHead != ''">
+        and pr.project_head = #{projectHead}
+      </if>
+    </where>
+        GROUP BY su.id
+  </select>
+
+  <select id="projectList" resultType="com.jeeplus.assess.projectRecords.service.dto.FileUploadListDTO">
+    SELECT
+        su.`name`,
+        COUNT(1) AS num
+    FROM
+        project_records pr
+        LEFT JOIN sys_user su ON pr.project_head = su.id
+    <where>
+      su.del_flag=0
+      and pr.del_flag=0
+      and pr.file_upload_type = 1
+      and pr.item_type = #{itemType}
+      <if test="year != null and year != ''">
+        and pr.year = #{year}
+      </if>
+      <if test="customerName != null and customerName != ''">
+        and pr.customer_name like concat('%',#{customerName},'%')
+      </if>
+      <if test="protocolNum != null and protocolNum != ''">
+        and pr.protocol_num like concat('%',#{protocolNum},'%')
+      </if>
+      <if test="projectName != null and projectName != ''">
+        and pr.project_name like concat('%',#{projectName},'%')
+      </if>
+      <if test="documentNum != null and documentNum != ''">
+        and pr.document_num like concat('%',#{documentNum},'%')
+      </if>
+      <if test="projectHead != null and projectHead != ''">
+        and pr.project_head = #{projectHead}
+      </if>
+    </where>
+        GROUP BY su.id
+  </select>
+
+</mapper>

+ 187 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/service/ProjectService.java

@@ -0,0 +1,187 @@
+package com.jeeplus.assess.projectRecords.service;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jeeplus.sys.service.dto.RoleDTO;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.UserUtils;
+import com.jeeplus.assess.projectRecords.domain.Project;
+import com.jeeplus.assess.projectRecords.mapper.ProjectMapper;
+import com.jeeplus.assess.projectRecords.service.dto.FileUploadListDTO;
+import com.jeeplus.assess.projectRecords.service.dto.ProjectDTO;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.List;
+
+@Service
+@Transactional
+public class ProjectService extends ServiceImpl<ProjectMapper, Project> {
+
+    @Autowired
+    private ProjectMapper projectMapper;
+
+    public IPage<Project> selectPage(Page<Project> page, QueryWrapper queryWrapper){
+        queryWrapper.eq ("pr.del_flag", 0 ); // 排除已经删除
+        return projectMapper.findList(page, queryWrapper);
+    }
+
+    /**
+     * 通过项目id查询项目信息
+     * @param projectId
+     * @return
+     */
+    public Project selectByProjectId(String projectId){
+        Project project = projectMapper.selectByProjectId(projectId);
+
+        UserDTO currentUserDTO = UserUtils.getCurrentUserDTO();
+        Boolean bmzrRoleFlag = false;
+        if(null != currentUserDTO.getRoleDTOList() && currentUserDTO.getRoleDTOList().size()>0){
+            for (RoleDTO roleDTO : currentUserDTO.getRoleDTOList()) {
+                if("bmzr".equals(roleDTO.getEnName())){
+                    bmzrRoleFlag = true;
+                    break;
+                }
+            }
+        }
+        if((StringUtils.isNotBlank(project.getProjectHead()) && project.getProjectHead().equals(currentUserDTO.getId())) || bmzrRoleFlag){
+            project.setPermissionFlag(true);
+        }else{
+            project.setPermissionFlag(false);
+        }
+        return project;
+    }
+
+    /**
+     * 用于将ProjectDTO类中的DateUi属性转换为时间格式存储到Project类中的Date属性中
+     * @param project
+     * @param projectDTO
+     * @return
+     */
+    public Project projectDtoToDate(Project project, ProjectDTO projectDTO){
+        SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
+        try {
+            if(StringUtils.isNotBlank(projectDTO.getEvaluationBaseDateUi())){
+                project.setEvaluationBaseDate(sdf.parse(projectDTO.getEvaluationBaseDateUi()));
+            }
+
+            if(StringUtils.isNotBlank(projectDTO.getEvaluationReportDateUi())){
+                project.setEvaluationReportDate(sdf.parse(projectDTO.getEvaluationReportDateUi()));
+            }
+
+            if(StringUtils.isNotBlank(projectDTO.getInvoiceDateUi())){
+                project.setInvoiceDate(sdf.parse(projectDTO.getInvoiceDateUi()));
+            }
+
+            if(StringUtils.isNotBlank(projectDTO.getReimbursementDateUi())){
+                project.setReimbursementDate(sdf.parse(projectDTO.getReimbursementDateUi()));
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return project;
+    }
+
+    /**
+     * mp的update()方法,如果将参数设为null的,mp会默认不修改的
+     * 所以通过这种方式,使用wrapper将你要设置为null的手动set为null,这样update()方法就会按你的想法执行了
+     * @param project
+     * @return
+     */
+    public LambdaUpdateWrapper getLambdaUpdateWrapper(ProjectDTO project){
+        LambdaUpdateWrapper<Project> wrapper = new LambdaUpdateWrapper<Project>();
+
+        if(StringUtils.isNotBlank(project.getId())){
+            wrapper.eq(Project::getId,project.getId());
+        }
+
+        if(StrUtil.isEmpty(project.getEvaluationBaseDateUi())){
+            wrapper.set(Project::getEvaluationBaseDate, null);
+        }
+
+        if(StrUtil.isEmpty(project.getEvaluationReportDateUi())){
+            wrapper.set(Project::getEvaluationReportDate, null);
+        }
+
+        if(StrUtil.isEmpty(project.getInvoiceDateUi())){
+            wrapper.set(Project::getInvoiceDate, null);
+        }
+
+        if(StrUtil.isEmpty(project.getReimbursementDateUi())){
+            wrapper.set(Project::getReimbursementDate, null);
+        }
+
+        return wrapper;
+    }
+
+    /**
+     * 根据文号查询项目信息
+     * @param projectDTO
+     * @return
+     */
+    public Project selectByDocumentNum(ProjectDTO projectDTO){
+        return projectMapper.selectByDocumentNum(projectDTO);
+    }
+
+    /**
+     * 项目文件上传完成比例
+     * @param queryWrapper
+     * @return
+     */
+    public String proportion(QueryWrapper queryWrapper) {
+        // 排除已经删除
+        queryWrapper.eq ("pr.del_flag", 0 );
+        int all = projectMapper.proportion(queryWrapper);
+        if (all == 0) {
+            return "0.00%";
+        }
+        queryWrapper.eq("pr.file_upload_type", "1");
+        int on = projectMapper.proportion(queryWrapper);
+        DecimalFormat df = new DecimalFormat("0.00");
+        String s = df.format((float)on*100/(float)all) + "%";
+        return s;
+    }
+
+    public List<FileUploadListDTO> exportFileUploadList(ProjectDTO projectDTO) {
+        //queryWrapper.eq("su.del_flag", 0);
+        UserDTO currentUserDTO = UserUtils.getCurrentUserDTO();
+        projectDTO.setOfficeDTO(currentUserDTO.getOfficeDTO());
+        List<FileUploadListDTO> allList = projectMapper.projectAllList(projectDTO);
+        //queryWrapper.eq("pr.file_upload_type", "1");
+        List<FileUploadListDTO> list = projectMapper.projectList(projectDTO);
+        if (CollectionUtil.isNotEmpty(allList)) {
+            DecimalFormat df = new DecimalFormat("0.00");
+            for (FileUploadListDTO dto : allList) {
+                if(null != list && list.size()>0){
+                    for (FileUploadListDTO i : list) {
+                        if (dto.getName().equals(i.getName())) {
+                            dto.setNum(i.getNum());
+                            String s = df.format((float) i.getNum() * 100 / (float) dto.getAllNum());
+                            dto.setProportion(s+"%");
+                        }
+                    }
+                }
+            }
+            allList.stream().forEach(i -> {
+                //如果没有找到或没有完成数量,则填入默认完成数量0,完成比例0
+                if (StringUtils.isBlank(i.getProportion())) {
+                    i.setProportion("0.00%");
+                }
+                if (null == i.getNum()) {
+                    i.setNum(0);
+                }
+            });
+        }
+        return allList;
+    }
+}

+ 34 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/service/dto/FileUploadListDTO.java

@@ -0,0 +1,34 @@
+package com.jeeplus.assess.projectRecords.service.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.jeeplus.core.service.dto.BaseDTO;
+import lombok.Data;
+
+@Data
+public class FileUploadListDTO extends BaseDTO {
+
+    /**
+     *姓名
+     */
+    @Excel(name = "姓名", width = 30)
+    private String name;
+
+    /**
+     * 项目总量
+     */
+    @Excel(name = "项目总量", width = 20)
+    private Integer allNum;
+
+    /**
+     * 完成数量
+     */
+    @Excel(name = "完成数量", width = 20)
+    private Integer num;
+
+    /**
+     * 完成比例
+     */
+    @Excel(name = "完成比例", width = 20)
+    private String proportion;
+
+}

+ 282 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/service/dto/ProjectDTO.java

@@ -0,0 +1,282 @@
+package com.jeeplus.assess.projectRecords.service.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.jeeplus.core.service.dto.BaseDTO;
+import com.jeeplus.sys.service.dto.OfficeDTO;
+import com.jeeplus.pubmodules.oss.domain.WorkAttachment;
+import com.jeeplus.pubmodules.oss.service.dto.OssServiceDto;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class ProjectDTO extends BaseDTO {
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 客户名称
+     */
+    @Excel(name = "客户名称")
+    private String customerName;
+
+    /**
+     * 项目名称
+     */
+    @Excel(name = "年份")
+    private String year;
+
+    /**
+     * 项目名称
+     */
+    @Excel(name = "项目名称")
+    private String projectName;
+
+    /**
+     * 评估目的
+     */
+    @Excel(name = "评估目的")
+    private String evaluationObjective;
+
+    /**
+     * 项目类型
+     */
+    @Excel(name = "项目类型")
+    private String projectType;
+
+    /**
+     * 评估基准日ui
+     */
+    @Excel(name = "评估基准日",importFormat = "yyyy/MM/dd")
+    private String evaluationBaseDateUi;
+
+    /**
+     * 评估基准日
+     */
+    private Date evaluationBaseDate;
+
+
+    /**
+     * 评估报告日ui
+     */
+    @Excel(name = "评估报告日",importFormat = "yyyy/MM/dd")
+    private String evaluationReportDateUi;
+
+    /**
+     * 评估报告日
+     */
+    private Date evaluationReportDate;
+
+
+    /**
+     * 协议号
+     */
+    @Excel(name = "协议号")
+    private String protocolNum;
+
+    /**
+     * 文号
+     */
+    @Excel(name = "文号")
+    private String documentNum;
+
+    /**
+     * 项目负责人
+     */
+    @Excel(name = "项目负责人")
+    private String projectHead;
+
+    /**
+     * 废旧物资评估(万元)
+     */
+    @Excel(name = "废旧物资评估(万元)")
+    private String waystEvaluation;
+
+    /**
+     * 固定资产评估(万元)
+     */
+    @Excel(name = "固定资产评估(万元)")
+    private String fixedAssetsEvaluation;
+
+    /**
+     * 净资产评估
+     */
+    @Excel(name = "净资产评估")
+    private String netAssetsEvaluation;
+
+    /**
+     * 租金评估(万/年)
+     */
+    @Excel(name = "租金评估(万/年)")
+    private String rentEvaluation;
+
+    /**
+     * 司法鉴定
+     */
+    @Excel(name = "司法鉴定")
+    private String forensics;
+
+    /**
+     * 报告收费(元)
+     */
+    @Excel(name = "报告收费(元)")
+    private String reportCharges;
+
+    /**
+     * 当前处理人
+     */
+    @Excel(name = "当前处理人")
+    private String currentDisposePerson;
+
+    /**
+     * 是否开票
+     */
+    @Excel(name = "是否开票")
+    private String isInvoice;
+
+    /**
+     * 开票日期ui
+     */
+    @Excel(name = "开票日期",importFormat = "yyyy/MM/dd")
+    private String invoiceDateUi;
+
+    /**
+     * 开票日期
+     */
+    private Date invoiceDate;
+
+
+    /**
+     * 预估/实际收费(万元)
+     */
+    @Excel(name = "预估/实际收费(万元)")
+    private String actualCharges;
+
+    /**
+     * 合同是否存档
+     */
+    @Excel(name = "合同是否存档")
+    private String isContractArchive;
+
+    /**
+     * 底稿是否完好
+     */
+    @Excel(name = "底稿是否完好")
+    private String isPapersIntact;
+
+    /**
+     * 底稿是否归档
+     */
+    @Excel(name = "底稿是否归档")
+    private String isPapersArchive;
+
+    /**
+     * 报销外勤天数
+     */
+    @Excel(name = "报销外勤天数")
+    private String opsAmount;
+
+    /**
+     * 外勤是否已经报销
+     */
+    @Excel(name = "外勤是否已经报销")
+    private String isOpsReimbursement;
+
+    /**
+     * 已报销金额
+     */
+    @Excel(name = "已报销金额")
+    private String reimbursementAmount;
+
+    /**
+     * 未报销金额
+     */
+    @Excel(name = "未报销金额")
+    private String unreimbursedAmount;
+
+    /**
+     * 报销单号
+     */
+    @Excel(name = "报销单号")
+    private String reimbursementNum;
+
+    /**
+     * 报销日期ui
+     */
+    @Excel(name = "报销日期",importFormat = "yyyy/MM/dd")
+    private String reimbursementDateUi;
+
+    /**
+     * 报销日期
+     */
+    private Date reimbursementDate;
+
+
+    /**
+     * 签字评估师1
+     */
+    @Excel(name = "签字评估师1")
+    private String evaluationPersonOne;
+
+    /**
+     * 签字评估师2
+     */
+    @Excel(name = "签字评估师2")
+    private String evaluationPersonTwo;
+
+    /**
+     * 项目状态
+     */
+    private String status;
+
+    /**
+     * 评估报告日message
+     */
+    private String assessReportMessage;
+
+    /**
+     * 评估基准日message
+     */
+    private String assessBaseMessage;
+
+    /**
+     * 开票日期message
+     */
+    private String invoiceMessage;
+
+    /**
+     * 是否已经报销提成
+     */
+    @Excel(name = "是否已经报销提成")
+    private String isCommissionReimbursement;
+
+    /**
+     * 1、评估项目 2、咨询项目
+     */
+    private String itemType;
+
+    private static final long serialVersionUID = 1L;
+
+    public ProjectDTO(){
+        super();
+    }
+
+    public ProjectDTO(String id){
+        super(id);
+    }
+
+    /**
+     * oss上传文件相关数据
+     */
+    public List<WorkAttachment> workAttachments;
+
+    private OfficeDTO officeDTO;
+
+
+}

+ 14 - 0
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/projectRecords/service/mapstruct/ProjectWrapper.java

@@ -0,0 +1,14 @@
+package com.jeeplus.assess.projectRecords.service.mapstruct;
+
+import com.jeeplus.assess.projectRecords.domain.Project;
+import com.jeeplus.assess.projectRecords.service.dto.ProjectDTO;
+import com.jeeplus.core.mapstruct.EntityWrapper;
+import org.mapstruct.Mapper;
+import org.mapstruct.ReportingPolicy;
+import org.mapstruct.factory.Mappers;
+
+@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
+public interface ProjectWrapper extends EntityWrapper<ProjectDTO, Project> {
+
+    ProjectWrapper INSTANCE = Mappers.getMapper(ProjectWrapper.class);
+}

+ 2 - 2
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workClientInfo/controller/WorkClientController.java

@@ -42,10 +42,10 @@ public class WorkClientController {
         QueryWrapper<WorkClientInfo> workClientInfoQueryWrapper = QueryWrapperGenerator.buildQueryCondition(workClientInfo, WorkClientInfo.class);
         if (ObjectUtil.isNotEmpty(workClientInfo)) {
             if (ObjectUtil.isNotEmpty(workClientInfo.getCreateDates())) {
-                workClientInfoQueryWrapper.between("a.create_date",workClientInfo.getCreateDates()[0], workClientInfo.getCreateDates()[1]);
+                workClientInfoQueryWrapper.between("a.create_time",workClientInfo.getCreateDates()[0], workClientInfo.getCreateDates()[1]);
             }
             if (StringUtils.isNotBlank(workClientInfo.getCreateById())) {
-                workClientInfoQueryWrapper.eq("a.create_by",workClientInfo.getCreateById());
+                workClientInfoQueryWrapper.eq("a.create_by_id",workClientInfo.getCreateById());
             }
         }
         IPage<WorkClientInfo> list = workClientService.list(page,workClientInfoQueryWrapper);

+ 15 - 15
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workClientInfo/mapper/xml/WorkClientInfoMapper.xml

@@ -4,10 +4,10 @@
 
 	<sql id="Base_Column_List">
         a.id,
-        a.create_by,
-        a.create_date,
-        a.update_by,
-        a.update_date,
+        a.create_by_id,
+        a.create_time,
+        a.update_by_id,
+        a.update_time,
         a.del_flag,
         a.name,
         a.lawer_presint,
@@ -35,10 +35,10 @@
     </sql>
 	<resultMap id="BaseResultMap" type="com.jeeplus.assess.workClientInfo.domain.WorkClientInfo">
 		<id property="id" column="id" jdbcType="VARCHAR"/>
-		<result property="createById" column="create_by" jdbcType="VARCHAR"/>
-		<result property="createTime" column="create_date" jdbcType="TIMESTAMP"/>
-		<result property="updateById" column="update_by" jdbcType="VARCHAR"/>
-		<result property="updateTime" column="update_date" jdbcType="TIMESTAMP"/>
+		<result property="createById" column="create_by_id" jdbcType="VARCHAR"/>
+		<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+		<result property="updateById" column="update_by_id" jdbcType="VARCHAR"/>
+		<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
 		<result property="delFlag" column="del_flag" jdbcType="CHAR"/>
 		<result property="name" column="name" jdbcType="VARCHAR"/>
 		<result property="lawerPresint" column="lawer_presint" jdbcType="VARCHAR"/>
@@ -73,15 +73,15 @@
 		from work_client_info a
 		left join sys_area sa on sa.id = a.area_id and sa.del_flag = '0'
 		${ew.customSqlSegment}
-		order by a.update_date desc
+		order by a.update_time desc
 	</select>
 	<select id="findPageList" resultType="com.jeeplus.assess.workClientInfo.domain.WorkClientInfo">
 		SELECT
 			a.id,
-			su.name create_by,
-			a.create_date,
-			a.update_by,
-			a.update_date,
+			su.name create_by_id,
+			a.create_time,
+			a.update_by_id,
+			a.update_time,
 			a.del_flag,
 			a.name,
 			a.lawer_presint,
@@ -119,11 +119,11 @@
 		FROM
 			work_client_info a
 		LEFT JOIN sys_area b ON a.area_id = b.`code`
-		LEFT JOIN sys_user su ON su.id = a.create_by
+		LEFT JOIN sys_user su ON su.id = a.create_by_id
 		LEFT JOIN work_client_job_type_info f ON a.id = f.work_client_id
 		${ew.customSqlSegment}
 		ORDER BY
-			a.update_date DESC
+			a.update_time DESC
 	</select>
 
 	<select id="isExist" resultType="java.lang.Integer">

+ 2 - 39
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workContract/domain/WorkContractInfo.java

@@ -2,6 +2,7 @@ package com.jeeplus.assess.workContract.domain;
 
 import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.core.domain.BaseEntity;
 import com.jeeplus.core.query.Query;
 import lombok.Data;
 
@@ -10,45 +11,7 @@ import java.util.List;
 
 @Data
 @TableName("work_contract_info")
-public class WorkContractInfo {
-
-    /**
-     * 实体主键
-     */
-    @TableId
-    private String id;
-
-    /**
-     * 创建日期
-     */
-    @TableField(fill = FieldFill.INSERT)
-    private Date createDate;
-
-    /**
-     * 创建人
-     */
-    @Query(tableColumn = "a.create_by")
-    @TableField(fill = FieldFill.INSERT)
-    private String createBy;
-
-    /**
-     * 更新日期
-     */
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private Date updateDate;
-
-    /**
-     * 更新人
-     */
-    @TableField(fill = FieldFill.INSERT_UPDATE)
-    private String updateBy;
-
-    /**
-     * 逻辑删除标记
-     */
-    @TableLogic
-    @TableField(fill = FieldFill.INSERT)
-    private Integer delFlag;
+public class WorkContractInfo extends BaseEntity {
 
     /**
      * 客户id

+ 7 - 7
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workContract/mapper/xml/WorkContractBorrowMapper.xml

@@ -19,21 +19,21 @@
 		 <if test="type != null and type != ''">
 			 ,ret_data = NOW()
 		 </if>
-		 WHERE del_flag = 0 AND contract_borrow_id = #{id} order by create_date desc limit 1
+		 WHERE del_flag = 0 AND contract_borrow_id = #{id} order by create_time desc limit 1
 	</update>
 
 	<update id="deleteMessageById">
 		UPDATE work_contract_borrow_message SET del_flag = 1
-		WHERE del_flag = 0 AND contract_borrow_id = #{id} order by create_date desc limit 1
+		WHERE del_flag = 0 AND contract_borrow_id = #{id} order by create_time desc limit 1
 	</update>
 
 	<select id="findMessageList" resultType="com.jeeplus.assess.workContract.domain.WorkContractBorrowMessage">
 		SELECT
 			id,
-			create_by,
-			create_date,
-			update_by,
-			update_date,
+			create_by_id,
+			create_time,
+			update_by_id,
+			update_time,
 			del_flag,
 			contract_borrow_id,
 			name,
@@ -43,6 +43,6 @@
 			borrow_type,
 			DATE_FORMAT( ret_data, '%Y-%m-%d' ) AS ret_data
 		 FROM work_contract_borrow_message WHERE del_flag = 0 AND contract_borrow_id = #{id}
-		 order by create_date desc
+		 order by create_time desc
 	</select>
 </mapper>

+ 25 - 25
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workContract/mapper/xml/WorkContractInfoMapper.xml

@@ -5,10 +5,10 @@
 	<select id="findPageList" resultType="com.jeeplus.assess.workContract.domain.WorkContractInfo">
 		SELECT
 			a.id,
-			c.`name` AS create_by,
-			a.create_date,
-			a.update_by,
-			a.update_date,
+			c.`name` AS create_by_id,
+			a.create_time,
+			a.update_by_id,
+			a.update_time,
 			a.del_flag,
 			a.client_id,
 			a.client_name,
@@ -36,20 +36,20 @@
 			a.status,
 			f.borrow_type,
 			b.ID_ as task_id,
-			a.create_by as create_id,
+			a.create_by_id as create_id,
 			d.filed_type,
 			e.ID_ as task_filed_id,
 			g.ID_ as task_borrow_id
 		FROM
 			work_contract_info a
-			LEFT JOIN sys_user c ON a.create_by = c.id
+			LEFT JOIN sys_user c ON a.create_by_id = c.id
 			LEFT JOIN act_ru_task b ON a.proc_ins_id = b.PROC_INST_ID_
 			LEFT JOIN work_contract_file d ON a.id = d.contract_info_id
 			LEFT JOIN act_ru_task e ON d.proc_ins_id = e.PROC_INST_ID_
 			LEFT JOIN work_contract_borrow f ON a.id = f.contract_info_id
 			LEFT JOIN act_ru_task g ON f.proc_ins_id = g.PROC_INST_ID_
 		${ew.customSqlSegment}
-		ORDER BY a.update_date DESC
+		ORDER BY a.update_time DESC
 	</select>
 
 	<select id="findById" resultType="com.jeeplus.assess.workContract.domain.WorkContractInfo">
@@ -78,11 +78,11 @@
 			a.filed_remarks,
 			a.proc_ins_id,
 			a.borrow_type,
-			a.create_date,
-			a.create_by,
-			a.update_date,
+			a.create_time,
+			a.create_by_id,
+			a.update_time,
 			a.status,
-			a.update_by,
+			a.update_by_id,
 			a.del_flag,
 			d.id as contract_file_id,
 			d.filed_type
@@ -114,8 +114,8 @@
 			id,
 			url,
 			attachment_name AS `name`,
-			create_by AS `by`,
-			create_date
+			create_by_id AS `by`,
+			create_time
 		FROM
 			work_attachment
 		WHERE
@@ -128,8 +128,8 @@
 			id,
 			url,
 			attachment_name AS `name`,
-			create_by AS `by`,
-			create_date
+			create_by_id AS `by`,
+			create_time
 		FROM
 			work_attachment
 		WHERE
@@ -145,10 +145,10 @@
 	<select id="relationProjectList" resultType="com.jeeplus.assess.program.configuration.projectList.domain.ProgramProjectListInfo">
 		SELECT
            a.id,
-           b.name AS create_by,
-           a.create_date,
-           a.update_by,
-           a.update_date,
+           b.name AS create_by_id,
+           a.create_time,
+           a.update_by_id,
+           a.update_time,
            a.del_flag,
            a.contract_id,
            a.contract_name,
@@ -203,11 +203,11 @@
            a.process_definition_id
         FROM
             program_project_list_info a
-            LEFT JOIN sys_user b ON a.create_by = b.id
+            LEFT JOIN sys_user b ON a.create_by_id = b.id
             LEFT JOIN sys_user c ON a.project_manager = c.id
 		WHERE
 			a.contract_id = #{id}
-            ORDER BY a.update_date DESC
+            ORDER BY a.update_time DESC
 	</select>
 
 
@@ -238,10 +238,10 @@
 			a.filed_remarks,
 			a.proc_ins_id,
 			a.borrow_type,
-			a.create_date,
-			a.create_by,
-			a.update_date,
-			a.update_by,
+			a.create_time,
+			a.create_by_id,
+			a.update_time,
+			a.update_by_id,
 			a.del_flag,
 			d.id as contract_file_id,
 			d.filed_type

+ 8 - 8
jeeplus-modules/jeeplus-assess/src/main/java/com/jeeplus/assess/workContract/service/WorkContractService.java

@@ -110,16 +110,16 @@ public class WorkContractService {
         //获取当前登录人信息
         UserDTO userDTO = UserUtils.getCurrentUserDTO();
         //合同编号生成
-//        String serialNum = serialnumTplService.genSerialNum(userDTO.getCompanyDTO().getId(), WorkContractInfoDto.BIZ_CODE);
+        String serialNum = serialnumTplService.genSerialNum(userDTO.getCompanyDTO().getId(), WorkContractInfoDto.BIZ_CODE);
         String id = UUID.randomUUID().toString().replace("-", "");
         WorkContractInfo info = new WorkContractInfo();
         BeanUtils.copyProperties(workContractInfoDto, info);
         info.setId(id);
-//        info.setNo(serialNum);
-        info.setCreateBy(userDTO.getId());
-        info.setCreateDate(new Date());
-        info.setUpdateBy(userDTO.getId());
-        info.setUpdateDate(new Date());
+        info.setNo(serialNum);
+        info.setCreateById(userDTO.getId());
+        info.setCreateTime(new Date());
+        info.setUpdateById(userDTO.getId());
+        info.setUpdateTime(new Date());
         workContractInfoMapper.insert(info);
         List<WorkAttachmentDto> list = workContractInfoDto.getWorkAttachmentList();
         if (CollectionUtil.isNotEmpty(list)) {
@@ -140,8 +140,8 @@ public class WorkContractService {
         WorkContractInfo info = new WorkContractInfo();
         BeanUtils.copyProperties(workContractInfoDto, info);
 //        info.setNo(serialNum);
-        info.setUpdateBy(userDTO.getId());
-        info.setUpdateDate(new Date());
+        info.setUpdateById(userDTO.getId());
+        info.setUpdateTime(new Date());
         workContractInfoMapper.updateById(info);
         List<WorkAttachmentDto> list = workContractInfoDto.getWorkAttachmentList();
         if (CollectionUtil.isNotEmpty(list)) {

BIN=BIN
jeeplus-modules/jeeplus-assess/src/main/resources/dot/发票明细导入模板.xlsx


BIN=BIN
jeeplus-modules/jeeplus-assess/src/main/resources/dot/职位导入模板.xlsx


BIN=BIN
jeeplus-modules/jeeplus-assess/src/main/resources/dot/项目导入模板.xlsx


+ 2 - 2
jeeplus-modules/jeeplus-public-modules/src/main/java/com/jeeplus/pubmodules/serialNumTpl/mapper/xml/TemplateMapper.xml

@@ -13,14 +13,14 @@
 		FROM
 			sys_serialnum_tpl a
 		${ew.customSqlSegment}
-		ORDER BY create_date DESC
+		ORDER BY create_time DESC
 	</select>
 
 	<select id="queryByComAndBizCode" resultType="com.jeeplus.pubmodules.serialNumTpl.domain.SysSerialnumTpl">
 		select	a.*
 		 from sys_serialnum_tpl a
 		where a.company_id = #{id} and a.biz_code = #{bizCode} and a.del_flag = 0
-		order by update_date desc
+		order by update_time desc
 		limit 1
 	</select>
 

+ 18 - 1
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/OfficeController.java

@@ -3,6 +3,7 @@
  */
 package com.jeeplus.sys.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.common.collect.Lists;
 import com.jeeplus.aop.demo.annotation.DemoMode;
 import com.jeeplus.common.constant.CommonConstants;
@@ -113,9 +114,25 @@ public class OfficeController {
                                                       @RequestParam(required = false) String type,
                                                       @RequestParam(required = false, defaultValue = CommonConstants.NO) String showAll) {
         List <OfficeDTO> list = officeService.findList ( tenantId, parentId );
-        List <OfficeDTO> rootTree = officeService.getRootTree ( parentId, list, extId, type, showAll );
+        List <OfficeDTO> rootTree = officeService.getRootTree (list, extId, type, showAll,"1" );
         return ResponseEntity.ok ( rootTree );
     }
 
+    /**
+     * 获取机构JSON数据。
+     *
+     * @param extId 排除的ID
+     * @param type  类型(1:公司;2:部门)
+     * @param showAll 是否显示不可用数据 1 显示 0 隐藏
+     * @return
+     */
+    @ApiLog("获取部门数据")
+    @GetMapping("treeData2")
+    public ResponseEntity treeData2(@RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false, defaultValue = CommonConstants.NO) String showAll) {
+        List<OfficeDTO> list = officeWrapper.toDTO (officeService.list ());
+        List rootTree = officeService.getRootTree2 (list, extId, type, showAll);
+        return ResponseEntity.ok (rootTree);
+    }
+
 
 }

+ 45 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -12,13 +12,16 @@ import com.google.common.collect.Lists;
 import com.google.gson.Gson;
 import com.jeeplus.aop.demo.annotation.DemoMode;
 import com.jeeplus.common.SecurityUtils;
+import com.jeeplus.common.constant.CommonConstants;
 import com.jeeplus.common.excel.ExcelOptions;
 import com.jeeplus.common.excel.annotation.ExportMode;
 import com.jeeplus.common.utils.ResponseUtil;
 import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.logging.annotation.ApiLog;
 import com.jeeplus.sys.domain.User;
+import com.jeeplus.sys.service.OfficeService;
 import com.jeeplus.sys.service.UserService;
+import com.jeeplus.sys.service.dto.OfficeDTO;
 import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.service.mapstruct.UserWrapper;
 import com.jeeplus.sys.utils.DictUtils;
@@ -56,6 +59,9 @@ public class UserController {
     @Autowired
     private UserService userService;
 
+    @Autowired
+    private OfficeService officeService;
+
     /**
      * 根据id查询用户
      *
@@ -293,4 +299,43 @@ public class UserController {
         return ResponseEntity.ok ( res );
     }
 
+    /**
+     * 获取机构JSON数据。
+     *
+     * @param officeName 部门名称
+     * @param extId 排除的ID
+     * @param type  类型(1:公司;2:部门)
+     * @param showAll 是否显示不可用数据 1 显示 0 隐藏
+     * @return
+     */
+    @ApiLog("获取部门用户数据")
+    @GetMapping("treeUserDataAllOffice")
+    public ResponseEntity treeUserDataAllOffice(@RequestParam(required = false) String officeName,@RequestParam(required = false) String extId, @RequestParam(required = false) String type, @RequestParam(required = false, defaultValue = CommonConstants.NO) String showAll) {
+        List<OfficeDTO> list = officeService.getOfficeAllByOfficeName (officeName);
+        if(list.size()>0){
+            List<String> officeIds = Lists.newArrayList();
+            for (OfficeDTO info : list) {
+                info.setTypeFlag(true);
+                officeIds.add(info.getId());
+            }
+            //根据部门查询对应部门下的所有数据
+            List<OfficeDTO> officeDTOList = userService.getUserByOffice(officeIds,type);
+            list.addAll(officeDTOList);
+        }
+        List rootTree = officeService.getRootTree (list, extId, type, showAll, "1");
+        return ResponseEntity.ok (rootTree);
+    }
+
+    /**
+     * 判断当前用户是否是管理员
+     *
+     * @return
+     */
+    @ApiLog("判断当前用户是否是管理员")
+    @GetMapping("isAdmin")
+    @ApiOperation(value = "判断当前用户是否是管理员")
+    public Boolean isAdmin() {
+        return UserUtils.getCurrentUserDTO().isAdmin();
+    }
+
 }

+ 7 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/OfficeMapper.java

@@ -29,4 +29,11 @@ public interface OfficeMapper extends TreeMapper <Office> {
     public List <OfficeDTO> findList(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);
 
     SysParameterValue findValueByParameter(@Param("parameter")String parameter, @Param("branchOffice")String branchOffice);
+
+    /**
+     * 根据部门名称 查询部门及所有子部门信息
+     * @param officeName
+     * @return
+     */
+    List<OfficeDTO> getOfficeAllByOfficeName(@Param("officeName") String officeName);
 }

+ 17 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/UserMapper.java

@@ -11,6 +11,7 @@ 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.sys.domain.User;
+import com.jeeplus.sys.service.dto.OfficeDTO;
 import com.jeeplus.sys.service.dto.UserDTO;
 import org.apache.ibatis.annotations.Param;
 
@@ -106,4 +107,20 @@ public interface UserMapper extends BaseMapper <User> {
      */
     void insertUserPost(@Param("userId") String userId, @Param("postId") String postId);
 
+    /**
+     * 根据条件查询用户id
+     * @param name
+     * @return
+     */
+    String getUserIdByName(@Param("name") String name);
+
+    /**
+     * 根据部门获取员工数据
+     * @param officeIds
+     * @param type
+     * @return
+     */
+    List <OfficeDTO> getUserByOffice(@Param("officeIds") List<String> officeIds, @Param("type") String type);
+
+
 }

+ 40 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/OfficeMapper.xml

@@ -43,4 +43,44 @@
 		 and del_flag = '0'
 	</select>
 
+    <select id="getOfficeAllByOfficeName" resultType="com.jeeplus.sys.service.dto.OfficeDTO">
+        select
+            a.id,
+            a.parent_id AS "parent.id",
+            a.parent_ids,
+            a.area,
+            a.code,
+            a.name,
+            a.sort,
+            a.type,
+            a.grade,
+            a.address,
+            a.zip_code,
+            a.master,
+            a.phone,
+            a.fax,
+            a.email,
+            a.remarks,
+            a.create_by_id AS "createBy.id",
+            a.create_time,
+            a.update_by_id AS "updateBy.id",
+            a.update_time,
+            a.del_flag,
+            a.useable      AS useable,
+            a.tenant_id    AS "tenantDTO.id",
+            p.name         AS "parent.name"
+        from sys_office a
+        LEFT JOIN sys_office p ON p.id = a.parent_id
+        <where>
+            a.del_flag = 0
+            <if test="officeName != null and officeName != ''">
+                and (
+                a.id = (select id from sys_office where name = #{officeName})
+                or
+                a.parent_ids like concat('%',(select id from sys_office where name = #{officeName}),'%')
+                )
+            </if>
+        </where>
+    </select>
+
 </mapper>

+ 49 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/mapper/xml/UserMapper.xml

@@ -178,4 +178,53 @@
         INSERT INTO sys_user_post(user_id, post_id)
         VALUES (#{userId}, #{postId})
     </insert>
+
+    <select id="getUserIdByName" resultType="string">
+		select id from sys_user su where su.name = #{name} limit 1
+	</select>
+
+    <sql id="userOfficeColumns">
+    	a.id,
+    	a.login_name AS "loginName",
+		a.is_admin AS "isAdmin",
+    	a.password,
+    	a.no,
+		a.name,
+		a.email,
+		a.phone,
+		a.mobile,
+		a.login_ip AS "loginIp",
+		a.login_date AS "loginDate",
+		a.remarks,
+		a.login_flag,
+-- 		a.other_service_flag,
+		a.photo,
+		a.qr_code,
+		a.sign,
+		a.create_by_id AS "createBy.id",
+		a.create_time,
+		a.update_by_id AS "updateBy.id",
+		a.update_time,
+    	o.id AS "parent.id",
+    	o.parent_ids AS "parentIds"
+    </sql>
+
+    <!-- 查询岗位下的用户 -->
+    <select id="getUserByOffice" resultType="com.jeeplus.sys.service.dto.OfficeDTO">
+        SELECT
+        <include refid="userOfficeColumns"/>
+        ,#{type} as "type"
+        FROM sys_user a
+        <include refid="userJoins"/>
+        <where>
+            a.del_flag = 0
+            <if test="officeIds != null and officeIds.size>0">
+                and a.office_id in
+                <foreach collection="officeIds" item="officeId" separator="," open="(" close=")">
+                    #{officeId}
+                </foreach>
+            </if>
+            and a.is_admin IS NULL
+        </where>
+    </select>
 </mapper>

+ 158 - 9
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/service/OfficeService.java

@@ -3,6 +3,7 @@
  */
 package com.jeeplus.sys.service;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.common.collect.Lists;
@@ -13,10 +14,14 @@ import com.jeeplus.core.service.TreeService;
 import com.jeeplus.sys.domain.Office;
 import com.jeeplus.sys.mapper.OfficeMapper;
 import com.jeeplus.sys.service.dto.OfficeDTO;
+import com.jeeplus.sys.service.mapstruct.OfficeWrapper;
+import com.jeeplus.sys.utils.UserUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -30,6 +35,11 @@ import java.util.Map;
 @Transactional
 public class OfficeService extends TreeService <OfficeMapper, Office> {
 
+    @Autowired
+    private OfficeMapper officeMapper;
+
+    @Autowired
+    private OfficeWrapper officeWrapper;
 
     /**
      * 获取列表
@@ -45,21 +55,90 @@ public class OfficeService extends TreeService <OfficeMapper, Office> {
         return baseMapper.findList ( queryWrapper );
     }
 
-    public List <OfficeDTO> getRootTree(String parentId, List <OfficeDTO> list, String extId, String type, String showAll) {
-        List <OfficeDTO> offices = Lists.newArrayList ( );
-        parentId = StrUtil.isEmpty ( parentId ) ? OfficeDTO.getRootId ( ) : parentId;
-        for (OfficeDTO root : list) {
-            if ( parentId.equals ( root.getParentId ( ) ) ) {
-                if ( this.isUseAble ( extId, type, root, showAll ) ) {
-                    // 不是被排除节点的子节点
-                    List <OfficeDTO> officeList = formatListToTree ( root, list, extId, type, showAll );
-                    offices.addAll ( officeList );
+    public List <OfficeDTO> getRootTree(List<OfficeDTO> list, String extId, String type, String showAll, String showMyOffice) {
+        List<OfficeDTO> offices = Lists.newArrayList ();
+        // 获取到所有parent_id为‘0’的部门数据
+        List<OfficeDTO> rootTrees = OfficeWrapper.INSTANCE.toDTO (super.getChildren (new Office (OfficeDTO.getRootId ())));
+        for (OfficeDTO root : rootTrees) {
+            if (this.isUseAble ( extId, type,root, showAll )){
+                // 不是被排除节点的子节点
+                List<OfficeDTO> officeList = formatListToTree (root, list, extId, type, showAll);
+                offices.addAll (officeList);
+            }
+        }
+        if (StringUtils.isNotBlank(showMyOffice)) {
+            OfficeDTO officeDTO = UserUtils.getCurrentUserDTO().getOfficeDTO();
+            // 排除管理员
+            if (!UserUtils.getCurrentUserDTO().isAdmin()){
+                if (org.apache.commons.lang.StringUtils.isNotBlank(officeDTO.getParentIds())) {
+                    String[] split = officeDTO.getParentIds().split(",");
+                    if (split.length > 2) {
+                        Office office = officeMapper.selectById(split[2]);
+                        if ("0".equals(office.getIsPublic())) {
+                            // isPublic为“0”,当前用户的公司为私有,查询的部门包含自己所属公司全部部门和其他的公有部门
+                            if(null != officeDTO && org.apache.commons.lang.StringUtils.isNotBlank(officeDTO.getParentIds())){
+                                offices = this.getCompanyFromTree(offices);
+                            }
+                        }
+                    } else {
+                        if ("0".equals(officeDTO.getIsPublic())) {
+                            // isPublic为“0”,当前用户的公司为私有,查询的部门包含自己所属公司全部部门和其他的公有部门
+                            if(null != officeDTO && org.apache.commons.lang.StringUtils.isNotBlank(officeDTO.getParentIds())){
+                                offices = this.getCompanyFromTree(offices);
+                            }
+                        }
+                    }
                 }
             }
         }
         return offices;
     }
 
+    /**
+     * 在tree数据中找到当前登录人的“集团”以及“公司”
+     */
+    public List<OfficeDTO> getCompanyFromTree(List<OfficeDTO> rootTrees){
+        // 当前登录人的集团id
+        String corporationId = UserUtils.getCurrentUserDTO().getCompanyDTO().getId();
+        // 公司id
+        String parentIds = officeMapper.selectById(UserUtils.getCurrentUserDTO().getOfficeDTO().getId()).getParentIds();
+        String companyId = null;
+        String[] split = parentIds.split(",");
+        if(split.length>2){
+            companyId = split[2];
+        }else{
+            companyId = UserUtils.getCurrentUserDTO().getOfficeDTO().getId();
+        }
+        List<OfficeDTO> os = new ArrayList<>();
+        if (CollectionUtil.isNotEmpty(rootTrees)) {
+            String finalCompanyId = companyId;
+            rootTrees.stream().forEach(item->{
+                if ("1".equals(item.getIsPublic())) { // 找到公有的集团
+                    OfficeDTO officeDTO = item;
+                    if (CollectionUtil.isNotEmpty(item.getChildren())){
+                        officeDTO.setChildren(item.getChildren());
+                    }
+                    os.add(officeDTO);
+                }else{
+                    if(item.getId().equals(corporationId)){  // 找到登录人的集团
+                        OfficeDTO officeDTO = item;
+                        if (CollectionUtil.isNotEmpty(item.getChildren())&&!"".equals(finalCompanyId)){
+                            List<OfficeDTO> companys = new ArrayList<>();
+                            item.getChildren().stream().forEach(child->{
+                                if(child.getId().equals(finalCompanyId) || "1".equals(child.getIsPublic())){ // 登录人的公司 或者 公有公司
+                                    companys.add(child);
+                                }
+                            });
+                            officeDTO.setChildren(companys);
+                        }
+                        os.add(officeDTO);
+                    }
+                }
+            });
+        }
+        return os;
+    }
+
 
     public List <OfficeDTO> formatListToTree(OfficeDTO root, List <OfficeDTO> allList, String extId, String type, String showAll) {
         String rootId = root.getId ( );
@@ -135,5 +214,75 @@ public class OfficeService extends TreeService <OfficeMapper, Office> {
                 && (CommonConstants.YES.equals ( showAll ) || CommonConstants.YES.equals ( dto.getUseable ( ) ));
     }
 
+    /**
+     * 根据部门名称查询部门信息
+     * @param officeName
+     * @return
+     */
+    public List<OfficeDTO> getOfficeAllByOfficeName(String officeName){
+        List<OfficeDTO> officeList = officeMapper.getOfficeAllByOfficeName(officeName);
+
+        return officeList;
+    }
+
+    public List <OfficeDTO> getRootTree2(List<OfficeDTO> list, String extId, String type, String showAll) {
+        List<OfficeDTO> offices = Lists.newArrayList ();
+        List<OfficeDTO> rootTrees = officeWrapper.toDTO (super.getChildren (new Office (OfficeDTO.getRootId ())));
+        for (OfficeDTO root : rootTrees) {
+            if (this.isUseAble ( extId, type,root, showAll )){
+                // 不是被排除节点的子节点
+                List<OfficeDTO> officeList = formatListToTree2 (root, list, extId, type, showAll);
+                offices.addAll (officeList);
+            }
+        }
+        return offices;
+    }
+
+    public List<OfficeDTO> formatListToTree2(OfficeDTO root, List<OfficeDTO> allList, String extId, String type, String showAll) {
+        String rootId = root.getId ();
+
+        // type为1时,是选择公司,因此禁用type为2的部门节点
+        if(OfficeTypeEnum.COMPANY.getValue ().equals(type) && root.getType().equals(OfficeTypeEnum.COMPANY.getValue ())){
+            root.setDisabled(false);
+        }else {
+            root.setDisabled(true);
+        }
+        // 最终的树形态
+        List<OfficeDTO> trees = Lists.newArrayList ();
+
+        // 把需要构造树的所有列表, 根据以父id作为key, 整理为列表
+        Map <String, List<OfficeDTO>> treeMap = Maps.newHashMap ();
+        for (OfficeDTO entity : allList) {
+            List<OfficeDTO> offices = treeMap.get (entity.getParent ().getId ());
+            if (offices == null) {
+                offices = Lists.newLinkedList ();
+            }
+
+            if (this.isUseAble ( extId, type,root, showAll )){
+                // type为2时,是选择部门,因此禁用type为1的公司节点
+                if(OfficeTypeEnum.COMPANY.getValue ().equals(type) && entity.getType().equals(OfficeTypeEnum.COMPANY.getValue ())){
+                    entity.setDisabled(false);
+                }else {
+                    entity.setDisabled(true);
+                }
+                offices.add (entity);
+                treeMap.put (entity.getParent ().getId (), offices);
+            }
+        }
+
+        // 开始递归格式化
+        List<OfficeDTO> children = treeMap.get (rootId);
+        if (children != null) {
+            for (OfficeDTO parent : children) {
+                formatFillChildren (parent, treeMap);
+                trees.add (parent);
+            }
+        }
+
+        root.setChildren (trees);
+        return Lists.newArrayList (root);
+    }
+
+
 
 }

+ 18 - 0
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/service/UserService.java

@@ -17,6 +17,7 @@ import com.jeeplus.sys.domain.SysConfig;
 import com.jeeplus.sys.domain.User;
 import com.jeeplus.sys.mapper.OfficeMapper;
 import com.jeeplus.sys.mapper.UserMapper;
+import com.jeeplus.sys.service.dto.OfficeDTO;
 import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.service.mapstruct.UserWrapper;
 import com.jeeplus.sys.utils.UserUtils;
@@ -48,6 +49,9 @@ public class UserService extends ServiceImpl <UserMapper, User> {
     @Autowired
     private OfficeMapper officeMapper;
 
+    @Autowired
+    private UserMapper userMapper;
+
 
     /**
      * 获取用户
@@ -248,4 +252,18 @@ public class UserService extends ServiceImpl <UserMapper, User> {
         officeIds.add(officeId);
         return this.list(new QueryWrapper<User>().lambda().in(User::getOfficeId,officeIds));
     }
+
+    /**
+     * 根据用户name获取用户id
+     * @param name
+     * @return
+     */
+    public String getUserIdByName(String name) {
+        return userMapper.getUserIdByName (name);
+    }
+
+    //根据部门查询用户信息
+    public List<OfficeDTO> getUserByOffice(List<String> officeIds, String type){
+        return userMapper.getUserByOffice(officeIds,type);
+    }
 }