Просмотр исходного кода

Merge branch '盘古养号好友整改' into test

leon 4 лет назад
Родитель
Сommit
e5fc3b7a9c
34 измененных файлов с 912 добавлено и 77 удалено
  1. 1 1
      src/main/java/com/mokamrp/privates/constant/HttpMsg.java
  2. 8 0
      src/main/java/com/mokamrp/privates/constant/RedisKey.java
  3. 3 6
      src/main/java/com/mokamrp/privates/controller/pangu/FosterwxMobileController.java
  4. 55 0
      src/main/java/com/mokamrp/privates/controller/pangu/FosterwxMobileForbiddenRecordController.java
  5. 4 3
      src/main/java/com/mokamrp/privates/controller/pangu/FosterwxMobileWxfriendController.java
  6. 4 3
      src/main/java/com/mokamrp/privates/controller/pangu/FosterwxWxfriendController.java
  7. 1 0
      src/main/java/com/mokamrp/privates/entity/PostBasePageHandle.java
  8. 1 1
      src/main/java/com/mokamrp/privates/entity/pangu/AddFosterwxMobileHandle.java
  9. 22 0
      src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileForbiddenRecordMapper.java
  10. 37 0
      src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileForbiddenRecordMapper.xml
  11. 3 0
      src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileWxfriendMapper.java
  12. 24 3
      src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileWxfriendMapper.xml
  13. 3 2
      src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxWxfriendMapper.java
  14. 10 2
      src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxWxfriendMapper.xml
  15. 2 0
      src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxMobile.java
  16. 174 0
      src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxMobileForbiddenRecord.java
  17. 9 3
      src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxMobileWxfriend.java
  18. 37 1
      src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxWxfriend.java
  19. 20 0
      src/main/java/com/mokamrp/privates/service/pangu/FosterwxMobileForbiddenRecordService.java
  20. 9 1
      src/main/java/com/mokamrp/privates/service/pangu/FosterwxMobileWxfriendService.java
  21. 1 1
      src/main/java/com/mokamrp/privates/service/pangu/FosterwxWxfriendService.java
  22. 43 0
      src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxMobileForbiddenRecordServiceImpl.java
  23. 24 28
      src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxMobileServiceImpl.java
  24. 39 15
      src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxMobileWxfriendServiceImpl.java
  25. 2 2
      src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxWxfriendServiceImpl.java
  26. 65 0
      src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxCanBindFriendToRedis.java
  27. 69 0
      src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxCanSwitchFriendToRedis.java
  28. 35 0
      src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxFriendToRedis.java
  29. 7 1
      src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxMobile.java
  30. 5 3
      src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxMobileEdit.java
  31. 63 0
      src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxMobileFriendToRedis.java
  32. 50 0
      src/main/java/com/mokamrp/privates/task/pangu/UpdateFosterwxFriendStatus.java
  33. 81 0
      src/main/java/com/mokamrp/privates/task/pangu/UpdateFosterwxMobileStatus.java
  34. 1 1
      src/test/java/com/mokamrp/AutoMPPangu.java

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

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

+ 8 - 0
src/main/java/com/mokamrp/privates/constant/RedisKey.java

@@ -51,6 +51,14 @@ public class RedisKey {
     public static final String PanPromoteNoticeRecode = "pan_promote_notice_recode:";
     //.盘古 微信养号视频库
     public static final String PanWxFosterTeachingVideo = "pan_wxfoster_teaching_video_info";
+    //.盘古 站点微信好友库
+    public static final String PanWxFosterFriendInfo = "pan_wxfoster_friend_info:";
+    //.盘古 账号绑定的微信好友ID
+    public static final String PanWxFosterMobileFriendId = "pan_wxfoster_mobile_friend_id:";
+    //.盘古 站点内可被替换的解封微信好友ID
+    public static final String PanWxFosterCanSwitchFriendId = "pan_wxfoster_can_switch_friend_id:";
+    //.盘古 站点内可被绑定的解封微信好友ID
+    public static final String PanWxFosterCanBindFriendId = "pan_wxfoster_can_bind_friend_id:";
 
 }
 

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

@@ -563,12 +563,9 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
         feild.put(13, "wxIdentityCardNo|default");
         feild.put(14, "bankCardNo|default");
         feild.put(15, "bankCardMobileNo");
-        feild.put(16, "wxFriendName1");
-        feild.put(17, "wxFriendUserName1");
-        feild.put(18, "wxFriendName2");
-        feild.put(19, "wxFriendUserName2");
-        feild.put(20, "wxFriendName3");
-        feild.put(21, "wxFriendUserName3");
+        feild.put(16, "wxFriendId1|default");
+        feild.put(17, "wxFriendId2|default");
+        feild.put(18, "wxFriendId3|default");
         feild.put(22, "workWxCorp|default");
         feild.put(23, "workWxRegisterAt|default");
         List<Map<String, String>> row = new ArrayList<>();

+ 55 - 0
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxMobileForbiddenRecordController.java

@@ -0,0 +1,55 @@
+package com.mokamrp.privates.controller.pangu;
+
+import com.mokamrp.privates.constant.HttpStatus;
+import com.mokamrp.privates.entity.PostBasePageHandle;
+import com.mokamrp.privates.help.AjaxResult;
+import com.mokamrp.privates.entity.ResHandle;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.RequestMapping;
+import com.mokamrp.privates.service.pangu.FosterwxMobileForbiddenRecordService;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileForbiddenRecord;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import com.mokamrp.privates.controller.BaseController;
+import javax.validation.Valid;
+import java.util.Map;
+import java.util.List;
+
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 盘古养号账号封禁记录 前端控制器
+ * </p>
+ *
+ * @author leon
+ * @since 2021-11-13
+ */
+@RestController
+@RequestMapping("/fosterwxMobileForbiddenRecord")
+public class FosterwxMobileForbiddenRecordController extends BaseController<FosterwxMobileForbiddenRecord> {
+
+    @Autowired
+    public FosterwxMobileForbiddenRecordService fosterwxMobileForbiddenRecordService;
+
+    /*
+     * @fast
+     * 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
+     * 如果需要定制化,需要将BaseController中对应的方法复制到当前控制器,然后进行修改
+     */
+
+    @PostMapping("/list")
+    public Object list(@Valid @RequestBody PostBasePageHandle postBasePageHandle, BindingResult bindingResult){
+        if (bindingResult.hasErrors()) {
+            return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
+        }
+        ResHandle<List<FosterwxMobileForbiddenRecord>> res = fosterwxMobileForbiddenRecordService.getList(postBasePageHandle);
+        return AjaxResult.success(res);
+    }
+
+
+}
+

+ 4 - 3
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxMobileWxfriendController.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.mokamrp.privates.constant.HttpMsg;
 import com.mokamrp.privates.constant.HttpStatus;
 import com.mokamrp.privates.entity.PostBasePageHandle;
+import com.mokamrp.privates.entity.ResHandle;
 import com.mokamrp.privates.entity.VoltaHandle;
 import com.mokamrp.privates.entity.pangu.AddFosterwxMobileHandle;
 import com.mokamrp.privates.help.AjaxResult;
@@ -60,7 +61,7 @@ public class FosterwxMobileWxfriendController extends BaseController<FosterwxMob
         if (bindingResult.hasErrors()) {
             return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
         }
-        Map<String,Object> res = fosterwxMobileWxfriendService.getList(postBasePageHandle);
+        ResHandle<List<FosterwxMobileWxfriend>> res = fosterwxMobileWxfriendService.getList(postBasePageHandle);
         return AjaxResult.success(res);
     }
 
@@ -75,7 +76,7 @@ public class FosterwxMobileWxfriendController extends BaseController<FosterwxMob
         if (bindingResult.hasErrors()) {
             return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
         }
-        if (addFosterwxMobileHandle.getFriends() == null || addFosterwxMobileHandle.getFriends().size() <= 0){
+        if (addFosterwxMobileHandle.getFriendIds() == null || addFosterwxMobileHandle.getFriendIds().size() <= 0){
             return AjaxResult.error(HttpMsg.error);
         }
         //.判断好友微信名称是否同样的超过3个
@@ -103,7 +104,7 @@ public class FosterwxMobileWxfriendController extends BaseController<FosterwxMob
         if (bindingResult.hasErrors()) {
             return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
         }
-        if (addFosterwxMobileHandle.getFriends() == null || addFosterwxMobileHandle.getFriends().size() <= 0){
+        if (addFosterwxMobileHandle.getFriendIds() == null || addFosterwxMobileHandle.getFriendIds().size() <= 0){
             return AjaxResult.error(HttpMsg.error);
         }
         //.好友验证

+ 4 - 3
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxWxfriendController.java

@@ -4,6 +4,7 @@ import com.mokamrp.privates.constant.HttpStatus;
 import com.mokamrp.privates.entity.PostBasePageHandle;
 import com.mokamrp.privates.help.AjaxResult;
 import com.mokamrp.privates.entity.ResHandle;
+import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -26,10 +27,11 @@ import org.springframework.web.bind.annotation.RestController;
  * </p>
  *
  * @author leon
- * @since 2021-11-03
+ * @since 2021-11-10
  */
 @RestController
-@RequestMapping("/fosterwxWxfriend")
+@RequestMapping("/pangu/fosterwxWxfriend")
+@Api(tags = "个微养号站点好友管理")
 public class FosterwxWxfriendController extends BaseController<FosterwxWxfriend> {
 
     @Autowired
@@ -49,6 +51,5 @@ public class FosterwxWxfriendController extends BaseController<FosterwxWxfriend>
         ResHandle<List<FosterwxWxfriend>> res = fosterwxWxfriendService.getList(postBasePageHandle);
         return AjaxResult.success(res);
     }
-
 }
 

+ 1 - 0
src/main/java/com/mokamrp/privates/entity/PostBasePageHandle.java

@@ -20,6 +20,7 @@ public class PostBasePageHandle {
     private String ghId;
     private Integer uploadUid;
     private Integer wxType;
+    private Integer status;
     public Integer getPage() {
         return page;
     }

+ 1 - 1
src/main/java/com/mokamrp/privates/entity/pangu/AddFosterwxMobileHandle.java

@@ -8,5 +8,5 @@ import java.util.List;
 @Data
 public class AddFosterwxMobileHandle {
     private Integer mobileId;
-    private List<FosterwxMobileWxfriend> friends;
+    private List<Integer> friendIds;
 }

+ 22 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileForbiddenRecordMapper.java

@@ -0,0 +1,22 @@
+package com.mokamrp.privates.mapper.pangu;
+
+import com.mokamrp.privates.entity.PostBasePageHandle;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileForbiddenRecord;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.stereotype.Component;
+import org.apache.ibatis.annotations.Param;
+import java.util.List;
+
+/**
+ * <p>
+ * 盘古养号账号封禁记录 Mapper 接口
+ * </p>
+ *
+ * @author leon
+ * @since 2021-11-13
+ */
+@Component
+public interface FosterwxMobileForbiddenRecordMapper extends BaseMapper<FosterwxMobileForbiddenRecord> {
+    public List<FosterwxMobileForbiddenRecord> getList(Page<FosterwxMobileForbiddenRecord> pageObj, @Param("params")PostBasePageHandle handle);
+}

+ 37 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileForbiddenRecordMapper.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.mokamrp.privates.mapper.pangu.FosterwxMobileForbiddenRecordMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileForbiddenRecord">
+        <id column="id" property="id"/>
+        <result column="type" property="type"/>
+        <result column="unseal_friend_id" property="unsealFriendId"/>
+        <result column="switch_unseal_friend_id" property="switchUnsealFriendId"/>
+        <result column="forbidden_image" property="forbiddenImage"/>
+        <result column="forbidden_at" property="forbiddenAt"/>
+        <result column="unseal_at" property="unsealAt"/>
+        <result column="create_at" property="createAt"/>
+        <result column="update_at" property="updateAt"/>
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id
+        , type, unseal_friend_id, switch_unseal_friend_id, forbidden_image, forbidden_at, unseal_at, create_at, update_at
+    </sql>
+    <select id="getList" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileForbiddenRecord">
+        SELECT A.*,
+        B.wx_name as unseal_wx_name,
+        B.wx_username as unseal_wx_username,
+        C.wx_name as switch_unseal_wx_name,
+        C.wx_username as switch_unseal_wx_username
+        FROM pan_fosterwx_mobile_forbidden_record as A
+        left join pan_fosterwx_wxfriend as B on A.unseal_friend_id = B.id
+        left join pan_fosterwx_wxfriend as C on A.switch_unseal_friend_id = C.id
+        <where>
+            <if test="params.id != null">and A.mobile_id = #{params.id}</if>
+            <if test="params.type != null">and A.type = #{params.type}</if>
+        </where>
+    </select>
+</mapper>

+ 3 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileWxfriendMapper.java

@@ -3,6 +3,7 @@ package com.mokamrp.privates.mapper.pangu;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileWxfriend;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend;
 import org.springframework.stereotype.Component;
 import org.apache.ibatis.annotations.Param;
 import java.util.List;
@@ -18,4 +19,6 @@ import java.util.List;
 @Component
 public interface FosterwxMobileWxfriendMapper extends BaseMapper<FosterwxMobileWxfriend> {
     public List<FosterwxMobileWxfriend> getList(Page<FosterwxMobileWxfriend> pageObj);
+    public List<FosterwxWxfriend> getCanSwtichFriendList();
+    public List<FosterwxWxfriend> getCanBindFriendList();
 }

+ 24 - 3
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileWxfriendMapper.xml

@@ -7,8 +7,6 @@
         <id column="id" property="id" />
         <result column="mobile_id" property="mobileId" />
         <result column="seq" property="seq" />
-        <result column="wx_name" property="wxName" />
-        <result column="wx_username" property="wxUsername" />
         <result column="create_at" property="createAt" />
         <result column="update_at" property="updateAt" />
     </resultMap>
@@ -18,6 +16,29 @@
         id, mobile_id, seq, wx_name, wx_username, create_at, update_at
     </sql>
     <select id="getList" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileWxfriend">
-        SELECT * FROM pan_fosterwx_mobile_wxfriend
+        SELECT A.id,
+               A.seq,
+               A.mobile_id,
+               A.friend_id,
+               B.wx_name,
+               B.wx_username,
+               B.status,
+               B.switch_friend_id,
+               B.next_start_at
+               FROM pan_fosterwx_mobile_wxfriend as A
+        left join pan_fosterwx_wxfriend as B on A.friend_id = B.id
+    </select>
+
+    <select id="getCanSwtichFriendList" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend">
+        SELECT A.* FROM pan_fosterwx_wxfriend AS A
+        LEFT JOIN (SELECT friend_id FROM pan_fosterwx_mobile_wxfriend GROUP BY friend_id) AS B ON A.id = B.friend_id
+        WHERE B.friend_id IS null
+    </select>
+
+    <select id="getCanBindFriendList" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend">
+        SELECT A.*,ifnull(B.bind_mobile_cnt,0) as bind_mobile_cnt FROM pan_fosterwx_wxfriend AS A
+        LEFT JOIN (SELECT count(friend_id) as bind_mobile_cnt,friend_id FROM pan_fosterwx_mobile_wxfriend GROUP BY friend_id) AS B ON A.id = B.friend_id
+        Where B.bind_mobile_cnt &lt; 3
+        And A.status = 1
     </select>
 </mapper>

+ 3 - 2
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxWxfriendMapper.java

@@ -1,5 +1,6 @@
 package com.mokamrp.privates.mapper.pangu;
 
+import com.mokamrp.privates.entity.PostBasePageHandle;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -13,9 +14,9 @@ import java.util.List;
  * </p>
  *
  * @author leon
- * @since 2021-11-03
+ * @since 2021-11-10
  */
 @Component
 public interface FosterwxWxfriendMapper extends BaseMapper<FosterwxWxfriend> {
-    public List<FosterwxWxfriend> getList(Page<FosterwxWxfriend> pageObj);
+    public List<FosterwxWxfriend> getList(Page<FosterwxWxfriend> pageObj, @Param("params") PostBasePageHandle handle);
 }

+ 10 - 2
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxWxfriendMapper.xml

@@ -9,6 +9,7 @@
         <result column="status" property="status" />
         <result column="wx_name" property="wxName" />
         <result column="wx_username" property="wxUsername" />
+        <result column="switch_friend_id" property="switchFriendId" />
         <result column="next_start_at" property="nextStartAt" />
         <result column="create_at" property="createAt" />
         <result column="update_at" property="updateAt" />
@@ -16,9 +17,16 @@
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, station_id, status, wx_name, wx_username, next_start_at, create_at, update_at
+        id, station_id, status, wx_name, wx_username, switch_friend_id, next_start_at, create_at, update_at
     </sql>
     <select id="getList" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend">
-        SELECT * FROM pan_fosterwx_wxfriend
+        SELECT A.*,B.wx_name as switch_friend_wx_name FROM pan_fosterwx_wxfriend as A
+        left join pan_fosterwx_wxfriend as B on A.switch_friend_id = B.id
+        <where>
+            <if test="params.name != null">and wx_name like CONCAT('%',#{params.name},'%')</if>
+            <if test="params.status != null">and status = #{params.status}</if>
+            <if test="params.stationId != null">and station_id = #{params.stationId}</if>
+            <if test="params.mobileId != null">and mobile_id = #{params.mobileId}</if>
+        </where>
     </select>
 </mapper>

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import io.swagger.models.auth.In;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -183,6 +184,7 @@ public class FosterwxMobile extends Model<FosterwxMobile> {
      */
     private String codeUrl;
 
+
     /**
      * 创建时间
      */

+ 174 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxMobileForbiddenRecord.java

@@ -0,0 +1,174 @@
+package com.mokamrp.privates.mapper.pangu.pojo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 盘古养号账号封禁记录
+ * </p>
+ *
+ * @author leon
+ * @since 2021-11-13
+ */
+@Data
+@TableName("pan_fosterwx_mobile_forbidden_record")
+public class FosterwxMobileForbiddenRecord extends Model<FosterwxMobileForbiddenRecord> {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * ID
+     */
+      @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 封禁类型(1.个微2.企微)
+     */
+    private Integer type;
+
+    /**
+     * 解封好友
+     */
+    private Integer unsealFriendId;
+
+    /**
+     * 新解封好友
+     */
+    private Integer switchUnsealFriendId;
+
+    @TableField(exist = false)
+    private String unsealWxName;
+    @TableField(exist = false)
+    private String unsealWxUsername;
+    @TableField(exist = false)
+    private String switchUnsealWxName;
+    @TableField(exist = false)
+    private String switchUnsealWxUsername;
+
+    /**
+     * 账号封禁截图
+     */
+    private String forbiddenImage;
+
+    /**
+     * 封禁时间
+     */
+    private LocalDateTime forbiddenAt;
+
+    /**
+     * 解封时间
+     */
+    private LocalDateTime unsealAt;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createAt;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updateAt;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getUnsealFriendId() {
+        return unsealFriendId;
+    }
+
+    public void setUnsealFriendId(Integer unsealFriendId) {
+        this.unsealFriendId = unsealFriendId;
+    }
+
+    public Integer getSwitchUnsealFriendId() {
+        return switchUnsealFriendId;
+    }
+
+    public void setSwitchUnsealFriendId(Integer switchUnsealFriendId) {
+        this.switchUnsealFriendId = switchUnsealFriendId;
+    }
+
+    public String getForbiddenImage() {
+        return forbiddenImage;
+    }
+
+    public void setForbiddenImage(String forbiddenImage) {
+        this.forbiddenImage = forbiddenImage;
+    }
+
+    public LocalDateTime getForbiddenAt() {
+        return forbiddenAt;
+    }
+
+    public void setForbiddenAt(LocalDateTime forbiddenAt) {
+        this.forbiddenAt = forbiddenAt;
+    }
+
+    public LocalDateTime getUnsealAt() {
+        return unsealAt;
+    }
+
+    public void setUnsealAt(LocalDateTime unsealAt) {
+        this.unsealAt = unsealAt;
+    }
+
+    public LocalDateTime getCreateAt() {
+        return createAt;
+    }
+
+    public void setCreateAt(LocalDateTime createAt) {
+        this.createAt = createAt;
+    }
+
+    public LocalDateTime getUpdateAt() {
+        return updateAt;
+    }
+
+    public void setUpdateAt(LocalDateTime updateAt) {
+        this.updateAt = updateAt;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "FosterwxMobileForbiddenRecord{" +
+        "id=" + id +
+        ", type=" + type +
+        ", unsealFriendId=" + unsealFriendId +
+        ", switchUnsealFriendId=" + switchUnsealFriendId +
+        ", forbiddenImage=" + forbiddenImage +
+        ", forbiddenAt=" + forbiddenAt +
+        ", unsealAt=" + unsealAt +
+        ", createAt=" + createAt +
+        ", updateAt=" + updateAt +
+        "}";
+    }
+}

+ 9 - 3
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxMobileWxfriend.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import lombok.Data;
+import org.springframework.cglib.core.Local;
 
 import java.time.LocalDateTime;
 import java.io.Serializable;
@@ -43,12 +44,17 @@ public class FosterwxMobileWxfriend extends Model<FosterwxMobileWxfriend> {
     /**
      * 好友ID
      */
-    @TableField(exist = false)
     private Integer friendId;
-
+    @TableField(exist = false)
     private String wxName;
-
+    @TableField(exist = false)
     private String wxUsername;
+    @TableField(exist = false)
+    private Integer status;
+    @TableField(exist = false)
+    private Integer switchFriendId;
+    @TableField(exist = false)
+    private LocalDateTime nextStartAt;
     /**
      * 创建时间
      */

+ 37 - 1
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxWxfriend.java

@@ -1,11 +1,17 @@
 package com.mokamrp.privates.mapper.pangu.pojo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.Data;
+
 import java.time.LocalDateTime;
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * <p>
@@ -13,8 +19,9 @@ import java.io.Serializable;
  * </p>
  *
  * @author leon
- * @since 2021-11-03
+ * @since 2021-11-10
  */
+@Data
 @TableName("pan_fosterwx_wxfriend")
 public class FosterwxWxfriend extends Model<FosterwxWxfriend> {
 
@@ -47,6 +54,26 @@ public class FosterwxWxfriend extends Model<FosterwxWxfriend> {
     private String wxUsername;
 
     /**
+     * 替换解封好友
+     */
+    private Integer switchFriendId;
+
+    /**
+     * 已经绑定的账号
+     */
+    @TableField(exist = false)
+    private Integer bindMobileCnt;
+
+    /**
+     * 绑定的解封手机账号
+     */
+    @TableField(exist = false)
+    private List<FosterwxMobile> bindUnsealMobile;
+
+    @TableField(exist = false)
+    private String switchFriendWxName;
+
+    /**
      * 下次启用时间
      */
     private LocalDateTime nextStartAt;
@@ -96,6 +123,14 @@ public class FosterwxWxfriend extends Model<FosterwxWxfriend> {
         this.wxUsername = wxUsername;
     }
 
+    public Integer getSwitchFriendId() {
+        return switchFriendId;
+    }
+
+    public void setSwitchFriendId(Integer switchFriendId) {
+        this.switchFriendId = switchFriendId;
+    }
+
     public LocalDateTime getNextStartAt() {
         return nextStartAt;
     }
@@ -133,6 +168,7 @@ public class FosterwxWxfriend extends Model<FosterwxWxfriend> {
         ", status=" + status +
         ", wxName=" + wxName +
         ", wxUsername=" + wxUsername +
+        ", switchFriendId=" + switchFriendId +
         ", nextStartAt=" + nextStartAt +
         ", createAt=" + createAt +
         ", updateAt=" + updateAt +

+ 20 - 0
src/main/java/com/mokamrp/privates/service/pangu/FosterwxMobileForbiddenRecordService.java

@@ -0,0 +1,20 @@
+package com.mokamrp.privates.service.pangu;
+
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileForbiddenRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.mokamrp.privates.entity.PostBasePageHandle;
+import com.mokamrp.privates.entity.ResHandle;
+import java.util.List;
+import java.util.Map;
+/**
+ * <p>
+ * 盘古养号账号封禁记录 服务类
+ * </p>
+ *
+ * @author leon
+ * @since 2021-11-13
+ */
+public interface FosterwxMobileForbiddenRecordService extends IService<FosterwxMobileForbiddenRecord> {
+    //.@leon 获取数据列表
+    public ResHandle<List<FosterwxMobileForbiddenRecord>> getList(PostBasePageHandle handle);
+}

+ 9 - 1
src/main/java/com/mokamrp/privates/service/pangu/FosterwxMobileWxfriendService.java

@@ -1,10 +1,14 @@
 package com.mokamrp.privates.service.pangu;
 
+import com.mokamrp.privates.entity.ResHandle;
 import com.mokamrp.privates.entity.VoltaHandle;
 import com.mokamrp.privates.entity.pangu.AddFosterwxMobileHandle;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileWxfriend;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.mokamrp.privates.entity.PostBasePageHandle;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend;
+
+import java.util.List;
 import java.util.Map;
 /**
  * <p>
@@ -16,7 +20,11 @@ import java.util.Map;
  */
 public interface FosterwxMobileWxfriendService extends IService<FosterwxMobileWxfriend> {
     //.@leon 获取数据列表
-    public Map<String, Object> getList(PostBasePageHandle handle);
+    public ResHandle<List<FosterwxMobileWxfriend>> getList(PostBasePageHandle handle);
+    //.@volta 获取可被替换的解封好友
+    public List<FosterwxWxfriend> getCanSwtichFriendList();
+    //.@volta 获取可被绑定的解封好友
+    public List<FosterwxWxfriend> getCanBindFriendList();
     //.@leon 删除数据同时新增数据
     public Boolean removeAndAdd(AddFosterwxMobileHandle addFosterwxMobileHandle);
     //.@leon 检查好友限制

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

@@ -12,7 +12,7 @@ import java.util.Map;
  * </p>
  *
  * @author leon
- * @since 2021-11-03
+ * @since 2021-11-10
  */
 public interface FosterwxWxfriendService extends IService<FosterwxWxfriend> {
     //.@leon 获取数据列表

+ 43 - 0
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxMobileForbiddenRecordServiceImpl.java

@@ -0,0 +1,43 @@
+package com.mokamrp.privates.service.pangu.impl;
+
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileForbiddenRecord;
+import com.mokamrp.privates.mapper.pangu.FosterwxMobileForbiddenRecordMapper;
+import com.mokamrp.privates.service.pangu.FosterwxMobileForbiddenRecordService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.mokamrp.privates.entity.PostBasePageHandle;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import com.mokamrp.privates.entity.ResHandle;
+import java.util.*;
+
+/**
+ * <p>
+ * 盘古养号账号封禁记录 服务实现类
+ * </p>
+ *
+ * @author leon
+ * @since 2021-11-13
+ */
+@Service
+public class FosterwxMobileForbiddenRecordServiceImpl extends ServiceImpl<FosterwxMobileForbiddenRecordMapper, FosterwxMobileForbiddenRecord> implements FosterwxMobileForbiddenRecordService {
+
+    @Autowired
+    public FosterwxMobileForbiddenRecordMapper fosterwxMobileForbiddenRecordMapper;
+    /**
+     * 获取数据列表 支持分页
+     * @param handle
+     * @return
+     */
+    public ResHandle<List<FosterwxMobileForbiddenRecord>> getList(PostBasePageHandle handle) {
+        Integer pagesize = handle.getPagesize();
+        Integer page = handle.getPage();
+        Page<FosterwxMobileForbiddenRecord> pageObj = new Page<FosterwxMobileForbiddenRecord>(page, pagesize);
+        List<FosterwxMobileForbiddenRecord> list = fosterwxMobileForbiddenRecordMapper.getList(pageObj,handle);
+        ResHandle<List<FosterwxMobileForbiddenRecord>> res = new ResHandle<>();
+        res.setList(list);
+        res.setTotal(pageObj.getTotal());
+        return res;
+    }
+}

+ 24 - 28
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxMobileServiceImpl.java

@@ -186,32 +186,28 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
             );
             //.批量录入微信好友
             List<FosterwxMobileWxfriend> addFriend = new ArrayList<>();
-            Map<String, Boolean> friendsNames = new HashMap<>();
+            Map<Integer, Boolean> friendsIds = new HashMap<>();
             for (Integer s = 1; s <= 3; s++) {
                 String sStr = s.toString();
-                String wxFriendName = row.get(i).get("wxFriendName" + sStr);
-                String wxFriendUserName = row.get(i).get("wxFriendUserName" + sStr);
-                if (wxFriendName == null || wxFriendName.isEmpty()) {
+                String wxFriendIdStr = row.get(i).get("wxFriendId" + sStr);
+                Integer wxFriendId = Integer.parseInt(wxFriendIdStr);
+                if (wxFriendId == null || wxFriendId == 0) {
                     continue;
                 }
-                if (friendsNames.get(wxFriendName) != null) {
-                    throw new Exception("第" + (i + 1) + "行," + wxFriendName + "微信好友名称录入重复");
+                if (friendsIds.get(wxFriendId) != null) {
+                    throw new Exception("第" + (i + 1) + "行," + wxFriendId + "微信好友ID录入重复");
                 }
-                friendsNames.put(wxFriendName, true);
-                Boolean findRes = this.checkWxFriendCnt(friends, wxFriendName);
+                friendsIds.put(wxFriendId, true);
+                Boolean findRes = this.checkWxFriendCnt(friends, wxFriendId);
                 if (!findRes) {
-                    throw new Exception("第" + (i + 1) + "行," + wxFriendName + "微信好友名称在当前站点内已经使用超过三次,无法再次录入");
+                    throw new Exception("第" + (i + 1) + "行," + wxFriendId + "微信好友ID在当前站点内已经使用超过三次,无法再次录入");
                 }
                 FosterwxMobileWxfriend fosterwxMobileWxfriend = new FosterwxMobileWxfriend();
                 fosterwxMobileWxfriend.setMobileId(fosterwxMobile.getId());
                 fosterwxMobileWxfriend.setCreateAt(nowDate);
                 fosterwxMobileWxfriend.setUpdateAt(nowDate);
                 fosterwxMobileWxfriend.setSeq(s);
-                fosterwxMobileWxfriend.setWxName(wxFriendName);
-                if (wxFriendUserName != null && !wxFriendUserName.isEmpty()) {
-                    fosterwxMobileWxfriend.setWxUsername(wxFriendUserName);
-                }
-
+                fosterwxMobileWxfriend.setFriendId(wxFriendId);
                 addFriend.add(fosterwxMobileWxfriend);
             }
 
@@ -245,18 +241,18 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
             if (wxfriendList == null || wxfriendList.size() <= 0) {
                 continue;
             }
-            for (FosterwxMobileWxfriend fosterwxMobileWxfriend : wxfriendList) {
-                if (fosterwxMobileWxfriend.getSeq().equals(1)) {
-                    fosterwxMobileVo.setWxName1(fosterwxMobileWxfriend.getWxName());
-                    fosterwxMobileVo.setWxUsername1(fosterwxMobileWxfriend.getWxUsername());
-                } else if (fosterwxMobileWxfriend.getSeq().equals(2)) {
-                    fosterwxMobileVo.setWxName2(fosterwxMobileWxfriend.getWxName());
-                    fosterwxMobileVo.setWxUsername2(fosterwxMobileWxfriend.getWxUsername());
-                } else if (fosterwxMobileWxfriend.getSeq().equals(3)) {
-                    fosterwxMobileVo.setWxName3(fosterwxMobileWxfriend.getWxName());
-                    fosterwxMobileVo.setWxUsername3(fosterwxMobileWxfriend.getWxUsername());
-                }
-            }
+//            for (FosterwxMobileWxfriend fosterwxMobileWxfriend : wxfriendList) {
+//                if (fosterwxMobileWxfriend.getSeq().equals(1)) {
+//                    fosterwxMobileVo.setWxName1(fosterwxMobileWxfriend.getWxName());
+//                    fosterwxMobileVo.setWxUsername1(fosterwxMobileWxfriend.getWxUsername());
+//                } else if (fosterwxMobileWxfriend.getSeq().equals(2)) {
+//                    fosterwxMobileVo.setWxName2(fosterwxMobileWxfriend.getWxName());
+//                    fosterwxMobileVo.setWxUsername2(fosterwxMobileWxfriend.getWxUsername());
+//                } else if (fosterwxMobileWxfriend.getSeq().equals(3)) {
+//                    fosterwxMobileVo.setWxName3(fosterwxMobileWxfriend.getWxName());
+//                    fosterwxMobileVo.setWxUsername3(fosterwxMobileWxfriend.getWxUsername());
+//                }
+//            }
         }
         return list;
     }
@@ -333,10 +329,10 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
         return true;
     }
 
-    private Boolean checkWxFriendCnt(List<FosterwxMobileWxfriend> row, String wxName) {
+    private Boolean checkWxFriendCnt(List<FosterwxMobileWxfriend> row, Integer friendId) {
         Integer findCnt = 0;
         for (FosterwxMobileWxfriend fosterwxMobileWxfriend : row) {
-            if (fosterwxMobileWxfriend.getWxName().equals(wxName)) {
+            if (fosterwxMobileWxfriend.getFriendId().equals(friendId)) {
                 findCnt++;
             }
             if (findCnt >= 3) {

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

@@ -2,12 +2,14 @@ package com.mokamrp.privates.service.pangu.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.mokamrp.privates.constant.HttpMsg;
+import com.mokamrp.privates.entity.ResHandle;
 import com.mokamrp.privates.entity.VoltaHandle;
 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.FosterwxMobileWxfriend;
 import com.mokamrp.privates.mapper.pangu.FosterwxMobileWxfriendMapper;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend;
 import com.mokamrp.privates.service.pangu.FosterwxMobileService;
 import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -42,15 +44,33 @@ public class FosterwxMobileWxfriendServiceImpl extends ServiceImpl<FosterwxMobil
      * @param handle
      * @return
      */
-    public Map<String, Object> getList(PostBasePageHandle handle) {
+    public ResHandle<List<FosterwxMobileWxfriend>> getList(PostBasePageHandle handle) {
         Integer pagesize = handle.getPagesize();
         Integer page = handle.getPage();
         Page<FosterwxMobileWxfriend> pageObj = new Page<FosterwxMobileWxfriend>(page, pagesize);
         List<FosterwxMobileWxfriend> list = fosterwxMobileWxfriendMapper.getList(pageObj);
-        Map<String, Object> resMap = new HashMap<String, Object>();
-        resMap.put("list", list);
-        resMap.put("total", pageObj.getTotal());
-        return resMap;
+        ResHandle<List<FosterwxMobileWxfriend>> res = new ResHandle<>();
+        res.setList(list);
+        res.setTotal(pageObj.getTotal());
+        return res;
+    }
+
+    /**
+     * 获取可被替换的解封好友
+     * @return
+     */
+    public List<FosterwxWxfriend> getCanSwtichFriendList() {
+        List<FosterwxWxfriend> list = fosterwxMobileWxfriendMapper.getCanSwtichFriendList();
+        return list;
+    }
+
+    /**
+     * 获取可被绑定的解封好友
+     * @return
+     */
+    public List<FosterwxWxfriend> getCanBindFriendList() {
+        List<FosterwxWxfriend> list = fosterwxMobileWxfriendMapper.getCanSwtichFriendList();
+        return list;
     }
 
     /**
@@ -62,8 +82,10 @@ public class FosterwxMobileWxfriendServiceImpl extends ServiceImpl<FosterwxMobil
         Integer i = 1;
         this.remove(new QueryWrapper<FosterwxMobileWxfriend>().eq("mobile_id",addFosterwxMobileHandle.getMobileId()));
         List<FosterwxMobileWxfriend> add = new ArrayList<>();
-        for (FosterwxMobileWxfriend fosterwxMobileWxfriend : addFosterwxMobileHandle.getFriends()){
+        for (Integer friendId : addFosterwxMobileHandle.getFriendIds()){
+            FosterwxMobileWxfriend fosterwxMobileWxfriend = new FosterwxMobileWxfriend();
             fosterwxMobileWxfriend.setSeq(i);
+            fosterwxMobileWxfriend.setFriendId(friendId);
             fosterwxMobileWxfriend.setMobileId(addFosterwxMobileHandle.getMobileId());
             fosterwxMobileWxfriend.setCreateAt(LocalDateTime.now());
             fosterwxMobileWxfriend.setUpdateAt(LocalDateTime.now());
@@ -88,26 +110,28 @@ public class FosterwxMobileWxfriendServiceImpl extends ServiceImpl<FosterwxMobil
         List<FosterwxMobileWxfriend> friends = this.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){
-                res.setErr(HttpMsg.wxFriendResume+add.getWxName());
+
+        Map<Integer,Boolean> friendsNames = new HashMap<>();
+        for (Integer friendId :addFosterwxMobileHandle.getFriendIds()){
+            if(friendsNames.get(friendId) != null){
+                res.setErr(HttpMsg.wxFriendResume+friendId.toString());
                 return res;
             }
-            friendsNames.put(add.getWxName(),true);
-            Boolean findRes = this.checkWxFriendCnt(friends,add.getWxName());
+            friendsNames.put(friendId,true);
+            Boolean findRes = this.checkWxFriendCnt(friends,friendId);
             if (!findRes){
-                res.setErr(HttpMsg.wxFriendCntMax3+add.getWxName());
+                res.setErr(HttpMsg.wxFriendCntMax3+friendId.toString());
+
                 return res;
             }
         }
         return res;
     }
 
-    public Boolean checkWxFriendCnt(List<FosterwxMobileWxfriend> row,String wxName){
+    public Boolean checkWxFriendCnt(List<FosterwxMobileWxfriend> row,Integer friendId){
         Integer findCnt = 0;
         for (FosterwxMobileWxfriend fosterwxMobileWxfriend : row){
-            if (fosterwxMobileWxfriend.getWxName().equals(wxName)){
+            if (fosterwxMobileWxfriend.getFriendId().equals(friendId)){
                 findCnt++;
             }
             if (findCnt >= 3){

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

@@ -18,7 +18,7 @@ import java.util.*;
  * </p>
  *
  * @author leon
- * @since 2021-11-03
+ * @since 2021-11-10
  */
 @Service
 public class FosterwxWxfriendServiceImpl extends ServiceImpl<FosterwxWxfriendMapper, FosterwxWxfriend> implements FosterwxWxfriendService {
@@ -34,7 +34,7 @@ public class FosterwxWxfriendServiceImpl extends ServiceImpl<FosterwxWxfriendMap
         Integer pagesize = handle.getPagesize();
         Integer page = handle.getPage();
         Page<FosterwxWxfriend> pageObj = new Page<FosterwxWxfriend>(page, pagesize);
-        List<FosterwxWxfriend> list = fosterwxWxfriendMapper.getList(pageObj);
+        List<FosterwxWxfriend> list = fosterwxWxfriendMapper.getList(pageObj,handle);
         ResHandle<List<FosterwxWxfriend>> res = new ResHandle<>();
         res.setList(list);
         res.setTotal(pageObj.getTotal());

+ 65 - 0
src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxCanBindFriendToRedis.java

@@ -0,0 +1,65 @@
+package com.mokamrp.privates.task.pangu;
+
+import com.mokamrp.privates.constant.RedisKey;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend;
+import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
+import com.mokamrp.privates.service.pangu.FosterwxStationService;
+import com.mokamrp.privates.service.pangu.FosterwxWxfriendService;
+import net.javacrumbs.shedlock.core.SchedulerLock;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class SyncFosterwxCanBindFriendToRedis {
+    @Autowired
+    public FosterwxWxfriendService fosterwxWxfriendService;
+
+    @Autowired
+    public FosterwxMobileWxfriendService fosterwxMobileWxfriendService;
+
+    @Autowired
+    public StringRedisTemplate stringRedisTemplate;
+
+    @Autowired
+    public FosterwxStationService fosterwxStationService;
+
+    @Scheduled(cron = "*/5 * * * * ?")
+    @SchedulerLock(name = "pangu:SyncFosterwxCanBindFriendToRedis", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
+    public void execute() {
+        System.out.println("[cronjob]:同步微信养号可被绑定的解封好友到REDIS");
+        List<FosterwxStation> stations = fosterwxStationService.list();
+        List<FosterwxWxfriend> list = fosterwxMobileWxfriendService.getCanBindFriendList();
+        Map<Integer,List<FosterwxWxfriend>> sync = new HashMap<>();
+        for (FosterwxWxfriend fosterwxWxfriend : list) {
+            if (sync.get(fosterwxWxfriend.getStationId()) == null){
+                List<FosterwxWxfriend> stationFriends = new ArrayList<>();
+                stationFriends.add(fosterwxWxfriend);
+                sync.put(fosterwxWxfriend.getStationId(),stationFriends);
+            }else{
+                List<FosterwxWxfriend> stationFriends = sync.get(fosterwxWxfriend.getStationId());
+                stationFriends.add(fosterwxWxfriend);
+                sync.put(fosterwxWxfriend.getStationId(),stationFriends);
+            }
+        }
+        for (FosterwxStation fosterwxStation : stations){
+            Integer stationId = fosterwxStation.getId();
+            //.置空
+            stringRedisTemplate.delete(RedisKey.PanWxFosterCanBindFriendId+stationId.toString());
+            if (sync.get(stationId) == null) continue;
+            for (FosterwxWxfriend fosterwxWxfriend: sync.get(stationId)){
+                //.更新可用好友
+                stringRedisTemplate.opsForSet().add(
+                        RedisKey.PanWxFosterCanBindFriendId+stationId.toString(),
+                        fosterwxWxfriend.getId().toString());
+            }
+        }
+    }
+}

+ 69 - 0
src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxCanSwitchFriendToRedis.java

@@ -0,0 +1,69 @@
+package com.mokamrp.privates.task.pangu;
+
+import com.alibaba.fastjson.JSONObject;
+import com.mokamrp.privates.constant.RedisKey;
+import com.mokamrp.privates.entity.PostBasePageHandle;
+import com.mokamrp.privates.entity.ResHandle;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileWxfriend;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend;
+import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
+import com.mokamrp.privates.service.pangu.FosterwxStationService;
+import com.mokamrp.privates.service.pangu.FosterwxWxfriendService;
+import net.javacrumbs.shedlock.core.SchedulerLock;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class SyncFosterwxCanSwitchFriendToRedis {
+    @Autowired
+    public FosterwxWxfriendService fosterwxWxfriendService;
+
+    @Autowired
+    public FosterwxMobileWxfriendService fosterwxMobileWxfriendService;
+
+    @Autowired
+    public StringRedisTemplate stringRedisTemplate;
+
+    @Autowired
+    public FosterwxStationService fosterwxStationService;
+
+    @Scheduled(cron = "*/5 * * * * ?")
+    @SchedulerLock(name = "pangu:SyncFosterwxCanSwitchFriendToRedis", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
+    public void execute() {
+        System.out.println("[cronjob]:同步微信养号可被替换的解封好友到REDIS");
+        List<FosterwxStation> stations = fosterwxStationService.list();
+        List<FosterwxWxfriend> list = fosterwxMobileWxfriendService.getCanSwtichFriendList();
+        Map<Integer,List<FosterwxWxfriend>> sync = new HashMap<>();
+        for (FosterwxWxfriend fosterwxWxfriend : list) {
+            if (sync.get(fosterwxWxfriend.getStationId()) == null){
+                List<FosterwxWxfriend> stationFriends = new ArrayList<>();
+                stationFriends.add(fosterwxWxfriend);
+                sync.put(fosterwxWxfriend.getStationId(),stationFriends);
+            }else{
+                List<FosterwxWxfriend> stationFriends = sync.get(fosterwxWxfriend.getStationId());
+                stationFriends.add(fosterwxWxfriend);
+                sync.put(fosterwxWxfriend.getStationId(),stationFriends);
+            }
+        }
+        for (FosterwxStation fosterwxStation : stations){
+            Integer stationId = fosterwxStation.getId();
+            //.置空
+            stringRedisTemplate.delete(RedisKey.PanWxFosterCanSwitchFriendId+stationId.toString());
+            if (sync.get(stationId) == null) continue;
+            for (FosterwxWxfriend fosterwxWxfriend: sync.get(stationId)){
+                //.更新可用好友
+                stringRedisTemplate.opsForSet().add(
+                        RedisKey.PanWxFosterCanSwitchFriendId+stationId.toString(),
+                        fosterwxWxfriend.getId().toString());
+            }
+        }
+    }
+}

+ 35 - 0
src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxFriendToRedis.java

@@ -0,0 +1,35 @@
+package com.mokamrp.privates.task.pangu;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.mokamrp.privates.constant.RedisKey;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxTeachingVideo;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend;
+import com.mokamrp.privates.service.pangu.*;
+import net.javacrumbs.shedlock.core.SchedulerLock;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public class SyncFosterwxFriendToRedis {
+    @Autowired
+    public FosterwxWxfriendService fosterwxWxfriendService;
+
+    @Autowired
+    public StringRedisTemplate stringRedisTemplate;
+
+    @Scheduled(cron = "*/1 * * * * ?")
+    @SchedulerLock(name = "pangu:SyncFosterwxFriendToRedis", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
+    public void execute() {
+        System.out.println("[cronjob]:同步微信养号站点好友到REDIS");
+        List<FosterwxWxfriend> fosterwxWxfriendList = fosterwxWxfriendService.list();
+        for (FosterwxWxfriend fosterwxWxfriend : fosterwxWxfriendList) {
+            stringRedisTemplate.opsForHash().put(RedisKey.PanWxFosterFriendInfo+fosterwxWxfriend.getStationId(),fosterwxWxfriend.getId().toString(),JSONObject.toJSONString(fosterwxWxfriend));
+        }
+    }
+}

+ 7 - 1
src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxMobile.java

@@ -2,6 +2,8 @@ package com.mokamrp.privates.task.pangu;
 
 import com.alibaba.fastjson.JSONArray;
 import com.mokamrp.privates.constant.RedisKey;
+import com.mokamrp.privates.entity.PostBasePageHandle;
+import com.mokamrp.privates.entity.ResHandle;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileWxfriend;
 import com.mokamrp.privates.service.pangu.FosterwxMobileService;
@@ -45,7 +47,11 @@ public class SyncFosterwxMobile {
         List<Integer> mobileIds = new ArrayList<>();
         this.fosterwxMobileList = fosterwxMobileService.list();
         //.查询所有账号下微信好友
-        this.fosterwxMobileWxfriendList = fosterwxMobileWxfriendService.list();
+        PostBasePageHandle handle = new PostBasePageHandle();
+        handle.setPage(1);
+        handle.setPagesize(999999);
+        ResHandle<List<FosterwxMobileWxfriend>> resHandle = fosterwxMobileWxfriendService.getList(handle);
+        this.fosterwxMobileWxfriendList = resHandle.getList();
         Map<String, List<FosterwxMobile>> add = new HashMap<>();
         for (FosterwxMobile fosterwxMobile : this.fosterwxMobileList) {
             Integer stationId = fosterwxMobile.getStationId();

+ 5 - 3
src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxEdit.java → src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxMobileEdit.java

@@ -21,9 +21,10 @@ import org.springframework.stereotype.Component;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Component
-public class SyncFosterwxEdit {
+public class SyncFosterwxMobileEdit {
 
     @Autowired
     public FosterwxTaskScheduleService fosterwxTaskScheduleService;
@@ -52,7 +53,7 @@ public class SyncFosterwxEdit {
      *     它的目的不在于隐藏任务,更重要的是,释放锁,并且查找解决问题。
      *     至于是否带有string后缀,只是2种表达方式,数字类型的就是毫秒数,字符串类型的就有自己固定的格式 ,例如:PT30S  30s时间设置,单位可以是S,M,H
      */
-    @SchedulerLock(name = "pangu:SyncFosterwxEdit", lockAtLeastForString = "PT2S", lockAtMostForString = "PT15M")
+    @SchedulerLock(name = "pangu:SyncFosterwxMobileEdit", lockAtLeastForString = "PT2S", lockAtMostForString = "PT15M")
     public void execute() {
         System.out.println("[cronjob]:异步执行微信养号账号信息修改/新增操作");
         Integer cnt = 1;
@@ -95,7 +96,8 @@ public class SyncFosterwxEdit {
                 if (fosterwxMobile.getFriend() != null) {
                     AddFosterwxMobileHandle addFosterwxMobileHandle = new AddFosterwxMobileHandle();
                     addFosterwxMobileHandle.setMobileId(fosterwxMobile.getId());
-                    addFosterwxMobileHandle.setFriends(fosterwxMobile.getFriend());
+                    List<Integer> friendIds = fosterwxMobile.getFriend().stream().map(FosterwxMobileWxfriend::getFriendId).collect(Collectors.toList());
+                    addFosterwxMobileHandle.setFriendIds(friendIds);
                     fosterwxMobileWxfriendService.removeAndAdd(addFosterwxMobileHandle);
                 }
                 //.立刻更新账号REDIS

+ 63 - 0
src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxMobileFriendToRedis.java

@@ -0,0 +1,63 @@
+package com.mokamrp.privates.task.pangu;
+
+import com.alibaba.fastjson.JSONObject;
+import com.mokamrp.privates.constant.RedisKey;
+import com.mokamrp.privates.entity.PostBasePageHandle;
+import com.mokamrp.privates.entity.ResHandle;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileWxfriend;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend;
+import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
+import com.mokamrp.privates.service.pangu.FosterwxWxfriendService;
+import net.javacrumbs.shedlock.core.SchedulerLock;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class SyncFosterwxMobileFriendToRedis {
+    @Autowired
+    public FosterwxWxfriendService fosterwxWxfriendService;
+
+    @Autowired
+    public FosterwxMobileWxfriendService fosterwxMobileWxfriendService;
+
+    @Autowired
+    public StringRedisTemplate stringRedisTemplate;
+
+    @Scheduled(cron = "*/20 * * * * ?")
+    @SchedulerLock(name = "pangu:SyncFosterwxMobileFriendToRedis", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
+    public void execute() {
+        System.out.println("[cronjob]:同步微信养号账号绑定的好友到REDIS");
+        PostBasePageHandle handle = new PostBasePageHandle();
+        handle.setPage(1);
+        handle.setPagesize(999999);
+        ResHandle<List<FosterwxMobileWxfriend>> res = fosterwxMobileWxfriendService.getList(handle);
+        Map<Integer, List<FosterwxMobileWxfriend>> sync = new HashMap<>();
+        for (FosterwxMobileWxfriend fosterwxMobileWxfriend : res.getList()) {
+            if (sync.get(fosterwxMobileWxfriend.getMobileId()) == null) {
+                List<FosterwxMobileWxfriend> mobileFriends = new ArrayList<>();
+                mobileFriends.add(fosterwxMobileWxfriend);
+                sync.put(fosterwxMobileWxfriend.getMobileId(), mobileFriends);
+            } else {
+                List<FosterwxMobileWxfriend> mobileFriends = sync.get(fosterwxMobileWxfriend.getMobileId());
+                mobileFriends.add(fosterwxMobileWxfriend);
+                sync.put(fosterwxMobileWxfriend.getMobileId(), mobileFriends);
+            }
+        }
+        for (Integer mobileId : sync.keySet()) {
+            //.置空
+            stringRedisTemplate.delete(RedisKey.PanWxFosterMobileFriendId + mobileId);
+            for (FosterwxMobileWxfriend fosterwxMobileWxfriend : sync.get(mobileId)) {
+                //.更新可用好友
+                stringRedisTemplate.opsForSet().add(RedisKey.PanWxFosterMobileFriendId + mobileId.toString(),fosterwxMobileWxfriend.getFriendId().toString());
+            }
+        }
+    }
+}

+ 50 - 0
src/main/java/com/mokamrp/privates/task/pangu/UpdateFosterwxFriendStatus.java

@@ -0,0 +1,50 @@
+package com.mokamrp.privates.task.pangu;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileForbiddenRecord;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxWxfriend;
+import com.mokamrp.privates.service.pangu.FosterwxMobileForbiddenRecordService;
+import com.mokamrp.privates.service.pangu.FosterwxMobileService;
+import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
+import com.mokamrp.privates.service.pangu.FosterwxWxfriendService;
+import net.javacrumbs.shedlock.core.SchedulerLock;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Component
+public class UpdateFosterwxFriendStatus {
+    @Autowired
+    public FosterwxWxfriendService fosterwxWxfriendService;
+
+    @Autowired
+    public FosterwxMobileService fosterwxMobileService;
+
+    @Autowired
+    public FosterwxMobileWxfriendService fosterwxMobileWxfriendService;
+
+    @Autowired
+    public FosterwxMobileForbiddenRecordService fosterwxMobileForbiddenRecordService;
+
+    @Autowired
+    public StringRedisTemplate stringRedisTemplate;
+
+    @Scheduled(cron = "0 */1 * * * ?")
+    @SchedulerLock(name = "pangu:UpdateFosterwxFriendStatus", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
+    public void execute() {
+        System.out.println("[cronjob]:更新养号微信好友的停用状态");
+        List<FosterwxWxfriend> list = fosterwxWxfriendService.list(new QueryWrapper<FosterwxWxfriend>().eq("status", 2));
+        for (FosterwxWxfriend fosterwxWxfriend:list) {
+            if (fosterwxWxfriend.getNextStartAt().isBefore(LocalDateTime.now())){
+                fosterwxWxfriend.setStatus(1);
+                fosterwxWxfriend.setUpdateAt(LocalDateTime.now());
+                fosterwxWxfriendService.updateById(fosterwxWxfriend);
+            }
+        }
+    }
+}

+ 81 - 0
src/main/java/com/mokamrp/privates/task/pangu/UpdateFosterwxMobileStatus.java

@@ -0,0 +1,81 @@
+package com.mokamrp.privates.task.pangu;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.mokamrp.privates.constant.RedisKey;
+import com.mokamrp.privates.entity.PostBasePageHandle;
+import com.mokamrp.privates.entity.ResHandle;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileForbiddenRecord;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileWxfriend;
+import com.mokamrp.privates.service.pangu.FosterwxMobileForbiddenRecordService;
+import com.mokamrp.privates.service.pangu.FosterwxMobileService;
+import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
+import com.mokamrp.privates.service.pangu.FosterwxWxfriendService;
+import net.javacrumbs.shedlock.core.SchedulerLock;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class UpdateFosterwxMobileStatus {
+    @Autowired
+    public FosterwxWxfriendService fosterwxWxfriendService;
+
+    @Autowired
+    public FosterwxMobileService fosterwxMobileService;
+
+    @Autowired
+    public FosterwxMobileWxfriendService fosterwxMobileWxfriendService;
+
+    @Autowired
+    public FosterwxMobileForbiddenRecordService fosterwxMobileForbiddenRecordService;
+
+    @Autowired
+    public StringRedisTemplate stringRedisTemplate;
+
+    @Scheduled(cron = "0 */1 * * * ?")
+    @SchedulerLock(name = "pangu:UpdateFosterwxMobileStatus", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
+    public void execute() {
+        System.out.println("[cronjob]:更新养号账号的封禁状态");
+        List<FosterwxMobile> wxFobiddenMobile = fosterwxMobileService.list(new QueryWrapper<FosterwxMobile>().eq("wx_status", 2));
+        for (FosterwxMobile fosterwxMobile : wxFobiddenMobile) {
+            FosterwxMobileForbiddenRecord record = getLastFobiddenRecord(fosterwxMobile.getId(),1); //.个微封禁记录
+            if(record == null){
+                continue;
+            }
+            if (record.getUnsealAt().isBefore(LocalDateTime.now())){
+                fosterwxMobile.setWxStatus(1); //.解封
+                fosterwxMobile.setUpdateAt(LocalDateTime.now());
+                fosterwxMobileService.updateById(fosterwxMobile);
+            }
+        }
+        List<FosterwxMobile> workwxFobiddenMobile = fosterwxMobileService.list(new QueryWrapper<FosterwxMobile>().eq("work_wx_status", 2));
+        for (FosterwxMobile fosterwxMobile : workwxFobiddenMobile) {
+            FosterwxMobileForbiddenRecord record = getLastFobiddenRecord(fosterwxMobile.getId(),2); //.企微封禁记录
+            if(record == null){
+                continue;
+            }
+            if (record.getUnsealAt().isBefore(LocalDateTime.now())){
+                fosterwxMobile.setWorkWxStatus(1); //.解封
+                fosterwxMobile.setUpdateAt(LocalDateTime.now());
+                fosterwxMobileService.updateById(fosterwxMobile);
+            }
+        }
+    }
+
+    public FosterwxMobileForbiddenRecord getLastFobiddenRecord(Integer mobileId,Integer type){
+        return fosterwxMobileForbiddenRecordService.getOne(new QueryWrapper<FosterwxMobileForbiddenRecord>()
+                .eq("mobile_id",mobileId)
+                .eq("type",type)
+                .orderByDesc("unseal_at")
+                .last("limit 1")
+        );
+    }
+}

+ 1 - 1
src/test/java/com/mokamrp/AutoMPPangu.java

@@ -46,7 +46,7 @@ public class AutoMPPangu {
                 .setColumnNaming(NamingStrategy.underline_to_camel)
                 .setNaming(NamingStrategy.underline_to_camel) // 数据库表映射到实体的命名策略,下划线转驼峰命名
                 .setTablePrefix("pan_") //表名前缀
-                .setInclude("pan_fosterwx_cash_workwx_mobile_group");
+                .setInclude("pan_fosterwx_mobile_forbidden_record");
         //4. 包名策略配置
         PackageConfig pkConfig = new PackageConfig();
         pkConfig.setParent("com.mokamrp.privates")