Commit cfab5a89 authored by wujiang's avatar wujiang

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 64bcd455 2590bfae
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
......@@ -17,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
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;
......@@ -121,10 +123,24 @@ public class IdxBizFanWeightController extends BaseController {
@Transactional
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/update")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<IdxBizFanWeight> update(@RequestBody List<IdxBizFanWeight> list) {
@ApiOperation(httpMethod = "POST", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<IdxBizFanWeight> update(@RequestBody Map<String,List<IdxBizFanWeight>> map) {
//获取所属,同类指标
if(list!=null&&list.size()>0){
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());
......@@ -135,12 +151,22 @@ public class IdxBizFanWeightController extends BaseController {
qu.eq(!StringUtils.isEmpty(reviewDto.getPointName()),IdxBizFanWeight::getPointName,reviewDto.getPointName());
List<IdxBizFanWeight> listdata = idxBizFanWeightMapper.selectList(qu);
Float value= list.stream().map(e->e.getValue()).reduce(Float::sum).get();
//设置权重值,
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 = Float.parseFloat(new DecimalFormat("0.0000").format((1-value)/num));
float formattedNum =num!=0? Float.parseFloat(new DecimalFormat("0.0000").format((1-value)/num)):0;
for (IdxBizFanWeight listdatum : listdata) {
for (IdxBizFanWeight idxBizPvWeight : list) {
......
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -19,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
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;
......@@ -132,28 +134,50 @@ public class IdxBizPvWeightController extends BaseController {
}
@Transactional
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping (value = "/update")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<IdxBizPvWeight> update(@RequestBody List<IdxBizPvWeight> list) {
@ApiOperation(httpMethod = "POST", value = "根据sequenceNbr更新", notes = "根据sequenceNbr更新")
public ResponseModel<IdxBizPvWeight> update(@RequestBody Map<String,List<IdxBizPvWeight>> map) {
//获取所属,同类指标
if(list!=null&&list.size()>0){
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.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);
Float value= list.stream().map(e->e.getValue()).reduce(Float::sum).get();
//设置权重值,
int num= listdata.size()-list.size();
//剩余权重值
float formattedNum = Float.parseFloat(new DecimalFormat("0.0000").format((1-value)/num));
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) {
......@@ -167,7 +191,10 @@ public class IdxBizPvWeightController extends BaseController {
}
idxBizPvWeightMapper.updateById(listdatum);
}
}
return ResponseHelper.buildResponse(null);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
......
......@@ -151,4 +151,11 @@ public class IdxBizFanWarningRecord{
*/
@TableField("KKS")
private String kks;
/**
* 预警周期
*/
@TableField("WARNING_PERIOD")
private String warningPeriod;
}
......@@ -64,5 +64,6 @@ public class IdxBizFanWeight {
*/
@TableField("VALUE")
private Float value;
@TableField(exist=false)
private String Symbol_key;
}
......@@ -152,4 +152,10 @@ public class IdxBizPvWarningRecord{
*/
@TableField("KKS")
private String kks;
/**
* 预警周期
*/
@TableField("WARNING_PERIOD")
private String warningPeriod;
}
......@@ -65,6 +65,6 @@ public class IdxBizPvWeight {
*/
@TableField("VALUE")
private Float value;
@TableField(exist=false)
private String Symbol_key;
}
......@@ -230,6 +230,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setWarningName(level);
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizPvWarningRecord.setRecDate(time);
idxBizPvWarningRecord.setWarningPeriod("按时刻");
idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer());
idxBizPvWarningRecord.setPointName(idxBizPvHealthIndices.get(0).getPointName());
idxBizPvWarningRecord.setHealthIndexSeq(idxBizPvHealthIndices.get(0).getHealthIndex().toString());
......@@ -374,6 +375,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setWarningName(level);
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizPvWarningRecord.setRecDate(time);
idxBizPvWarningRecord.setWarningPeriod("按小时");
idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer());
idxBizPvWarningRecord.setPointName(idxBizPvHealthIndices.get(0).getPointName());
idxBizPvWarningRecord.setHealthIndexSeq(idxBizPvHealthIndices.get(0).getHealthIndex().toString());
......@@ -512,6 +514,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizPvWarningRecord.setWarningName(level);
idxBizPvWarningRecord.setCONTENT(idxBizPvHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizPvWarningRecord.setRecDate(time);
idxBizPvWarningRecord.setWarningPeriod("按天");
idxBizPvWarningRecord.setManufacturer(idxBizPvHealthIndices.get(0).getManufacturer());
idxBizPvWarningRecord.setPointName(idxBizPvHealthIndices.get(0).getPointName());
idxBizPvWarningRecord.setHealthIndexSeq(idxBizPvHealthIndices.get(0).getHealthIndex().toString());
......@@ -652,6 +655,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setWarningName(level);
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizFanWarningRecord.setRecDate(time);
idxBizFanWarningRecord.setWarningPeriod("按时刻");
idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber());
idxBizFanWarningRecord.setPointName(idxBizFanHealthIndices.get(0).getPointName());
idxBizFanWarningRecord.setHealthIndexSeq(idxBizFanHealthIndices.get(0).getHealthIndex().toString());
......@@ -791,6 +795,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setWarningName(level);
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizFanWarningRecord.setRecDate(time);
idxBizFanWarningRecord.setWarningPeriod("按小时");
idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber());
idxBizFanWarningRecord.setHealthIndexSeq(idxBizFanHealthIndices.get(0).getHealthIndex().toString());
idxBizFanWarningRecord.setHealthLevel(idxBizFanHealthIndices.get(0).getHealthLevel());
......@@ -932,6 +937,7 @@ public class HealthStatusIndicatorServiceImpl {
idxBizFanWarningRecord.setWarningName(level);
idxBizFanWarningRecord.setCONTENT(idxBizFanHealthIndices.get(0).getPointName() + "连续"+content+"健康指数<"+num );
idxBizFanWarningRecord.setRecDate(time);
idxBizFanWarningRecord.setWarningPeriod("按天");
idxBizFanWarningRecord.setNumber(idxBizFanHealthIndices.get(0).getNumber());
idxBizFanWarningRecord.setHealthIndexSeq(idxBizFanHealthIndices.get(0).getHealthIndex().toString());
idxBizFanWarningRecord.setHealthLevel(idxBizFanHealthIndices.get(0).getHealthLevel());
......
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