Commit 00e09e7c authored by tangwei's avatar tangwei

修改接口

parent 2590bfae
...@@ -124,82 +124,210 @@ public class IdxBizFanWeightController extends BaseController { ...@@ -124,82 +124,210 @@ public class IdxBizFanWeightController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/update") @PostMapping(value = "/update")
@ApiOperation(httpMethod = "POST", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新") @ApiOperation(httpMethod = "POST", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<IdxBizFanWeight> update(@RequestBody Map<String,List<IdxBizFanWeight>> map) { public ResponseModel<IdxBizFanWeight> update(@RequestBody Map<String,Object> value) {
if (value != null) {
List<String> list1 = Arrays.asList(value.get("ids").toString().split(","));
LambdaQueryWrapper<IdxBizFanWeight> qu1 = new LambdaQueryWrapper<>();
qu1.in(!list1.isEmpty(), IdxBizFanWeight::getSequenceNbr, list1);
List<IdxBizFanWeight> list = idxBizFanWeightMapper.selectList(qu1);
IdxBizFanWeight reviewDto = list.get(0);
//获取所属,同类指标 //获取所属,同类指标
if(map!=null){
List<IdxBizFanWeight> list= map.get("data"); // Float list= map.get("data");
//判断是否同一层级 //判断是否同一层级
String flagtype=null; String flagtype = null;
for (IdxBizFanWeight idxBizFanWeight : list) { for (IdxBizFanWeight idxBizFanWeight : list) {
if(flagtype==null){ if (flagtype == null) {
switch (reviewDto.getType()) {
case "1":
flagtype = idxBizFanWeight.getArae() ;
flagtype= idxBizFanWeight.getArae()+idxBizFanWeight.getStation()+idxBizFanWeight.getEquipmentName()+idxBizFanWeight.getSubarray()+idxBizFanWeight.getPointName()+idxBizFanWeight.getType(); break;
}else{ case "2":
if(!flagtype.equals(idxBizFanWeight.getArae()+idxBizFanWeight.getStation()+idxBizFanWeight.getEquipmentName()+idxBizFanWeight.getSubarray()+idxBizFanWeight.getPointName()+idxBizFanWeight.getType())){ flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation();
break;
case "3":
flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() ;
break;
case "4":
flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray() ;
break;
case "5":
flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray() + idxBizFanWeight.getPointName() ;
break;
}
} else {
switch (reviewDto.getType()) {
case "1":
if (!flagtype.equals(idxBizFanWeight.getArae() )) {
throw new BadRequest("配置权重必须是同一个层级的数据"); throw new BadRequest("配置权重必须是同一个层级的数据");
} }
break;
case "2":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() )) {
throw new BadRequest("配置权重必须是同一个层级的数据");
} }
break;
case "3":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() )) {
throw new BadRequest("配置权重必须是同一个层级的数据");
} }
Float value= list.stream().map(e->e.getValue()).reduce(Float::sum).get(); break;
IdxBizFanWeight reviewDto= list.get(0); case "4":
LambdaQueryWrapper<IdxBizFanWeight> qu=new LambdaQueryWrapper<>(); if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray() )) {
qu.eq(!StringUtils.isEmpty(reviewDto.getType()),IdxBizFanWeight::getType,reviewDto.getType()); throw new BadRequest("配置权重必须是同一个层级的数据");
qu.eq(!StringUtils.isEmpty(reviewDto.getArae()),IdxBizFanWeight::getArae,reviewDto.getArae()); }
qu.eq(!StringUtils.isEmpty(reviewDto.getStation()), IdxBizFanWeight::getStation,reviewDto.getStation()); break;
qu.eq(!StringUtils.isEmpty(reviewDto.getSubarray()),IdxBizFanWeight::getSubarray,reviewDto.getSubarray()); case "5":
qu.eq(!StringUtils.isEmpty(reviewDto.getEquipmentName()),IdxBizFanWeight::getEquipmentName,reviewDto.getEquipmentName()); if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray() + idxBizFanWeight.getPointName() )) {
qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()),IdxBizFanWeight::getPointName,reviewDto.getPointName()); throw new BadRequest("配置权重必须是同一个层级的数据");
}
break;
}
}
Float valued = list.size() * Float.valueOf(value.get("data").toString());
LambdaQueryWrapper<IdxBizFanWeight> qu = new LambdaQueryWrapper<>();
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());
qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()), IdxBizFanWeight::getPointName, reviewDto.getPointName());
List<IdxBizFanWeight> listdata = idxBizFanWeightMapper.selectList(qu); List<IdxBizFanWeight> listdata = idxBizFanWeightMapper.selectList(qu);
//设置权重值, //设置权重值,
int num= listdata.size()-list.size(); int num = listdata.size() - list.size();
if (num == 0) {
if (valued != 1) {
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
}
}
//值不能大于1 //值不能大于1
if(value>1){ if (valued > 1) {
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1"); throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
} }
if(value!=1&&num!=0){ if (valued != 1 && num != 0) {
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1"); throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
} }
//剩余权重值 //剩余权重值
float formattedNum =num!=0? Float.parseFloat(new DecimalFormat("0.0000").format((1-value)/num)):0; float formattedNum = num != 0 ? Float.parseFloat(new DecimalFormat("0.0000000000").format((1 - valued) / num)) : 0;
for (IdxBizFanWeight listdatum : listdata) { for (IdxBizFanWeight listdatum : listdata) {
for (IdxBizFanWeight idxBizPvWeight : list) { for (IdxBizFanWeight idxBizPvWeight : list) {
if(idxBizPvWeight.getSequenceNbr().equals(listdatum.getSequenceNbr())){ if (idxBizPvWeight.getSequenceNbr().equals(listdatum.getSequenceNbr())) {
listdatum.setValue(idxBizPvWeight.getValue()); listdatum.setValue(idxBizPvWeight.getValue());
break; break;
}else{ } else {
listdatum.setValue(formattedNum); listdatum.setValue(formattedNum);
break; break;
} }
} }
idxBizFanWeightMapper.updateById(listdatum); idxBizFanWeightMapper.updateById(listdatum);
} }
} }
}
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
// @Transactional
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @PostMapping(value = "/update")
// @ApiOperation(httpMethod = "POST", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
// public ResponseModel<IdxBizFanWeight> update(@RequestBody Map<String,List<IdxBizFanWeight>> map) {
// //获取所属,同类指标
// if(map!=null){
// List<IdxBizFanWeight> list= map.get("data");
// //判断是否同一层级
// String flagtype=null;
// for (IdxBizFanWeight idxBizFanWeight : list) {
// if(flagtype==null){
//
// flagtype= idxBizFanWeight.getArae()+idxBizFanWeight.getStation()+idxBizFanWeight.getEquipmentName()+idxBizFanWeight.getSubarray()+idxBizFanWeight.getPointName()+idxBizFanWeight.getType();
// }else{
// if(!flagtype.equals(idxBizFanWeight.getArae()+idxBizFanWeight.getStation()+idxBizFanWeight.getEquipmentName()+idxBizFanWeight.getSubarray()+idxBizFanWeight.getPointName()+idxBizFanWeight.getType())){
// throw new BadRequest("配置权重必须是同一个层级的数据");
// }
// }
// }
// Float value= list.stream().map(e->e.getValue()).reduce(Float::sum).get();
// IdxBizFanWeight reviewDto= list.get(0);
// LambdaQueryWrapper<IdxBizFanWeight> qu=new LambdaQueryWrapper<>();
// 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());
// qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()),IdxBizFanWeight::getPointName,reviewDto.getPointName());
// List<IdxBizFanWeight> listdata = idxBizFanWeightMapper.selectList(qu);
//
// //设置权重值,
// int num= listdata.size()-list.size();
//
// //值不能大于1
// if(value>1){
// throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
// }
// if(value!=1&&num!=0){
// throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
// }
//
//
//
//
// //剩余权重值
// float formattedNum =num!=0? Float.parseFloat(new DecimalFormat("0.0000000000").format((1-value)/num)):0;
//
// for (IdxBizFanWeight listdatum : listdata) {
// for (IdxBizFanWeight idxBizPvWeight : list) {
// if(idxBizPvWeight.getSequenceNbr().equals(listdatum.getSequenceNbr())){
// listdatum.setValue(idxBizPvWeight.getValue());
// break;
// }else{
// listdatum.setValue(formattedNum);
// break;
// }
// }
// idxBizFanWeightMapper.updateById(listdatum);
// }
//
//
// }
//
// return ResponseHelper.buildResponse(null);
// }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping (value = "/list") @GetMapping (value = "/list")
@ApiOperation(httpMethod = "get", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新") @ApiOperation(httpMethod = "get", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<Map<String,Object>> list( String ids public ResponseModel<Map<String,Object>> list( String ids) {
) {
List<String> list= Arrays.asList(ids.split(","));
LambdaQueryWrapper<IdxBizFanWeight> qu=new LambdaQueryWrapper<>();
qu.in(!list.isEmpty(),IdxBizFanWeight::getSequenceNbr,list);
List<IdxBizFanWeight> listdata = idxBizFanWeightMapper.selectList(qu);
Map<String,Object> data=new HashMap<>(); Map<String,Object> data=new HashMap<>();
data.put("data",listdata); data.put("ids",ids);
return ResponseHelper.buildResponse(data); return ResponseHelper.buildResponse(data);
} }
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @GetMapping (value = "/list")
// @ApiOperation(httpMethod = "get", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
// public ResponseModel<Map<String,Object>> list( String ids
// ) {
// List<String> list= Arrays.asList(ids.split(","));
// LambdaQueryWrapper<IdxBizFanWeight> qu=new LambdaQueryWrapper<>();
// qu.in(!list.isEmpty(),IdxBizFanWeight::getSequenceNbr,list);
// List<IdxBizFanWeight> listdata = idxBizFanWeightMapper.selectList(qu);
// Map<String,Object> data=new HashMap<>();
//
// data.put("data",listdata);
// return ResponseHelper.buildResponse(data);
// }
} }
...@@ -9,7 +9,7 @@ import com.github.pagehelper.PageHelper; ...@@ -9,7 +9,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBiz3yudDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBiz3yudDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWeight; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWeight;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWeight; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWeight;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvWeightMapper; import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvWeightMapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -133,82 +133,222 @@ public class IdxBizPvWeightController extends BaseController { ...@@ -133,82 +133,222 @@ public class IdxBizPvWeightController extends BaseController {
return ResponseHelper.buildResponse(list); return ResponseHelper.buildResponse(list);
} }
@Transactional @Transactional
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping (value = "/update") @PostMapping(value = "/update")
@ApiOperation(httpMethod = "POST", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新") @ApiOperation(httpMethod = "POST", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<IdxBizPvWeight> update(@RequestBody Map<String,List<IdxBizPvWeight>> map) { public ResponseModel<IdxBizPvWeight> update(@RequestBody Map<String,Object> value) {
if (value != null) {
List<String> list1 = Arrays.asList(value.get("ids").toString().split(","));
LambdaQueryWrapper<IdxBizPvWeight> qu1 = new LambdaQueryWrapper<>();
qu1.in(!list1.isEmpty(), IdxBizPvWeight::getSequenceNbr, list1);
List<IdxBizPvWeight> list = idxBizPvWeightMapper.selectList(qu1);
IdxBizPvWeight reviewDto = list.get(0);
//获取所属,同类指标 //获取所属,同类指标
if(map!=null){
List<IdxBizPvWeight> list= map.get("data"); // Float list= map.get("data");
//判断是否同一层级 //判断是否同一层级
String flagtype=null; String flagtype = null;
for (IdxBizPvWeight idxBizPvWeight : list) { for (IdxBizPvWeight idxBizFanWeight : list) {
if(flagtype==null){ if (flagtype == null) {
switch (reviewDto.getType()) {
case "1":
flagtype = idxBizFanWeight.getArae() ;
break;
case "2":
flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation();
break;
case "3":
flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() ;
break;
case "4":
flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray() ;
flagtype= idxBizPvWeight.getArae()+idxBizPvWeight.getStation()+idxBizPvWeight.getEquipmentName()+idxBizPvWeight.getSubarray()+idxBizPvWeight.getPointName()+idxBizPvWeight.getType(); break;
}else{ case "5":
if(!flagtype.equals(idxBizPvWeight.getArae()+idxBizPvWeight.getStation()+idxBizPvWeight.getEquipmentName()+idxBizPvWeight.getSubarray()+idxBizPvWeight.getPointName()+idxBizPvWeight.getType())){ flagtype = idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray() + idxBizFanWeight.getPointName() ;
break;
}
} else {
switch (reviewDto.getType()) {
case "1":
if (!flagtype.equals(idxBizFanWeight.getArae() )) {
throw new BadRequest("配置权重必须是同一个层级的数据"); throw new BadRequest("配置权重必须是同一个层级的数据");
} }
break;
case "2":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() )) {
throw new BadRequest("配置权重必须是同一个层级的数据");
} }
break;
case "3":
if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() )) {
throw new BadRequest("配置权重必须是同一个层级的数据");
} }
Float value= list.stream().map(e->e.getValue()).reduce(Float::sum).get(); break;
IdxBizPvWeight reviewDto= list.get(0); case "4":
LambdaQueryWrapper<IdxBizPvWeight> qu=new LambdaQueryWrapper<>(); if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray() )) {
qu.eq(!StringUtils.isEmpty(reviewDto.getType()),IdxBizPvWeight::getType,reviewDto.getType()); throw new BadRequest("配置权重必须是同一个层级的数据");
qu.eq(!StringUtils.isEmpty(reviewDto.getArae()),IdxBizPvWeight::getArae,reviewDto.getArae()); }
qu.eq(!StringUtils.isEmpty(reviewDto.getStation()), IdxBizPvWeight::getStation,reviewDto.getStation()); break;
qu.eq(!StringUtils.isEmpty(reviewDto.getSubarray()),IdxBizPvWeight::getSubarray,reviewDto.getSubarray()); case "5":
qu.eq(!StringUtils.isEmpty(reviewDto.getEquipmentName()),IdxBizPvWeight::getEquipmentName,reviewDto.getEquipmentName()); if (!flagtype.equals(idxBizFanWeight.getArae() + idxBizFanWeight.getStation() + idxBizFanWeight.getEquipmentName() + idxBizFanWeight.getSubarray() + idxBizFanWeight.getPointName() )) {
qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()),IdxBizPvWeight::getPointName,reviewDto.getPointName()); throw new BadRequest("配置权重必须是同一个层级的数据");
}
break;
}
}
Float valued = list.size() * Float.valueOf(value.get("data").toString());
LambdaQueryWrapper<IdxBizPvWeight> qu = new LambdaQueryWrapper<>();
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.getStation()), IdxBizPvWeight::getStation, reviewDto.getStation());
qu.eq(!StringUtils.isEmpty(reviewDto.getSubarray()), IdxBizPvWeight::getSubarray, reviewDto.getSubarray());
qu.eq(!StringUtils.isEmpty(reviewDto.getEquipmentName()), IdxBizPvWeight::getEquipmentName, reviewDto.getEquipmentName());
qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()), IdxBizPvWeight::getPointName, reviewDto.getPointName());
List<IdxBizPvWeight> listdata = idxBizPvWeightMapper.selectList(qu); List<IdxBizPvWeight> listdata = idxBizPvWeightMapper.selectList(qu);
//设置权重值, //设置权重值,
int num= listdata.size()-list.size(); int num = listdata.size() - list.size();
if (num == 0) {
if (valued != 1) {
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
}
}
//值不能大于1 //值不能大于1
if(value>1){ if (valued > 1) {
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1"); throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
} }
if(value!=1&&num!=0){ if (valued != 1 && num != 0) {
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1"); throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
} }
//剩余权重值 //剩余权重值
float formattedNum = num != 0 ? Float.parseFloat(new DecimalFormat("0.0000000000").format((1 - valued) / num)) : 0;
float formattedNum =num!=0? Float.parseFloat(new DecimalFormat("0.0000").format((1-value)/num)):0;
for (IdxBizPvWeight listdatum : listdata) { for (IdxBizPvWeight listdatum : listdata) {
for (IdxBizPvWeight idxBizPvWeight : list) { for (IdxBizPvWeight idxBizPvWeight : list) {
if(idxBizPvWeight.getSequenceNbr().equals(listdatum.getSequenceNbr())){ if (idxBizPvWeight.getSequenceNbr().equals(listdatum.getSequenceNbr())) {
listdatum.setValue(idxBizPvWeight.getValue()); listdatum.setValue(idxBizPvWeight.getValue());
break; break;
}else{ } else {
listdatum.setValue(formattedNum); listdatum.setValue(formattedNum);
break; break;
} }
} }
idxBizPvWeightMapper.updateById(listdatum); idxBizPvWeightMapper.updateById(listdatum);
} }
} }
}
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
// @Transactional
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @PostMapping (value = "/update")
// @ApiOperation(httpMethod = "POST", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
// public ResponseModel<IdxBizPvWeight> update(@RequestBody Map<String,List<IdxBizPvWeight>> map) {
// //获取所属,同类指标
// if(map!=null){
// List<IdxBizPvWeight> list= map.get("data");
// //判断是否同一层级
// String flagtype=null;
// for (IdxBizPvWeight idxBizPvWeight : list) {
// if(flagtype==null){
//
// flagtype= idxBizPvWeight.getArae()+idxBizPvWeight.getStation()+idxBizPvWeight.getEquipmentName()+idxBizPvWeight.getSubarray()+idxBizPvWeight.getPointName()+idxBizPvWeight.getType();
// }else{
// if(!flagtype.equals(idxBizPvWeight.getArae()+idxBizPvWeight.getStation()+idxBizPvWeight.getEquipmentName()+idxBizPvWeight.getSubarray()+idxBizPvWeight.getPointName()+idxBizPvWeight.getType())){
// throw new BadRequest("配置权重必须是同一个层级的数据");
// }
// }
// }
// Float value= list.stream().map(e->e.getValue()).reduce(Float::sum).get();
// IdxBizPvWeight reviewDto= list.get(0);
// LambdaQueryWrapper<IdxBizPvWeight> qu=new LambdaQueryWrapper<>();
// 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.getStation()), IdxBizPvWeight::getStation,reviewDto.getStation());
// qu.eq(!StringUtils.isEmpty(reviewDto.getSubarray()),IdxBizPvWeight::getSubarray,reviewDto.getSubarray());
// qu.eq(!StringUtils.isEmpty(reviewDto.getEquipmentName()),IdxBizPvWeight::getEquipmentName,reviewDto.getEquipmentName());
// qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()),IdxBizPvWeight::getPointName,reviewDto.getPointName());
// List<IdxBizPvWeight> listdata = idxBizPvWeightMapper.selectList(qu);
//
// //设置权重值,
// int num= listdata.size()-list.size();
//
// //值不能大于1
// if(value>1){
// throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
// }
// if(value!=1&&num!=0){
// throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
// }
//
// //剩余权重值
//
// float formattedNum =num!=0? Float.parseFloat(new DecimalFormat("0.0000").format((1-value)/num)):0;
//
// for (IdxBizPvWeight listdatum : listdata) {
// for (IdxBizPvWeight idxBizPvWeight : list) {
// if(idxBizPvWeight.getSequenceNbr().equals(listdatum.getSequenceNbr())){
// listdatum.setValue(idxBizPvWeight.getValue());
// break;
// }else{
// listdatum.setValue(formattedNum);
// break;
// }
// }
// idxBizPvWeightMapper.updateById(listdatum);
// }
//
//
// }
//
// return ResponseHelper.buildResponse(null);
// }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping (value = "/list") @GetMapping (value = "/list")
@ApiOperation(httpMethod = "get", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新") @ApiOperation(httpMethod = "get", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<Map<String,Object>> list( String ids public ResponseModel<Map<String,Object>> list( String ids
) { ) {
List<String> list= Arrays.asList(ids.split(","));
LambdaQueryWrapper<IdxBizPvWeight> qu=new LambdaQueryWrapper<>();
qu.in(!list.isEmpty(),IdxBizPvWeight::getSequenceNbr,list);
List<IdxBizPvWeight> listdata = idxBizPvWeightMapper.selectList(qu);
Map<String,Object> data=new HashMap<>(); Map<String,Object> data=new HashMap<>();
data.put("data",listdata); data.put("ids",ids);
return ResponseHelper.buildResponse(data); return ResponseHelper.buildResponse(data);
} }
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @GetMapping (value = "/list")
// @ApiOperation(httpMethod = "get", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
// public ResponseModel<Map<String,Object>> list( String ids
// ) {
// List<String> list= Arrays.asList(ids.split(","));
// LambdaQueryWrapper<IdxBizPvWeight> qu=new LambdaQueryWrapper<>();
// qu.in(!list.isEmpty(),IdxBizPvWeight::getSequenceNbr,list);
// List<IdxBizPvWeight> listdata = idxBizPvWeightMapper.selectList(qu);
// Map<String,Object> data=new HashMap<>();
//
// data.put("data",listdata);
// return ResponseHelper.buildResponse(data);
// }
} }
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