Ver Fonte

Merge branch 'master' into dev-lqc

lqc há 4 anos atrás
pai
commit
8661230bee

+ 17 - 17
src/main/java/com/mokamrp/privates/config/ApiPanic.java

@@ -6,20 +6,20 @@ import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.ControllerAdvice;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 
-@ControllerAdvice
-public class ApiPanic {
-    private final String feishu = "https://open.feishu.cn/open-apis/bot/v2/hook/538d8993-e23a-4836-863c-05515b41160e";
-    @Value("${spring.profiles.active}")
-    private String env;
-
-    @ExceptionHandler(value = Exception.class)
-    public String exceptionHandler(Exception e) {
-        if (env.equals("prod")) {
-            //.正式环境捕获API异常 推送到飞书
-            if (e.getMessage() != null){
-                Cmd.sendFeishuMsg(feishu, "[moka-private]:api panic " + e);
-            }
-        }
-        return e.getMessage();
-    }
-}
+//@ControllerAdvice
+//public class ApiPanic {
+//    private final String feishu = "https://open.feishu.cn/open-apis/bot/v2/hook/538d8993-e23a-4836-863c-05515b41160e";
+//    @Value("${spring.profiles.active}")
+//    private String env;
+//
+//    @ExceptionHandler(value = Exception.class)
+//    public String exceptionHandler(Exception e) {
+//        if (env.equals("prod")) {
+//            //.正式环境捕获API异常 推送到飞书
+//            if (e.getMessage() != null){
+//                Cmd.sendFeishuMsg(feishu, "[moka-private]:api panic " + e);
+//            }
+//        }
+//        return e.getMessage();
+//    }
+//}

+ 21 - 24
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxMobileController.java

@@ -28,7 +28,6 @@ import javax.validation.Valid;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.*;
-import java.util.stream.Collectors;
 
 
 /**
@@ -99,10 +98,10 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
 //            res.setList(list);
 
 //        } else {
-            //.正常查询
-            res = fosterwxMobileService.getList(getForsterwxMobileHandle);
-            List<FosterwxMobileVo> list = fosterwxMobileService.setWxFriend(res.getList());
-            res.setList(list);
+        //.正常查询
+        res = fosterwxMobileService.getList(getForsterwxMobileHandle);
+        List<FosterwxMobileVo> list = fosterwxMobileService.setWxFriend(res.getList());
+        res.setList(list);
 //        }
         return AjaxResult.success(res);
     }
@@ -156,24 +155,23 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
             return AjaxResult.error("该站点中该手机编码已存在!请确认!");
         }
         //.验证企微主体ID&客服昵称是否重复
-        if ((addHandle.getRaw().getWorkWxCorpId() != null || !addHandle.getRaw().getWorkWxCorpId().equals(0))
-                && (addHandle.getRaw().getCustserviceName() != null || !addHandle.getRaw().getCustserviceName().isEmpty())){
+        if (addHandle.getRaw().getWorkWxCorpId() != null && (addHandle.getRaw().getCustserviceName() != null || !addHandle.getRaw().getCustserviceName().isEmpty())) {
             Integer hasCorpIdAndCustServiceNm = fosterwxMobileService.count(
                     new QueryWrapper<FosterwxMobile>()
-                            .eq("work_wx_corp_id",addHandle.getRaw().getWorkWxCorpId())
-                            .eq("custservice_name",addHandle.getRaw().getCustserviceName())
+                            .eq("work_wx_corp_id", addHandle.getRaw().getWorkWxCorpId())
+                            .eq("custservice_name", addHandle.getRaw().getCustserviceName())
             );
-            if (hasCorpIdAndCustServiceNm > 0){
+            if (hasCorpIdAndCustServiceNm > 0) {
                 return AjaxResult.error("企微主体ID和客服昵称组合同时存在");
             }
         }
         //.验证teamID是否为空
-        if (addHandle.getRaw().getTeamId() != null || !addHandle.getRaw().getTeamId().isEmpty()){
+        if (addHandle.getRaw().getTeamId() != null && !addHandle.getRaw().getTeamId().isEmpty()) {
             Integer hasTeamId = fosterwxMobileService.count(
                     new QueryWrapper<FosterwxMobile>()
-                            .eq("team_id",addHandle.getRaw().getTeamId())
+                            .eq("team_id", addHandle.getRaw().getTeamId())
             );
-            if (hasTeamId > 0){
+            if (hasTeamId > 0) {
                 return AjaxResult.error("团队ID已经存在");
             }
         }
@@ -215,26 +213,26 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
 
             // 单独更新账号操作
             //.验证企微主体ID&客服昵称是否重复
-            if (!editHandle.getRaw().getWorkWxCorpId().equals(0) &&
-                    (editHandle.getRaw().getCustserviceName() != null || !editHandle.getRaw().getCustserviceName().isEmpty())){
+            if (null != editHandle.getRaw().getWorkWxCorpId() && !editHandle.getRaw().getWorkWxCorpId().equals(0) &&
+                    (editHandle.getRaw().getCustserviceName() != null && !editHandle.getRaw().getCustserviceName().isEmpty())) {
                 Integer hasCorpIdAndCustServiceNm = fosterwxMobileService.count(
                         new QueryWrapper<FosterwxMobile>()
-                                .ne("id",id)
-                                .eq("work_wx_corp_id",editHandle.getRaw().getWorkWxCorpId())
-                                .eq("custservice_name",editHandle.getRaw().getCustserviceName())
+                                .ne("id", id)
+                                .eq("work_wx_corp_id", editHandle.getRaw().getWorkWxCorpId())
+                                .eq("custservice_name", editHandle.getRaw().getCustserviceName())
                 );
-                if (hasCorpIdAndCustServiceNm > 0){
+                if (hasCorpIdAndCustServiceNm > 0) {
                     return AjaxResult.error("企微主体ID和客服昵称组合同时存在");
                 }
             }
             //.验证teamID是否为空
-            if (editHandle.getRaw().getTeamId() != null || !editHandle.getRaw().getTeamId().isEmpty()){
+            if (editHandle.getRaw().getTeamId() != null && !editHandle.getRaw().getTeamId().isEmpty()) {
                 Integer hasTeamId = fosterwxMobileService.count(
                         new QueryWrapper<FosterwxMobile>()
-                                .ne("id",id)
-                                .eq("team_id",editHandle.getRaw().getTeamId())
+                                .ne("id", id)
+                                .eq("team_id", editHandle.getRaw().getTeamId())
                 );
-                if (hasTeamId > 0){
+                if (hasTeamId > 0) {
                     return AjaxResult.error("团队ID已经存在");
                 }
             }
@@ -255,7 +253,6 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
             }
 
 
-
             AjaxResult ajaxResult = null;
             // 个微的任务相关操作
             if (null != editHandle.getRaw().getGwTaskTimeLists()) {

+ 8 - 8
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxMobileWxfriendServiceImpl.java

@@ -88,26 +88,26 @@ public class FosterwxMobileWxfriendServiceImpl extends ServiceImpl<FosterwxMobil
         List<FosterwxMobileWxfriend> friends = this.list(new QueryWrapper<FosterwxMobileWxfriend>()
                 .in("mobile_id",mobileIds)
         );
-        Map<Integer,Boolean> friendsNames = new HashMap<>();
+        Map<String,Boolean> friendsNames = new HashMap<>();
         for (FosterwxMobileWxfriend add :addFosterwxMobileHandle.getFriends()){
-            if(friendsNames.get(add.getFriendId()) != null){
-                res.setErr(HttpMsg.wxFriendResume+add.getFriendId().toString());
+            if(friendsNames.get(add.getWxName()) != null){
+                res.setErr(HttpMsg.wxFriendResume+add.getWxName());
                 return res;
             }
-            friendsNames.put(add.getFriendId(),true);
-            Boolean findRes = this.checkWxFriendCnt(friends,add.getFriendId());
+            friendsNames.put(add.getWxName(),true);
+            Boolean findRes = this.checkWxFriendCnt(friends,add.getWxName());
             if (!findRes){
-                res.setErr(HttpMsg.wxFriendCntMax3+add.getFriendId());
+                res.setErr(HttpMsg.wxFriendCntMax3+add.getWxName());
                 return res;
             }
         }
         return res;
     }
 
-    public Boolean checkWxFriendCnt(List<FosterwxMobileWxfriend> row,Integer friendId){
+    public Boolean checkWxFriendCnt(List<FosterwxMobileWxfriend> row,String wxName){
         Integer findCnt = 0;
         for (FosterwxMobileWxfriend fosterwxMobileWxfriend : row){
-            if (fosterwxMobileWxfriend.getFriendId().equals(friendId)){
+            if (fosterwxMobileWxfriend.getWxName().equals(wxName)){
                 findCnt++;
             }
             if (findCnt >= 3){