|
@@ -3,17 +3,19 @@ package com.mokamrp.privates.controller.pangu;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.mokamrp.privates.constant.Constants;
|
|
import com.mokamrp.privates.constant.Constants;
|
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
|
|
|
+import com.mokamrp.privates.controller.BaseController;
|
|
|
import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
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.FosterwxMobileWxfriend;
|
|
|
-import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
|
|
|
|
|
|
|
+import com.mokamrp.privates.mapper.pojo.User;
|
|
|
|
|
+import com.mokamrp.privates.service.pangu.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
-import com.mokamrp.privates.service.pangu.FosterwxMobileService;
|
|
|
|
|
-import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobile;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
-import com.mokamrp.privates.controller.BaseController;
|
|
|
|
|
|
|
+
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -36,6 +38,16 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
public FosterwxMobileWxfriendService fosterwxMobileWxfriendService;
|
|
public FosterwxMobileWxfriendService fosterwxMobileWxfriendService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FosterTaskScheduleService fosterTaskScheduleService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FosterwxStationService fosterwxStationService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private FosterTaskListService fosterTaskListService;
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* @fast
|
|
* @fast
|
|
|
* 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
|
|
* 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
|
|
@@ -43,25 +55,68 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
@PostMapping("/list")
|
|
@PostMapping("/list")
|
|
|
- public Object list(@Valid @RequestBody PostBasePageHandle postBasePageHandle, BindingResult bindingResult){
|
|
|
|
|
|
|
+ public Object list(@Valid @RequestBody PostBasePageHandle postBasePageHandle, BindingResult bindingResult) {
|
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
|
return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
}
|
|
}
|
|
|
- Map<String,Object> res = fosterwxMobileService.getList(postBasePageHandle);
|
|
|
|
|
|
|
+ Map<String, Object> res = fosterwxMobileService.getList(postBasePageHandle);
|
|
|
return AjaxResult.success(res);
|
|
return AjaxResult.success(res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
@GetMapping("/info")
|
|
@GetMapping("/info")
|
|
|
public Object info(@RequestParam(name = "ids") String ids) {
|
|
public Object info(@RequestParam(name = "ids") String ids) {
|
|
|
if (ids == null || ids.isEmpty()) {
|
|
if (ids == null || ids.isEmpty()) {
|
|
|
return AjaxResult.error("ids null");
|
|
return AjaxResult.error("ids null");
|
|
|
}
|
|
}
|
|
|
FosterwxMobile res = service.getOne(new QueryWrapper<FosterwxMobile>().eq("id", ids));
|
|
FosterwxMobile res = service.getOne(new QueryWrapper<FosterwxMobile>().eq("id", ids));
|
|
|
- List<FosterwxMobileWxfriend> friendList = fosterwxMobileWxfriendService.list(new QueryWrapper<FosterwxMobileWxfriend>().eq("mobile_id",res.getId()).orderByAsc("seq"));
|
|
|
|
|
|
|
+ List<FosterwxMobileWxfriend> friendList = fosterwxMobileWxfriendService.list(new QueryWrapper<FosterwxMobileWxfriend>().eq("mobile_id", res.getId()).orderByAsc("seq"));
|
|
|
res.setFriend(friendList);
|
|
res.setFriend(friendList);
|
|
|
return AjaxResult.success(Constants.SUCCESS, res);
|
|
return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/addPro")
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public Object addPro(@RequestBody FosterwxMobile fosterwxMobile, @AuthUser User authUser) {
|
|
|
|
|
+ // 新增账号
|
|
|
|
|
+ fosterwxMobileService.save(fosterwxMobile);
|
|
|
|
|
+
|
|
|
|
|
+ // 判断开始做任务时间是否设置了
|
|
|
|
|
+ AjaxResult ajaxResult = null;
|
|
|
|
|
+ if (null != fosterwxMobile.getTaskStartAt() && fosterwxMobile.getWxStatus() != 2) {
|
|
|
|
|
+ ajaxResult = fosterTaskScheduleService.insertByTaskDate(fosterwxMobile, authUser);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (null == ajaxResult) return AjaxResult.success("新增账号成功");
|
|
|
|
|
+
|
|
|
|
|
+ return ajaxResult;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/edit")
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
+ public Object edit(@RequestBody FosterwxMobile fosterwxMobile, @AuthUser User authUser) {
|
|
|
|
|
+ // 新增账号
|
|
|
|
|
+ fosterwxMobileService.updateById(fosterwxMobile);
|
|
|
|
|
+ fosterwxMobile = fosterwxMobileService.getById(fosterwxMobile.getId());
|
|
|
|
|
+
|
|
|
|
|
+ // 判断开始做任务时间是否设置了
|
|
|
|
|
+ AjaxResult ajaxResult = null;
|
|
|
|
|
+ if (null != fosterwxMobile.getTaskStartAt()) {
|
|
|
|
|
+ if (fosterwxMobile.getWxStatus() != 2) {
|
|
|
|
|
+ ajaxResult = fosterTaskScheduleService.insertByTaskDate(fosterwxMobile, authUser);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 判断微信状态是否更新为封禁
|
|
|
|
|
+ if (fosterwxMobile.getWxStatus() == 2) {
|
|
|
|
|
+ ajaxResult = fosterTaskScheduleService.deleteByDate(fosterwxMobile, authUser);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (null == ajaxResult) return AjaxResult.success("更新账号成功");
|
|
|
|
|
+
|
|
|
|
|
+ return ajaxResult;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|