Преглед изворни кода

获取公司打卡数据修改

anderx пре 2 месеци
родитељ
комит
a85acb0103

+ 1 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ProjectTaskController.java

@@ -547,10 +547,9 @@ public class ProjectTaskController extends BaseController {
      * 获取公司打卡数据
      */
     @GetMapping("/getCompanyClock")
-    public AjaxResult getCompanyClock(String usci,Integer year,Integer month){
+    public AjaxResult getCompanyClock(@RequestParam String usci,Integer year,Integer month){
         SysDept sysDept = sysDeptService.selectByusci(usci);
         Long deptId = sysDept.getDeptId();
-        startPage();
         pushRdDataBo res = projectStaffRecordService.getCompanyClock(deptId,year,month);
         res.setUsci(usci);
         return AjaxResult.success(res);

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/project/bo/pushCompanyDataBo.java

@@ -8,6 +8,16 @@ public class pushCompanyDataBo {
     private List<pushDataUser> listUser;
     private List<pushDataProject> listUserProject;
 
+    private List<PushRdDataListBo> rdList;
+
+    public List<PushRdDataListBo> getRdList() {
+        return rdList;
+    }
+
+    public void setRdList(List<PushRdDataListBo> rdList) {
+        this.rdList = rdList;
+    }
+
     public List<pushDataDep> getListDep() {
         return listDep;
     }

+ 9 - 0
ruoyi-system/src/main/java/com/ruoyi/project/bo/pushDataDep.java

@@ -33,6 +33,15 @@ public class pushDataDep {
     private String kyId;
     private String kySuperId;
     private String usci;
+    private Double maxDuration;
+
+    public Double getMaxDuration() {
+        return maxDuration;
+    }
+
+    public void setMaxDuration(Double maxDuration) {
+        this.maxDuration = maxDuration;
+    }
 
     public String getKyId() {
         return kyId;

+ 26 - 7
ruoyi-system/src/main/java/com/ruoyi/project/service/impl/ProjectTaskServiceImpl.java

@@ -585,8 +585,15 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
     public Object pushCompanyData(pushCompanyDataBo in) {
         //导入部门
         Long kyId=null;
+        String usci = null;
         if (!in.getListDep().isEmpty()){
-            kyId = pushAddDep(in.getListDep());
+            //假设只设置2级 1级为公司
+            List<pushDataDep> sp1 = in.getListDep().stream().filter(e -> StringUtils.isNotEmpty(e.getUsci())).collect(Collectors.toList());
+            //先新增公司
+            pushDataDep pushDataDep = sp1.get(0);
+            usci = pushDataDep.getUsci();
+            kyId = pushAddDep(in.getListDep(), pushDataDep);
+
         }
         //导入用户
         if (!in.getListUser().isEmpty()){
@@ -596,6 +603,11 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
         if (!in.getListUserProject().isEmpty()){
             pushAddUserProject(in.getListUserProject(),kyId);
         }
+
+        pushRdDataBo pushRdDataBo = new pushRdDataBo();
+        pushRdDataBo.setRdList(in.getRdList());
+        pushRdDataBo.setUsci(usci);
+        pushRdData(pushRdDataBo);
         return 1;
     }
 
@@ -802,11 +814,7 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
 
     }
 
-    private Long pushAddDep(List<pushDataDep> listDep) {
-            //假设只设置2级 1级为公司
-            List<pushDataDep> sp1 = listDep.stream().filter(e -> StringUtils.isNotEmpty(e.getUsci())).collect(Collectors.toList());
-            //先新增公司
-            pushDataDep pushDataDep = sp1.get(0);
+    private Long pushAddDep(List<pushDataDep> listDep, pushDataDep pushDataDep) {
             SysDept sysDept1 = sysDeptMapper.selectByusci(pushDataDep.getUsci());
             SysDept sysDept = new SysDept();
             sysDept.setUsci(pushDataDep.getUsci());
@@ -814,17 +822,28 @@ public class ProjectTaskServiceImpl   implements ProjectTaskService {
             sysDept.setKyId(pushDataDep.getKyId());
             sysDept.setParentId(100l);
             sysDept.setAncestors("0,100");
+            if (pushDataDep.getMaxDuration()!=null){
+                sysDept.setMaxDuration(pushDataDep.getMaxDuration());
+            }else {
+                sysDept.setMaxDuration(8d);
+            }
             if (sysDept1==null){
                 sysDeptMapper.insertDept(sysDept);
             }else {
                 sysDept.setDeptId(sysDept1.getDeptId());
                 sysDeptMapper.updateDept(sysDept);
             }
-            pushDep(listDep, pushDataDep.getKyId(),sysDept1);
+            pushDep(listDep, pushDataDep.getKyId(),sysDept);
             return pushDataDep.getDeptId();
     }
 
 
+    /**
+     *
+     * @param listDep 所有需要新增部门
+     * @param kyId  刚新增的部门kyId
+     * @param pushDataDep 公司
+     */
     private void pushDep(List<pushDataDep> listDep, String kyId, SysDept pushDataDep) {
         List<pushDataDep> sp2 = listDep.stream().filter(e ->
                 Objects.equals(e.getKySuperId(),kyId)).collect(Collectors.toList());