From aef13c72540c16bc38a70d366fe7005489b6673e Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 18 四月 2025 18:25:20 +0800
Subject: [PATCH] 工单业务

---
 server/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java    |   24 ++++++------
 server/src/main/java/com/doumee/service/business/impl/WorkorderServiceImpl.java |   61 ++++++++++++++++--------------
 server/src/main/resources/application.yml                                       |    2 
 server/src/main/java/com/doumee/api/web/WebMemberController.java                |    4 +-
 server/src/main/java/com/doumee/core/utils/qiyeweixin/QywxUtil.java             |    1 
 5 files changed, 49 insertions(+), 43 deletions(-)

diff --git a/server/src/main/java/com/doumee/api/web/WebMemberController.java b/server/src/main/java/com/doumee/api/web/WebMemberController.java
index e697dd8..4ad127f 100644
--- a/server/src/main/java/com/doumee/api/web/WebMemberController.java
+++ b/server/src/main/java/com/doumee/api/web/WebMemberController.java
@@ -54,8 +54,8 @@
     @PreventRepeat(limit = 10, lockTime = 10000)
     @ApiOperation("H5涓氬姟鐧诲綍")
     @PostMapping("/loginH5")
-    @EncryptionReq
-    @EncryptionResp
+//    @EncryptionReq
+//    @EncryptionResp
     public ApiResponse<Member> loginH5 (@RequestBody LoginH5DTO dto) {
         try {
             //鎷緾ODE鎹wid锛屽厛鏌ヤ笅鏈郴缁熸槸鍚﹀瓨鍦紝瀛樺湪鐩存帴杩斿洖member锛屽惁鍒欑敤qwid鏌ヨ浼佷笟鐢ㄦ埛鏁版嵁锛屾彃鍏ユ暟鎹簱锛坢ember)
diff --git a/server/src/main/java/com/doumee/core/utils/qiyeweixin/QywxUtil.java b/server/src/main/java/com/doumee/core/utils/qiyeweixin/QywxUtil.java
index 487fbf5..2f4f290 100644
--- a/server/src/main/java/com/doumee/core/utils/qiyeweixin/QywxUtil.java
+++ b/server/src/main/java/com/doumee/core/utils/qiyeweixin/QywxUtil.java
@@ -27,6 +27,7 @@
 
 
     private static QywxUtil qyUtil;
+
     @Value("${qiwei.serviceurl}")
     private    String qiweiUrl;
 
diff --git a/server/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java b/server/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
index f317f6c..89a00d9 100644
--- a/server/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
+++ b/server/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -436,18 +436,18 @@
         }
         String token = systemDictDataBiz.queryByCode(Constants.QYWX,Constants.QYWX_TOKEN).getCode();
         //鏍规嵁code鎹㈠尯浼佷笟寰俊ID
-        QywxBaseResponse<String> qwIdBaseResponse= null;// QywxUtil.getUserInfoByCode(token,dto.getCode());
-//        if(Objects.isNull(qwIdBaseResponse)||Objects.isNull(qwIdBaseResponse.getErrcode())){
-//            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浼佷笟寰俊鐧诲綍鐮佽В鏋愬け璐ワ紝璇疯仈绯荤鐞嗗憳");
-//        }
-//        if(!Constants.equalsInteger(qwIdBaseResponse.getErrcode(),Constants.ZERO)){
-//            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浼佷笟寰俊鐧诲綍澶辫触锛�"+qwIdBaseResponse.getErrmsg());
-//        }
-//        if(Objects.isNull(qwIdBaseResponse.getData())){
-//            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浼佷笟寰俊鐢ㄦ埛淇℃伅瑙f瀽澶辫触锛岃鑱旂郴绠$悊鍛�");
-//        }
-//        String qwId = qwIdBaseResponse.getData();
-        String qwId = dto.getCode();
+        QywxBaseResponse<String> qwIdBaseResponse=  QywxUtil.getUserInfoByCode(token,dto.getCode());
+        if(Objects.isNull(qwIdBaseResponse)||Objects.isNull(qwIdBaseResponse.getErrcode())){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浼佷笟寰俊鐧诲綍鐮佽В鏋愬け璐ワ紝璇疯仈绯荤鐞嗗憳");
+        }
+        if(!Constants.equalsInteger(qwIdBaseResponse.getErrcode(),Constants.ZERO)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浼佷笟寰俊鐧诲綍澶辫触锛�"+qwIdBaseResponse.getErrmsg());
+        }
+        if(Objects.isNull(qwIdBaseResponse.getData())){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"浼佷笟寰俊鐢ㄦ埛淇℃伅瑙f瀽澶辫触锛岃鑱旂郴绠$悊鍛�");
+        }
+        String qwId = qwIdBaseResponse.getData();
+//        String qwId = dto.getCode();
         Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda().eq(Member::getQwId,qwId).eq(Member::getIsdeleted,Constants.ZERO).last(" limit 1 "));
         if(Objects.isNull(member)){
             //鏍规嵁浼佷笟寰俊ID 鏌ヨ鐢ㄦ埛淇℃伅
diff --git a/server/src/main/java/com/doumee/service/business/impl/WorkorderServiceImpl.java b/server/src/main/java/com/doumee/service/business/impl/WorkorderServiceImpl.java
index 0507cab..eba8fd2 100644
--- a/server/src/main/java/com/doumee/service/business/impl/WorkorderServiceImpl.java
+++ b/server/src/main/java/com/doumee/service/business/impl/WorkorderServiceImpl.java
@@ -189,10 +189,10 @@
                 message = message + " <div class=\"normal\">"+  DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm") +"/"+ workorder.getLocationName() +"/"+  categoryName+"</div>";
             }else{
                 message = message + "  <div class=\"normal\">"+ (org.apache.commons.lang3.StringUtils.isNotBlank(userName)?userName:"绯荤粺") + (Constants.equalsInteger(contentType,Constants.ZERO)?"浠诲姟鍒嗛厤缁欎綘":(Constants.equalsInteger(contentType,Constants.ONE)?"瀵硅宸ュ崟杩涜浜嗗偓淇冿紝璇峰敖蹇鐞�":((Constants.equalsInteger(contentType,Constants.TWO)?"鎶勯�佺粰浣�":"宸插鐞嗕竴椤�")))) +"</div>";
-                message = message + "  <div class=\"normal\">瑙傚療涓婚"+  categoryName +"</div>";
+                message = message + "  <div class=\"normal\">瑙傚療涓婚  "+ categoryName +"</div>";
                 message = message + "  <div class=\"normal\">绗﹀悎锛�"+ workorder.getDcaYesNum()  +" 涓嶇鍚堬細"+workorder.getDcaNoNum()+"</div>";
                 if(Constants.equalsInteger(contentType,Constants.TWO)){
-                    message = message + "  <div class=\"normal\">璇存槑锛�"+ csInfo +"</div>";
+                    message = message + "  <div class=\"normal\">璇存槑    "+ csInfo +"</div>";
                 }
             }
             textCard.setDescription(message);
@@ -500,6 +500,7 @@
         if(Objects.isNull(workorder)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
+
         this.dealButton(workorder,member);
         //鏌ヨ闄勪欢淇℃伅
         List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda().eq(Multifile::getIsdeleted,Constants.ZERO)
@@ -514,7 +515,6 @@
             }
             workorder.setMultifileList(multifileList);
         }
-
         //鏌ヨ鏃ュ織淇℃伅
         workorder.setLogList(this.getLogList(workorder,member));
         if(Constants.equalsInteger(workorder.getType(),Constants.ONE)){
@@ -523,10 +523,12 @@
             param.setIsdeleted(Constants.ZERO);
             param.setDcaRecordId(workorder.getId());
             List<Workorder> dcaChildList = findList(param);
-            for (Workorder dcaChild:dcaChildList) {
-                this.dealButton(dcaChild,member);
+            if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(dcaChildList)){
+                for (Workorder dcaChild:dcaChildList) {
+                    this.dealButton(dcaChild,member);
+                }
+                workorder.setManagerId(dcaChildList.stream().filter(i->Objects.nonNull(i.getManagerId())).map(i->i.getManagerId()).collect(Collectors.joining(",")));
             }
-
             workorder.setDcaChildList(dcaChildList);
         }
         return workorder;
@@ -589,26 +591,29 @@
             Boolean canOpenUrgeButton = true;
             for (WorkorderLog workorderLog:logList) {
                 workorderLog.setUrgeButton(Constants.ZERO);
-                //鐗╀笟涓荤澶勭悊涓�
-                if(Constants.equalsInteger(workorder.getStatus(),Constants.ONE)){
-                    Member member = memberMapper.selectById(workorderLog.getParam1());
-                    if(Objects.nonNull(member) && org.apache.commons.lang3.StringUtils.isNotBlank(member.getQwId())
-                            && Objects.nonNull(loginMember) &&  Constants.equalsInteger(member.getId(),loginMember.getId())
-                            && workorder.getQwnoticeMemberIds().indexOf(member.getQwId())>=Constants.ZERO){
-                        workorderLog.setUrgeButton(Constants.ONE);
+                if(Constants.equalsInteger(workorderLog.getObjType(),Constants.TWO)||Constants.equalsInteger(workorderLog.getObjType(),Constants.ONE)){
+                    //鐗╀笟涓荤澶勭悊涓�
+                    if(Constants.equalsInteger(workorder.getStatus(),Constants.ONE)){
+                        Member member = memberMapper.selectById(workorderLog.getParam1());
+                        if(Objects.nonNull(member) && org.apache.commons.lang3.StringUtils.isNotBlank(member.getQwId())
+                                && Objects.nonNull(loginMember) &&  Constants.equalsInteger(member.getId(),loginMember.getId())
+                                && workorder.getQwnoticeMemberIds().indexOf(member.getQwId())>=Constants.ZERO){
+                            workorderLog.setUrgeButton(Constants.ONE);
+                        }
+                    }
+                    //宸ョ▼甯堝鐞嗕腑
+                    if(Constants.equalsInteger(workorder.getStatus(),Constants.TWO)){
+                        Member member = memberMapper.selectById(workorderLog.getParam1());
+                        if(Objects.nonNull(member) && org.apache.commons.lang3.StringUtils.isNotBlank(member.getQwId())
+                                && canOpenUrgeButton
+                                && (workorder.getQwnoticeMemberIds().indexOf(member.getQwId()) >= Constants.ZERO ||  member.getQwId().equals(workorder.getManagerId()) )
+                        ){
+                            workorderLog.setUrgeButton(Constants.ONE);
+                            canOpenUrgeButton = false;
+                        }
                     }
                 }
-                //宸ョ▼甯堝鐞嗕腑
-                if(Constants.equalsInteger(workorder.getStatus(),Constants.TWO)){
-                    Member member = memberMapper.selectById(workorderLog.getParam1());
-                    if(Objects.nonNull(member) && org.apache.commons.lang3.StringUtils.isNotBlank(member.getQwId())
-                            && canOpenUrgeButton
-                            && (workorder.getQwnoticeMemberIds().indexOf(member.getQwId()) >= Constants.ZERO ||  member.getQwId().equals(workorder.getManagerId()) )
-                    ){
-                        workorderLog.setUrgeButton(Constants.ONE);
-                        canOpenUrgeButton = false;
-                    }
-                }
+
                 //鏌ヨ闄勪欢淇℃伅
                 List<Multifile> multifileList = multifileMapper.selectList(new QueryWrapper<Multifile>().lambda()
                         .eq(Multifile::getIsdeleted,Constants.ZERO)
@@ -922,7 +927,7 @@
             workorder.setStatus(Constants.WorkOrderStatus.waitDeal.getKey());
         }
         workorder.setEditDate(new Date());
-        workorder.setUrgeDate(DateUtil.afterMinutesDate(new Date(),2));
+        workorder.setUrgeDate(DateUtil.afterMinutesDate(new Date(),10));
         workorderMapper.updateById(workorder);
         String paramr2 = member.getCompanyName()+"/"+member.getName();
         //澶勭悊涓婃姤鏃ュ織
@@ -1128,7 +1133,7 @@
     public void urge(Integer workorderId,Member member){
         Workorder workorder = workorderMapper.selectById(workorderId);
         workorder.setEditDate(new Date());
-        workorder.setUrgeDate(DateUtil.afterMinutesDate(new Date(),2));//DateUtil.afterHoursDate(new Date(),24));
+        workorder.setUrgeDate(DateUtil.afterMinutesDate(new Date(),10));
         workorderMapper.updateById(workorder);
         if(Objects.isNull(workorder)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌宸ュ崟鏁版嵁");
@@ -1159,13 +1164,13 @@
     public void jobUrge(){
         List<Workorder> workorderList = workorderMapper.selectList(new QueryWrapper<Workorder>().lambda().eq(Workorder::getIsdeleted,Constants.ZERO)
                 .in(Workorder::getStatus,Constants.WorkOrderStatus.waitAllocation.getKey(),Constants.WorkOrderStatus.waitDeal.getKey())
-                .apply(" urge_time > now() ")
+                .apply(" URGE_DATE < now() ")
         );
         if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(workorderList)){
             for (Workorder workorder:workorderList) {
                 this.autoUrge(workorder);
                 workorder.setEditDate(new Date());
-                workorder.setUrgeDate(DateUtil.afterMinutesDate(new Date(),2));//DateUtil.afterHoursDate(new Date(),24));
+                workorder.setUrgeDate(DateUtil.afterMinutesDate(new Date(),10));//DateUtil.afterHoursDate(new Date(),24));
                 workorderMapper.updateById(workorder);
             }
         }
diff --git a/server/src/main/resources/application.yml b/server/src/main/resources/application.yml
index 3425d71..cc6c4bb 100644
--- a/server/src/main/resources/application.yml
+++ b/server/src/main/resources/application.yml
@@ -9,7 +9,7 @@
 
 spring:
   profiles:
-    active: dev
+    active: test
   # JSON杩斿洖閰嶇疆
   jackson:
     # 榛樿鏃跺尯

--
Gitblit v1.9.3