Browse Source

配置类别列表过滤

dev_shibei_match
lzh 4 years ago
parent
commit
08e84a5b4f
  1. 48
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/ResiCategoryStatsConfigListFormDTO.java
  2. 7
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java
  3. 3
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/ResiCategoryStatsConfigService.java
  4. 29
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java

48
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
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

7
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<IcResiCategoryStatsConfigResultDTO>> list(@LoginUser TokenDto tokenDTO){
public Result<List<IcResiCategoryStatsConfigResultDTO>> list(@LoginUser TokenDto tokenDTO,@RequestBody ResiCategoryStatsConfigListFormDTO formDTO){
String customerId = tokenDTO.getCustomerId();
// String customerId = "123123";
return new Result<List<IcResiCategoryStatsConfigResultDTO>>().ok(resiCategoryStatsConfigService.list(customerId));
return new Result<List<IcResiCategoryStatsConfigResultDTO>>().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();

3
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<IcResiCategoryStatsConfigResultDTO> list(String customerId);
List<IcResiCategoryStatsConfigResultDTO> list(String customerId, ResiCategoryStatsConfigListFormDTO formDTO);
IcResiCategoryStatsConfigResultDTO info(String id);

29
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<IcResiCategoryStatsConfigResultDTO> list(String customerId) {
public List<IcResiCategoryStatsConfigResultDTO> list(String customerId, ResiCategoryStatsConfigListFormDTO formDTO) {
//1.获取IC_FORM_ITEM 中 用于数据分析字段的 id 和label
List<IcFormItemEntity> icFormItemEntityList = icFormItemDao.selectList(new QueryWrapper<IcFormItemEntity>().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<IcResiCategoryStatsConfigResultDTO> 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);

Loading…
Cancel
Save