|
@@ -2,13 +2,17 @@ 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.HttpMsg;
|
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
import com.mokamrp.privates.constant.HttpStatus;
|
|
|
import com.mokamrp.privates.entity.*;
|
|
import com.mokamrp.privates.entity.*;
|
|
|
import com.mokamrp.privates.entity.pangu.GetFosterwxCashOasBoxMobileGroupHandle;
|
|
import com.mokamrp.privates.entity.pangu.GetFosterwxCashOasBoxMobileGroupHandle;
|
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
import com.mokamrp.privates.help.AjaxResult;
|
|
|
|
|
+import com.mokamrp.privates.help.Analysis;
|
|
|
|
|
+import com.mokamrp.privates.interceptor.AuthUser;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.Custservice;
|
|
import com.mokamrp.privates.mapper.pangu.pojo.Custservice;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashMobileGroup;
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashMobileGroup;
|
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashOasBoxMobileGroup;
|
|
import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashOasBoxMobileGroup;
|
|
|
|
|
+import com.mokamrp.privates.mapper.pojo.User;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashMobileGroupService;
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashMobileGroupService;
|
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashOasBoxMobileGroupService;
|
|
import com.mokamrp.privates.service.pangu.FosterwxCashOasBoxMobileGroupService;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
@@ -22,9 +26,12 @@ 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.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import com.mokamrp.privates.controller.BaseController;
|
|
import com.mokamrp.privates.controller.BaseController;
|
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
@@ -69,9 +76,9 @@ public class FosterwxCashOasBoxController extends BaseController<FosterwxCashOas
|
|
|
return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
|
|
|
}
|
|
}
|
|
|
this.onUpdate(editHandle);
|
|
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()){
|
|
|
|
|
|
|
+ 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();
|
|
FosterwxCashOasBoxMobileGroup add = new FosterwxCashOasBoxMobileGroup();
|
|
|
add.setOasBoxId(Integer.parseInt(editHandle.getIds()));
|
|
add.setOasBoxId(Integer.parseInt(editHandle.getIds()));
|
|
|
add.setCashMobileGroupId(groupId);
|
|
add.setCashMobileGroupId(groupId);
|
|
@@ -135,7 +142,7 @@ public class FosterwxCashOasBoxController extends BaseController<FosterwxCashOas
|
|
|
handle.setOasBoxId(res.getId());
|
|
handle.setOasBoxId(res.getId());
|
|
|
handle.setPage(1);
|
|
handle.setPage(1);
|
|
|
handle.setPagesize(999999);
|
|
handle.setPagesize(999999);
|
|
|
- ResHandle<List<FosterwxCashOasBoxMobileGroup>> list = fosterwxCashOasBoxMobileGroupService.getList(handle);
|
|
|
|
|
|
|
+ ResHandle<List<FosterwxCashOasBoxMobileGroup>> list = fosterwxCashOasBoxMobileGroupService.getList(handle);
|
|
|
res.setMobileGroups(list.getList());
|
|
res.setMobileGroups(list.getList());
|
|
|
return AjaxResult.success(Constants.SUCCESS, res);
|
|
return AjaxResult.success(Constants.SUCCESS, res);
|
|
|
}
|
|
}
|
|
@@ -155,6 +162,33 @@ public class FosterwxCashOasBoxController extends BaseController<FosterwxCashOas
|
|
|
return AjaxResult.success(Constants.SUCCESS, true);
|
|
return AjaxResult.success(Constants.SUCCESS, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/import")
|
|
|
|
|
+ public Object uploadFile(@RequestBody MultipartFile file, @AuthUser User authUser) {
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>(16);
|
|
|
|
|
+ Map<Integer, String> feild = new HashMap<>(5);
|
|
|
|
|
+ feild.put(0, "stationName");
|
|
|
|
|
+ feild.put(1, "groupId");
|
|
|
|
|
+ feild.put(2, "mobileGroupId");
|
|
|
|
|
+ feild.put(3, "type");
|
|
|
|
|
+ feild.put(4, "boxType");
|
|
|
|
|
+ feild.put(5, "boxLocation");
|
|
|
|
|
+ feild.put(6, "ghId");
|
|
|
|
|
+ feild.put(7, "name");
|
|
|
|
|
+ feild.put(8, "scope");
|
|
|
|
|
+ feild.put(9, "remark");
|
|
|
|
|
+ List<Map<String, String>> row = new ArrayList<>();
|
|
|
|
|
+ VoltaHandle<ArrayList<Map<String, String>>> voltaRes = Analysis.analysis(file, feild);
|
|
|
|
|
+ if (voltaRes.getErr() != null) {
|
|
|
|
|
+ return AjaxResult.error(voltaRes.getErr());
|
|
|
|
|
+ }
|
|
|
|
|
+ row = voltaRes.getData();
|
|
|
|
|
+ try {
|
|
|
|
|
+ VoltaHandle<Boolean> res = fosterwxCashOasBoxService.importData(row, authUser);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return AjaxResult.success(HttpMsg.importSuccess);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|