|
|
@@ -2,11 +2,16 @@ 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.HttpMsg;
|
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
|
+import com.mokamrp.privates.entity.DelHandle;
|
|
|
+import com.mokamrp.privates.entity.EditHandle;
|
|
|
import com.mokamrp.privates.entity.PostBasePageHandle;
|
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileWxfriend;
|
|
|
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxStation;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxMobileWxfriendService;
|
|
|
+import com.mokamrp.privates.service.pangu.FosterwxStationService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -14,6 +19,7 @@ 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 java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -32,6 +38,9 @@ import java.util.Map;
|
|
|
public class FosterwxMobileController extends BaseController<FosterwxMobile> {
|
|
|
|
|
|
@Autowired
|
|
|
+ public FosterwxStationService fosterwxStationService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
public FosterwxMobileService fosterwxMobileService;
|
|
|
|
|
|
@Autowired
|
|
|
@@ -43,11 +52,11 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/list")
|
|
|
- public Object list(@Valid @RequestBody PostBasePageHandle postBasePageHandle, BindingResult bindingResult){
|
|
|
+ public Object list(@Valid @RequestBody PostBasePageHandle postBasePageHandle, BindingResult bindingResult) {
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
@@ -57,7 +66,87 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
|
|
|
return AjaxResult.error("ids null");
|
|
|
}
|
|
|
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);
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ *@Leon 以下接口为站点负责人后台页面接口,需要独立登陆才可访问
|
|
|
+ */
|
|
|
+
|
|
|
+ @PostMapping("/getMobileList")
|
|
|
+ public Object getMobileList(@RequestParam(name = "token") String token,
|
|
|
+ @Valid @RequestBody PostBasePageHandle postBasePageHandle, 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);
|
|
|
+ }
|
|
|
+ Map<String, Object> res = fosterwxMobileService.getListByStationId(postBasePageHandle.getPage(),postBasePageHandle.getPagesize(),fosterwxStation.getId());
|
|
|
+ return AjaxResult.success(res);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/delMobile")
|
|
|
+ public Object delMobile(@RequestParam(name = "token") String token,
|
|
|
+ @Valid @RequestBody DelHandle<FosterwxMobile> delHandle, 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);
|
|
|
+ }
|
|
|
+ QueryWrapper<FosterwxMobile> QueryWrapper = new QueryWrapper<>();
|
|
|
+ String[] ids = delHandle.getIds().split(",");
|
|
|
+ QueryWrapper.in("id", ids).eq("station_id",fosterwxStation.getId());
|
|
|
+ boolean res = service.remove(QueryWrapper);
|
|
|
+ if (!res) {
|
|
|
+ return AjaxResult.error(HttpMsg.error);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/editMobile")
|
|
|
+ public Object editMobile(@RequestParam(name = "token") String token,
|
|
|
+ @Valid @RequestBody EditHandle<FosterwxMobile> editHandle, 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.onUpdate(editHandle);
|
|
|
+ fosterwxMobileService.update(editHandle.getRaw(),
|
|
|
+ new QueryWrapper<FosterwxMobile>()
|
|
|
+ .eq("station_id",fosterwxStation.getId())
|
|
|
+ .in("id", editHandle.getIds()));
|
|
|
+ return AjaxResult.success(Constants.SUCCESS, true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/mobileInfo")
|
|
|
+ public Object mobileInfo(@RequestParam(name = "token") String token,
|
|
|
+ @RequestParam(name = "ids") String ids) {
|
|
|
+ //.登录验证
|
|
|
+ FosterwxStation fosterwxStation = fosterwxStationService.getAuthInfo(token);
|
|
|
+ if (fosterwxStation == null){
|
|
|
+ return AjaxResult.error(HttpStatus.LOGIN_ERROR, HttpMsg.needLogin);
|
|
|
+ }
|
|
|
+ if (ids == null || ids.isEmpty()) {
|
|
|
+ return AjaxResult.error("ids null");
|
|
|
+ }
|
|
|
+ FosterwxMobile res = service.getOne(new QueryWrapper<FosterwxMobile>()
|
|
|
+ .eq("id", ids)
|
|
|
+ .eq("station_id",fosterwxStation.getId()));
|
|
|
+ List<FosterwxMobileWxfriend> friendList = fosterwxMobileWxfriendService.list(new QueryWrapper<FosterwxMobileWxfriend>()
|
|
|
+ .eq("mobile_id", res.getId())
|
|
|
+ .orderByAsc("seq"));
|
|
|
res.setFriend(friendList);
|
|
|
return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
}
|