leon пре 5 година
родитељ
комит
e5201d9a47

+ 3 - 0
src/main/java/com/mokamrp/privates/constant/HttpMsg.java

@@ -10,4 +10,7 @@ public class HttpMsg {
     public static final String needLogin = "请先登录";
 
     public static final String importSuccess = "导入数据成功";
+
+    public static final String wxFriendCntMax3 = "当前站点下,微信好友名称存在超过三个:";
+    public static final String wxFriendResume = "本次录入的微信好友昵称存在重复:";
 }

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

@@ -103,7 +103,7 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
         fosterwxMobileLambdaQueryWrapper.eq(FosterwxMobile::getStationId, addHandle.getRaw().getStationId());
         fosterwxMobileLambdaQueryWrapper.eq(FosterwxMobile::getMobileCode, addHandle.getRaw().getMobileCode());
         if (fosterwxMobileService.count(fosterwxMobileLambdaQueryWrapper) > 0) {
-            return AjaxResult.error("该站点中该手机编码已登陆!请确认!");
+            return AjaxResult.error("该站点中该手机编码已存在!请确认!");
         }
         FosterwxStation stationInfo = fosterwxStationService.getOne(new QueryWrapper<FosterwxStation>()
                 .eq("id", addHandle.getRaw().getStationId()));

+ 57 - 0
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxMobileWxfriendController.java

@@ -6,9 +6,12 @@ import com.mokamrp.privates.constant.HttpStatus;
 import com.mokamrp.privates.entity.PostBasePageHandle;
 import com.mokamrp.privates.entity.pangu.AddFosterwxMobileHandle;
 import com.mokamrp.privates.help.AjaxResult;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
+import com.mokamrp.privates.service.pangu.FosterwxMobileService;
 import com.mokamrp.privates.service.pangu.FosterwxStationService;
 import org.aspectj.weaver.loadtime.Aj;
+import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.*;
@@ -19,8 +22,10 @@ import com.mokamrp.privates.controller.BaseController;
 import javax.validation.Valid;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 
 /**
@@ -40,6 +45,9 @@ public class FosterwxMobileWxfriendController extends BaseController<FosterwxMob
 
     @Autowired
     public FosterwxStationService fosterwxStationService;
+
+    @Autowired
+    public FosterwxMobileService fosterwxMobileService;
     /*
      * @fast
      * 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
@@ -69,6 +77,24 @@ public class FosterwxMobileWxfriendController extends BaseController<FosterwxMob
         if (addFosterwxMobileHandle.getFriends() == null || addFosterwxMobileHandle.getFriends().size() <= 0){
             return AjaxResult.error(HttpMsg.error);
         }
+        //.判断好友微信名称是否同样的超过3个
+        FosterwxMobile fosterwxMobile = fosterwxMobileService.getOne(new QueryWrapper<FosterwxMobile>().eq("id",addFosterwxMobileHandle.getMobileId()));
+        List<FosterwxMobile> mobileList = fosterwxMobileService.list(new QueryWrapper<FosterwxMobile>().eq("station_id",fosterwxMobile.getStationId()));
+        List<Integer> mobileIds = mobileList.stream().map(FosterwxMobile::getId).collect(Collectors.toList());
+        List<FosterwxMobileWxfriend> friends = fosterwxMobileWxfriendService.list(new QueryWrapper<FosterwxMobileWxfriend>()
+                .in("mobile_id",mobileIds)
+        );
+        Map<String,Boolean> friendsNames = new HashMap<>();
+        for (FosterwxMobileWxfriend add :addFosterwxMobileHandle.getFriends()){
+            if(friendsNames.get(add.getWxName()) == null){
+                return AjaxResult.error(HttpMsg.wxFriendResume+add.getWxName());
+            }
+            friendsNames.put(add.getWxName(),true);
+            Boolean findRes = this.checkWxFriendCnt(friends,add.getWxName());
+            if (!findRes){
+                return AjaxResult.error(HttpMsg.wxFriendCntMax3+add.getWxName());
+            }
+        }
         fosterwxMobileWxfriendService.removeAndAdd(addFosterwxMobileHandle);
         return AjaxResult.success();
     }
@@ -92,6 +118,24 @@ public class FosterwxMobileWxfriendController extends BaseController<FosterwxMob
         if (addFosterwxMobileHandle.getFriends() == null || addFosterwxMobileHandle.getFriends().size() <= 0){
             return AjaxResult.error(HttpMsg.error);
         }
+        //.判断好友微信名称是否同样的超过3个
+        FosterwxMobile fosterwxMobile = fosterwxMobileService.getOne(new QueryWrapper<FosterwxMobile>().eq("id",addFosterwxMobileHandle.getMobileId()));
+        List<FosterwxMobile> mobileList = fosterwxMobileService.list(new QueryWrapper<FosterwxMobile>().eq("station_id",fosterwxMobile.getStationId()));
+        List<Integer> mobileIds = mobileList.stream().map(FosterwxMobile::getId).collect(Collectors.toList());
+        List<FosterwxMobileWxfriend> friends = fosterwxMobileWxfriendService.list(new QueryWrapper<FosterwxMobileWxfriend>()
+             .in("mobile_id",mobileIds)
+        );
+        Map<String,Boolean> friendsNames = new HashMap<>();
+        for (FosterwxMobileWxfriend add :addFosterwxMobileHandle.getFriends()){
+            if(friendsNames.get(add.getWxName()) == null){
+                return AjaxResult.error(HttpMsg.wxFriendResume+add.getWxName());
+            }
+            friendsNames.put(add.getWxName(),true);
+            Boolean findRes = this.checkWxFriendCnt(friends,add.getWxName());
+            if (!findRes){
+                return AjaxResult.error(HttpMsg.wxFriendCntMax3+add.getWxName());
+            }
+        }
         //.登录验证
         FosterwxStation fosterwxStation = fosterwxStationService.getAuthInfo(token);
         if (fosterwxStation == null){
@@ -100,5 +144,18 @@ public class FosterwxMobileWxfriendController extends BaseController<FosterwxMob
         fosterwxMobileWxfriendService.removeAndAdd(addFosterwxMobileHandle);
         return AjaxResult.success();
     }
+
+    private Boolean checkWxFriendCnt(List<FosterwxMobileWxfriend> row,String wxName){
+        Integer findCnt = 0;
+        for (FosterwxMobileWxfriend fosterwxMobileWxfriend : row){
+            if (fosterwxMobileWxfriend.getWxName().equals(wxName)){
+                findCnt++;
+            }
+            if (findCnt >= 3){
+                return false;
+            }
+        }
+        return true;
+    }
 }
 

+ 3 - 2
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxStationBindBoxController.java

@@ -3,6 +3,7 @@ package com.mokamrp.privates.controller.pangu;
 import com.mokamrp.privates.constant.HttpMsg;
 import com.mokamrp.privates.constant.HttpStatus;
 import com.mokamrp.privates.entity.PostBasePageHandle;
+import com.mokamrp.privates.entity.pangu.GetForsterwxStationBindBoxHandle;
 import com.mokamrp.privates.help.AjaxResult;
 import com.mokamrp.privates.help.Analysis;
 import com.mokamrp.privates.interceptor.AuthUser;
@@ -48,11 +49,11 @@ public class FosterwxStationBindBoxController extends BaseController<FosterwxSta
      */
 
     @PostMapping("/list")
-    public Object list(@Valid @RequestBody PostBasePageHandle postBasePageHandle, BindingResult bindingResult){
+    public Object list(@Valid @RequestBody GetForsterwxStationBindBoxHandle getForsterwxStationBindBoxHandle, BindingResult bindingResult){
         if (bindingResult.hasErrors()) {
             return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
         }
-        Map<String,Object> res = fosterwxStationBindBoxService.getList(postBasePageHandle);
+        Map<String,Object> res = fosterwxStationBindBoxService.getList(getForsterwxStationBindBoxHandle);
         return AjaxResult.success(res);
     }
 

+ 20 - 0
src/main/java/com/mokamrp/privates/entity/pangu/GetForsterwxStationBindBoxHandle.java

@@ -0,0 +1,20 @@
+package com.mokamrp.privates.entity.pangu;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class GetForsterwxStationBindBoxHandle {
+    private Integer id;
+    private Integer page;
+    private Integer pagesize;
+    private Integer stationId;
+    private String stationName;
+    private Integer type;
+    private String boxName;
+    private List<String> ghId;
+    private Integer uploadUid;
+    private String createDate;
+    private String updateDate;
+}

+ 2 - 1
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxStationBindBoxMapper.java

@@ -1,5 +1,6 @@
 package com.mokamrp.privates.mapper.pangu;
 
+import com.mokamrp.privates.entity.pangu.GetForsterwxStationBindBoxHandle;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStationBindBox;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -17,5 +18,5 @@ import java.util.List;
  */
 @Component
 public interface FosterwxStationBindBoxMapper extends BaseMapper<FosterwxStationBindBox> {
-    public List<FosterwxStationBindBox> getList(Page<FosterwxStationBindBox> pageObj);
+    public List<FosterwxStationBindBox> getList(Page<FosterwxStationBindBox> pageObj, @Param("handle") GetForsterwxStationBindBoxHandle getForsterwxStationBindBoxHandle);
 }

+ 12 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxStationBindBoxMapper.xml

@@ -21,5 +21,17 @@
     </sql>
     <select id="getList" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxStationBindBox">
         SELECT * FROM pan_fosterwx_station_bind_box
+        <where>
+            <if test="handle.id != null">and id = #{handle.id}</if>
+            <if test="handle.stationId != null">and station_id = #{handle.stationId}</if>
+            <if test="handle.type != null">and type = #{handle.type}</if>
+            <if test="handle.boxName != null">and box_name like CONCAT('%',#{handle.boxName},'%')</if>
+            <if test="handle.ghId != null and handle.ghId.size() > 0">and gh_id in
+                <foreach item="item" index="index" collection="handle.ghId" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="handle.uploadUid">and upload_uid = #{handle.uploadUid}</if>
+        </where>
     </select>
 </mapper>

+ 2 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxTaskSchedule.java

@@ -92,6 +92,8 @@ public class FosterwxTaskSchedule extends Model<FosterwxTaskSchedule> {
      */
     private String errMsg;
 
+    private String errImage;
+
     /**
      * 检查备注
      */

+ 2 - 1
src/main/java/com/mokamrp/privates/service/pangu/FosterwxStationBindBoxService.java

@@ -1,5 +1,6 @@
 package com.mokamrp.privates.service.pangu;
 
+import com.mokamrp.privates.entity.pangu.GetForsterwxStationBindBoxHandle;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStationBindBox;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.mokamrp.privates.entity.PostBasePageHandle;
@@ -17,7 +18,7 @@ import java.util.Map;
  */
 public interface FosterwxStationBindBoxService extends IService<FosterwxStationBindBox> {
     //.@leon 获取数据列表
-    public Map<String, Object> getList(PostBasePageHandle handle);
+    public Map<String, Object> getList(GetForsterwxStationBindBoxHandle handle);
     //.@leon 导入数据
     public Boolean importData(List<Map<String,String>> row, User authUser);
 }

+ 3 - 2
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxStationBindBoxServiceImpl.java

@@ -1,5 +1,6 @@
 package com.mokamrp.privates.service.pangu.impl;
 
+import com.mokamrp.privates.entity.pangu.GetForsterwxStationBindBoxHandle;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStationBindBox;
 import com.mokamrp.privates.mapper.pangu.FosterwxStationBindBoxMapper;
 import com.mokamrp.privates.mapper.pojo.User;
@@ -34,11 +35,11 @@ public class FosterwxStationBindBoxServiceImpl extends ServiceImpl<FosterwxStati
      * @param handle
      * @return
      */
-    public Map<String, Object> getList(PostBasePageHandle handle) {
+    public Map<String, Object> getList(GetForsterwxStationBindBoxHandle handle) {
         Integer pagesize = handle.getPagesize();
         Integer page = handle.getPage();
         Page<FosterwxStationBindBox> pageObj = new Page<FosterwxStationBindBox>(page, pagesize);
-        List<FosterwxStationBindBox> list = fosterwxStationBindBoxMapper.getList(pageObj);
+        List<FosterwxStationBindBox> list = fosterwxStationBindBoxMapper.getList(pageObj,handle);
         Map<String, Object> resMap = new HashMap<String, Object>();
         resMap.put("list", list);
         resMap.put("total", pageObj.getTotal());

+ 1 - 1
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxTaskScheduleServiceImpl.java

@@ -56,7 +56,7 @@ public class FosterwxTaskScheduleServiceImpl extends ServiceImpl<FosterwxTaskSch
         Integer page = handle.getPage();
         Page<FosterwxTaskSchedule> pageObj = new Page<FosterwxTaskSchedule>(page, pagesize);
         QueryWrapper<FosterwxTaskSchedule> fosterwxTaskScheduleQueryWrapper = new QueryWrapper<>();
-        fosterwxTaskScheduleQueryWrapper.select("distinct station_id,station_name,task_id,task_name,task_status,task_content,task_send_status,create_uid,send_date,send_time,err_msg,mark");
+        fosterwxTaskScheduleQueryWrapper.select("distinct station_id,station_name,task_id,task_name,task_status,task_content,task_send_status,create_uid,send_date,send_time,err_msg,err_image,mark");
         if (null != handle.getDate() && !handle.getDate().isEmpty())
             fosterwxTaskScheduleQueryWrapper.eq("send_date", LocalDate.parse(handle.getDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
         if (null != handle.getId()) fosterwxTaskScheduleQueryWrapper.eq("id", handle.getId());

+ 1 - 0
src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxTaskEdit.java

@@ -61,6 +61,7 @@ public class SyncFosterwxTaskEdit {
                 }
                 FosterwxTaskSchedule save = new FosterwxTaskSchedule();
                 save.setErrMsg(fosterwxTaskSchedule.getErrMsg());
+                save.setErrImage(fosterwxTaskSchedule.getErrImage());
                 if (!fosterwxTaskSchedule.getTaskStatus().equals(0)) {
                     save.setTaskStatus(fosterwxTaskSchedule.getTaskStatus());
                 }

+ 1 - 0
src/main/resources/application-local.properties

@@ -57,6 +57,7 @@ xxl-sso.excluded.paths=/healthy,\
   /pangu/fosterwxMobile/addMobilePro,\
   /pangu/fosterwxFlowList/changeStatus,\
   /pangu/fosterwxFlowList/list,\
+  /pangu/fosterwxStation/login,\
   /pangu/fosterwxMobilePool/getOutOfServerList
 #xxl.sso.redis.address=redis://xxl-sso:Jch9shshl@r-uf633f3f27aa2174pd.redis.rds.aliyuncs.com:6379/0
 xxl.sso.redis.address=redis://xxl-sso:MokaSapce666$%25_RediS@r-uf6727zrr24ioihy72pd.redis.rds.aliyuncs.com:23563/0

+ 1 - 0
src/main/resources/application-prod.properties

@@ -52,6 +52,7 @@ xxl-sso.excluded.paths=/healthy,\
   /pangu/fosterwxMobile/addMobilePro,\
   /pangu/fosterwxFlowList/changeStatus,\
   /pangu/fosterwxFlowList/list,\
+  /pangu/fosterwxStation/login,\
   /pangu/fosterwxMobilePool/getOutOfServerList
 xxl.sso.redis.address=redis://xxl-sso:MokaSapce666$%25_RediS@r-uf6727zrr24ioihy72.redis.rds.aliyuncs.com:6379/0
 menu.host=http://space-server-in-svc/space/menu/getMenuInterface?sysCode=1006&userId=

+ 1 - 0
src/main/resources/application-test.properties

@@ -52,6 +52,7 @@ xxl-sso.excluded.paths=/healthy,\
 /pangu/fosterwxMobile/addMobilePro,\
 /pangu/fosterwxFlowList/changeStatus,\
 /pangu/fosterwxFlowList/list,\
+/pangu/fosterwxStation/login,\
 /pangu/fosterwxMobilePool/getOutOfServerList
 #xxl.sso.redis.address=redis://xxl-sso:Jch9shshl@r-uf633f3f27aa2174pd.redis.rds.aliyuncs.com:6379/0
 xxl.sso.redis.address=redis://xxl-sso:MokaSapce666$%25_RediS@r-uf6727zrr24ioihy72pd.redis.rds.aliyuncs.com:23563/0