Browse Source

小程序优化

3254194295 2 years ago
parent
commit
a517eb5c68

+ 1 - 1
platform-dao/src/main/resources/mapper/check/CheckJobMapper.xml

@@ -318,7 +318,7 @@
                 and check_user_id in (select user_id from t_sys_user_dept where dept_id=#{deptId})
             </if>
             <if test="type!=null">
-                type=#{type}
+                and type=#{type}
             </if>
         </where>
         group by status

+ 1 - 1
platform-dao/src/main/resources/mapper/repair/RepairApplicationFormMapper.xml

@@ -281,7 +281,7 @@
     <select id="getRepairCount" resultType="com.platform.dao.vo.repair.RepairApplicationFormVO"
             parameterType="com.platform.dao.dto.repair.RepairApplicationFormDTO"
     >
-        select status, count(*) repairCount from t_repair_application_form form left JOIN t_sys_user_dept dept ON
+        select status, count(1) repairCount from t_repair_application_form form left JOIN t_sys_user_dept dept ON
         dept.user_id=form.repair_user_id
         <where>
             <if test="statusList != null and statusList.size > 0">

+ 12 - 12
platform-rest/src/main/java/com/platform/rest/controller/repair/RepairApplicationFormController.java

@@ -354,18 +354,18 @@ public class RepairApplicationFormController {
     @SysLog("获取报修人或维修人或维修主管,或仓库管理员下的‘最近的一个工单")
     @GetMapping("/getRepairApplicationForm")
     public R getRepairApplicationForm() {
-//        UserInfo userInfo=new UserInfo();
-//        List list=new ArrayList();
-//        list.add("workplace_store_normal");
-//        list.add("workplace_store_manage");
-//        list.add("workplace-repair-normal");
-//        list.add("workplace-repair-manage");
-//        list.add("REPAIR_MANAGE");
-//        list.add("REPAIR_EXAMINE");
-//        userInfo.setUserId("629ff44ad2b1150bf0e3f834");
-//        userInfo.setRoleCodes(list);
-//        userInfo.setSuperAdmin(0);
-        UserInfo userInfo= SecurityUtils.getUserInfo();
+        UserInfo userInfo=new UserInfo();
+        List list=new ArrayList();
+        list.add("workplace_store_normal");
+        list.add("workplace_store_manage");
+        list.add("workplace-repair-normal");
+        list.add("workplace-repair-manage");
+        list.add("REPAIR_MANAGE");
+        list.add("REPAIR_EXAMINE");
+        userInfo.setUserId("629ff44ad2b1150bf0e3f834");
+        userInfo.setRoleCodes(list);
+        userInfo.setSuperAdmin(0);
+//        UserInfo userInfo= SecurityUtils.getUserInfo();
         // 根据用户的角色来定
         StringBuilder roleCodes = new StringBuilder();
         userInfo.getRoleCodes().forEach(item-> {

+ 31 - 20
platform-service/src/main/java/com/platform/service/repair/impl/RepairApplicationFormServiceImpl.java

@@ -212,9 +212,9 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
             }else if(vo.getStatus()==CheckJobStatusEnum.EXECUTING.getValue()){
                 noticeNumberVO.setExecutedTaskNum(vo.getCountNum()==null?initNum:vo.getCountNum());
             }
-//            if(vo.getReceiveOvertime()!=null&&vo.getReceiveOvertime()){
-//                noticeNumberVO.setTimeOutTaskNum(vo.getCountNum()==null?initNum:vo.getCountNum());
-//            }
+            if(vo.getReceiveOvertime()!=null&&vo.getReceiveOvertime()){
+                noticeNumberVO.setTimeOutTaskNum(vo.getCountNum()==null?initNum:vo.getCountNum());
+            }
             BigDecimal num=vo.getCountNum()==null?initNum:vo.getCountNum();
             count=new BigDecimal(count.intValue()+num.intValue());
         }
@@ -241,17 +241,17 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
     public NoticeNumberVO getNoticeNumberVO() {
         Long t1=System.currentTimeMillis();
         NoticeNumberVO noticeNumberVO=new NoticeNumberVO();
-        UserInfo userInfo=SecurityUtils.getUserInfo();
-//        UserInfo userInfo=new UserInfo();
-//        List list=new ArrayList();
-//        list.add("workplace_store_normal");
-//        list.add("workplace_store_manage");
-//        list.add("workplace-repair-normal");
-//        list.add("workplace-repair-manage");
-//        list.add("REPAIR_MANAGE");
-//        userInfo.setSuperAdmin(0);
-//        userInfo.setUserId("629ff44ad2b1150bf0e3f834");
-//        userInfo.setRoleCodes(list);
+//        UserInfo userInfo=SecurityUtils.getUserInfo();
+        UserInfo userInfo=new UserInfo();
+        List list=new ArrayList();
+        list.add("workplace_store_normal");
+        list.add("workplace_store_manage");
+        list.add("workplace-repair-normal");
+        list.add("workplace-repair-manage");
+        list.add("REPAIR_MANAGE");
+        userInfo.setSuperAdmin(0);
+        userInfo.setUserId("629ff44ad2b1150bf0e3f834");
+        userInfo.setRoleCodes(list);
         InStoreFormDTO inStoreFormDTO=new InStoreFormDTO();
         OutStoreFormDTO outStoreFormDTO=new OutStoreFormDTO();
         StoreCheckJobDTO storeCheckJobDTO=new StoreCheckJobDTO();
@@ -303,15 +303,22 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
 //                repairApplicationFormDTO.setDeptId(deptId);
                 repairApplicationFormDTO.setDispatchUserId(userInfo.getUserId());
                 repairApplicationFormVOS= mapper.getRepairCount(repairApplicationFormDTO);
+                Long int1=System.currentTimeMillis();
                 noticeNumberVO=addRepairNums(noticeNumberVO,repairApplicationFormVOS);
+                System.out.println("addRepairNums:"+(System.currentTimeMillis()-int1));
                 //保养
                 checkJobDTO.setDeptId(deptId);
-                checkJobMapper.getCheckJobCount1(checkJobDTO);
+                Long int2=System.currentTimeMillis();
                 checkJobVOS=checkJobMapper.getCheckJobCount1(checkJobDTO);
+                System.out.println("checkJobMapper:"+(System.currentTimeMillis()-int2));
                 checkJobDTO.setReceiveOvertime(true);
+                Long int3=System.currentTimeMillis();
                 BigDecimal overTimeCount=checkJobMapper.getReceiveOverTimeCount(checkJobDTO);
+                System.out.println("checkJobMapperoverTimeCount:"+(System.currentTimeMillis()-int3));
                 noticeNumberVO.setTimeOutTaskNum(overTimeCount==null?initNum:overTimeCount);
+                Long int4=System.currentTimeMillis();
                 noticeNumberVO=addCheckJobNums(noticeNumberVO,checkJobVOS);
+                System.out.println("addCheckJobNums:"+(System.currentTimeMillis()-int4));
             }
             if(sb.toString().contains(CommonConstants.WORKPLACE_STORE_MANAGE) &&!sb.toString().contains(CommonConstants.WORKPLACE_REPAIR_MANAGE) && !sb.toString().contains(SysRoleCodeEnum.REPAIR_MANAGE.name()) ){
                 //仓库管理员
@@ -336,7 +343,7 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
 ////        BigDecimal num=workplaceBacklogMapper.getWorkplaceBacklogCount("1");
         BigDecimal num=workplaceBacklogMapper.getWorkplaceBacklogCount(userInfo.getUserId());
         Long t2=System.currentTimeMillis();
-        System.out.println(t2-t1);
+        System.out.println("getNums:"+(t2-t1));
         noticeNumberVO.setUnreadNum(num);
         return noticeNumberVO;
     }
@@ -474,16 +481,20 @@ public class RepairApplicationFormServiceImpl extends BaseServiceImpl<RepairAppl
 //                repairApplicationFormVO.setRoleFlag(3);
             }
 
-        BigDecimal count=initNum;
+        BigDecimal count;
+
+        Long int4=System.currentTimeMillis();
         repairApplicationFormVO=mapper.getFirstRepairApplicationFormVO(repairApplicationFormDTO);
+        System.out.println("getFirstRepairApplicationFormVO:"+(System.currentTimeMillis()-int4));
         if(repairApplicationFormVO!=null){
             repairApplicationFormVO.setRoleFlag(roleFlag);
             repairApplicationFormDTO.setStatus(repairApplicationFormVO.getStatus());
+            Long int5=System.currentTimeMillis();
             count=mapper.getRepairCount1(repairApplicationFormDTO);
-            repairApplicationFormVO.setRepairCount(count);
+            repairApplicationFormVO.setRepairCount(count==null?initNum:count);
+            System.out.println("getRepairCount1:"+(System.currentTimeMillis()-int5));
         }
-        Long t2=System.currentTimeMillis();
-        System.out.println(t2-t1);
+        System.out.println("getRepairApplicationForm:"+(System.currentTimeMillis()-t1));
         return repairApplicationFormVO;