Browse Source

Merge branch 'develop' of http://git.elinkit.com.cn:7070/r/epmet-cloud into release_temp

master
jianjun 4 years ago
parent
commit
503d44cb20
  1. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
  2. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java
  3. 4
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcResiCategoryWarnConfigDTO.java
  4. 3
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java
  5. 15
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcResiCategoryStatsConfigDao.java
  6. 4
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryWarnConfigEntity.java
  7. 2
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/ResiCategoryStatsConfigService.java
  8. 149
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java
  9. 49
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcResiCategoryStatsConfigDao.xml
  10. 1
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcResiCategoryWarnConfigDao.xml

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java

@ -1238,8 +1238,8 @@ public class DataStatsServiceImpl implements DataStatsService {
List<String> agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId());
if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) {
List<ScreenCustomerAgencyDTO> subAgencies = indexService.getSubAgencyList(formDTO.getAgencyId(), agencyDTO.getAreaCode());
agencyIds = subAgencies.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), agencyDTO.getAreaCode());
agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
}
//2.按日期查询所有下级组织的事件治理指数

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java

@ -321,8 +321,10 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
log.error("extractDaily run exception", e);
}
log.info("===== extractDaily method end customerId:{}======",customerId);
}finally {
lock.unlock();
} catch (Exception e) {
log.error("extractDaily exception msg:{}", e);
} finally {
distributedLock.unLock(lock);
}
}

4
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcResiCategoryWarnConfigDTO.java

@ -57,6 +57,10 @@ public class IcResiCategoryWarnConfigDTO implements Serializable {
* 列名
*/
private String columnName;
/**
* 是否预警 1 0
*/
private String warn;
/**
* 排序

3
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java

@ -124,7 +124,7 @@ public class ResiCategoryStatsConfigController {
@PostMapping("info")
public Result<IcResiCategoryStatsConfigResultDTO> info(@LoginUser TokenDto tokenDTO,@RequestBody IcResiCategoryStatsConfigFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, IcResiCategoryStatsConfigFormDTO.SelectGroup.class);
return new Result<IcResiCategoryStatsConfigResultDTO>().ok(resiCategoryStatsConfigService.info(formDTO.getId()));
return new Result<IcResiCategoryStatsConfigResultDTO>().ok(resiCategoryStatsConfigService.info(formDTO.getId(),tokenDTO.getCustomerId()));
}
@PostMapping("resicategorystatslistshowd")
@ -150,6 +150,7 @@ public class ResiCategoryStatsConfigController {
List<IcResiCategoryWarnConfigEntity> warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper<IcResiCategoryWarnConfigEntity>()
.lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)
.eq(IcResiCategoryWarnConfigEntity::getWarn,"1")
.orderByAsc(IcResiCategoryWarnConfigEntity::getSort));
return new Result<List<IcResiCategoryWarnConfigDTO>>().ok(ConvertUtils.sourceToTarget(warnConfigEntityList, IcResiCategoryWarnConfigDTO.class));

15
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcResiCategoryStatsConfigDao.java

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.IcResiCategoryStatsConfigResultDTO;
import com.epmet.entity.IcResiCategoryStatsConfigEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 居民类别配置表
@ -29,5 +33,14 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcResiCategoryStatsConfigDao extends BaseDao<IcResiCategoryStatsConfigEntity> {
/**
* 获取配置信息
* @param customerId
* @param isWarn
* @param level
*/
List<IcResiCategoryStatsConfigResultDTO> listInfo(@Param("customerId") String customerId, @Param("isWarn") Integer isWarn, @Param("level") Integer level);
IcResiCategoryStatsConfigResultDTO info(@Param("id") String id,@Param("customerId") String customerId);
}

4
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryWarnConfigEntity.java

@ -58,6 +58,10 @@ public class IcResiCategoryWarnConfigEntity extends BaseEpmetEntity {
* 列名
*/
private String columnName;
/**
* 是否预警 1 0
*/
private String warn;
/**
* 排序

2
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/ResiCategoryStatsConfigService.java

@ -39,7 +39,7 @@ public interface ResiCategoryStatsConfigService {
List<IcResiCategoryStatsConfigResultDTO> list(String customerId, ResiCategoryStatsConfigListFormDTO formDTO);
IcResiCategoryStatsConfigResultDTO info(String id);
IcResiCategoryStatsConfigResultDTO info(String id,String customerId);
void update(String customerId,IcResiCategoryStatsConfigFormDTO formDTO);

149
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java

@ -1,6 +1,8 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.constant.IcResiCategoryStatsConfigConstant;
import com.epmet.dao.IcFormItemDao;
import com.epmet.dao.IcFormItemGroupDao;
@ -59,11 +61,13 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
if(!CollectionUtils.isEmpty(groupIds)){
icFormItemGroupEntityList.addAll(icFormItemGroupDao.selectList(new QueryWrapper<IcFormItemGroupEntity>().lambda().eq(IcFormItemGroupEntity::getCustomerId,customerId).in(IcFormItemGroupEntity::getId, groupIds)));
}
//获取tableName和COLUMN_NAME
Map<String,IcFormItemEntity> tableColumnMap = new HashMap<>();
Map<String,String> idTableMap = new HashMap<>();
icFormItemEntityList.forEach(item->{
Map<String,String> map = new HashMap<>();
item.setColumnName(item.getColumnName().concat(NumConstant.ZERO == item.getColumnNum() ? StrConstant.EPMETY_STR : item.getColumnNum().toString()));
if("0".equals(item.getItemGroupId())){
tableColumnMap.put(IcResiCategoryStatsConfigConstant.IC_RESI_USER+"-"+item.getColumnName(),item);
idTableMap.put(item.getId(),IcResiCategoryStatsConfigConstant.IC_RESI_USER);
@ -110,7 +114,22 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
if(!CollectionUtils.isEmpty(newStatsEntityList)){
icResiCategoryStatsConfigService.insertBatch(newStatsEntityList);
}
List<String> newWarnList = tableColumnMap.keySet().stream().filter(item -> !warnTableColumnMap.containsKey(item)).collect(Collectors.toList());
List<IcResiCategoryWarnConfigEntity> newWarnEntityList = new ArrayList<>();
newWarnList.forEach(item->{
IcFormItemEntity icFormItemEntity = tableColumnMap.get(item);
IcResiCategoryWarnConfigEntity entity = new IcResiCategoryWarnConfigEntity();
entity.setCustomerId(customerId);
entity.setLabel(icFormItemEntity.getLabel());
entity.setTableName(idTableMap.get(icFormItemEntity.getId()));
entity.setColumnName(icFormItemEntity.getColumnName());
entity.setWarn("0");
entity.setSort(icFormItemEntity.getSort());
newWarnEntityList.add(entity);
});
if(!CollectionUtils.isEmpty(newWarnEntityList)){
icResiCategoryWarnConfigService.insertBatch(newWarnEntityList);
}
List<String> delStatsEntityIdList = new ArrayList<>();
List<String> delWarnEntityIdList = new ArrayList<>();
//需要删除的
@ -130,90 +149,16 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
}
//4.返回数据
List<IcResiCategoryStatsConfigEntity> statsConfigList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper<IcResiCategoryStatsConfigEntity>().lambda()
.eq(IcResiCategoryStatsConfigEntity::getCustomerId,customerId)
.orderByAsc(IcResiCategoryStatsConfigEntity::getSort));
List<IcResiCategoryWarnConfigEntity> warnConfigList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId));
Map<String,IcResiCategoryWarnConfigEntity> warnMap =new HashMap<>();
warnConfigList.forEach(item->{
warnMap.put(item.getTableName()+"-"+item.getColumnName(),item);
});
List<IcResiCategoryStatsConfigResultDTO> result = new ArrayList<>();
statsConfigList.forEach(item->{
IcResiCategoryStatsConfigResultDTO icResiCategoryStatsConfigResultDTO = new IcResiCategoryStatsConfigResultDTO();
icResiCategoryStatsConfigResultDTO.setId(item.getId());
icResiCategoryStatsConfigResultDTO.setLabel(item.getLabel());
icResiCategoryStatsConfigResultDTO.setManagementIcon(item.getManagementIcon());
icResiCategoryStatsConfigResultDTO.setDataIcon(item.getDataIcon());
icResiCategoryStatsConfigResultDTO.setHouseShowIcon(item.getHouseShowIcon());
icResiCategoryStatsConfigResultDTO.setStatus(item.getStatus());
icResiCategoryStatsConfigResultDTO.setSort(item.getSort());
IcResiCategoryWarnConfigEntity warnConfigEntity = warnMap.get(item.getTableName() + "-" + item.getColumnName());
if(warnConfigEntity==null){
icResiCategoryStatsConfigResultDTO.setWarn(IcResiCategoryStatsConfigConstant.WARN_NO);
}else{
icResiCategoryStatsConfigResultDTO.setWarn(IcResiCategoryStatsConfigConstant.WARN_YES);
icResiCategoryStatsConfigResultDTO.setLevel1(warnConfigEntity.getLevel1());
icResiCategoryStatsConfigResultDTO.setLevel2(warnConfigEntity.getLevel2());
icResiCategoryStatsConfigResultDTO.setLevel3(warnConfigEntity.getLevel3());
}
result.add(icResiCategoryStatsConfigResultDTO);
List<IcResiCategoryStatsConfigResultDTO> result = icResiCategoryStatsConfigDao.listInfo(customerId,formDTO.getIsWarn(),formDTO.getLevel());
});
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;
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
public IcResiCategoryStatsConfigResultDTO info(String id) {
public IcResiCategoryStatsConfigResultDTO info(String id,String customerId) {
IcResiCategoryStatsConfigResultDTO result =new IcResiCategoryStatsConfigResultDTO();
IcResiCategoryStatsConfigDTO icResiCategoryStatsConfigDTO = icResiCategoryStatsConfigService.get(id);
if(null == icResiCategoryStatsConfigDTO){
return result;
}
IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId, icResiCategoryStatsConfigDTO.getCustomerId())
.eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName())
.eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName()));
// IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = Optional.ofNullable(entity).orElse(new IcResiCategoryWarnConfigEntity());
result.setId(icResiCategoryStatsConfigDTO.getId());
result.setLabel(icResiCategoryStatsConfigDTO.getLabel());
result.setManagementIcon(icResiCategoryStatsConfigDTO.getManagementIcon());
result.setDataIcon(icResiCategoryStatsConfigDTO.getDataIcon());
result.setHouseShowIcon(icResiCategoryStatsConfigDTO.getHouseShowIcon());
result.setStatus(icResiCategoryStatsConfigDTO.getStatus());
result.setSort(icResiCategoryStatsConfigDTO.getSort());
result.setWarn(null==icResiCategoryWarnConfigEntity?IcResiCategoryStatsConfigConstant.WARN_NO:IcResiCategoryStatsConfigConstant.WARN_YES);
if(null!=icResiCategoryWarnConfigEntity){
result.setLevel1(icResiCategoryWarnConfigEntity.getLevel1());
result.setLevel2(icResiCategoryWarnConfigEntity.getLevel2());
result.setLevel3(icResiCategoryWarnConfigEntity.getLevel3());
}
return result;
return icResiCategoryStatsConfigDao.info(id,customerId);
}
@Override
@ -231,42 +176,16 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf
icResiCategoryStatsConfigDao.updateById(icResiCategoryStatsConfigEntity);
//更新配置预警
if(IcResiCategoryStatsConfigConstant.WARN_YES.equals(formDTO.getWarn())){
//更新
IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)
.eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName())
.eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName()));
if(null == icResiCategoryWarnConfigEntity){
icResiCategoryWarnConfigEntity = new IcResiCategoryWarnConfigEntity();
icResiCategoryWarnConfigEntity.setCustomerId(customerId);
icResiCategoryWarnConfigEntity.setLabel(icResiCategoryStatsConfigDTO.getLabel());
icResiCategoryWarnConfigEntity.setTableName(icResiCategoryStatsConfigDTO.getTableName());
icResiCategoryWarnConfigEntity.setColumnName(icResiCategoryStatsConfigDTO.getColumnName());
icResiCategoryWarnConfigEntity.setLevel1(formDTO.getLevel1());
icResiCategoryWarnConfigEntity.setLevel2(formDTO.getLevel2());
icResiCategoryWarnConfigEntity.setLevel3(formDTO.getLevel3());
icResiCategoryWarnConfigEntity.setSort(icResiCategoryStatsConfigDTO.getSort());
icResiCategoryWarnConfigDao.insert(icResiCategoryWarnConfigEntity);
}else{
// icResiCategoryWarnConfigEntity.setCustomerId(customerId);
icResiCategoryWarnConfigEntity.setLabel(icResiCategoryStatsConfigDTO.getLabel());
icResiCategoryWarnConfigEntity.setTableName(icResiCategoryStatsConfigDTO.getTableName());
icResiCategoryWarnConfigEntity.setColumnName(icResiCategoryStatsConfigDTO.getColumnName());
icResiCategoryWarnConfigEntity.setLevel1(formDTO.getLevel1());
icResiCategoryWarnConfigEntity.setLevel2(formDTO.getLevel2());
icResiCategoryWarnConfigEntity.setLevel3(formDTO.getLevel3());
icResiCategoryWarnConfigEntity.setSort(icResiCategoryStatsConfigDTO.getSort());
icResiCategoryWarnConfigDao.updateById(icResiCategoryWarnConfigEntity);
}
}else if(IcResiCategoryStatsConfigConstant.WARN_NO.equals(formDTO.getWarn())){
//删除
icResiCategoryWarnConfigDao.delete(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)
.eq(IcResiCategoryWarnConfigEntity::getTableName,icResiCategoryStatsConfigDTO.getTableName())
.eq(IcResiCategoryWarnConfigEntity::getColumnName,icResiCategoryStatsConfigDTO.getColumnName()));
}
//更新
IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper<IcResiCategoryWarnConfigEntity>().lambda()
.eq(IcResiCategoryWarnConfigEntity::getCustomerId,customerId)
.eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName())
.eq(IcResiCategoryWarnConfigEntity::getColumnName, icResiCategoryStatsConfigDTO.getColumnName()));
icResiCategoryWarnConfigEntity.setWarn(formDTO.getWarn());
icResiCategoryWarnConfigEntity.setLevel1(formDTO.getLevel1());
icResiCategoryWarnConfigEntity.setLevel2(formDTO.getLevel2());
icResiCategoryWarnConfigEntity.setLevel3(formDTO.getLevel3());
icResiCategoryWarnConfigDao.updateById(icResiCategoryWarnConfigEntity);
}

49
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcResiCategoryStatsConfigDao.xml

@ -22,5 +22,54 @@
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="listInfo" resultType="com.epmet.dto.result.IcResiCategoryStatsConfigResultDTO">
select
a.ID as id,
a.LABEL as label,
a.MANAGEMENT_ICON as managementIcon,
a.DATA_ICON as dataIcon,
a.HOUSE_SHOW_ICON as houseShowIcon,
a.`STATUS` as status,
a.SORT as sort ,
b.LEVEL_1 as level1,
b.LEVEL_2 as level2,
b.LEVEL_3 as level3,
b.WARN
from
ic_resi_category_stats_config a
left join ic_resi_category_warn_config b on a.TABLE_NAME = b.TABLE_NAME and a.COLUMN_NAME = b.COLUMN_NAME and b.DEL_FLAG =0 and b.CUSTOMER_ID = #{customerId}
where a.DEL_FLAG = 0 and a.CUSTOMER_ID = #{customerId}
<if test="isWarn != null">
AND b.WARN = CONCAT(#{isWarn},'')
</if>
<if test="level != null and level == 1 ">
AND b.LEVEL_1 IS NOT NULL
</if>
<if test="level != null and level == 2 ">
AND b.LEVEL_2 IS NOT NULL
</if>
ORDER BY a.SORT
</select>
<select id="info" resultType="com.epmet.dto.result.IcResiCategoryStatsConfigResultDTO">
select
a.ID as id,
a.LABEL as label,
a.MANAGEMENT_ICON as managementIcon,
a.DATA_ICON as dataIcon,
a.HOUSE_SHOW_ICON as houseShowIcon,
a.`STATUS` as status,
a.SORT as sort ,
b.LEVEL_1 as level1,
b.LEVEL_2 as level2,
b.LEVEL_3 as level3,
b.WARN
from
ic_resi_category_stats_config a
left join ic_resi_category_warn_config b on a.TABLE_NAME = b.TABLE_NAME and a.COLUMN_NAME = b.COLUMN_NAME and b.DEL_FLAG =0 and b.CUSTOMER_ID = #{customerId}
where a.DEL_FLAG = 0 and a.CUSTOMER_ID = #{customerId}
and a.id = #{id}
</select>
</mapper>

1
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcResiCategoryWarnConfigDao.xml

@ -9,6 +9,7 @@
<result property="label" column="LABEL"/>
<result property="tableName" column="TABLE_NAME"/>
<result property="columnName" column="COLUMN_NAME"/>
<result property="warn" column="WARN"/>
<result property="sort" column="SORT"/>
<result property="level1" column="LEVEL_1"/>
<result property="level2" column="LEVEL_2"/>

Loading…
Cancel
Save