Commit d7549df8 authored by hezhuozhi's avatar hezhuozhi

区域权重修改

parent fbad3c07
......@@ -14,6 +14,7 @@ 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.mapper2.IdxBizFanWeightMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvWeightMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
......@@ -29,10 +30,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -47,6 +45,8 @@ public class IdxBizFanWeightController extends BaseController {
@Autowired
IdxBizFanWeightMapper idxBizFanWeightMapper;
@Autowired
IdxBizPvWeightMapper idxBizPvWeightMapper;
@Autowired
UserEmpowerMapper userEmpowerMapper;
......@@ -296,8 +296,18 @@ public class IdxBizFanWeightController extends BaseController {
// qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()), IdxBizFanWeight::getPointName, reviewDto.getPointName());
List<IdxBizFanWeight> listdata = idxBizFanWeightMapper.selectList(qu);
//场站级别包括风电
int allDataSize = listdata.size();
List<IdxBizPvWeight> pvData = new ArrayList<>();
if("2".equals(reviewDto.getType())){
LambdaQueryWrapper<IdxBizPvWeight> pvWrapper = new LambdaQueryWrapper<>();
pvWrapper.eq(IdxBizPvWeight::getType, reviewDto.getType());
pvWrapper.eq(IdxBizPvWeight::getArae, reviewDto.getArae());
pvData = idxBizPvWeightMapper.selectList(pvWrapper);
allDataSize= allDataSize + pvData.size();
}
//设置权重值,
int num = listdata.size() - list.size();
int num = allDataSize - list.size();
if (num == 0) {
if (valued != 1) {
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
......@@ -331,6 +341,14 @@ public class IdxBizFanWeightController extends BaseController {
}
idxBizFanWeightMapper.updateById(listdatum);
}
if(CollectionUtil.isNotEmpty(pvData)){
for (IdxBizPvWeight listdatum : pvData) {
listdatum.setValue(formattedNum);
listdatum.setFlag(null);
idxBizPvWeightMapper.updateById(listdatum);
}
}
}
return ResponseHelper.buildResponse(null);
......
......@@ -19,6 +19,7 @@ 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.IdxBizFanWeightMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvWeightMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -35,10 +36,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -55,6 +53,8 @@ public class IdxBizPvWeightController extends BaseController {
@Autowired
IdxBizPvWeightMapper idxBizPvWeightMapper;
@Autowired
IdxBizFanWeightMapper idxBizFanWeightMapper;
@Autowired
UserEmpowerMapper userEmpowerMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/queryPage")
......@@ -305,9 +305,18 @@ public class IdxBizPvWeightController extends BaseController {
// qu.eq(!StringUtils.isEmpty(reviewDto.getEquipmentName()), IdxBizFanWeight::getEquipmentName, reviewDto.getEquipmentName());
// qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()), IdxBizFanWeight::getPointName, reviewDto.getPointName());
List<IdxBizPvWeight> listdata = idxBizPvWeightMapper.selectList(qu);
//处理场站级别 包括风电
int allDataSize = listdata.size();
List<IdxBizFanWeight> fanData = new ArrayList<>();
if("2".equals(reviewDto.getType())){
LambdaQueryWrapper<IdxBizFanWeight> fanWrapper = new LambdaQueryWrapper<>();
fanWrapper.eq(IdxBizFanWeight::getType, reviewDto.getType());
fanWrapper.eq(IdxBizFanWeight::getArae, reviewDto.getArae());
fanData = idxBizFanWeightMapper.selectList(fanWrapper);
allDataSize= allDataSize + fanData.size();
}
//设置权重值,
int num = listdata.size() - list.size();
int num = allDataSize - list.size();
if (num == 0) {
if (valued != 1) {
throw new BadRequest("超出权重最大值限制,层级下权重等级总和为1");
......@@ -340,6 +349,13 @@ public class IdxBizPvWeightController extends BaseController {
}
idxBizPvWeightMapper.updateById(listdatum);
}
if(CollectionUtil.isNotEmpty(fanData)){
for (IdxBizFanWeight listdatum : fanData) {
listdatum.setValue(formattedNum);
listdatum.setFlag(null);
idxBizFanWeightMapper.updateById(listdatum);
}
}
}
return ResponseHelper.buildResponse(null);
......
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