Selaa lähdekoodia

Auto stash before merge of "dev-lqc" and "test"

lqc 4 vuotta sitten
vanhempi
commit
8e6e0cb00c

+ 13 - 7
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxCashAccountScheduleController.java

@@ -22,10 +22,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
@@ -77,7 +74,7 @@ public class FosterwxCashAccountScheduleController extends BaseController<Foster
     }
 
     @PostMapping("/addPro")
-    @ApiOperation(value = "新建按钮")
+    @ApiOperation(value = "新建按钮 个微企微用type区分")
     @Transactional(rollbackFor = Exception.class)
     public Object addPro(@RequestBody FosterwxCashAccountSchedule fosterwxCashAccountSchedule, @AuthUser User user) {
         this.onInsert(fosterwxCashAccountSchedule);
@@ -88,20 +85,23 @@ public class FosterwxCashAccountScheduleController extends BaseController<Foster
 
         // 待创建
         fosterwxCashAccountSchedule.setStatus(2);
+
         fosterwxCashAccountScheduleService.save(fosterwxCashAccountSchedule);
 
         return AjaxResult.success("新建成功");
     }
 
-    @ApiOperation(value = "导入排期按钮")
+    @ApiOperation(value = "导入排期按钮 新加一个type字段 加在url后面传输")
     @PostMapping("/importSchedule")
     @Transactional(rollbackFor = Exception.class)
-    public Object importSchedule(@RequestBody MultipartFile file, @AuthUser User user) {
+    public Object importSchedule(@RequestParam(defaultValue = "1") Integer type, @RequestBody MultipartFile file, @AuthUser User user) {
         Map<String, Object> map = new HashMap<>(16);
         Map<Integer, String> feild = new HashMap<>(5);
         feild.put(0, "scheduleDate");
         feild.put(1, "groupId");
         feild.put(2, "templateId");
+        feild.put(3, "groupNumEveryTime|default");
+        feild.put(4, "messageInterval|default");
         List<Map<String, String>> row = new ArrayList<>();
         VoltaHandle<ArrayList<Map<String, String>>> voltaRes = Analysis.analysis(file, feild);
         if (voltaRes.getErr() != null) {
@@ -111,10 +111,16 @@ public class FosterwxCashAccountScheduleController extends BaseController<Foster
 
         for (Map<String, String> detail : row) {
             FosterwxCashAccountSchedule fosterwxCashAccountSchedule = new FosterwxCashAccountSchedule();
+
             fosterwxCashAccountSchedule.setScheduleDate(LocalDate.parse(detail.get("scheduleDate")));
             fosterwxCashAccountSchedule.setGroupId(Integer.valueOf(detail.get("groupId")));
             fosterwxCashAccountSchedule.setTemplateId(Integer.valueOf(detail.get("templateId")));
             fosterwxCashAccountSchedule.setStatus(2);
+            fosterwxCashAccountSchedule.setType(type);
+            if (2 == type) {
+                fosterwxCashAccountSchedule.setGroupNumEveryTime(Integer.valueOf(detail.get("groupNumEveryTime")));
+                fosterwxCashAccountSchedule.setMessageInterval(Integer.valueOf(detail.get("messageInterval")));
+            }
             fosterwxCashAccountSchedule.setCreateUid(user.getId());
             fosterwxCashAccountSchedule.setCreateUser(user.getName());
             fosterwxCashAccountSchedule.setUpdateUid(user.getId());

+ 2 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxCashAccountScheduleMapper.xml

@@ -10,6 +10,8 @@
         <result column="template_id" property="templateId" />
         <result column="status" property="status" />
         <result column="type" property="type" />
+        <result column="group_num_erery_time" property="groupNumEreryTime" />
+        <result column="message_interval" property="messageInterval" />
         <result column="create_uid" property="createUid" />
         <result column="create_user" property="createUser" />
         <result column="update_uid" property="updateUid" />

+ 28 - 0
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxCashAccountSchedule.java

@@ -55,6 +55,16 @@ public class FosterwxCashAccountSchedule extends Model<FosterwxCashAccountSchedu
     private Integer type;
 
     /**
+     * 单次发送群数量
+     */
+    private Integer groupNumEveryTime;
+
+    /**
+     * 消息间隔(秒)
+     */
+    private Integer messageInterval;
+
+    /**
      * 创建人
      */
     private Integer createUid;
@@ -142,6 +152,22 @@ public class FosterwxCashAccountSchedule extends Model<FosterwxCashAccountSchedu
         this.type = type;
     }
 
+    public Integer getGroupNumEveryTime() {
+        return groupNumEveryTime;
+    }
+
+    public void setGroupNumEveryTime(Integer groupNumEveryTime) {
+        this.groupNumEveryTime = groupNumEveryTime;
+    }
+
+    public Integer getMessageInterval() {
+        return messageInterval;
+    }
+
+    public void setMessageInterval(Integer messageInterval) {
+        this.messageInterval = messageInterval;
+    }
+
     public Integer getCreateUid() {
         return createUid;
     }
@@ -236,6 +262,8 @@ public class FosterwxCashAccountSchedule extends Model<FosterwxCashAccountSchedu
                 ", templateId=" + templateId +
                 ", status=" + status +
                 ", type=" + type +
+                ", groupNumEreryTime=" + groupNumEveryTime +
+                ", messageInterval=" + messageInterval +
                 ", createUid=" + createUid +
                 ", createUser=" + createUser +
                 ", updateUid=" + updateUid +

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

@@ -57,7 +57,7 @@ public class SyncCreateCashTask {
         // 获取明天日期
         LocalDate nextDay = LocalDate.now().plusDays(1);
 
-        List<FosterwxCashAccountSchedule> fosterwxCashAccountSchedules = fosterwxCashAccountScheduleService.list(new LambdaQueryWrapper<FosterwxCashAccountSchedule>().eq(FosterwxCashAccountSchedule::getScheduleDate, nextDay).eq(FosterwxCashAccountSchedule::getStatus, 2));
+        List<FosterwxCashAccountSchedule> fosterwxCashAccountSchedules = fosterwxCashAccountScheduleService.list(new LambdaQueryWrapper<FosterwxCashAccountSchedule>().eq(FosterwxCashAccountSchedule::getType, 1).eq(FosterwxCashAccountSchedule::getScheduleDate, nextDay).eq(FosterwxCashAccountSchedule::getStatus, 2));
 
         List<FosterwxCashScheduleTaskList> newsList = new ArrayList<>();
         fosterwxCashAccountSchedules.forEach(fosterwxCashAccountSchedule -> {

+ 27 - 0
src/main/java/com/mokamrp/privates/task/pangu/SyncFosterwxWorkCash.java

@@ -0,0 +1,27 @@
+package com.mokamrp.privates.task.pangu;
+
+import com.mokamrp.privates.service.pangu.FosterwxMobileService;
+import lombok.extern.slf4j.Slf4j;
+import net.javacrumbs.shedlock.core.SchedulerLock;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+/**
+ * 企微任务相关
+ */
+@Component
+@Slf4j
+public class SyncFosterwxWorkCash {
+    @Autowired
+    private FosterwxMobileService fosterwxMobileService;
+
+    /**
+     * 每分钟根据接口更新企业微信在线状态
+     */
+    @Scheduled(cron = "0 */1 * * * ?")
+    @SchedulerLock(name = "pangu:SyncWorkwxStatus", lockAtLeastForString = "PT5S", lockAtMostForString = "PT15M")
+    public void syncWorkwxStatus() {
+        // TODO 根据爬虫提供的接口更新企微登陆状态
+    }
+}

BIN
src/main/resources/static/养号变现导入排期-企微.xls


+ 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_task_catalog");
+                .setInclude("pan_fosterwx_cash_account_schedule");
         //4. 包名策略配置
         PackageConfig pkConfig = new PackageConfig();
         pkConfig.setParent("com.mokamrp.privates")