Bladeren bron

合同以及任务等级

cs 2 jaren geleden
bovenliggende
commit
3f8ff8779c

+ 28 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Contract.java

@@ -49,6 +49,34 @@ public class Contract extends Model<Contract> {
     @TableField("creator_id")
     private String creatorId;
 
+    /**
+     * 创建者姓名
+     */
+    @TableField(exist = false)
+    private String creatorName;
+
+    /**
+     * 创建者wxCorpId
+     */
+    @TableField(exist = false)
+    private String creatorWxCorpId;
+
+    /**
+     * 合同开始时间
+     */
+    @TableField("start_date")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private LocalDate startDate;
+
+    /**
+     * 合同结束时间
+     */
+    @TableField("end_date")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private LocalDate endDate;
+
     /**
      * 合同编号
      */

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/GanttDataItem.java

@@ -3,6 +3,7 @@ package com.management.platform.entity.vo;
 import lombok.Data;
 
 import java.util.List;
+import java.util.logging.Level;
 
 @Data
 public class GanttDataItem {
@@ -20,5 +21,6 @@ public class GanttDataItem {
     public String type;
     public String translationType;
     public String color;
+    public Integer level;
     public List<GanttDataItem> children;
 }

+ 45 - 14
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java

@@ -83,6 +83,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
         try {
             String token = request.getHeader("token");
             User user = userMapper.selectById(token);
+            WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
             List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全部合同");
             if(functionContractList.size() <= 0){
                 httpRespMsg.setError(MessageUtils.message("access.viewError"));
@@ -111,6 +112,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
             }
             List<Contract> contracts = contractMapper.selectContract(user.getCompanyId(), pageStart, pageSize, number, name , typeName , status, startDate,endDate);
             List<Contract> total = contractMapper.selectContract(user.getCompanyId(), null, null, number, name, typeName, status, startDate, endDate);
+            for (Contract contract : contracts) {
+                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                    contract.setCreatorName(contract.getCreatorWxCorpId());
+                }
+            }
             //首先获取所有合同的Id
             List<Integer> contractCollect = contracts.stream().map(c -> c.getId()).collect(Collectors.toList());
             contractCollect.add(-1);
@@ -120,7 +126,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
             List<String> userCollect = fileList.stream().map(c -> c.getCreatorId()).distinct().collect(Collectors.toList());
             userCollect.add("-1");
             List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("id", userCollect));
-            WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
             for (ContractDocument contractDocument : fileList) {
                 if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
                     for (User item : userList) {
@@ -138,6 +143,10 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
                 contractPageVO.setId(contract.getId());
                 contractPageVO.setCompanyId(contract.getCompanyId());
                 contractPageVO.setCreatorId(contract.getCreatorId());
+                contractPageVO.setCreatorName(contract.getCreatorName());
+                contractPageVO.setCreatorWxCorpId(contract.getCreatorWxCorpId());
+                contractPageVO.setStartDate(contract.getStartDate());
+                contractPageVO.setEndDate(contract.getEndDate());
                 contractPageVO.setIndate(contract.getIndate());
                 contractPageVO.setNumber(contract.getNumber());
                 contractPageVO.setName(contract.getName());
@@ -195,6 +204,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
         List<String> headList = new ArrayList<String>();
 //        headList.add("合同编号");
 //        headList.add("合同名称");
+//        headList.add("合同开始时间");
+//        headList.add("合同结束时间");
+//        headList.add("合同创建者");
 //        headList.add("合同金额(¥)");
 //        headList.add("合同类型");
 //        headList.add("状态");
@@ -202,6 +214,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
 //        headList.add("备注");
         headList.add(MessageUtils.message("entry.contractNo"));
         headList.add(MessageUtils.message("contract.name"));
+        headList.add(MessageUtils.message("Contract.startDate"));
+        headList.add(MessageUtils.message("Contract.endDate"));
+        headList.add(MessageUtils.message("Contract.creatorName"));
         headList.add(MessageUtils.message("entry.contract"));
         headList.add(MessageUtils.message("contract.type"));
         headList.add(MessageUtils.message("leave.status"));
@@ -213,6 +228,14 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
             ArrayList<String> item = new ArrayList<>();
             item.add(contract.getNumber()==null?"":contract.getNumber());
             item.add(contract.getName());
+            item.add(contract.getStartDate()==null?"":contract.getStartDate()+"");
+            item.add(contract.getEndDate()==null?"":contract.getEndDate()+"");
+            if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                contract.setCreatorName("$userName=" + contract.getCreatorWxCorpId() + "$");
+            }else {
+                contract.setCreatorName(contract.getCreatorName());
+            }
+            item.add(contract.getCreatorName());
             item.add(contract.getAmounts()==null?"":contract.getAmounts().toString() + "元");
             item.add(contract.getTypeName());
             switch (contract.getStatus()){
@@ -229,7 +252,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
                     item.add("导入待审核");
                     break;
                 default:
-                    item.add("");
+                    item.add("_");
             }
             item.add(contract.getIndate().toString());
             item.add(contract.getRemarks()==null?"":contract.getRemarks());
@@ -279,10 +302,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
             httpRespMsg.msg = MessageUtils.message("Contract.amountNegative");
             return httpRespMsg;
         }
-        //若日期为空,则写入当前日期
-        if (contract.getIndate() == null){
-            contract.setIndate(LocalDate.now());
-        }
+        contract.setIndate(LocalDate.now());
         contract.setCreatorId(user.getId());
         contract.setCompanyId(user.getCompanyId());
         contractMapper.insert(contract);
@@ -325,6 +345,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
                     return httpRespMsg;
                 }
             }
+            contract.setStatus(1);
+            contract.setIndate(null);
             contractMapper.updateById(contract);
             httpRespMsg.msg = MessageUtils.message("contract.editSuc");
             return httpRespMsg;
@@ -370,9 +392,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
             outputStream.close();
             //然后解析表格
             Workbook workbook = WorkbookFactory.create(new FileInputStream(file));
-            //时间格式
-            DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/M/d");
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy/M/d");
             Sheet sheet = workbook.getSheetAt(0);
             int rowNum = sheet.getLastRowNum();
             if (rowNum == 0) {
@@ -396,7 +415,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
                 }
                 boolean NoExists = false;
                 boolean TypeExists = false;
-                for (int i = 0; i < 5; i++) {
+                for (int i = 0; i < 7; i++) {
                     if (row.getCell(i) != null) {
                         row.getCell(i).setCellType(CellType.STRING);
                     }
@@ -408,9 +427,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
                 }
                 String No = row.getCell(0)==null?null:row.getCell(0).getStringCellValue();
                 String name = row.getCell(1)==null?null:row.getCell(1).getStringCellValue();
-                String amounts = row.getCell(2)==null?null:row.getCell(2).getStringCellValue();
-                String type = row.getCell(3)==null?null:row.getCell(3).getStringCellValue();
-                String remarks = row.getCell(4)==null?null:row.getCell(4).getStringCellValue();
+                String startDate = row.getCell(2)==null?null:row.getCell(2).getStringCellValue();
+                String endDate = row.getCell(3)==null?null:row.getCell(3).getStringCellValue();
+                String amounts = row.getCell(4)==null?null:row.getCell(4).getStringCellValue();
+                String type = row.getCell(5)==null?null:row.getCell(5).getStringCellValue();
+                String remarks = row.getCell(6)==null?null:row.getCell(6).getStringCellValue();
                 Contract item = new Contract();
                 //检查合同编号是否存在
                 if (StringUtils.isNotBlank(No)){
@@ -456,7 +477,17 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
                 item.setCreatorId(user.getId());
                 item.setIndate(LocalDate.now());
                 item.setStatus(3);
-                if (Double.parseDouble(amounts) <= 0 ){
+                //时间转化
+                DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-M-d");
+                if (StringUtils.isNotBlank(startDate)){
+                    LocalDate start = LocalDate.parse(startDate, dtf);
+                    item.setStartDate(start);
+                }
+                if (StringUtils.isNotBlank(endDate)){
+                    LocalDate end = LocalDate.parse(endDate, dtf);
+                    item.setEndDate(end);
+                }
+                if (StringUtils.isNotBlank(amounts) && Double.parseDouble(amounts) <= 0 ){
                     //第{0}行金额不可为负数
                     msg.setError(MessageUtils.message("Contract.amountNegativeByCell",dataIndex));
                     return msg;

+ 3 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -8727,6 +8727,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 //String exeId = "任务_"+map.get("task_id") +"_"+ (type==0?(Integer) map.get("exe_id"):userId);
                 String exeId = MessageUtils.message("excel.task") + "_"+map.get("task_id") +"_"+ (type==0?(Integer) map.get("exe_id"):userId);
                 String taskId = ""+ (Integer) map.get("task_id");
+                int level = Integer.parseInt(map.get("level").toString());
 
                 GanttDataItem curItem = new GanttDataItem();;
                 if (type == 0) {
@@ -8760,6 +8761,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     curItem.end_date = end_date;
                     curItem.time = (Integer)map.get("duration");
                     curItem.parent = lastItemId;
+                    curItem.level = level;
                     curItem.children=new ArrayList<>();
                     itemList=getUserGanttDataItemList(curItem,itemList);
                     lastItemId = userId;
@@ -8787,6 +8789,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     curItem.time = (Integer)map.get("duration");
                     curItem.translationType="user";
                     curItem.parent = lastItemId;
+                    curItem.level = level;
                     itemList=getUserGanttDataItemList(curItem,itemList);
                     lastItemId = projectId;
                 }

+ 4 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages.properties

@@ -764,4 +764,7 @@ Contract.NoRepeat=第{0}行合同编号与第{1}行合同编号重复
 Contract.typeExists=第{0}行合同类型不存在
 Contract.amountNegative = 合同金额不可为负
 Contract.typeDelError = 该类型尚有合同在使用,无法删除!
-Contract.amountNegativeByCell = 第{0}行合同金额不可为负
+Contract.amountNegativeByCell = 第{0}行合同金额不可为负
+Contract.startDate = 合同开始时间
+Contract.endDate = 合同结束时间
+Contract.creatorName = 合同创建者

+ 4 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages_en_US.properties

@@ -764,4 +764,7 @@ Contract.NoRepeat=The contract number in line {0} is duplicate with that in line
 Contract.typeExists=The contract type in row {0} does not exist
 Contract.amountNegative = The contract amount cannot be negative
 Contract.typeDelError = This type is still in use and cannot be deleted!
-Contract.amountNegativeByCell = The contract amount in line {0} cannot be negative
+Contract.amountNegativeByCell = The contract amount in line {0} cannot be negative
+Contract.startDate = Contract start time
+Contract.endDate = Contract end time
+Contract.creatorName = Contract Creator

+ 5 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ContractMapper.xml

@@ -23,10 +23,14 @@
     </sql>
 
     <select id="selectContract" resultType="com.management.platform.entity.Contract">
-        select contract.id,contract.company_id,contract.creator_id,contract.number,contract.name,contract.amounts,contract.type_id,contract_type.type_name,contract.status,contract.indate,contract.remarks
+        select contract.id,contract.company_id,contract.creator_id,contract.number,contract.name,contract.amounts,contract.type_id,contract_type.type_name,contract.status,contract.indate,contract.remarks,
+        contract.start_date as startDate,contract.end_date as endDate,
+        user.name as creatorName,user.corpwx_userid as creatorWxCorpId
         from contract
         left join contract_type
         on contract.type_id = contract_type.id
+        left join user
+        on contract.creator_id = user.id
         where contract.company_id = #{companyId}
         <if test="number!=null">
         and number like #{number}

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml

@@ -619,7 +619,7 @@
 
     <select id="getTaskPlanByMemb" resultType="java.util.Map">
         SELECT user.`id` as user_id, user.`name`,project.id, project.`project_name`,task.id as task_id, task.name as task_name,task_executor.id as exe_id,
-        IFNULL(task.`start_date`, task.end_date) as start_date, task.`end_date`, task_executor.plan_hours as duration FROM user
+        IFNULL(task.`start_date`, task.end_date) as start_date, task.`end_date`, task_executor.plan_hours as duration, task.task_level as level FROM user
         LEFT JOIN task_executor ON user.id = task_executor.`executor_id`
         left join task on task.id = task_executor.task_id
         LEFT JOIN project ON project.`id` = task.`project_id`