Browse Source

添加万达关系映射接口

fengyanjie 3 years ago
parent
commit
61e7bfd9c6

+ 31 - 0
dmp-model/src/main/java/com/persagy/dmp/rwd/model/ClassDefWdModel.java

@@ -0,0 +1,31 @@
+package com.persagy.dmp.rwd.model;
+
+import com.persagy.dmp.rwd.enums.ObjType;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+@Setter
+@Getter
+public class ClassDefWdModel {
+
+    private String id;
+    private String code;
+    private ObjType objType;
+    private String name;
+    private String aliasCode;
+    private String aliasName;
+    private String type;
+    private String groupCode;
+    private String projectId;
+    private String majorCode;
+    private String systemCode;
+    private String equipmentCode;
+    private String parentCode;
+
+    private Integer isUsed;//状态 0.历史版本 1.使用中
+    private String version;//版本
+    private Date lastUpdateTime;//最后更新时间
+
+}

+ 12 - 10
dmp-rwd/src/main/java/com/persagy/dmp/rwd/controller/ClassDefWdController.java

@@ -2,20 +2,22 @@ package com.persagy.dmp.rwd.controller;
 
 import com.persagy.common.criteria.JacksonCriteria;
 import com.persagy.common.json.JacksonMapper;
-import com.persagy.common.web.ListResponse;
 import com.persagy.common.web.PagedResponse;
-import com.persagy.dmp.rwd.model.ClassDefModel;
+import com.persagy.dmp.rwd.model.ClassDefWdModel;
 import com.persagy.dmp.rwd.service.ClassDefService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+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.RestController;
 
 @Slf4j
 @RestController
 @RequestMapping("/rwd/def/class/wd")
 public class ClassDefWdController {
-	@Autowired
-	private ClassDefService service;
+    @Autowired
+    private ClassDefService service;
 
 //	@PostMapping("")
 //	public ListResponse<ClassDefModel> queryClass(@RequestParam(name = "groupCode", required = false) String groupCode,
@@ -28,11 +30,11 @@ public class ClassDefWdController {
 //		return service.queryClass(groupCode, schemaId, projectId, appId, subFlag, criteria);
 //	}
 
-	@PostMapping("/query")
-	public PagedResponse<ClassDefModel> query(@RequestBody JacksonCriteria criteria) {
-		log.info("================================= /class/query: {}", JacksonMapper.toSimpleJson(criteria));
-		return service.query(criteria);
-	}
+    @PostMapping("/query")
+    public PagedResponse<ClassDefWdModel> query(@RequestBody JacksonCriteria criteria) {
+        log.info("================================= /class/query: {}", JacksonMapper.toSimpleJson(criteria));
+        return service.query(criteria);
+    }
 
 //	@PostMapping("/create")
 //	public MapResponse create(@RequestBody ClassDefModel param){

+ 51 - 51
dmp-rwd/src/main/java/com/persagy/dmp/rwd/entity/ClassDefWd.java

@@ -1,7 +1,7 @@
 package com.persagy.dmp.rwd.entity;
 
 import com.persagy.dmp.rwd.enums.ObjType;
-import com.persagy.dmp.rwd.model.ClassDefModel;
+import com.persagy.dmp.rwd.model.ClassDefWdModel;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -14,57 +14,57 @@ import javax.persistence.*;
 @IdClass(GroupPK.class)
 public class ClassDefWd {
 
-	@Id
-	private String id;
-	@Id
-	private String groupCode;
-	private String code;
-	@Enumerated(value = EnumType.STRING)
-	private ObjType objType;
-	private String name;
-	private String aliasCode;
-	private String aliasName;
-	private String type;
-	private String projectId;
-	private String majorCode;
-	private String systemCode;
-	private String equipmentCode;
-	private String parentCode;
+    @Id
+    private String id;
+    @Id
+    private String groupCode;
+    private String code;
+    @Enumerated(value = EnumType.STRING)
+    private ObjType objType;
+    private String name;
+    private String aliasCode;
+    private String aliasName;
+    private String type;
+    private String projectId;
+    private String majorCode;
+    private String systemCode;
+    private String equipmentCode;
+    private String parentCode;
 
-	public static ClassDefWd fromModel(ClassDefModel model) {
-		ClassDefWd entity = new ClassDefWd();
-		entity.setId(model.getId());
-		entity.setCode(model.getCode());
-		entity.setObjType(model.getObjType());
-		entity.setName(model.getName());
-		entity.setAliasCode(model.getAliasCode());
-		entity.setAliasName(model.getAliasName());
-		entity.setType(model.getType());
-		entity.setGroupCode(model.getGroupCode());
-		entity.setProjectId(model.getProjectId());
-		entity.setMajorCode(model.getMajorCode());
-		entity.setSystemCode(model.getSystemCode());
-		entity.setEquipmentCode(model.getEquipmentCode());
-		entity.setParentCode(model.getParentCode());
-		return entity;
-	}
+    public static ClassDefWd fromModel(ClassDefWdModel model) {
+        ClassDefWd entity = new ClassDefWd();
+        entity.setId(model.getId());
+        entity.setCode(model.getCode());
+        entity.setObjType(model.getObjType());
+        entity.setName(model.getName());
+        entity.setAliasCode(model.getAliasCode());
+        entity.setAliasName(model.getAliasName());
+        entity.setType(model.getType());
+        entity.setGroupCode(model.getGroupCode());
+        entity.setProjectId(model.getProjectId());
+        entity.setMajorCode(model.getMajorCode());
+        entity.setSystemCode(model.getSystemCode());
+        entity.setEquipmentCode(model.getEquipmentCode());
+        entity.setParentCode(model.getParentCode());
+        return entity;
+    }
 
-	public ClassDefModel toModel() {
-		ClassDefModel model = new ClassDefModel();
-		model.setId(this.getId());
-		model.setCode(this.getCode());
-		model.setObjType(this.getObjType());
-		model.setName(this.getName());
-		model.setAliasCode(this.getAliasCode());
-		model.setAliasName(this.getAliasName());
-		model.setType(this.getType());
-		model.setGroupCode(this.getGroupCode());
-		model.setProjectId(this.getProjectId());
-		model.setMajorCode(this.getMajorCode());
-		model.setSystemCode(this.getSystemCode());
-		model.setEquipmentCode(this.getEquipmentCode());
-		model.setParentCode(this.getParentCode());
-		return model;
-	}
+    public ClassDefWdModel toModel() {
+        ClassDefWdModel model = new ClassDefWdModel();
+        model.setId(this.getId());
+        model.setCode(this.getCode());
+        model.setObjType(this.getObjType());
+        model.setName(this.getName());
+        model.setAliasCode(this.getAliasCode());
+        model.setAliasName(this.getAliasName());
+        model.setType(this.getType());
+        model.setGroupCode(this.getGroupCode());
+        model.setProjectId(this.getProjectId());
+        model.setMajorCode(this.getMajorCode());
+        model.setSystemCode(this.getSystemCode());
+        model.setEquipmentCode(this.getEquipmentCode());
+        model.setParentCode(this.getParentCode());
+        return model;
+    }
 
 }

+ 23 - 23
dmp-rwd/src/main/java/com/persagy/dmp/rwd/service/ClassDefService.java

@@ -11,7 +11,7 @@ import com.persagy.common.web.PagedResponse;
 import com.persagy.dmp.rwd.entity.*;
 import com.persagy.dmp.rwd.enums.FuncidDataType;
 import com.persagy.dmp.rwd.enums.ObjType;
-import com.persagy.dmp.rwd.model.ClassDefModel;
+import com.persagy.dmp.rwd.model.ClassDefWdModel;
 import com.persagy.dmp.rwd.model.FuncidDefModel;
 import com.persagy.dmp.rwd.repository.ClassDefWdRepository;
 import com.persagy.dmp.rwd.util.ClassCodeUtils;
@@ -41,8 +41,8 @@ public class ClassDefService extends BaseService {
     @Autowired
     private ClassCodeUtils classCodeUtils;
 
-    public ListResponse<ClassDefModel> queryClass(String groupCode, String schemaId, String projectId, String appId, Boolean subFlag, JacksonCriteria criteria) {
-        ListResponse<ClassDefModel> resp = new ListResponse<>();
+    public ListResponse<ClassDefWdModel> queryClass(String groupCode, String schemaId, String projectId, String appId, Boolean subFlag, JacksonCriteria criteria) {
+        ListResponse<ClassDefWdModel> resp = new ListResponse<>();
         OrgParam orgParam = prepareParam(resp);
         if (!resp.success()) {
             return resp;
@@ -70,7 +70,7 @@ public class ClassDefService extends BaseService {
             }
         }
 
-        Map<String, ClassDefModel> map = new HashMap<>();
+        Map<String, ClassDefWdModel> map = new HashMap<>();
         // 查询平台级
         JacksonCriteria jacksonCriteria = JacksonCriteria.newInstance();
         jacksonCriteria.getCriteria().setAll(criteria.getCriteria());
@@ -78,8 +78,8 @@ public class ClassDefService extends BaseService {
         jacksonCriteria.add("groupCode", "0");
         jacksonCriteria.setWithoutCount(true);
         setSharding("0", "0"); // sharding
-        PagedResponse<ClassDefModel> queryResponse = query(jacksonCriteria);
-        for (ClassDefModel model : queryResponse.getData()) {
+        PagedResponse<ClassDefWdModel> queryResponse = query(jacksonCriteria);
+        for (ClassDefWdModel model : queryResponse.getData()) {
             map.put(model.getCode(), model);
         }
 
@@ -92,7 +92,7 @@ public class ClassDefService extends BaseService {
             jacksonCriteria.setWithoutCount(true);
             setSharding(orgParam.groupCode, "0"); // sharding
             queryResponse = query(groupCriteria);
-            for (ClassDefModel model : queryResponse.getData()) {
+            for (ClassDefWdModel model : queryResponse.getData()) {
                 map.put(model.getCode(), model);
             }
         }
@@ -107,7 +107,7 @@ public class ClassDefService extends BaseService {
             jacksonCriteria.setWithoutCount(true);
             setSharding(orgParam.groupCode, orgParam.projectId); // sharding
             queryResponse = query(jacksonCriteria);
-            for (ClassDefModel model : queryResponse.getData()) {
+            for (ClassDefWdModel model : queryResponse.getData()) {
                 map.put(model.getCode(), model);
             }
         }
@@ -124,9 +124,9 @@ public class ClassDefService extends BaseService {
 
             if (classCodes.size() > 0) {
                 // 方案有订阅, 去除未订阅的内容
-                Iterator<Map.Entry<String, ClassDefModel>> iterator = map.entrySet().iterator();
+                Iterator<Map.Entry<String, ClassDefWdModel>> iterator = map.entrySet().iterator();
                 while (iterator.hasNext()) {
-                    Map.Entry<String, ClassDefModel> next = iterator.next();
+                    Map.Entry<String, ClassDefWdModel> next = iterator.next();
                     if (!classCodes.contains(next.getKey())) {
                         iterator.remove();
                     }
@@ -146,9 +146,9 @@ public class ClassDefService extends BaseService {
 
             if (classCodes.size() > 0) {
                 // 方案有订阅, 去除未订阅的内容
-                Iterator<Map.Entry<String, ClassDefModel>> iterator = map.entrySet().iterator();
+                Iterator<Map.Entry<String, ClassDefWdModel>> iterator = map.entrySet().iterator();
                 while (iterator.hasNext()) {
-                    Map.Entry<String, ClassDefModel> next = iterator.next();
+                    Map.Entry<String, ClassDefWdModel> next = iterator.next();
                     if (!classCodes.contains(next.getKey())) {
                         iterator.remove();
                     }
@@ -160,7 +160,7 @@ public class ClassDefService extends BaseService {
         if (subFlag && map.size() > 0) {
 
             //List<FuncidDataType> enumTypeList = Arrays.asList(FuncidDataType.ENUM);
-            List<String> classCodeList = map.values().stream().map(ClassDefModel::getCode).collect(Collectors.toList());
+            List<String> classCodeList = map.values().stream().map(ClassDefWdModel::getCode).collect(Collectors.toList());
             JacksonCriteria funcidCriteria = JacksonCriteria.newInstance();
             funcidCriteria.add("classCode").in(classCodeList);
             funcidCriteria.add("dataType", FuncidDataType.ENUM);
@@ -174,7 +174,7 @@ public class ClassDefService extends BaseService {
                 }
 
                 String classCode = funcid.getClassCode();
-                ClassDefModel classDefModel = map.get(classCode);
+                ClassDefWdModel classDefModel = map.get(classCode);
                 if (classDefModel == null) {
                     continue;
                 }
@@ -185,7 +185,7 @@ public class ClassDefService extends BaseService {
 
                 for (JsonNode jsonNode : dataSource) {
                     ObjectNode item = (ObjectNode) jsonNode;
-                    ClassDefModel model = new ClassDefModel();
+                    ClassDefWdModel model = new ClassDefWdModel();
                     BeanUtils.copyProperties(classDefModel, model);
                     model.setCode(classDefModel.getCode() + "&" + funcid.getCode() + "=" + item.get("code").asText());
                     model.setName(classDefModel.getName() + "-" + item.get("name").asText());
@@ -198,7 +198,7 @@ public class ClassDefService extends BaseService {
         }
 
         //
-        List<ClassDefModel> data = new ArrayList<>(map.size());
+        List<ClassDefWdModel> data = new ArrayList<>(map.size());
         data.addAll(map.values());
         resp.setData(data);
         return resp;
@@ -213,14 +213,14 @@ public class ClassDefService extends BaseService {
         return list;
     }
 
-    public PagedResponse<ClassDefModel> query(JacksonCriteria criteria) {
+    public PagedResponse<ClassDefWdModel> query(JacksonCriteria criteria) {
         PagedResponse<ClassDefWd> resp = criteriaUtils.query(QClassDefWd.classDefWd, this::parse, criteria);
-        PagedResponse<ClassDefModel> result = new PagedResponse<>();
+        PagedResponse<ClassDefWdModel> result = new PagedResponse<>();
         result.setCount(resp.getCount());
         List<ClassDefWd> dataList = resp.getData();
         if (dataList != null && dataList.size() > 0) {
-            List<ClassDefModel> collect = dataList.stream().map(entity -> {
-                ClassDefModel model = entity.toModel();
+            List<ClassDefWdModel> collect = dataList.stream().map(entity -> {
+                ClassDefWdModel model = entity.toModel();
                 return model;
             }).collect(Collectors.toList());
             result.setData(collect);
@@ -229,7 +229,7 @@ public class ClassDefService extends BaseService {
     }
 
     @Transactional
-    public MapResponse create(ClassDefModel param) {
+    public MapResponse create(ClassDefWdModel param) {
         MapResponse response = new MapResponse();
         // TODO
         ClassDefWd entity = ClassDefWd.fromModel(param);
@@ -238,7 +238,7 @@ public class ClassDefService extends BaseService {
     }
 
     @Transactional
-    public MapResponse update(ClassDefModel param) {
+    public MapResponse update(ClassDefWdModel param) {
         MapResponse response = new MapResponse();
         // TODO
         ClassDefWd entity = ClassDefWd.fromModel(param);
@@ -247,7 +247,7 @@ public class ClassDefService extends BaseService {
     }
 
     @Transactional
-    public MapResponse delete(ClassDefModel param) {
+    public MapResponse delete(ClassDefWdModel param) {
         MapResponse response = new MapResponse();
         // TODO
         return response;