Parcourir la source

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

leon il y a 5 ans
Parent
commit
2e3a478537

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

@@ -4,27 +4,25 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.mokamrp.privates.constant.Constants;
 import com.mokamrp.privates.constant.HttpMsg;
 import com.mokamrp.privates.constant.HttpStatus;
+import com.mokamrp.privates.controller.BaseController;
 import com.mokamrp.privates.entity.AddHandle;
 import com.mokamrp.privates.entity.DelHandle;
 import com.mokamrp.privates.entity.EditHandle;
-import com.mokamrp.privates.controller.BaseController;
-import com.mokamrp.privates.entity.PostBasePageHandle;
 import com.mokamrp.privates.entity.pangu.GetForsterwxMobileHandle;
 import com.mokamrp.privates.help.AjaxResult;
 import com.mokamrp.privates.interceptor.AuthUser;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileWxfriend;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
+import com.mokamrp.privates.mapper.pojo.User;
+import com.mokamrp.privates.service.pangu.FosterwxMobileService;
 import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
 import com.mokamrp.privates.service.pangu.FosterwxStationService;
-import com.mokamrp.privates.mapper.pojo.User;
-import com.mokamrp.privates.service.pangu.*;
+import com.mokamrp.privates.service.pangu.FosterwxTaskScheduleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.*;
-import com.mokamrp.privates.service.pangu.FosterwxMobileService;
-import org.springframework.web.bind.annotation.RequestMapping;
 
 import javax.validation.Valid;
 import java.util.List;
@@ -93,7 +91,7 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
             ajaxResult = fosterwxTaskScheduleService.insertByTaskDate(addHandle.getRaw(), authUser, false);
         }
 
-        if (null == ajaxResult) return AjaxResult.success(HttpMsg.success,addHandle.getRaw().getId());
+        if (null == ajaxResult) return AjaxResult.success(HttpMsg.success, addHandle.getRaw().getId());
 
         return ajaxResult;
     }
@@ -101,15 +99,15 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
     @PostMapping("/editPro")
     public Object editPro(@Valid @RequestBody EditHandle<FosterwxMobile> editHandle, @AuthUser User authUser) {
         String[] ids = editHandle.getIds().split(",");
-        for (String id : ids){
+        for (String id : ids) {
             FosterwxMobile fosterwxMobile = editHandle.getRaw();
             FosterwxMobile oldVO = fosterwxMobileService.getById(id);
             // 新增账号
-            fosterwxMobileService.update(fosterwxMobile,new QueryWrapper<FosterwxMobile>().eq("id",id));
+            fosterwxMobileService.update(fosterwxMobile, new QueryWrapper<FosterwxMobile>().eq("id", id));
             fosterwxMobile = fosterwxMobileService.getById(id);
             // 判断开始做任务时间是否设置了
             AjaxResult ajaxResult = null;
-            if (null != fosterwxMobile.getTaskStartAt()) {
+            if (null != fosterwxMobile.getTaskStartAt() && oldVO.getTaskStartAt() == null) {
                 if (fosterwxMobile.getWxStatus() != 2) {
                     ajaxResult = fosterwxTaskScheduleService.insertByTaskDate(fosterwxMobile, authUser, false);
                 }
@@ -122,8 +120,8 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
             if (fosterwxMobile.getWxStatus() == 1 && oldVO.getWxStatus() == 2) {
                 ajaxResult = fosterwxTaskScheduleService.insertByTaskDate(fosterwxMobile, authUser, true);
             }
-            if (ajaxResult != null){
-                return AjaxResult.error(id+"账号批量操作中出现错误");
+            if (ajaxResult != null) {
+                return AjaxResult.error(id + "账号批量操作中出现错误");
             }
         }
         return AjaxResult.success("更新账号成功");
@@ -143,10 +141,10 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
         }
         //.登录验证
         FosterwxStation fosterwxStation = fosterwxStationService.getAuthInfo(token);
-        if (fosterwxStation == null){
+        if (fosterwxStation == null) {
             return AjaxResult.error(HttpStatus.LOGIN_ERROR, HttpMsg.needLogin);
         }
-        Map<String, Object> res = fosterwxMobileService.getListByStationId(getForsterwxMobileHandle,fosterwxStation.getId());
+        Map<String, Object> res = fosterwxMobileService.getListByStationId(getForsterwxMobileHandle, fosterwxStation.getId());
         return AjaxResult.success(res);
     }
 
@@ -158,12 +156,12 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
         }
         //.登录验证
         FosterwxStation fosterwxStation = fosterwxStationService.getAuthInfo(token);
-        if (fosterwxStation == null){
+        if (fosterwxStation == null) {
             return AjaxResult.error(HttpStatus.LOGIN_ERROR, HttpMsg.needLogin);
         }
         QueryWrapper<FosterwxMobile> QueryWrapper = new QueryWrapper<>();
         String[] ids = delHandle.getIds().split(",");
-        QueryWrapper.in("id", ids).eq("station_id",fosterwxStation.getId());
+        QueryWrapper.in("id", ids).eq("station_id", fosterwxStation.getId());
         boolean res = service.remove(QueryWrapper);
         if (!res) {
             return AjaxResult.error(HttpMsg.error);
@@ -173,13 +171,13 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
 
     @PostMapping("/addMobilePro")
     public Object addMobile(@RequestParam(name = "token") String token,
-                            @Valid @RequestBody AddHandle<FosterwxMobile> addHandle, BindingResult bindingResult){
+                            @Valid @RequestBody AddHandle<FosterwxMobile> addHandle, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
         }
         //.登录验证
         FosterwxStation fosterwxStation = fosterwxStationService.getAuthInfo(token);
-        if (fosterwxStation == null){
+        if (fosterwxStation == null) {
             return AjaxResult.error(HttpStatus.LOGIN_ERROR, HttpMsg.needLogin);
         }
         this.onInsert(addHandle.getRaw());
@@ -200,13 +198,13 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
         }
         //.登录验证
         FosterwxStation fosterwxStation = fosterwxStationService.getAuthInfo(token);
-        if (fosterwxStation == null){
+        if (fosterwxStation == null) {
             return AjaxResult.error(HttpStatus.LOGIN_ERROR, HttpMsg.needLogin);
         }
         this.onUpdate(editHandle);
         fosterwxMobileService.update(editHandle.getRaw(),
                 new QueryWrapper<FosterwxMobile>()
-                        .eq("station_id",fosterwxStation.getId())
+                        .eq("station_id", fosterwxStation.getId())
                         .in("id", editHandle.getIds()));
         return AjaxResult.success(Constants.SUCCESS, true);
     }
@@ -216,7 +214,7 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
                              @RequestParam(name = "ids") String ids) {
         //.登录验证
         FosterwxStation fosterwxStation = fosterwxStationService.getAuthInfo(token);
-        if (fosterwxStation == null){
+        if (fosterwxStation == null) {
             return AjaxResult.error(HttpStatus.LOGIN_ERROR, HttpMsg.needLogin);
         }
         if (ids == null || ids.isEmpty()) {
@@ -224,7 +222,7 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
         }
         FosterwxMobile res = service.getOne(new QueryWrapper<FosterwxMobile>()
                 .eq("id", ids)
-                .eq("station_id",fosterwxStation.getId()));
+                .eq("station_id", fosterwxStation.getId()));
         List<FosterwxMobileWxfriend> friendList = fosterwxMobileWxfriendService.list(new QueryWrapper<FosterwxMobileWxfriend>()
                 .eq("mobile_id", res.getId())
                 .orderByAsc("seq"));

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

@@ -140,7 +140,8 @@ public class FosterwxTaskScheduleController extends BaseController<FosterwxTaskS
                 FosterwxTaskScheduleHandle fosterwxTaskScheduleHandle = new FosterwxTaskScheduleHandle();
                 fosterwxTaskScheduleHandle.setTaskId(fosterwxTaskSchedule.getTaskId());
                 fosterwxTaskScheduleHandle.setStationId(fosterwxTaskSchedule.getStationId());
-                FosterwxTaskSchedule mobileContent = fosterwxTaskScheduleService.getInfo(handle);
+                fosterwxTaskScheduleHandle.setSendDate(fosterwxTaskSchedule.getSendDate());
+                FosterwxTaskSchedule mobileContent = fosterwxTaskScheduleService.getInfo(fosterwxTaskScheduleHandle);
                 if (null != mobileContent) {
                     fosterwxTaskSchedule.setMobileCount(mobileContent.getMobileCount());
                     fosterwxTaskSchedule.setComment(mobileContent.getComment());

+ 5 - 3
src/main/java/com/mokamrp/privates/mapper/pangu/pojo/FosterwxMobile.java

@@ -1,14 +1,15 @@
 package com.mokamrp.privates.mapper.pangu.pojo;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 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 com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
-import java.time.LocalDateTime;
 import java.io.Serializable;
+import java.time.LocalDateTime;
 import java.util.List;
 
 /**
@@ -145,6 +146,7 @@ public class FosterwxMobile extends Model<FosterwxMobile> {
     /**
      * 任务开始时间
      */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime taskStartAt;
 
     /**

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

@@ -55,7 +55,7 @@ public class FosterwxTaskScheduleServiceImpl extends ServiceImpl<FosterwxTaskSch
         Integer page = handle.getPage();
         Page<FosterwxTaskSchedule> pageObj = new Page<FosterwxTaskSchedule>(page, pagesize);
         QueryWrapper<FosterwxTaskSchedule> fosterwxTaskScheduleQueryWrapper = new QueryWrapper<>();
-        fosterwxTaskScheduleQueryWrapper.select("distinct station_id,station_name,task_id,task_name,task_status,task_send_status,create_uid,send_time,err_msg,mark");
+        fosterwxTaskScheduleQueryWrapper.select("distinct station_id,station_name,task_id,task_name,task_status,task_send_status,create_uid,send_date,send_time,err_msg,mark");
         fosterwxTaskScheduleQueryWrapper.eq("send_date", LocalDate.parse(handle.getDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
         if (null != handle.getId()) fosterwxTaskScheduleQueryWrapper.eq("id", handle.getId());
         if (null != handle.getTaskName() && !handle.getTaskName().isEmpty())
@@ -185,6 +185,7 @@ public class FosterwxTaskScheduleServiceImpl extends ServiceImpl<FosterwxTaskSch
         LambdaQueryWrapper<FosterwxTaskSchedule> fosterwxTaskScheduleLambdaQueryWrapper = new LambdaQueryWrapper<>();
         fosterwxTaskScheduleLambdaQueryWrapper.eq(FosterwxTaskSchedule::getStationId, handle.getStationId());
         fosterwxTaskScheduleLambdaQueryWrapper.eq(FosterwxTaskSchedule::getTaskId, handle.getTaskId());
+        fosterwxTaskScheduleLambdaQueryWrapper.eq(FosterwxTaskSchedule::getSendDate, handle.getSendDate());
         fosterwxTaskScheduleLambdaQueryWrapper.eq(FosterwxTaskSchedule::getDelFlg, 1);
         fosterwxTaskScheduleLambdaQueryWrapper.orderByAsc(FosterwxTaskSchedule::getMobileCode);
 
@@ -195,7 +196,7 @@ public class FosterwxTaskScheduleServiceImpl extends ServiceImpl<FosterwxTaskSch
             Integer code = fosterwxTaskSchedule.getMobileCode();
             // 第一条数据
             if (mobileCode.isEmpty()) {
-                mobileCode = String.format("%03d", code);
+                mobileCode = String.format("%03d", code) + "、";
             } else {
                 // 按顿号分组数据
                 String[] mobileArry = mobileCode.split("、");
@@ -229,7 +230,7 @@ public class FosterwxTaskScheduleServiceImpl extends ServiceImpl<FosterwxTaskSch
 
         FosterwxTaskSchedule fosterwxTaskSchedule = fosterwxTaskScheduleList.get(0);
         fosterwxTaskSchedule.setMobileCount(fosterwxTaskScheduleList.size());
-        fosterwxTaskSchedule.setComment(mobileCode);
+        fosterwxTaskSchedule.setComment(mobileCode.endsWith("、") ? mobileCode.substring(0, mobileCode.length() - 1) : mobileCode);
         return fosterwxTaskSchedule;
     }
 }