|
|
@@ -78,6 +78,93 @@ public class ThresholdService {
|
|
|
@Autowired
|
|
|
KwsDeviceReferenceMapper deviceReferenceMapper;
|
|
|
|
|
|
+ public PageRes newSelect(ThresholdQuery thresholdQuery, HttpServletRequest request) {
|
|
|
+ PageHelper.startPage(thresholdQuery.getPage(), thresholdQuery.getPageSize());
|
|
|
+ HeaderData headerData = commonService.getHeaderData(request);
|
|
|
+ List<Integer> status = new ArrayList<>();
|
|
|
+ status.add(DeviceEnum.ALREADY_REFERRED_TO.getCode());
|
|
|
+ List<KwsThreshold> list = thresholdMapper.selectListAll(thresholdQuery, headerData, status);
|
|
|
+ List<ThresholdSelectDTO> dtoList = deviceMapper.selectDeviceAllByProjectAndMountainId(thresholdQuery.getProjectId(), headerData.getMountainId(), status);
|
|
|
+ PageInfo<ThresholdSelectDTO> info = new PageInfo<>(dtoList);
|
|
|
+ if (CollectionUtils.isEmpty(dtoList)) {
|
|
|
+ return PageRes.build(info, dtoList);
|
|
|
+ }
|
|
|
+ for (ThresholdSelectDTO dto : dtoList) {
|
|
|
+ Long deviceId = dto.getDeviceId();
|
|
|
+ //基本要素
|
|
|
+ List<DeviceElementDTO> basiclElementList = deviceModelPartMapper.selectElementList(thresholdQuery.getProjectId(),
|
|
|
+ headerData.getMountainId(), status, deviceId);
|
|
|
+ List<KwsThreshold> kwsThresholds = thresholdMapper.selectList(new LambdaQueryWrapper<KwsThreshold>()
|
|
|
+ .eq(KwsThreshold::getDeviceId, deviceId)
|
|
|
+ .eq(KwsThreshold::getMountainId, headerData.getMountainId())
|
|
|
+ .eq(KwsThreshold::getDelFlag, NumberConstant.ZERO)
|
|
|
+ .orderByDesc(KwsThreshold::getCreateTime)
|
|
|
+ );
|
|
|
+ String setting = ThresholdEnum.IS_NOT_SET.getStatus();
|
|
|
+ String statusName = ThresholdEnum.IS_NOT_SET.getDestination();
|
|
|
+ if (!CollectionUtils.isEmpty(kwsThresholds)) {
|
|
|
+ setting = kwsThresholds.get(0).getSetting();
|
|
|
+ if (ThresholdEnum.PARTIAL_SETTING.getStatus().equals(setting)) {
|
|
|
+ statusName = ThresholdEnum.PARTIAL_SETTING.getDestination();
|
|
|
+ } else {
|
|
|
+ setting = ThresholdEnum.HAVE_SET.getStatus();
|
|
|
+ statusName = ThresholdEnum.HAVE_SET.getDestination();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dto.setId(thresholdQuery.getProjectId());
|
|
|
+ StringBuilder phones = new StringBuilder();
|
|
|
+ if (!CollectionUtils.isEmpty(kwsThresholds)) {
|
|
|
+ for (int i = 0; i < kwsThresholds.size(); i++) {
|
|
|
+ if (i != (kwsThresholds.size() - 1)) {
|
|
|
+ phones.append(kwsThresholds.get(i).getPhones()).append(",");
|
|
|
+ } else {
|
|
|
+ phones.append(kwsThresholds.get(i).getPhones());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<String> itemNameList = new ArrayList<>();
|
|
|
+ //翻译
|
|
|
+ List<String> collect = basiclElementList.stream().map(DeviceElementDTO::getElement).collect(Collectors.toList());
|
|
|
+ if (!CollectionUtils.isEmpty(collect)) {
|
|
|
+ for (String dict : collect) {
|
|
|
+ //不查询数据库【kws_device_model_part】 查字典
|
|
|
+ Map<String, SystemDict> dictList = commonService.getDictList(null,
|
|
|
+ new HashMap<>() {
|
|
|
+ {
|
|
|
+ put("code", DictEnum.MODEL_PART.getCodeType());
|
|
|
+ put("type", "1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ itemNameList.add(dictList == null ? dict : (dictList.get(dict) == null ? dict : dictList.get(dict).getLabel()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //集成要素
|
|
|
+ List<DeviceElementDTO> integratedElementList = deviceIntegrationMapper.selectIntegratedElement(thresholdQuery.getProjectId(),
|
|
|
+ headerData.getMountainId(), status, deviceId);
|
|
|
+ List<String> collect1 = integratedElementList.stream().map(DeviceElementDTO::getIntegrationElement).collect(Collectors.toList());
|
|
|
+ if (!CollectionUtils.isEmpty(collect1)) {
|
|
|
+ itemNameList.addAll(collect1);
|
|
|
+ }
|
|
|
+ dto.setItemName(JSONObject.toJSONString(itemNameList));
|
|
|
+ //获取总数和设置阈值数
|
|
|
+ int deviceTotal = getThresholdNumber(thresholdQuery.getProjectId(), headerData, deviceId);
|
|
|
+ dto.setDeviceTotal(String.valueOf(deviceTotal));
|
|
|
+ int deviceSetTotal = 0;
|
|
|
+ if (!CollectionUtils.isEmpty(kwsThresholds)) {
|
|
|
+ deviceSetTotal = kwsThresholds.stream().map(KwsThreshold::getItemName).distinct().collect(Collectors.toList()).size();
|
|
|
+ }
|
|
|
+ dto.setDeviceSetTotal(deviceSetTotal);
|
|
|
+ dto.setDeviceName(dto.getDeviceName());
|
|
|
+ dto.setStatus(setting);
|
|
|
+ dto.setStatusName(statusName);
|
|
|
+ dto.setPhones(phones.toString());
|
|
|
+ dto.setUpdateByName(CollectionUtils.isEmpty(kwsThresholds) ? null : kwsThresholds.get(0).getCreateBy().toString());
|
|
|
+ dto.setUpdateTime(CollectionUtils.isEmpty(kwsThresholds) ? null : kwsThresholds.get(0).getCreateTime());
|
|
|
+ }
|
|
|
+ return PageRes.build(info, dtoList);
|
|
|
+ }
|
|
|
+
|
|
|
public PageRes select(ThresholdQuery thresholdQuery, HttpServletRequest request) {
|
|
|
PageHelper.startPage(thresholdQuery.getPage(), thresholdQuery.getPageSize());
|
|
|
HeaderData headerData = commonService.getHeaderData(request);
|
|
|
@@ -213,6 +300,7 @@ public class ThresholdService {
|
|
|
.eq(KwsDeviceReference::getDeviceId, deviceId)
|
|
|
.eq(KwsDeviceReference::getType, 1)
|
|
|
.eq(KwsDeviceReference::getItem, itemName)
|
|
|
+ .eq(KwsDeviceReference::getDelFlag, 0)
|
|
|
);
|
|
|
ThresholdDetailVO vo = new ThresholdDetailVO();
|
|
|
if (!CollectionUtils.isEmpty(kwsThreshold)) {
|
|
|
@@ -226,8 +314,8 @@ public class ThresholdService {
|
|
|
for (KwsThreshold threshold : kwsThreshold) {
|
|
|
ThresholdBean bean = new ThresholdBean();
|
|
|
bean.setLevel(threshold.getLevel());
|
|
|
- bean.setMax(threshold.getMax());
|
|
|
- bean.setMin(threshold.getMin());
|
|
|
+ bean.setMax(Integer.valueOf(threshold.getMax()));
|
|
|
+ bean.setMin(Integer.valueOf(threshold.getMin()));
|
|
|
beanList.add(bean);
|
|
|
}
|
|
|
vo.setThreshold(beanList);
|
|
|
@@ -260,7 +348,7 @@ public class ThresholdService {
|
|
|
for (ThresholdBean thresholdBean : threshold) {
|
|
|
//验证数据库层面阈值数据存储值
|
|
|
int level = thresholdBean.getLevel();
|
|
|
- checkDatabaseThresholdLevel(level, thresholdBean, headerData, deviceId, itemName);
|
|
|
+// checkDatabaseThresholdLevel(level, thresholdBean, headerData, deviceId, itemName);
|
|
|
KwsThreshold selected = thresholdMapper.selectOne(new LambdaQueryWrapper<KwsThreshold>()
|
|
|
.eq(KwsThreshold::getMountainId, headerData.getMountainId())
|
|
|
.eq(KwsThreshold::getDeviceId, deviceId)
|
|
|
@@ -278,8 +366,8 @@ public class ThresholdService {
|
|
|
String setting = checkAndSettings(configurationDTO, headerData);
|
|
|
kwsThreshold.setSetting(setting);
|
|
|
kwsThreshold.setLevel(Integer.valueOf(thresholdBean.getLevel()));
|
|
|
- kwsThreshold.setMax(thresholdBean.getMax());
|
|
|
- kwsThreshold.setMin(thresholdBean.getMin());
|
|
|
+ kwsThreshold.setMax(String.valueOf(thresholdBean.getMax()));
|
|
|
+ kwsThreshold.setMin(String.valueOf(thresholdBean.getMin()));
|
|
|
kwsThreshold.setPhones(phones);
|
|
|
kwsThreshold.setStatus(0);
|
|
|
kwsThreshold.setCreateBy(headerData.getCreateBy() == null ? null : Long.parseLong(headerData.getCreateBy()));
|
|
|
@@ -292,8 +380,8 @@ public class ThresholdService {
|
|
|
//计算设置状态 便于select
|
|
|
String setting = checkAndSettings(configurationDTO, headerData);
|
|
|
selected.setSetting(setting);
|
|
|
- selected.setMax(thresholdBean.getMax());
|
|
|
- selected.setMin(thresholdBean.getMin());
|
|
|
+ selected.setMax(String.valueOf(thresholdBean.getMax()));
|
|
|
+ selected.setMin(String.valueOf(thresholdBean.getMin()));
|
|
|
selected.setPhones(phones);
|
|
|
selected.setStatus(0);
|
|
|
selected.setUpdateBy(headerData.getUpdateBy() == null ? null : Long.parseLong(headerData.getUpdateBy()));
|
|
|
@@ -332,24 +420,24 @@ public class ThresholdService {
|
|
|
String min = twoKwsThreshold.getMin();
|
|
|
if (min.contains("-")) {
|
|
|
// min = StringUtils.deleteCharString(min, "-");
|
|
|
- if (Long.parseLong(min) < Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) < thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在二级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("一级最小值阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(min) > Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) > thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在二级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("一级最小值阈值设置数据填写错误");
|
|
|
}
|
|
|
}
|
|
|
String max = twoKwsThreshold.getMax();
|
|
|
if (max.contains("-")) {
|
|
|
- if (Long.parseLong(max) > Long.parseLong(thresholdBean.getMax())) {
|
|
|
+ if (Long.parseLong(max) > thresholdBean.getMax()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在二级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("一级最大值阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(max) > Long.parseLong(thresholdBean.getMax())) {
|
|
|
+ if (Long.parseLong(max) > thresholdBean.getMax()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在二级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("一级最大值阈值设置数据填写错误");
|
|
|
}
|
|
|
@@ -358,24 +446,24 @@ public class ThresholdService {
|
|
|
if (threeKwsThreshold != null) {
|
|
|
String min = threeKwsThreshold.getMin();
|
|
|
if (min.contains("-")) {
|
|
|
- if (Long.parseLong(min) < Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) < thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在三级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("一级最小值阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(min) < Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) < thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在三级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("一级最小值阈值设置数据填写错误");
|
|
|
}
|
|
|
}
|
|
|
String max = threeKwsThreshold.getMax();
|
|
|
if (max.contains("-")) {
|
|
|
- if (Long.parseLong(max) > Long.parseLong(thresholdBean.getMax())) {
|
|
|
+ if (Long.parseLong(max) > thresholdBean.getMax()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在三级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("一级最大值阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(max) > Long.parseLong(thresholdBean.getMax())) {
|
|
|
+ if (Long.parseLong(max) > thresholdBean.getMax()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在三级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("一级最大值阈值设置数据填写错误");
|
|
|
}
|
|
|
@@ -388,12 +476,12 @@ public class ThresholdService {
|
|
|
String min = oneKwsThreshold.getMin();
|
|
|
if (min.contains("-")) {
|
|
|
// min = StringUtils.deleteCharString(min, "-");
|
|
|
- if (Long.parseLong(min) > Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) > thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在一级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("二级最小值阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(min) > Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) > thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在一级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("阈值设置数据填写错误");
|
|
|
}
|
|
|
@@ -401,12 +489,12 @@ public class ThresholdService {
|
|
|
String max = oneKwsThreshold.getMax();
|
|
|
if (max.contains("-")) {
|
|
|
// min = StringUtils.deleteCharString(min, "-");
|
|
|
- if (Long.parseLong(max) > Long.parseLong(thresholdBean.getMax())) {
|
|
|
+ if (Long.parseLong(max) > thresholdBean.getMax()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在一级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(max) < Long.parseLong(thresholdBean.getMax())) {
|
|
|
+ if (Long.parseLong(max) < thresholdBean.getMax()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在一级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("阈值设置数据填写错误");
|
|
|
}
|
|
|
@@ -415,24 +503,24 @@ public class ThresholdService {
|
|
|
if (threeKwsThreshold != null) {
|
|
|
String min = threeKwsThreshold.getMin();
|
|
|
if (min.contains("-")) {
|
|
|
- if (Long.parseLong(min) < Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) < thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在三级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("二级最小级阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(min) < Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) < thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在三级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("二级最小级阈值设置数据填写错误");
|
|
|
}
|
|
|
}
|
|
|
String max = threeKwsThreshold.getMax();
|
|
|
if (max.contains("-")) {
|
|
|
- if (Long.parseLong(max) > Long.parseLong(thresholdBean.getMax())) {
|
|
|
+ if (Long.parseLong(max) > thresholdBean.getMax()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在三级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("二级最大值阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(max) > Long.parseLong(thresholdBean.getMax())) {
|
|
|
+ if (Long.parseLong(max) > thresholdBean.getMax()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在三级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("二级最大值阈值设置数据填写错误");
|
|
|
}
|
|
|
@@ -444,24 +532,24 @@ public class ThresholdService {
|
|
|
if (oneKwsThreshold != null) {
|
|
|
String min = oneKwsThreshold.getMin();
|
|
|
if (min.contains("-")) {
|
|
|
- if (Long.parseLong(min) > Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) > thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在一级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("三级最小值阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(min) < Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) < thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在一级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("三级最小值阈值设置数据填写错误");
|
|
|
}
|
|
|
}
|
|
|
String max = oneKwsThreshold.getMax();
|
|
|
if (max.contains("-")) {
|
|
|
- if (Long.parseLong(max) < Long.parseLong(thresholdBean.getMax())) {
|
|
|
+ if (Long.parseLong(max) < thresholdBean.getMax()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在一级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("三级最大值阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(max) < Long.parseLong(thresholdBean.getMax())) {
|
|
|
+ if (Long.parseLong(max) < thresholdBean.getMax()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在一级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("三级最大值阈值设置数据填写错误");
|
|
|
}
|
|
|
@@ -470,24 +558,24 @@ public class ThresholdService {
|
|
|
if (twoKwsThreshold != null) {
|
|
|
String min = twoKwsThreshold.getMin();
|
|
|
if (min.contains("-")) {
|
|
|
- if (Long.parseLong(min) > Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) > thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在二级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("三级最小值阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(min) > Long.parseLong(thresholdBean.getMin())) {
|
|
|
+ if (Long.parseLong(min) > thresholdBean.getMin()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在二级阈值:{}", level, thresholdBean.getMin(), min);
|
|
|
throw new BusinessException("三级最小值阈值设置数据填写错误");
|
|
|
}
|
|
|
}
|
|
|
String max = twoKwsThreshold.getMax();
|
|
|
if (max.contains("-")) {
|
|
|
- if (Long.parseLong(thresholdBean.getMax()) > Long.parseLong(max)) {
|
|
|
+ if (thresholdBean.getMax() > Long.parseLong(max)) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在二级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("三级最大值阈值设置数据填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (Long.parseLong(max) < Long.parseLong(thresholdBean.getMax())) {
|
|
|
+ if (Long.parseLong(max) < thresholdBean.getMax()) {
|
|
|
log.error("当前等级:{},当前设置阈值:{},存在二级阈值:{}", level, thresholdBean.getMax(), max);
|
|
|
throw new BusinessException("三级最大值阈值设置数据填写错误");
|
|
|
}
|
|
|
@@ -514,32 +602,32 @@ public class ThresholdService {
|
|
|
ThresholdBean thresholdBeanTwo = maps.get(2);
|
|
|
ThresholdBean thresholdBeanThree = maps.get(3);
|
|
|
if (thresholdBeanTwo != null) {
|
|
|
- String min = thresholdBeanTwo.getMin();//10
|
|
|
- String max = thresholdBeanTwo.getMax();//90
|
|
|
+ String min = String.valueOf(thresholdBeanTwo.getMin());//10
|
|
|
+ String max = String.valueOf(thresholdBeanTwo.getMax());//90
|
|
|
if (thresholdBeanThree != null) {
|
|
|
- String minThree = thresholdBeanThree.getMin();//8
|
|
|
+ long minThree = thresholdBeanThree.getMin();//8
|
|
|
// if (minThree.contains("-")) {
|
|
|
// minThree = com.sckw.core.utils.StringUtils.deleteCharString(minThree, "-");//-8
|
|
|
// }
|
|
|
- String maxThree = thresholdBeanThree.getMax();//80
|
|
|
- if (BigDecimal.valueOf(Long.parseLong(max)).compareTo(BigDecimal.valueOf(Long.parseLong(maxThree))) < 0) {
|
|
|
+ long maxThree = thresholdBeanThree.getMax();//80
|
|
|
+ if (BigDecimal.valueOf(Long.parseLong(max)).compareTo(BigDecimal.valueOf(maxThree)) < 0) {
|
|
|
throw new BusinessException("阈值填写错误");
|
|
|
}
|
|
|
if (min.contains("-")) {
|
|
|
// min = com.sckw.core.utils.StringUtils.deleteCharString(min, "-");//-10
|
|
|
- if (BigDecimal.valueOf(Long.parseLong(min)).compareTo(BigDecimal.valueOf(Long.parseLong(minThree))) > 0) {
|
|
|
+ if (BigDecimal.valueOf(Long.parseLong(min)).compareTo(BigDecimal.valueOf(minThree)) > 0) {
|
|
|
throw new BusinessException("阈值填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (BigDecimal.valueOf(Long.parseLong(min)).compareTo(BigDecimal.valueOf(Long.parseLong(minThree))) > 0) {
|
|
|
+ if (BigDecimal.valueOf(Long.parseLong(min)).compareTo(BigDecimal.valueOf(minThree)) > 0) {
|
|
|
throw new BusinessException("阈值填写错误");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (thresholdBeanOne != null) {
|
|
|
- String minOne = thresholdBeanOne.getMin(); //15
|
|
|
- String maxThree = thresholdBeanOne.getMax();//100
|
|
|
+ String minOne = String.valueOf(thresholdBeanOne.getMin()); //15
|
|
|
+ String maxThree = String.valueOf(thresholdBeanOne.getMax());//100
|
|
|
if (BigDecimal.valueOf(Long.parseLong(max)).compareTo(BigDecimal.valueOf(Long.parseLong(maxThree))) > 0) {
|
|
|
throw new BusinessException("阈值填写错误");
|
|
|
}
|
|
|
@@ -556,21 +644,21 @@ public class ThresholdService {
|
|
|
}
|
|
|
}
|
|
|
if (thresholdBeanThree != null) {
|
|
|
- String minThree = thresholdBeanThree.getMin();//8
|
|
|
- String maxThree = thresholdBeanThree.getMax();//80
|
|
|
+ String minThree = String.valueOf(thresholdBeanThree.getMin());//8
|
|
|
+ String maxThree = String.valueOf(thresholdBeanThree.getMax());//80
|
|
|
if (thresholdBeanTwo != null) {
|
|
|
- String twoMax = thresholdBeanTwo.getMax();//90
|
|
|
- String twoMin = thresholdBeanTwo.getMin();//-10
|
|
|
- if (BigDecimal.valueOf(Long.parseLong(twoMax)).compareTo(BigDecimal.valueOf(Long.parseLong(maxThree))) < 0) {
|
|
|
+ long twoMax = thresholdBeanTwo.getMax();//90
|
|
|
+ long twoMin = thresholdBeanTwo.getMin();//-10
|
|
|
+ if (BigDecimal.valueOf(twoMax).compareTo(BigDecimal.valueOf(Long.parseLong(maxThree))) < 0) {
|
|
|
throw new BusinessException("阈值填写错误");
|
|
|
}
|
|
|
if (minThree.contains("-")) {
|
|
|
// minThree = com.sckw.core.utils.StringUtils.deleteCharString(minThree, "-");//-8
|
|
|
- if (BigDecimal.valueOf(Long.parseLong(twoMin)).compareTo(BigDecimal.valueOf(Long.parseLong(minThree))) > 0) {
|
|
|
+ if (BigDecimal.valueOf(twoMin).compareTo(BigDecimal.valueOf(Long.parseLong(minThree))) > 0) {
|
|
|
throw new BusinessException("阈值填写错误");
|
|
|
}
|
|
|
} else {
|
|
|
- if (BigDecimal.valueOf(Long.parseLong(twoMin)).compareTo(BigDecimal.valueOf(Long.parseLong(minThree))) > 0) {
|
|
|
+ if (BigDecimal.valueOf(twoMin).compareTo(BigDecimal.valueOf(Long.parseLong(minThree))) > 0) {
|
|
|
throw new BusinessException("阈值填写错误");
|
|
|
}
|
|
|
}
|
|
|
@@ -580,8 +668,8 @@ public class ThresholdService {
|
|
|
|
|
|
}
|
|
|
if (thresholdBeanOne != null) {
|
|
|
- String oneMax = thresholdBeanOne.getMax();//100
|
|
|
- String oneMin = thresholdBeanOne.getMin();//-15
|
|
|
+ String oneMax = String.valueOf(thresholdBeanOne.getMax());//100
|
|
|
+ String oneMin = String.valueOf(thresholdBeanOne.getMin());//-15
|
|
|
if (BigDecimal.valueOf(Long.parseLong(oneMax)).compareTo(BigDecimal.valueOf(Long.parseLong(maxThree))) < 0) {
|
|
|
throw new BusinessException("阈值填写错误");
|
|
|
}
|
|
|
@@ -607,18 +695,18 @@ public class ThresholdService {
|
|
|
for (int i = maxLevel; i > 0; i--) {
|
|
|
ThresholdBean thresholdBean = maps.get(maxLevel);
|
|
|
if (thresholdBean != null) {
|
|
|
- String thresholdBeanMin = thresholdBean.getMin();
|
|
|
+ String thresholdBeanMin = String.valueOf(thresholdBean.getMin());
|
|
|
if (thresholdBeanMin.contains("-")) {
|
|
|
thresholdBeanMin = com.sckw.core.utils.StringUtils.deleteCharString(thresholdBeanMin, "-");
|
|
|
}
|
|
|
ThresholdBean thresholdBean1 = maps.get(i);
|
|
|
if (thresholdBean1 != null) {
|
|
|
- String max = thresholdBean1.getMax();
|
|
|
- String min = thresholdBean1.getMin();
|
|
|
+ String max = String.valueOf(thresholdBean1.getMax());
|
|
|
+ String min = String.valueOf(thresholdBean1.getMin());
|
|
|
if (min.contains("-")) {
|
|
|
min = com.sckw.core.utils.StringUtils.deleteCharString(min, "-");
|
|
|
}
|
|
|
- if (BigDecimal.valueOf(Long.parseLong(max)).compareTo(BigDecimal.valueOf(Long.parseLong(thresholdBean.getMax()))) > 0) {
|
|
|
+ if (BigDecimal.valueOf(Long.parseLong(max)).compareTo(BigDecimal.valueOf(thresholdBean.getMax())) > 0) {
|
|
|
throw new BusinessException("阈值填写错误");
|
|
|
}
|
|
|
if (BigDecimal.valueOf(Long.parseLong(min)).compareTo(BigDecimal.valueOf(Long.parseLong(thresholdBeanMin))) < 0) {
|
|
|
@@ -633,8 +721,8 @@ public class ThresholdService {
|
|
|
int levelMax = level + 1;
|
|
|
int levelMin = level - 1;
|
|
|
if (maps.get(levelMax) != null) {
|
|
|
- String min = value.getMin();
|
|
|
- String max = value.getMax();
|
|
|
+ long min = value.getMin();
|
|
|
+ long max = value.getMax();
|
|
|
}
|
|
|
if (maps.get(levelMin) != null) {
|
|
|
|
|
|
@@ -834,7 +922,7 @@ public class ThresholdService {
|
|
|
//100 全部 0未设置 1 部分设置 2 已设置
|
|
|
String type = param.getType();
|
|
|
if ("100".equals(type)) {
|
|
|
- return getDeviceAll(projectId, headerData,param);
|
|
|
+ return getDeviceAll(projectId, headerData, param);
|
|
|
} else {
|
|
|
List<ProjectThresholdSettingVO> returnList = new ArrayList<>();
|
|
|
List<KwsProjectDevice> selectList = projectDeviceMapper.selectList(new LambdaQueryWrapper<KwsProjectDevice>()
|
|
|
@@ -938,14 +1026,14 @@ public class ThresholdService {
|
|
|
returnList.add(vo);
|
|
|
}
|
|
|
}
|
|
|
- if (!CollectionUtils.isEmpty(returnList)){
|
|
|
+ if (!CollectionUtils.isEmpty(returnList)) {
|
|
|
returnList = returnList.stream().skip((param.getPage() - 1) * param.getPageSize()).limit(param.getPageSize()).collect(Collectors.toList());
|
|
|
}
|
|
|
return HttpResult.ok(returnList);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private HttpResult getDeviceAll(String projectId, HeaderData headerData,ProjectThresholdSettingParam param) {
|
|
|
+ private HttpResult getDeviceAll(String projectId, HeaderData headerData, ProjectThresholdSettingParam param) {
|
|
|
List<ProjectThresholdSettingVO> returnList = new ArrayList<>();
|
|
|
List<KwsProjectDevice> selectList = projectDeviceMapper.selectList(new LambdaQueryWrapper<KwsProjectDevice>()
|
|
|
.eq(KwsProjectDevice::getDelFlag, 0)
|
|
|
@@ -1029,7 +1117,7 @@ public class ThresholdService {
|
|
|
returnData.setPhones(phoneList == null ? null : phoneList.toString());
|
|
|
returnList.add(returnData);
|
|
|
}
|
|
|
- if (!CollectionUtils.isEmpty(returnList)){
|
|
|
+ if (!CollectionUtils.isEmpty(returnList)) {
|
|
|
returnList = returnList.stream().skip((param.getPage() - 1) * param.getPageSize()).limit(param.getPageSize()).collect(Collectors.toList());
|
|
|
}
|
|
|
return HttpResult.ok(returnList);
|