|
@@ -11,7 +11,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
import com.persagy.adm.server.custom.client.RwdClient;
|
|
|
import com.persagy.adm.server.custom.common.AdmConst;
|
|
|
import com.persagy.adm.server.custom.common.AdmRequest;
|
|
|
-import com.persagy.adm.server.custom.common.AdmResult;
|
|
|
import com.persagy.adm.server.custom.dao.*;
|
|
|
import com.persagy.adm.server.custom.entity.Dict;
|
|
|
import com.persagy.adm.server.custom.entity.InfoDef;
|
|
@@ -23,6 +22,8 @@ import com.persagy.adm.server.custom.service.ServiceUtil;
|
|
|
import com.persagy.dmp.basic.model.QueryCriteria;
|
|
|
import com.persagy.dmp.common.constant.ResponseCode;
|
|
|
import com.persagy.dmp.common.exception.BusinessException;
|
|
|
+import com.persagy.dmp.common.model.response.CommonResult;
|
|
|
+import com.persagy.dmp.common.utils.ResultHelper;
|
|
|
import com.persagy.dmp.define.entity.GraphDefine;
|
|
|
import com.persagy.dmp.define.entity.RelationDefine;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -54,12 +55,12 @@ public class ToolController {
|
|
|
private AdmM2dEquipMapper m2dEquipMapper;
|
|
|
|
|
|
@GetMapping("/hello")
|
|
|
- public AdmResult<Integer> hello(){
|
|
|
- return AdmResult.success(configService.queryCommonConfig(null).size());
|
|
|
+ public CommonResult<Integer> hello(){
|
|
|
+ return ResultHelper.single(configService.queryCommonConfig(null).size());
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/dict")
|
|
|
- public AdmResult<Dict> dict(@RequestBody AdmRequest req, @RequestParam(required = false) String module){
|
|
|
+ public CommonResult<Dict> dict(@RequestBody AdmRequest req, @RequestParam(required = false) String module){
|
|
|
Dict map = syncApp.queryDict(req.getGroupCode(), req.getProjectId(), req.getUserId(), !"infos".equals(module), false);
|
|
|
|
|
|
List<Map<String, Object>> majorList = map.getMajor();
|
|
@@ -119,7 +120,7 @@ public class ToolController {
|
|
|
map.setRelation(rels);
|
|
|
}
|
|
|
|
|
|
- return AdmResult.success(map);
|
|
|
+ return ResultHelper.single(map);
|
|
|
}
|
|
|
|
|
|
private <T> void distinct(List<T> list){
|
|
@@ -154,7 +155,7 @@ public class ToolController {
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/cfgs")
|
|
|
- public AdmResult<Object> cfgs(@RequestBody AdmRequest req, @RequestParam(required = false) String module){
|
|
|
+ public CommonResult<Object> cfgs(@RequestBody AdmRequest req, @RequestParam(required = false) String module){
|
|
|
String projectId = req.getProjectId();
|
|
|
HashMap<String, Object> data = new HashMap<>();
|
|
|
|
|
@@ -172,11 +173,11 @@ public class ToolController {
|
|
|
data.put("containerConfig", containerConfig);
|
|
|
}
|
|
|
|
|
|
- return AdmResult.success(data);
|
|
|
+ return ResultHelper.single(data);
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/typeInfos")
|
|
|
- public AdmResult<Object> typeInfos(@RequestBody AdmRequest req, @RequestParam String typeCode){
|
|
|
+ public CommonResult<Object> typeInfos(@RequestBody AdmRequest req, @RequestParam String typeCode){
|
|
|
QueryCriteria criteria = new QueryCriteria();
|
|
|
ObjectNode node = objectMapper.createObjectNode();
|
|
|
node.put("classCode", typeCode);
|
|
@@ -192,7 +193,7 @@ public class ToolController {
|
|
|
buildInfosTree(roots, infoDef);
|
|
|
}
|
|
|
|
|
|
- return AdmResult.success(roots);
|
|
|
+ return ResultHelper.single(roots);
|
|
|
}
|
|
|
|
|
|
private void buildInfosTree(List<Object> roots, InfoDef infoDef){
|
|
@@ -234,7 +235,7 @@ public class ToolController {
|
|
|
private AdmContainerConfigMapper containerConfigMapper;
|
|
|
|
|
|
@PostMapping("/updateCfgItem")
|
|
|
- public AdmResult<Object> updateCfgItem(@RequestBody Map<String, Object> content) {
|
|
|
+ public CommonResult<Object> updateCfgItem(@RequestBody Map<String, Object> content) {
|
|
|
String type = (String) content.get("type");
|
|
|
Map<String, Object> itemMap = (Map<String, Object>) content.get("item");
|
|
|
String delId = (String) content.get("delId");
|
|
@@ -253,7 +254,7 @@ public class ToolController {
|
|
|
doUpdateItem(delId, itemMap, create, AdmContainerConfig.class, containerConfigMapper);
|
|
|
}
|
|
|
|
|
|
- return AdmResult.success(newId);
|
|
|
+ return ResultHelper.single(newId);
|
|
|
}
|
|
|
|
|
|
private <T extends BaseAdmEntity> void doUpdateItem(String delId, Map<String, Object> itemMap, boolean create, Class<T> cls, BaseMapper<T> mapper){
|
|
@@ -282,7 +283,7 @@ public class ToolController {
|
|
|
private AdmInfosConfigMapper infosConfigMapper;
|
|
|
|
|
|
@PostMapping("/updateInfos")
|
|
|
- public AdmResult<Object> updateInfos(@RequestBody AdmInfosConfig cfg) {
|
|
|
+ public CommonResult<Object> updateInfos(@RequestBody AdmInfosConfig cfg) {
|
|
|
String newId = null;
|
|
|
if(StrUtil.isBlank(cfg.getId())){
|
|
|
newId = IdUtil.fastSimpleUUID();
|
|
@@ -302,11 +303,11 @@ public class ToolController {
|
|
|
else
|
|
|
infosConfigMapper.updateById(cfg);
|
|
|
|
|
|
- return AdmResult.success(newId);
|
|
|
+ return ResultHelper.single(newId);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/updateM2d")
|
|
|
- public AdmResult<Object> updateM2d(@RequestBody Map<String, Object> cfg){
|
|
|
+ public CommonResult<Object> updateM2d(@RequestBody Map<String, Object> cfg){
|
|
|
String code = (String) cfg.get("code");
|
|
|
boolean m2d = (Boolean)cfg.get("m2d");
|
|
|
AdmM2dEquip item = m2dEquipMapper.selectOne(new QueryWrapper<AdmM2dEquip>().eq("class_code", code));
|
|
@@ -321,11 +322,11 @@ public class ToolController {
|
|
|
if(item != null)
|
|
|
m2dEquipMapper.deleteById(item.getId());
|
|
|
}
|
|
|
- return AdmResult.success(null);
|
|
|
+ return ResultHelper.success();
|
|
|
}
|
|
|
|
|
|
@PostMapping("/bdAndFls")
|
|
|
- public AdmResult<List<ObjectNode>> bdAndFls(@RequestBody AdmRequest req){
|
|
|
+ public CommonResult<List<ObjectNode>> bdAndFls(@RequestBody AdmRequest req){
|
|
|
Map<String, Object> data = syncApp.downloadFrameData(req.getGroupCode(), req.getProjectId(), req.getUserId());
|
|
|
List<ObjectNode> bdAndFls = (List<ObjectNode>)data.get("buildingsAndFloors");
|
|
|
|
|
@@ -355,7 +356,7 @@ public class ToolController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- return AdmResult.success(bds);
|
|
|
+ return ResultHelper.single(bds);
|
|
|
}
|
|
|
|
|
|
}
|