Commit b3ee5f65 authored by tangwei's avatar tangwei

修改权重接口

parent 2258991a
......@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
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.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -171,23 +172,23 @@ public class IdxBizFanWeightController extends BaseController {
break;
case "2":
if (!flagtype.equals(idxBizFanWeight.getArae())) {
throw new BaseException("配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
throw new BadRequest("配置权重必须是同一个层级的数据");
}
break;
case "3":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation())) {
throw new BaseException("配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
throw new BadRequest("配置权重必须是同一个层级的数据");
}
break;
case "4":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName())) {
throw new BaseException("配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
throw new BadRequest("配置权重必须是同一个层级的数据");
}
break;
case "5":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray())) {
throw new BaseException("配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
throw new BadRequest("配置权重必须是同一个层级的数据");
}
break;
......@@ -218,7 +219,7 @@ public class IdxBizFanWeightController extends BaseController {
qu.eq(!StringUtils.isEmpty(reviewDto.getType()), IdxBizFanWeight::getType, reviewDto.getType());
qu.eq(!StringUtils.isEmpty(reviewDto.getArae()), IdxBizFanWeight::getArae, reviewDto.getArae());
qu.eq(!StringUtils.isEmpty(reviewDto.getStation()), IdxBizFanWeight::getStation, reviewDto.getStation());
qu.eq(!StringUtils.isEmpty(reviewDto.getSubarray()), IdxBizFanWeight::getSubarray, reviewDto.getSubarray());
qu.eq(!StringUtils.isEmpty(reviewDto.getEquipmentName()), IdxBizFanWeight::getEquipmentName, reviewDto.getEquipmentName());
break;
case "5":
......@@ -242,7 +243,7 @@ public class IdxBizFanWeightController extends BaseController {
int num = listdata.size() - list.size();
if (num == 0) {
if (valued != 1) {
throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
}
}
......@@ -250,11 +251,11 @@ public class IdxBizFanWeightController extends BaseController {
//值不能大于1
if (valued > 1) {
throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
}
if (valued != 1 && num == 0) {
throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
if (valued == 1 && num != 0) {
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
}
......@@ -263,12 +264,10 @@ public class IdxBizFanWeightController extends BaseController {
for (IdxBizFanWeight listdatum : listdata) {
for (IdxBizFanWeight idxBizPvWeight : list) {
listdatum.setValue(formattedNum);
if (idxBizPvWeight.getSequenceNbr().equals(listdatum.getSequenceNbr())) {
listdatum.setValue(Float.valueOf(value.get("data").toString()));
break;
} else {
listdatum.setValue(formattedNum);
break;
}
}
idxBizFanWeightMapper.updateById(listdatum);
......
......@@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
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.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -167,11 +168,11 @@ public class IdxBizPvWeightController extends BaseController {
break;
case "3":
flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation();
flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation()+ idxBizFanWeight.getSubarray();
break;
case "4":
flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName();
flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation() ;
break;
case "5":
......@@ -187,22 +188,22 @@ public class IdxBizPvWeightController extends BaseController {
break;
case "2":
if (!flagtype.equals(idxBizFanWeight.getArae())) {
throw new BaseException( "配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
throw new BadRequest( "配置权重必须是同一个层级的数据");
}
break;
case "3":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation()+ idxBizFanWeight.getSubarray())) {
throw new BaseException( "配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
throw new BadRequest( "配置权重必须是同一个层级的数据");
}
break;
case "4":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() )) {
throw new BaseException( "配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
throw new BadRequest( "配置权重必须是同一个层级的数据");
}
break;
case "5":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray())) {
throw new BaseException( "配置权重必须是同一个层级的数据", "403" , "配置权重必须是同一个层级的数据");
throw new BadRequest( "配置权重必须是同一个层级的数据");
}
break;
}
......@@ -256,18 +257,18 @@ public class IdxBizPvWeightController extends BaseController {
int num = listdata.size() - list.size();
if (num == 0) {
if (valued != 1) {
throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
}
}
//值不能大于1
if (valued > 1) {
throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
}
if (valued != 1 && num == 0) {
throw new BaseException("超出权重最大值限制,层级下权重等级总和为1", "403" , "超出权重最大值限制,层级下权重等级总和为1");
if (valued == 1 && num != 0) {
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
}
......@@ -276,12 +277,10 @@ public class IdxBizPvWeightController extends BaseController {
for (IdxBizPvWeight listdatum : listdata) {
for (IdxBizPvWeight idxBizPvWeight : list) {
listdatum.setValue(formattedNum);
if (idxBizPvWeight.getSequenceNbr().equals(listdatum.getSequenceNbr())) {
listdatum.setValue(Float.valueOf(value.get("data").toString()));
break;
} else {
listdatum.setValue(formattedNum);
break;
}
}
idxBizPvWeightMapper.updateById(listdatum);
......
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