Przeglądaj źródła

Merge branch 'master' of http://git.mokasz.com/marketing/moka-private

leon 4 lat temu
rodzic
commit
9473c85f03

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

@@ -65,8 +65,8 @@ public class FosterwxFlowListController extends BaseController<FosterwxFlowList>
         // 最大进粉阈值
         Integer maxFans = Integer.valueOf(fosterwxMobilePool.getMaxFans());
 
-        // 查看是否超过百分之五十
-        if (fosterwxFlowList.getBusFans() > maxFans / 2.0) {
+        // 查看是否超过百分之五十 并且 所属组别不是游戏导粉类型
+        if (fosterwxFlowList.getBusFans() > maxFans * 7 / 10.0 && 2 != fosterwxMobilePool.getIncomeFansType()) {
             // 超过
             // 更新
             // 设置流量位置

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

@@ -509,6 +509,7 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
             fosterwxMobilePool.setCodeUrl(fosterwxMobile.getCodeUrl());
             fosterwxMobilePool.setStatus(1);
             fosterwxMobilePool.setMaxFans("");
+            fosterwxMobilePool.setIncomeFansType(fosterwxMobile.getIncomeFansType());
             fosterwxMobilePool.setBusMobileNo(fosterwxMobile.getMobileNo());
             fosterwxMobilePool.setFlowPosition("");
             if (null != corp) {

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

@@ -13,4 +13,5 @@ public class FosterwxMobilePoolHandle extends Model<FosterwxMobilePoolHandle> {
     private String mobileNo;
     private Integer status;
     private String flowPosition;
+    private Integer incomeFansType;
 }

+ 4 - 3
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobilePoolMapper.xml

@@ -12,10 +12,11 @@
         <result column="mobile_no" property="mobileNo"/>
         <result column="code_url" property="codeUrl"/>
         <result column="status" property="status"/>
-        <result column="is_auto" property="isAuto" />
-        <result column="status_update_time" property="statusUpdateTime" />
+        <result column="is_auto" property="isAuto"/>
+        <result column="status_update_time" property="statusUpdateTime"/>
         <result column="wx_appid" property="wxAppid"/>
         <result column="max_fans" property="maxFans"/>
+        <result column="income_fans_type" property="incomeFansType"/>
         <result column="bus_mobile_no" property="busMobileNo"/>
         <result column="flow_position" property="flowPosition"/>
         <result column="create_uid" property="createUid"/>
@@ -27,7 +28,7 @@
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id
-        , pool_index, station_id, station_name, mobile_code, mobile_no, code_url, status, is_auto, status_update_time, wx_appid, max_fans, bus_mobile_no, flow_position, create_uid, update_uid, create_at, update_at
+        , pool_index, station_id, station_name, mobile_code, mobile_no, code_url, status, is_auto, status_update_time, wx_appid, max_fans, income_fans_type, bus_mobile_no, flow_position, create_uid, update_uid, create_at, update_at
     </sql>
     <select id="getList" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobilePool">
         SELECT *

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

@@ -190,6 +190,8 @@ public class FosterwxMobile extends Model<FosterwxMobile> {
     @TableField(exist = false)
     private String type;
 
+    @TableField(exist = false)
+    private Integer incomeFansType;
 
     public Integer getId() {
         return id;

+ 4 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxMobilePool.java

@@ -85,6 +85,10 @@ public class FosterwxMobilePool extends Model<FosterwxMobilePool> {
      */
     private String maxFans;
 
+    /**
+     * 导粉类型(1、流量导粉2、游戏导粉)
+     */
+    private Integer incomeFansType;
 
     /**
      * 当日进粉数量

+ 3 - 0
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxMobilePoolServiceImpl.java

@@ -50,6 +50,9 @@ public class FosterwxMobilePoolServiceImpl extends ServiceImpl<FosterwxMobilePoo
             fosterwxMobilePoolLambdaQueryWrapper.eq(FosterwxMobilePool::getStatus, handle.getStatus());
         if (null != handle.getFlowPosition() && !handle.getFlowPosition().isEmpty())
             fosterwxMobilePoolLambdaQueryWrapper.like(FosterwxMobilePool::getFlowPosition, handle.getFlowPosition());
+        if (null != handle.getIncomeFansType() && 0 != handle.getIncomeFansType())
+            fosterwxMobilePoolLambdaQueryWrapper.eq(FosterwxMobilePool::getIncomeFansType, handle.getIncomeFansType());
+
         fosterwxMobilePoolLambdaQueryWrapper.orderByDesc(FosterwxMobilePool::getId);
 
         pageObj = fosterwxMobilePoolMapper.selectPage(pageObj, fosterwxMobilePoolLambdaQueryWrapper);

+ 49 - 0
src/main/java/com/mokamrp/privates/task/pangu/CheckPoolStatus.java

@@ -0,0 +1,49 @@
+package com.mokamrp.privates.task.pangu;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobilePool;
+import com.mokamrp.privates.service.pangu.FosterwxMobilePoolService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**检查个微池二维码是否有能用的
+ * @author luqiucheng
+ */
+@Component
+@Slf4j
+public class CheckPoolStatus {
+    @Autowired
+    private FosterwxMobilePoolService fosterwxMobilePoolService;
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    @Scheduled(cron = "0 */1 * * * ?")
+    public void execute() {
+        LambdaQueryWrapper<FosterwxMobilePool> fosterwxMobilePoolLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        // 查询有分组的 类型为游戏导粉的
+        fosterwxMobilePoolLambdaQueryWrapper.ne(FosterwxMobilePool::getFlowPosition, "").eq(FosterwxMobilePool::getIncomeFansType, 2).groupBy(FosterwxMobilePool::getFlowPosition);
+        fosterwxMobilePoolService.list(fosterwxMobilePoolLambdaQueryWrapper).forEach(fosterwxMobilePool -> {
+            // 判断分组下未停用账号是否存在
+            if (fosterwxMobilePoolService.count(new LambdaQueryWrapper<FosterwxMobilePool>().eq(FosterwxMobilePool::getFlowPosition, fosterwxMobilePool.getFlowPosition()).ne(FosterwxMobilePool::getStatus, 0)) == 0) {
+                Map<String, Object> jsonObject = new HashMap<>();
+                jsonObject.put("msg_type", "text");
+                Map<String, String> contentObj = new HashMap<>();
+                String info = "流量位置:" + fosterwxMobilePool.getFlowPosition() + "已没有可以使用的二维码了!";
+                contentObj.put("text", info);
+                jsonObject.put("content", contentObj);
+                HttpEntity<Map<String, Object>> entity = new HttpEntity<>(jsonObject, null);
+                ResponseEntity<String> str = restTemplate.exchange("https://open.feishu.cn/open-apis/bot/v2/hook/782210e2-b016-4dd7-885b-e0ea5e58be94", HttpMethod.POST, entity, String.class);
+            }
+        });
+    }
+}

+ 6 - 0
src/test/java/com/mokamrp/Tests.java

@@ -65,4 +65,10 @@ public class Tests {
 
 
     }
+
+    @Test
+    public void test5() {
+        Integer count = 12;
+        System.out.println(count * 7 / 10.0);
+    }
 }

+ 6 - 1
src/test/java/com/mokamrp/WebTest.java

@@ -10,6 +10,7 @@ import com.mokamrp.privates.service.pangu.FosterwxMobilePoolService;
 import com.mokamrp.privates.service.pangu.FosterwxMobileService;
 import com.mokamrp.privates.service.pangu.FosterwxMobileTaskTimeListService;
 import com.mokamrp.privates.service.pangu.FosterwxTaskScheduleService;
+import com.mokamrp.privates.task.pangu.CheckPoolStatus;
 import com.mokamrp.privates.task.pangu.SyncFosterwxMobilePool;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.Test;
@@ -42,6 +43,9 @@ public class WebTest {
     @Autowired
     private FosterwxTaskScheduleService fosterwxTaskScheduleService;
 
+    @Autowired
+    private CheckPoolStatus checkPoolStatus;
+
     @Test
     public void test1() {
         // 清洗数据
@@ -67,7 +71,8 @@ public class WebTest {
 
     @Test
     public void test2() {
-        syncFosterwxMobilePool.execute();
+        // syncFosterwxMobilePool.execute();
+        checkPoolStatus.execute();
     }
 
     /**