diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ResiCategoryStatsConfigListFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ResiCategoryStatsConfigListFormDTO.java
new file mode 100644
index 0000000000..96401a3029
--- /dev/null
+++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ResiCategoryStatsConfigListFormDTO.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.epmet.dto.form;
+
+import com.epmet.commons.tools.validator.group.UpdateGroup;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+
+/**
+ * 居民类别配置表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-11-04
+ */
+@Data
+public class ResiCategoryStatsConfigListFormDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 是否预警
+ */
+ private Integer isWarn;
+
+ /**
+ * 预警等级
+ */
+ private Integer level;
+
+}
\ No newline at end of file
diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java
index 1e48a9c6f6..ef94b7b4ac 100644
--- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java
+++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java
@@ -19,6 +19,7 @@ package com.epmet.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.annotation.LoginUser;
+import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
@@ -32,6 +33,7 @@ import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.IcResiCategoryWarnConfigDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigSortFormDTO;
+import com.epmet.dto.form.ResiCategoryStatsConfigListFormDTO;
import com.epmet.dto.result.IcResiCategoryStatsConfigResultDTO;
import com.epmet.entity.IcResiCategoryStatsConfigEntity;
import com.epmet.entity.IcResiCategoryWarnConfigEntity;
@@ -73,13 +75,14 @@ public class ResiCategoryStatsConfigController {
* @return
*/
@PostMapping("list")
- public Result> list(@LoginUser TokenDto tokenDTO){
+ public Result> list(@LoginUser TokenDto tokenDTO,@RequestBody ResiCategoryStatsConfigListFormDTO formDTO){
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
- return new Result>().ok(resiCategoryStatsConfigService.list(customerId));
+ return new Result>().ok(resiCategoryStatsConfigService.list(customerId,formDTO));
}
@PostMapping("update")
+ @NoRepeatSubmit
public Result update(@LoginUser TokenDto tokenDTO,@RequestBody IcResiCategoryStatsConfigFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class);
String customerId = tokenDTO.getCustomerId();
diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/ResiCategoryStatsConfigService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/ResiCategoryStatsConfigService.java
index 9f351d91b4..2494953fcb 100644
--- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/ResiCategoryStatsConfigService.java
+++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/ResiCategoryStatsConfigService.java
@@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigSortFormDTO;
+import com.epmet.dto.form.ResiCategoryStatsConfigListFormDTO;
import com.epmet.dto.result.IcResiCategoryStatsConfigResultDTO;
import com.epmet.entity.IcResiCategoryStatsConfigEntity;
@@ -36,7 +37,7 @@ import java.util.Map;
*/
public interface ResiCategoryStatsConfigService {
- List list(String customerId);
+ List list(String customerId, ResiCategoryStatsConfigListFormDTO formDTO);
IcResiCategoryStatsConfigResultDTO info(String id);
diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java
index bfeeaa0b9d..8865e16362 100644
--- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java
+++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java
@@ -9,6 +9,7 @@ import com.epmet.dao.IcResiCategoryWarnConfigDao;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO;
import com.epmet.dto.form.IcResiCategoryStatsConfigSortFormDTO;
+import com.epmet.dto.form.ResiCategoryStatsConfigListFormDTO;
import com.epmet.dto.result.IcResiCategoryStatsConfigResultDTO;
import com.epmet.entity.IcFormItemEntity;
import com.epmet.entity.IcFormItemGroupEntity;
@@ -47,7 +48,7 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
@Override
@Transactional(rollbackFor = Exception.class)
- public List list(String customerId) {
+ public List list(String customerId, ResiCategoryStatsConfigListFormDTO formDTO) {
//1.获取IC_FORM_ITEM 中 用于数据分析字段的 id 和label
List icFormItemEntityList = icFormItemDao.selectList(new QueryWrapper().lambda().eq(IcFormItemEntity::getCustomerId,customerId).eq(IcFormItemEntity::getDataAnalyse, 1));
if(CollectionUtils.isEmpty(icFormItemEntityList)){
@@ -160,7 +161,28 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
result.add(icResiCategoryStatsConfigResultDTO);
});
- return result;
+ if(null == formDTO){
+ return result;
+ }
+ List collect = new ArrayList<>();
+ for (IcResiCategoryStatsConfigResultDTO item:result){
+ String isWarn = String.valueOf(formDTO.getIsWarn());
+ if(null !=formDTO.getIsWarn() && (!item.getWarn().equals(isWarn))){
+ continue;
+ }
+ if(null!=formDTO.getLevel()){
+ if(1==formDTO.getLevel()&&null==item.getLevel1()){
+ continue;
+ }
+ if(2==formDTO.getLevel()&&null==item.getLevel2()){
+ continue;
+ }
+ }
+ collect.add(item);
+
+ }
+
+ return collect;
}
@Override
@@ -198,9 +220,10 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
@Transactional(rollbackFor = Exception.class)
public void update(String customerId,IcResiCategoryStatsConfigFormDTO formDTO) {
IcResiCategoryStatsConfigDTO icResiCategoryStatsConfigDTO = icResiCategoryStatsConfigService.get(formDTO.getId());
- if(null == icResiCategoryStatsConfigDTO){
+ if(null == icResiCategoryStatsConfigDTO || !customerId.equals(icResiCategoryStatsConfigDTO.getCustomerId())){
return ;
}
+
//更新配置类别
IcResiCategoryStatsConfigEntity icResiCategoryStatsConfigEntity = new IcResiCategoryStatsConfigEntity();
BeanUtils.copyProperties(formDTO,icResiCategoryStatsConfigEntity);