|
@@ -4,6 +4,7 @@ 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.HttpMsg;
|
|
import com.mokamrp.privates.constant.HttpMsg;
|
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
|
|
|
+import com.mokamrp.privates.entity.AddHandle;
|
|
|
import com.mokamrp.privates.entity.DelHandle;
|
|
import com.mokamrp.privates.entity.DelHandle;
|
|
|
import com.mokamrp.privates.entity.EditHandle;
|
|
import com.mokamrp.privates.entity.EditHandle;
|
|
|
import com.mokamrp.privates.controller.BaseController;
|
|
import com.mokamrp.privates.controller.BaseController;
|
|
@@ -82,29 +83,28 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
|
|
|
|
|
|
|
|
@PostMapping("/addPro")
|
|
@PostMapping("/addPro")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Object addPro(@RequestBody FosterwxMobile fosterwxMobile, @AuthUser User authUser) {
|
|
|
|
|
|
|
+ public Object addPro(@Valid @RequestBody AddHandle<FosterwxMobile> addHandle, @AuthUser User authUser) {
|
|
|
// 新增账号
|
|
// 新增账号
|
|
|
- fosterwxMobileService.save(fosterwxMobile);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ fosterwxMobileService.save(addHandle.getRaw());
|
|
|
// 判断开始做任务时间是否设置了
|
|
// 判断开始做任务时间是否设置了
|
|
|
AjaxResult ajaxResult = null;
|
|
AjaxResult ajaxResult = null;
|
|
|
- if (null != fosterwxMobile.getTaskStartAt() && fosterwxMobile.getWxStatus() != 2) {
|
|
|
|
|
- ajaxResult = fosterwxTaskScheduleService.insertByTaskDate(fosterwxMobile, authUser, false);
|
|
|
|
|
|
|
+ if (null != addHandle.getRaw().getTaskStartAt() && addHandle.getRaw().getWxStatus() != 2) {
|
|
|
|
|
+ ajaxResult = fosterwxTaskScheduleService.insertByTaskDate(addHandle.getRaw(), authUser, false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (null == ajaxResult) return AjaxResult.success("新增账号成功");
|
|
|
|
|
|
|
+ if (null == ajaxResult) return AjaxResult.success(HttpMsg.success,addHandle.getRaw().getId());
|
|
|
|
|
|
|
|
return ajaxResult;
|
|
return ajaxResult;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PutMapping("/edit")
|
|
@PutMapping("/edit")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Object edit(@RequestBody FosterwxMobile fosterwxMobile, @AuthUser User authUser) {
|
|
|
|
|
- FosterwxMobile oldVO = fosterwxMobileService.getById(fosterwxMobile.getId());
|
|
|
|
|
|
|
+ public Object edit(@Valid @RequestBody EditHandle<FosterwxMobile> editHandle, @AuthUser User authUser) {
|
|
|
|
|
+ FosterwxMobile fosterwxMobile = editHandle.getRaw();
|
|
|
|
|
+ FosterwxMobile oldVO = fosterwxMobileService.getById(editHandle.getIds());
|
|
|
// 新增账号
|
|
// 新增账号
|
|
|
- fosterwxMobileService.updateById(fosterwxMobile);
|
|
|
|
|
- fosterwxMobile = fosterwxMobileService.getById(fosterwxMobile.getId());
|
|
|
|
|
-
|
|
|
|
|
|
|
+ fosterwxMobileService.update(fosterwxMobile,new QueryWrapper<FosterwxMobile>().eq("id",editHandle.getIds()));
|
|
|
|
|
+ fosterwxMobile = fosterwxMobileService.getById(editHandle.getIds());
|
|
|
// 判断开始做任务时间是否设置了
|
|
// 判断开始做任务时间是否设置了
|
|
|
AjaxResult ajaxResult = null;
|
|
AjaxResult ajaxResult = null;
|
|
|
if (null != fosterwxMobile.getTaskStartAt()) {
|
|
if (null != fosterwxMobile.getTaskStartAt()) {
|
|
@@ -168,6 +168,27 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
|
|
|
return AjaxResult.success(Constants.SUCCESS, res);
|
|
return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/addMobilePro")
|
|
|
|
|
+ public Object addMobile(@RequestParam(name = "token") String token,
|
|
|
|
|
+ @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){
|
|
|
|
|
+ return AjaxResult.error(HttpStatus.LOGIN_ERROR, HttpMsg.needLogin);
|
|
|
|
|
+ }
|
|
|
|
|
+ this.onInsert(addHandle.getRaw());
|
|
|
|
|
+ Boolean res = fosterwxMobileService.save(addHandle.getRaw());
|
|
|
|
|
+ if (res) {
|
|
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, addHandle.getRaw().getId());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return AjaxResult.error("新增失败", res);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@PostMapping("/editMobile")
|
|
@PostMapping("/editMobile")
|
|
|
public Object editMobile(@RequestParam(name = "token") String token,
|
|
public Object editMobile(@RequestParam(name = "token") String token,
|
|
|
@Valid @RequestBody EditHandle<FosterwxMobile> editHandle, BindingResult bindingResult) {
|
|
@Valid @RequestBody EditHandle<FosterwxMobile> editHandle, BindingResult bindingResult) {
|