Commit 2258991a authored by tangwei's avatar tangwei

修改权重接口

parent 659f2f77
...@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -170,22 +171,24 @@ public class IdxBizFanWeightController extends BaseController { ...@@ -170,22 +171,24 @@ public class IdxBizFanWeightController extends BaseController {
break; break;
case "2": case "2":
if (!flagtype.equals(idxBizFanWeight.getArae())) { if (!flagtype.equals(idxBizFanWeight.getArae())) {
throw new RuntimeException("配置权重必须是同一个层级的数据"); throw new BaseException("配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
} }
break; break;
case "3": case "3":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation())) { if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation())) {
throw new RuntimeException("配置权重必须是同一个层级的数据"); throw new BaseException("配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
} }
break; break;
case "4": case "4":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName())) { if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName())) {
throw new RuntimeException("配置权重必须是同一个层级的数据"); throw new BaseException("配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
} }
break; break;
case "5": case "5":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray())) { if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray())) {
throw new RuntimeException("配置权重必须是同一个层级的数据");
throw new BaseException("配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
} }
break; break;
} }
...@@ -239,17 +242,20 @@ public class IdxBizFanWeightController extends BaseController { ...@@ -239,17 +242,20 @@ public class IdxBizFanWeightController extends BaseController {
int num = listdata.size() - list.size(); int num = listdata.size() - list.size();
if (num == 0) { if (num == 0) {
if (valued != 1) { if (valued != 1) {
throw new RuntimeException("超出权重最大值限制,层级下权重等级总和为1"); throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
} }
} }
//值不能大于1 //值不能大于1
if (valued > 1) { if (valued > 1) {
throw new RuntimeException("超出权重最大值限制,层级下权重等级总和为1"); throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
} }
if (valued != 1 && num == 0) { if (valued != 1 && num == 0) {
throw new RuntimeException("超出权重最大值限制,层级下权重等级总和为1"); throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
} }
//剩余权重值 //剩余权重值
......
...@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -186,22 +187,22 @@ public class IdxBizPvWeightController extends BaseController { ...@@ -186,22 +187,22 @@ public class IdxBizPvWeightController extends BaseController {
break; break;
case "2": case "2":
if (!flagtype.equals(idxBizFanWeight.getArae())) { if (!flagtype.equals(idxBizFanWeight.getArae())) {
throw new RuntimeException("配置权重必须是同一个层级的数据"); throw new BaseException( "配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
} }
break; break;
case "3": case "3":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation())) { if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation()+ idxBizFanWeight.getSubarray())) {
throw new RuntimeException("配置权重必须是同一个层级的数据"); throw new BaseException( "配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
} }
break; break;
case "4": case "4":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName())) { if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() )) {
throw new RuntimeException("配置权重必须是同一个层级的数据"); throw new BaseException( "配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
} }
break; break;
case "5": case "5":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray())) { if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray())) {
throw new RuntimeException("配置权重必须是同一个层级的数据"); throw new BaseException( "配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
} }
break; break;
} }
...@@ -225,13 +226,13 @@ public class IdxBizPvWeightController extends BaseController { ...@@ -225,13 +226,13 @@ public class IdxBizPvWeightController extends BaseController {
qu.eq(!StringUtils.isEmpty(reviewDto.getType()), IdxBizPvWeight::getType, reviewDto.getType()); qu.eq(!StringUtils.isEmpty(reviewDto.getType()), IdxBizPvWeight::getType, reviewDto.getType());
qu.eq(!StringUtils.isEmpty(reviewDto.getArae()), IdxBizPvWeight::getArae, reviewDto.getArae()); qu.eq(!StringUtils.isEmpty(reviewDto.getArae()), IdxBizPvWeight::getArae, reviewDto.getArae());
qu.eq(!StringUtils.isEmpty(reviewDto.getStation()), IdxBizPvWeight::getStation, reviewDto.getStation()); qu.eq(!StringUtils.isEmpty(reviewDto.getStation()), IdxBizPvWeight::getStation, reviewDto.getStation());
qu.eq(!StringUtils.isEmpty(reviewDto.getSubarray()), IdxBizPvWeight::getSubarray, reviewDto.getSubarray());
break; break;
case "4": case "4":
qu.eq(!StringUtils.isEmpty(reviewDto.getType()), IdxBizPvWeight::getType, reviewDto.getType()); qu.eq(!StringUtils.isEmpty(reviewDto.getType()), IdxBizPvWeight::getType, reviewDto.getType());
qu.eq(!StringUtils.isEmpty(reviewDto.getArae()), IdxBizPvWeight::getArae, reviewDto.getArae()); qu.eq(!StringUtils.isEmpty(reviewDto.getArae()), IdxBizPvWeight::getArae, reviewDto.getArae());
qu.eq(!StringUtils.isEmpty(reviewDto.getStation()), IdxBizPvWeight::getStation, reviewDto.getStation()); qu.eq(!StringUtils.isEmpty(reviewDto.getStation()), IdxBizPvWeight::getStation, reviewDto.getStation());
qu.eq(!StringUtils.isEmpty(reviewDto.getSubarray()), IdxBizPvWeight::getSubarray, reviewDto.getSubarray());
break; break;
case "5": case "5":
...@@ -255,17 +256,19 @@ public class IdxBizPvWeightController extends BaseController { ...@@ -255,17 +256,19 @@ public class IdxBizPvWeightController extends BaseController {
int num = listdata.size() - list.size(); int num = listdata.size() - list.size();
if (num == 0) { if (num == 0) {
if (valued != 1) { if (valued != 1) {
throw new RuntimeException("超出权重最大值限制,层级下权重等级总和为1"); throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
} }
} }
//值不能大于1 //值不能大于1
if (valued > 1) { if (valued > 1) {
throw new RuntimeException("超出权重最大值限制,层级下权重等级总和为1"); throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
} }
if (valued != 1 && num == 0) { if (valued != 1 && num == 0) {
throw new RuntimeException("超出权重最大值限制,层级下权重等级总和为1"); throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
} }
//剩余权重值 //剩余权重值
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment