소스 검색

好友模块整改完成

leon 4 년 전
부모
커밋
5bc1109a7f
22개의 변경된 파일606개의 추가작업 그리고 31개의 파일을 삭제
  1. 4 2
      src/main/java/com/mokamrp/privates/constant/RedisKey.java
  2. 55 0
      src/main/java/com/mokamrp/privates/controller/pangu/FosterwxMobileForbiddenRecordController.java
  3. 22 0
      src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileForbiddenRecordMapper.java
  4. 37 0
      src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileForbiddenRecordMapper.xml
  5. 1 0
      src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileWxfriendMapper.java
  6. 11 1
      src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileWxfriendMapper.xml
  7. 1 16
      src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxMobile.java
  8. 174 0
      src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxMobileForbiddenRecord.java
  9. 0 1
      src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxMobileWxfriend.java
  10. 8 0
      src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxWxfriend.java
  11. 20 0
      src/main/java/com/mokamrp/privates/service/pangu/FosterwxMobileForbiddenRecordService.java
  12. 2 0
      src/main/java/com/mokamrp/privates/service/pangu/FosterwxMobileWxfriendService.java
  13. 43 0
      src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxMobileForbiddenRecordServiceImpl.java
  14. 9 0
      src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxMobileWxfriendServiceImpl.java
  15. 65 0
      src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxCanBindFriendToRedis.java
  16. 10 2
      src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxCanSwitchFriendToRedis.java
  17. 7 1
      src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxMobile.java
  18. 3 3
      src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxMobileEdit.java
  19. 2 4
      src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxMobileFriendToRedis.java
  20. 50 0
      src/main/java/com/mokamrp/privates/task/pangu/UpdateFosterwxFriendStatus.java
  21. 81 0
      src/main/java/com/mokamrp/privates/task/pangu/UpdateFosterwxMobileStatus.java
  22. 1 1
      src/test/java/com/mokamrp/AutoMPPangu.java

+ 4 - 2
src/main/java/com/mokamrp/privates/constant/RedisKey.java

@@ -53,10 +53,12 @@ public class RedisKey {
     public static final String PanWxFosterTeachingVideo = "pan_wxfoster_teaching_video_info";
     //.盘古 站点微信好友库
     public static final String PanWxFosterFriendInfo = "pan_wxfoster_friend_info:";
-    //.盘古 账号绑定的微信好友
-    public static final String PanWxFosterMobileFriendInfo = "pan_wxfoster_mobile_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:";
 
 }
 

+ 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);
+    }
+
+
+}
+

+ 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>

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

@@ -20,4 +20,5 @@ import java.util.List;
 public interface FosterwxMobileWxfriendMapper extends BaseMapper<FosterwxMobileWxfriend> {
     public List<FosterwxMobileWxfriend> getList(Page<FosterwxMobileWxfriend> pageObj);
     public List<FosterwxWxfriend> getCanSwtichFriendList();
+    public List<FosterwxWxfriend> getCanBindFriendList();
 }

+ 11 - 1
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileWxfriendMapper.xml

@@ -16,7 +16,10 @@
         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 A.*,
+        SELECT A.id,
+               A.seq,
+               A.mobile_id,
+               A.friend_id,
                B.wx_name,
                B.wx_username,
                B.status,
@@ -31,4 +34,11 @@
         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>

+ 1 - 16
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,22 +184,6 @@ public class FosterwxMobile extends Model<FosterwxMobile> {
      */
     private String codeUrl;
 
-    /**
-     * 本次解封好友
-     */
-    private Integer unsealFriendId;
-    /**
-     * 新解封好友
-     */
-    private Integer switchUnsealFriendId;
-    /**
-     * 封禁时间
-     */
-    private LocalDateTime forbiddenAt;
-    /**
-     * 解封时间
-     */
-    private LocalDateTime unsealAt;
 
     /**
      * 创建时间

+ 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 +
+        "}";
+    }
+}

+ 0 - 1
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxMobileWxfriend.java

@@ -44,7 +44,6 @@ public class FosterwxMobileWxfriend extends Model<FosterwxMobileWxfriend> {
     /**
      * 好友ID
      */
-    @TableField(exist = false)
     private Integer friendId;
     @TableField(exist = false)
     private String wxName;

+ 8 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxWxfriend.java

@@ -7,6 +7,7 @@ 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;
@@ -20,6 +21,7 @@ import java.util.List;
  * @author leon
  * @since 2021-11-10
  */
+@Data
 @TableName("pan_fosterwx_wxfriend")
 public class FosterwxWxfriend extends Model<FosterwxWxfriend> {
 
@@ -57,6 +59,12 @@ public class FosterwxWxfriend extends Model<FosterwxWxfriend> {
     private Integer switchFriendId;
 
     /**
+     * 已经绑定的账号
+     */
+    @TableField(exist = false)
+    private Integer bindMobileCnt;
+
+    /**
      * 绑定的解封手机账号
      */
     @TableField(exist = false)

+ 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);
+}

+ 2 - 0
src/main/java/com/mokamrp/privates/service/pangu/FosterwxMobileWxfriendService.java

@@ -23,6 +23,8 @@ public interface FosterwxMobileWxfriendService extends IService<FosterwxMobileWx
     public ResHandle<List<FosterwxMobileWxfriend>> getList(PostBasePageHandle handle);
     //.@volta 获取可被替换的解封好友
     public List<FosterwxWxfriend> getCanSwtichFriendList();
+    //.@volta 获取可被绑定的解封好友
+    public List<FosterwxWxfriend> getCanBindFriendList();
     //.@leon 删除数据同时新增数据
     public Boolean removeAndAdd(AddFosterwxMobileHandle addFosterwxMobileHandle);
     //.@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;
+    }
+}

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

@@ -65,6 +65,15 @@ public class FosterwxMobileWxfriendServiceImpl extends ServiceImpl<FosterwxMobil
     }
 
     /**
+     * 获取可被绑定的解封好友
+     * @return
+     */
+    public List<FosterwxWxfriend> getCanBindFriendList() {
+        List<FosterwxWxfriend> list = fosterwxMobileWxfriendMapper.getCanSwtichFriendList();
+        return list;
+    }
+
+    /**
      * 删除数据同时新增数据
      * @param addFosterwxMobileHandle
      * @return

+ 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());
+            }
+        }
+    }
+}

+ 10 - 2
src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxCanSwitchFriendToRedis.java

@@ -5,8 +5,10 @@ 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;
@@ -30,10 +32,14 @@ public class SyncFosterwxCanSwitchFriendToRedis {
     @Autowired
     public StringRedisTemplate stringRedisTemplate;
 
-    @Scheduled(cron = "*/1 * * * * ?")
+    @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) {
@@ -47,9 +53,11 @@ public class SyncFosterwxCanSwitchFriendToRedis {
                 sync.put(fosterwxWxfriend.getStationId(),stationFriends);
             }
         }
-        for (Integer stationId : sync.keySet()){
+        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(

+ 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();

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

@@ -24,7 +24,7 @@ import java.util.List;
 import java.util.stream.Collectors;
 
 @Component
-public class SyncFosterwxEdit {
+public class SyncFosterwxMobileEdit {
 
     @Autowired
     public FosterwxTaskScheduleService fosterwxTaskScheduleService;
@@ -53,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;
@@ -96,7 +96,7 @@ public class SyncFosterwxEdit {
                 if (fosterwxMobile.getFriend() != null) {
                     AddFosterwxMobileHandle addFosterwxMobileHandle = new AddFosterwxMobileHandle();
                     addFosterwxMobileHandle.setMobileId(fosterwxMobile.getId());
-                    List<Integer> friendIds = fosterwxMobile.getFriend().stream().map(FosterwxMobileWxfriend::getId).collect(Collectors.toList());
+                    List<Integer> friendIds = fosterwxMobile.getFriend().stream().map(FosterwxMobileWxfriend::getFriendId).collect(Collectors.toList());
                     addFosterwxMobileHandle.setFriendIds(friendIds);
                     fosterwxMobileWxfriendService.removeAndAdd(addFosterwxMobileHandle);
                 }

+ 2 - 4
src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxMobileFriendToRedis.java

@@ -53,12 +53,10 @@ public class SyncFosterwxMobileFriendToRedis {
         }
         for (Integer mobileId : sync.keySet()) {
             //.置空
-            stringRedisTemplate.delete(RedisKey.PanWxFosterMobileFriendInfo + mobileId);
+            stringRedisTemplate.delete(RedisKey.PanWxFosterMobileFriendId + mobileId);
             for (FosterwxMobileWxfriend fosterwxMobileWxfriend : sync.get(mobileId)) {
                 //.更新可用好友
-                stringRedisTemplate.opsForSet().add(
-                        RedisKey.PanWxFosterMobileFriendInfo + mobileId.toString(),
-                        JSONObject.toJSONString(fosterwxMobileWxfriend));
+                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")