|
@@ -1,24 +1,33 @@
|
|
|
package com.mokamrp.privates.controller.pangu;
|
|
package com.mokamrp.privates.controller.pangu;
|
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.mokamrp.privates.constant.Constants;
|
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
|
-import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
|
|
|
|
|
+import com.mokamrp.privates.entity.*;
|
|
|
|
|
+import com.mokamrp.privates.entity.pangu.GetFosterwxCashOasBoxMobileGroupHandle;
|
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
|
-import com.mokamrp.privates.entity.ResHandle;
|
|
|
|
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.Custservice;
|
|
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashMobileGroup;
|
|
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashOasBoxMobileGroup;
|
|
|
|
|
+import com.mokamrp.privates.service.pangu.FosterwxCashMobileGroupService;
|
|
|
|
|
+import com.mokamrp.privates.service.pangu.FosterwxCashOasBoxMobileGroupService;
|
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import io.swagger.annotations.SwaggerDefinition;
|
|
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashOasBoxService;
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashOasBoxService;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashOasBox;
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashOasBox;
|
|
|
-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.RequestMapping;
|
|
|
import com.mokamrp.privates.controller.BaseController;
|
|
import com.mokamrp.privates.controller.BaseController;
|
|
|
|
|
+
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* <p>
|
|
* <p>
|
|
@@ -29,12 +38,16 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
* @since 2021-10-09
|
|
* @since 2021-10-09
|
|
|
*/
|
|
*/
|
|
|
@RestController
|
|
@RestController
|
|
|
|
|
+@Api(tags = "公众号/小程序模块")
|
|
|
@RequestMapping("/pangu/fosterwxCashOasBox")
|
|
@RequestMapping("/pangu/fosterwxCashOasBox")
|
|
|
public class FosterwxCashOasBoxController extends BaseController<FosterwxCashOasBox> {
|
|
public class FosterwxCashOasBoxController extends BaseController<FosterwxCashOasBox> {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
public FosterwxCashOasBoxService fosterwxCashOasBoxService;
|
|
public FosterwxCashOasBoxService fosterwxCashOasBoxService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ public FosterwxCashOasBoxMobileGroupService fosterwxCashOasBoxMobileGroupService;
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* @fast
|
|
* @fast
|
|
|
* 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
|
|
* 默认生成的控制器所继承的父类中有index/add/edit/del四个基础方法,均为post json请求
|
|
@@ -42,7 +55,7 @@ public class FosterwxCashOasBoxController extends BaseController<FosterwxCashOas
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
@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());
|
|
|
}
|
|
}
|
|
@@ -50,7 +63,97 @@ public class FosterwxCashOasBoxController extends BaseController<FosterwxCashOas
|
|
|
return AjaxResult.success(res);
|
|
return AjaxResult.success(res);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/edit")
|
|
|
|
|
+ public Object edit(@Valid @RequestBody EditHandle<FosterwxCashOasBox> editHandle, BindingResult bindingResult) {
|
|
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
|
|
+ return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ this.onUpdate(editHandle);
|
|
|
|
|
+ if (editHandle.getRaw().getMobileGroupIds() != null || editHandle.getRaw().getMobileGroupIds().size() > 0){
|
|
|
|
|
+ fosterwxCashOasBoxMobileGroupService.remove(new QueryWrapper<FosterwxCashOasBoxMobileGroup>().eq("oas_box_id",editHandle.getIds()));
|
|
|
|
|
+ for (Integer groupId: editHandle.getRaw().getMobileGroupIds()){
|
|
|
|
|
+ FosterwxCashOasBoxMobileGroup add = new FosterwxCashOasBoxMobileGroup();
|
|
|
|
|
+ add.setOasBoxId(Integer.parseInt(editHandle.getIds()));
|
|
|
|
|
+ add.setCashMobileGroupId(groupId);
|
|
|
|
|
+ add.setUpdateAt(LocalDateTime.now());
|
|
|
|
|
+ add.setCreateAt(LocalDateTime.now());
|
|
|
|
|
+ fosterwxCashOasBoxMobileGroupService.save(add);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ service.update(editHandle.getRaw(), new QueryWrapper<FosterwxCashOasBox>().in("id", editHandle.getIds()));
|
|
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "批量设置分组")
|
|
|
|
|
+ @PostMapping("/setGroup")
|
|
|
|
|
+ public Object setGroup(@Valid @RequestBody SetGroupHandle setGroupHandle, BindingResult bindingResult) {
|
|
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
|
|
+ return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ FosterwxCashOasBox save = new FosterwxCashOasBox();
|
|
|
|
|
+ save.setGroupId(setGroupHandle.getGroupId());
|
|
|
|
|
+ save.setUpdateAt(LocalDateTime.now());
|
|
|
|
|
+ service.update(save, new QueryWrapper<FosterwxCashOasBox>().in("id", setGroupHandle.getIds()));
|
|
|
|
|
+// this.sync();
|
|
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, true);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "批量设置账号分组")
|
|
|
|
|
+ @PostMapping("/setMobileGroup")
|
|
|
|
|
+ public Object setMobileGroup(@Valid @RequestBody SetIdssHandle handle, BindingResult bindingResult) {
|
|
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
|
|
+ return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ //.遍历公众号小程序ID
|
|
|
|
|
+ for (Integer localId : handle.getLocalIds()) {
|
|
|
|
|
+ //.遍历账号分组ID
|
|
|
|
|
+ for (Integer id : handle.getIds()) {
|
|
|
|
|
+ Integer has = fosterwxCashOasBoxMobileGroupService.count(new QueryWrapper<FosterwxCashOasBoxMobileGroup>()
|
|
|
|
|
+ .eq("oas_box_id", localId)
|
|
|
|
|
+ .eq("cash_mobile_group_id", id));
|
|
|
|
|
+ if (has > 0) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ FosterwxCashOasBoxMobileGroup add = new FosterwxCashOasBoxMobileGroup();
|
|
|
|
|
+ add.setCashMobileGroupId(id);
|
|
|
|
|
+ add.setOasBoxId(localId);
|
|
|
|
|
+ add.setCreateAt(LocalDateTime.now());
|
|
|
|
|
+ add.setUpdateAt(LocalDateTime.now());
|
|
|
|
|
+ fosterwxCashOasBoxMobileGroupService.save(add);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/info")
|
|
|
|
|
+ public Object info(@RequestParam(name = "ids") String ids) {
|
|
|
|
|
+ if (ids == null || ids.isEmpty()) {
|
|
|
|
|
+ return AjaxResult.error("ids null");
|
|
|
|
|
+ }
|
|
|
|
|
+ FosterwxCashOasBox res = service.getOne(new QueryWrapper<FosterwxCashOasBox>().eq("id", ids));
|
|
|
|
|
+ GetFosterwxCashOasBoxMobileGroupHandle handle = new GetFosterwxCashOasBoxMobileGroupHandle();
|
|
|
|
|
+ handle.setOasBoxId(res.getId());
|
|
|
|
|
+ handle.setPage(1);
|
|
|
|
|
+ handle.setPagesize(999999);
|
|
|
|
|
+ ResHandle<List<FosterwxCashOasBoxMobileGroup>> list = fosterwxCashOasBoxMobileGroupService.getList(handle);
|
|
|
|
|
+ res.setMobileGroups(list.getList());
|
|
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "批量设置小程序类型")
|
|
|
|
|
+ @PostMapping("/setBoxLocation")
|
|
|
|
|
+ public Object setBoxLocation(@Valid @RequestBody SetIdsHandle handle, BindingResult bindingResult) {
|
|
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
|
|
+ return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ FosterwxCashOasBox save = new FosterwxCashOasBox();
|
|
|
|
|
+ save.setBoxLocation(handle.getId());
|
|
|
|
|
+ save.setUpdateAt(LocalDateTime.now());
|
|
|
|
|
+ service.update(save, new QueryWrapper<FosterwxCashOasBox>().in("id", handle.getIds()));
|
|
|
|
|
+// this.sync();
|
|
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, true);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|