Browse Source

userwarnlist旧接口改造

dev
zxc 4 years ago
parent
commit
182ae42e4d
  1. 1
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java
  2. 24
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserWarnNameListResultDTO.java
  3. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java
  4. 25
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java
  5. 25
      epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml

1
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java

@ -43,5 +43,6 @@ public class IcStatsResiWarnUserResultDTO implements Serializable {
private String neighborhoodName;
private String buildingName;
private String residentNames;
private List<UserWarnNameListResultDTO> userList;
}

24
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserWarnNameListResultDTO.java

@ -0,0 +1,24 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/1/24 10:25 上午
* @DESC
*/
@Data
public class UserWarnNameListResultDTO implements Serializable {
private static final long serialVersionUID = 6695538440686292540L;
@JsonIgnore
private String buildingId;
private String residentName;
private String userId;
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java

@ -20,6 +20,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcResiCategoryStatsConfigDTO;
import com.epmet.dto.PersonWarnLeftPieDTO;
import com.epmet.dto.result.UserWarnNameListResultDTO;
import com.epmet.entity.IcStatsResiWarnEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -43,6 +44,11 @@ public interface IcStatsResiWarnDao extends BaseDao<IcStatsResiWarnEntity> {
@Param("tableName") String tableName,
@Param("columnName") String columnName);
List<UserWarnNameListResultDTO> userWarnListDTO(@Param("customerId") String customerId,
@Param("buildingIdList") List<String> buildingIdList,
@Param("tableName") String tableName,
@Param("columnName") String columnName);
Integer countListByLevelAndCol(
@Param("customerId") String customerId,
@Param("tableName") String tableName,

25
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java

@ -159,12 +159,25 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService {
IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData();
//根据buildingID,tableName he columnName获取名字
List<Map<String, String>> maps = icStatsResiWarnDao.userWarnList(customerId,buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName());
result.forEach(item->{
item.setConfigId(configId);
List<Map<String, String>> buildingIds = maps.stream().filter(map -> item.getBuildingId().equals(map.get("buildingId"))).collect(Collectors.toList());
item.setResidentNames(CollectionUtils.isEmpty(buildingIds)?"":buildingIds.get(0).get("residentNames"));
});
// List<Map<String, String>> maps = icStatsResiWarnDao.userWarnList(customerId,buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName());
List<UserWarnNameListResultDTO> dtos = icStatsResiWarnDao.userWarnListDTO(customerId, buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName());
// result.forEach(item->{
// item.setConfigId(configId);
// List<Map<String, String>> buildingIds = maps.stream().filter(map -> item.getBuildingId().equals(map.get("buildingId"))).collect(Collectors.toList());
// item.setResidentNames(CollectionUtils.isEmpty(buildingIds)?"":buildingIds.get(0).get("residentNames"));
// });
if (!CollectionUtils.isEmpty(dtos)){
Map<String, List<UserWarnNameListResultDTO>> groupByBuild = dtos.stream().collect(Collectors.groupingBy(UserWarnNameListResultDTO::getBuildingId));
result.forEach(item->{
item.setConfigId(configId);
groupByBuild.forEach((k,v) -> {
if (item.getBuildingId().equals(k)){
item.setUserList(v);
}
});
});
}
return mapResult;
}

25
epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml

@ -147,4 +147,29 @@
)
GROUP BY CONFIG_ID
</select>
<select id="userWarnListDTO" resultType="com.epmet.dto.result.UserWarnNameListResultDTO">
select
BUILD_ID as buildingId,
name as residentName,
ID AS userId
from ic_resi_user
where
BUILD_ID in
<foreach collection="buildingIdList" item="buildingId" open="(" separator="," close=" )">
#{buildingId}
</foreach>
<if test="tableName=='ic_resi_user'">
and ${columnName} = '1'
</if>
<if test="tableName!='ic_resi_user'">
and ID in (
select IC_RESI_USER from ${tableName} where ${columnName} = '1' and CUSTOMER_ID = #{customerId} and DEL_FLAG = '0'
)
</if>
and CUSTOMER_ID = #{customerId}
and DEL_FLAG = '0'
group by ID
</select>
</mapper>
Loading…
Cancel
Save