|
@@ -3,6 +3,7 @@ package com.persagy.dmp.rwd.digital.controller;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.fasterxml.jackson.databind.JsonNode;
|
|
|
import com.fasterxml.jackson.databind.node.ArrayNode;
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
import com.persagy.dmp.basic.model.QueryCriteria;
|
|
@@ -75,7 +76,7 @@ public class ObjectDigitalController{
|
|
|
|
|
|
@PostMapping("/createOne")
|
|
|
@Deprecated
|
|
|
- public CommonResult<ObjectDigital> create(@Valid @RequestBody ObjectNode node){
|
|
|
+ public CommonResult<ObjectDigital> create(@RequestBody ObjectNode node){
|
|
|
//基础参数校验
|
|
|
ParamCheckUtil.checkParam(CommonConstant.QUERY_GROUPCODE,CommonConstant.QUERY_PROJECTID);
|
|
|
ObjectDigital vo = JsonNodeUtils.toEntity(node, ObjectDigital.class, ObjectDigital.EXTRA_COLUMN);
|
|
@@ -89,9 +90,12 @@ public class ObjectDigitalController{
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Deprecated
|
|
|
- public CommonResult<List<ObjectDigital>> createBatch(@Valid @RequestBody ArrayNode array){
|
|
|
+ public CommonResult<List<ObjectDigital>> createBatch(@RequestBody ArrayNode array){
|
|
|
//基础参数校验
|
|
|
ParamCheckUtil.checkParam(CommonConstant.QUERY_GROUPCODE,CommonConstant.QUERY_PROJECTID);
|
|
|
+ //创建对象入参校验
|
|
|
+ createInstanceParamVerify(array);
|
|
|
+
|
|
|
List<ObjectDigital> voList = JsonNodeUtils.toEntity(array, ObjectDigital.class, ObjectDigital.EXTRA_COLUMN);
|
|
|
//创建默认条件
|
|
|
createDefaultValue(voList);
|
|
@@ -119,6 +123,9 @@ public class ObjectDigitalController{
|
|
|
public CommonResult<List<ObjectDigital>> updateBatch(@Valid @RequestBody ArrayNode array){
|
|
|
//基础参数校验
|
|
|
ParamCheckUtil.checkParam(CommonConstant.QUERY_GROUPCODE,CommonConstant.QUERY_PROJECTID);
|
|
|
+ //修改对象入参校验
|
|
|
+ updateInstanceParamVerify(array);
|
|
|
+
|
|
|
List<ObjectDigital> voList = JsonNodeUtils.toEntity(array, ObjectDigital.class, ObjectDigital.EXTRA_COLUMN);
|
|
|
//创建默认条件
|
|
|
createDefaultValue(voList);
|
|
@@ -196,4 +203,40 @@ public class ObjectDigitalController{
|
|
|
vo.setProjectId(projectId);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建实例入参校验
|
|
|
+ * @param array
|
|
|
+ */
|
|
|
+ private void createInstanceParamVerify(ArrayNode array){
|
|
|
+ if(array == null || array.size()<=0){
|
|
|
+ throw new BusinessException(ResponseCode.A0400.getCode(),ResponseCode.A0400.getCode());
|
|
|
+ }
|
|
|
+ for (JsonNode jsonNode : array) {
|
|
|
+ JsonNode name = jsonNode.get("name");
|
|
|
+ if(name == null){
|
|
|
+ throw new BusinessException(ResponseCode.A0400.getCode(),"对象名称不能为空");
|
|
|
+ }
|
|
|
+ JsonNode classCode = jsonNode.get("classCode");
|
|
|
+ if(classCode == null){
|
|
|
+ throw new BusinessException(ResponseCode.A0400.getCode(),"类型编码不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改实例入参校验
|
|
|
+ * @param array
|
|
|
+ */
|
|
|
+ private void updateInstanceParamVerify(ArrayNode array){
|
|
|
+ if(array == null || array.size()<=0){
|
|
|
+ throw new BusinessException(ResponseCode.A0400.getCode(),ResponseCode.A0400.getCode());
|
|
|
+ }
|
|
|
+ for (JsonNode jsonNode : array) {
|
|
|
+ JsonNode id = jsonNode.get("id");
|
|
|
+ if(id == null){
|
|
|
+ throw new BusinessException(ResponseCode.A0400.getCode(),"id不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|