|
@ -22,13 +22,22 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.dto.result.OptionResultDTO; |
|
|
import com.epmet.commons.tools.dto.result.OptionResultDTO; |
|
|
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.dao.IcHouseDao; |
|
|
import com.epmet.dao.IcHouseDao; |
|
|
import com.epmet.dto.IcHouseDTO; |
|
|
import com.epmet.dto.IcHouseDTO; |
|
|
|
|
|
import com.epmet.dto.IcResiCategoryStatsConfigDTO; |
|
|
|
|
|
import com.epmet.dto.IcResiUserDTO; |
|
|
import com.epmet.dto.form.HouseFormDTO; |
|
|
import com.epmet.dto.form.HouseFormDTO; |
|
|
|
|
|
import com.epmet.dto.result.HouseListResultDTO; |
|
|
import com.epmet.entity.IcHouseEntity; |
|
|
import com.epmet.entity.IcHouseEntity; |
|
|
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
|
|
|
import com.epmet.feign.OperCustomizeOpenFeignClient; |
|
|
import com.epmet.service.IcHouseService; |
|
|
import com.epmet.service.IcHouseService; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
@ -36,6 +45,7 @@ import org.apache.commons.lang3.StringUtils; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@ -48,6 +58,10 @@ import java.util.stream.Collectors; |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
@Service |
|
|
@Service |
|
|
public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntity> implements IcHouseService { |
|
|
public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntity> implements IcHouseService { |
|
|
|
|
|
@Resource |
|
|
|
|
|
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; |
|
|
|
|
|
@Resource |
|
|
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -147,4 +161,67 @@ public class IcHouseServiceImpl extends BaseServiceImpl<IcHouseDao, IcHouseEntit |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param formDTO |
|
|
|
|
|
* @Description 楼栋下房屋列表 |
|
|
|
|
|
* @Param tokenDto |
|
|
|
|
|
* @Param formDTO |
|
|
|
|
|
* @Return {@link List< HouseListResultDTO >} |
|
|
|
|
|
* @Author zhaoqifeng |
|
|
|
|
|
* @Date 2021/11/5 16:01 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<HouseListResultDTO> getHouseList(TokenDto tokenDto, HouseFormDTO formDTO) { |
|
|
|
|
|
//查询楼栋下房屋列表
|
|
|
|
|
|
LambdaQueryWrapper<IcHouseEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
wrapper.eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId()); |
|
|
|
|
|
wrapper.last("ORDER BY CONVERT ( HOUSE_NAME USING gbk ) ASC"); |
|
|
|
|
|
List<IcHouseEntity> list = baseDao.selectList(wrapper); |
|
|
|
|
|
if(CollectionUtils.isEmpty(list)) { |
|
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
|
} |
|
|
|
|
|
//获取居民分类列表
|
|
|
|
|
|
IcResiCategoryStatsConfigDTO categoryDto = new IcResiCategoryStatsConfigDTO(); |
|
|
|
|
|
categoryDto.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
|
|
Result<List<IcResiCategoryStatsConfigDTO>> categoryResult = operCustomizeOpenFeignClient.getCategoryList(categoryDto); |
|
|
|
|
|
if (!categoryResult.success()) { |
|
|
|
|
|
throw new RenException(categoryResult.getCode(), categoryResult.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
List<IcResiCategoryStatsConfigDTO> categoryList = categoryResult.getData(); |
|
|
|
|
|
//获取居民分类数量统计
|
|
|
|
|
|
IcResiUserDTO userDTO = new IcResiUserDTO(); |
|
|
|
|
|
userDTO.setBuildId(formDTO.getBuildingId()); |
|
|
|
|
|
Result<Map<String, Map<String, Integer>>> resultMap = epmetUserOpenFeignClient.getHomeUserCategoryCount(userDTO); |
|
|
|
|
|
if (!resultMap.success()) { |
|
|
|
|
|
throw new RenException(resultMap.getCode(), resultMap.getMsg()); |
|
|
|
|
|
} |
|
|
|
|
|
Map<String, Map<String, Integer>> map = resultMap.getData(); |
|
|
|
|
|
|
|
|
|
|
|
return list.stream().map(item -> { |
|
|
|
|
|
Map<String, Integer> countMap = map.get(item.getId()); |
|
|
|
|
|
HouseListResultDTO dto = new HouseListResultDTO(); |
|
|
|
|
|
dto.setHouseId(item.getId()); |
|
|
|
|
|
dto.setHouseName(item.getHouseName()); |
|
|
|
|
|
List<HouseListResultDTO.CategoryListBean> categories = new ArrayList<>(); |
|
|
|
|
|
if (null != countMap && CollectionUtils.isNotEmpty(categoryList)) { |
|
|
|
|
|
for (IcResiCategoryStatsConfigDTO category : categoryList) { |
|
|
|
|
|
if (null == countMap.get(category.getColumnName()) || countMap.get(category.getColumnName()) == NumConstant.ZERO) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
HouseListResultDTO.CategoryListBean bean = new HouseListResultDTO.CategoryListBean(); |
|
|
|
|
|
bean.setName(category.getLabel()); |
|
|
|
|
|
bean.setIconUrl(category.getHouseShowIcon()); |
|
|
|
|
|
if ("党员".equals(category.getLabel())) { |
|
|
|
|
|
bean.setIsSpecial(NumConstant.ONE_STR); |
|
|
|
|
|
} else { |
|
|
|
|
|
bean.setIsSpecial(NumConstant.ZERO_STR); |
|
|
|
|
|
} |
|
|
|
|
|
categories.add(bean); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
dto.setCategoryList(categories); |
|
|
|
|
|
return dto; |
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |