| | |
| | | */ |
| | | package org.springblade.modules.house.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.MapKey; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.modules.house.entity.HouseEntity; |
| | | import org.springblade.modules.house.excel.HouseExcel; |
| | | import org.springblade.modules.house.vo.HouseParam; |
| | | import org.springblade.modules.house.vo.HouseTree; |
| | | import org.springblade.modules.house.vo.HouseVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.house.excel.HouseExcel; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | /** |
| | | * 查询房屋树 |
| | | * |
| | | * @param houseParam |
| | | * @param list |
| | | * @return |
| | | */ |
| | | @MapKey(value = "code") |
| | | Map<String, HouseTree> getHouseTree(@Param("houseParam") HouseParam houseParam, |
| | | Map<String, HouseTree> getHouseTree(@Param("houseParam") HouseParam houseParam, |
| | | @Param("list") List<String> list); |
| | | |
| | | Integer getHouseStatisticsOne(String code, Long userId,String aoiCode,String buildingCode,String unitCode); |
| | | Integer getHouseStatisticsTwo(String code, Long userId,String aoiCode,String buildingCode,String unitCode); |
| | | Integer getHouseStatisticsThree(String code, Long userId,String aoiCode,String buildingCode,String unitCode); |
| | | Integer getHouseStatisticsFour(String code, Long userId,String aoiCode,String buildingCode,String unitCode); |
| | | Integer getHouseStatisticsOne(String code, Long userId, String aoiCode, String buildingCode, String unitCode, String roleType); |
| | | |
| | | Integer getHouseStatisticsTwo(String code, Long userId, String aoiCode, String buildingCode, String unitCode, String roleType); |
| | | |
| | | Integer getHouseStatisticsThree(String code, Long userId, String aoiCode, String buildingCode, String unitCode, String roleType); |
| | | |
| | | Integer getHouseStatisticsFour(String code, Long userId, String aoiCode, String buildingCode, String unitCode, String roleType); |
| | | } |
| | |
| | | <if test="aoiCode != null and aoiCode != ''"> |
| | | and jda.aoi_code=#{aoiCode} |
| | | </if> |
| | | <if test="userId != null"> |
| | | <if test="userId != null and roleType == '1'"> |
| | | AND jda.address_code IN ( |
| | | SELECT DISTINCT |
| | | jgr.house_code |
| | |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | </if> |
| | | <if test="userId != null and roleType == '3'"> |
| | | AND jda.address_code IN (SELECT |
| | | jda.address_code |
| | | FROM |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{userId}) |
| | | ) |
| | | </if> |
| | | ) a |
| | | |
| | |
| | | <if test="aoiCode != null and aoiCode != ''"> |
| | | and jda.aoi_code=#{aoiCode} |
| | | </if> |
| | | <if test="userId != null"> |
| | | <if test="userId != null and roleType == '1'"> |
| | | AND jda.address_code IN ( |
| | | SELECT DISTINCT |
| | | jgr.house_code |
| | |
| | | WHERE |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | </if> |
| | | <if test="userId != null and roleType == '3'"> |
| | | AND jda.address_code IN (SELECT |
| | | jda.address_code |
| | | FROM |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{userId}) |
| | | ) |
| | | </if> |
| | | ) a |
| | |
| | | <if test="aoiCode != null and aoiCode != ''"> |
| | | and jda.aoi_code=#{aoiCode} |
| | | </if> |
| | | <if test="userId != null"> |
| | | AND jda.address_code IN ( |
| | | SELECT |
| | | jgr.house_code |
| | | FROM |
| | | jczz_grid jg |
| | | LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id |
| | | WHERE |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | <if test="userId != null and roleType == '1'"> |
| | | AND jda.address_code IN ( |
| | | SELECT DISTINCT |
| | | jgr.house_code |
| | | FROM |
| | | jczz_grid jg |
| | | LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id |
| | | WHERE |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | </if> |
| | | <if test="userId != null and roleType == '3'"> |
| | | AND jda.address_code IN (SELECT |
| | | jda.address_code |
| | | FROM |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{userId}) |
| | | ) |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | <if test="aoiCode != null and aoiCode != ''"> |
| | | and jda.aoi_code=#{aoiCode} |
| | | </if> |
| | | <if test="userId != null"> |
| | | <if test="userId != null and roleType == '1'"> |
| | | AND jda.address_code IN ( |
| | | SELECT DISTINCT |
| | | jgr.house_code |
| | |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | </if> |
| | | <if test="userId != null and roleType == '3'"> |
| | | AND jda.address_code IN (SELECT |
| | | jda.address_code |
| | | FROM |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{userId}) |
| | | ) |
| | | </if> |
| | | ) a |
| | | |
| | | |
| | |
| | | */ |
| | | HouseholdOtherVO getSecurity(@Param("household") HouseholdVO household); |
| | | |
| | | List<Map<String, Object>> getHouseHoldStatistics(String code, Long userId); |
| | | List<Map<String, Object>> getHouseHoldStatistics(String code, Long userId,String roleType); |
| | | |
| | | List<Map<String, Object>> getHouseHoldStatisticsAge(String code, Long userId); |
| | | List<Map<String, Object>> getHouseHoldStatisticsAge(String code, Long userId,String roleType); |
| | | } |
| | |
| | | WHERE |
| | | jda.nei_code = #{code} |
| | | AND jh.is_deleted = 0 |
| | | <if test="userId != null"> |
| | | <if test="userId != null and roleType == '1'"> |
| | | AND jda.address_code IN ( |
| | | SELECT |
| | | jgr.house_code |
| | |
| | | jgm.user_id = #{userId} |
| | | AND jh.house_code = jgr.house_code |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | </if> |
| | | <if test="userId != null and roleType == '3'"> |
| | | AND jda.address_code IN (SELECT |
| | | jda.address_code |
| | | FROM |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{userId}) |
| | | ) |
| | | </if> |
| | | ) a |
| | |
| | | WHERE |
| | | jda.nei_code = #{code} |
| | | AND jh.is_deleted = 0 |
| | | <if test="userId != null"> |
| | | AND jda.address_code IN ( |
| | | SELECT |
| | | distinct jgr.house_code |
| | | FROM |
| | | jczz_grid jg |
| | | LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id |
| | | WHERE |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | <if test="userId != null and roleType == '1'"> |
| | | AND jda.address_code IN ( |
| | | SELECT |
| | | distinct jgr.house_code |
| | | FROM |
| | | jczz_grid jg |
| | | LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id |
| | | LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id |
| | | WHERE |
| | | jgm.user_id = #{userId} |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | </if> |
| | | |
| | | <if test="userId != null and roleType == '3'"> |
| | | AND jda.address_code IN (SELECT |
| | | jda.address_code |
| | | FROM |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{userId}) |
| | | ) |
| | | </if> |
| | | GROUP BY age |
| | | </select> |
| | |
| | | import org.springblade.modules.house.vo.HouseVO; |
| | | import org.springblade.modules.label.entity.LabelEntity; |
| | | import org.springblade.modules.label.service.ILabelService; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @Override |
| | | public Map<String, Object> getHouseStatistics(String code, String roleType,String aoiCode,String buildingCode,String unitCode) { |
| | | Map<String, Object> objectObjectHashMap = new HashMap<>(); |
| | | if (roleType.equals("1")) { |
| | | // result1 查询楼栋数 result2 查询房屋套数 result3 查询住户数 result4 查询单元数 |
| | | Integer result1 = baseMapper.getHouseStatisticsOne(code, AuthUtil.getUserId(),aoiCode,buildingCode,unitCode); |
| | | Integer result2 = baseMapper.getHouseStatisticsTwo(code, AuthUtil.getUserId(),aoiCode,buildingCode,unitCode); |
| | | Integer result3 = baseMapper.getHouseStatisticsThree(code, AuthUtil.getUserId(),aoiCode,buildingCode,unitCode); |
| | | Integer result4 = baseMapper.getHouseStatisticsFour(code, AuthUtil.getUserId(),aoiCode,buildingCode,unitCode); |
| | | if (roleType.equals("2")) { |
| | | // result1 查询楼栋数 result2 查询房屋套数 result3 查询住户数 result4 查询单元数 |
| | | Integer result1 = baseMapper.getHouseStatisticsOne(code, null, aoiCode, buildingCode, unitCode, roleType); |
| | | Integer result2 = baseMapper.getHouseStatisticsTwo(code, null, aoiCode, buildingCode, unitCode, roleType); |
| | | Integer result3 = baseMapper.getHouseStatisticsThree(code, null, aoiCode, buildingCode, unitCode, roleType); |
| | | Integer result4 = baseMapper.getHouseStatisticsFour(code, null, aoiCode, buildingCode, unitCode, roleType); |
| | | objectObjectHashMap.put("result1", result1); |
| | | objectObjectHashMap.put("result2", result2); |
| | | objectObjectHashMap.put("result3", result3); |
| | | objectObjectHashMap.put("result4", result4); |
| | | } else { |
| | | Integer result1 = baseMapper.getHouseStatisticsOne(code, null,aoiCode,buildingCode,unitCode); |
| | | Integer result2 = baseMapper.getHouseStatisticsTwo(code, null,aoiCode,buildingCode,unitCode); |
| | | Integer result3 = baseMapper.getHouseStatisticsThree(code, null,aoiCode,buildingCode,unitCode); |
| | | Integer result4 = baseMapper.getHouseStatisticsFour(code, null,aoiCode,buildingCode,unitCode); |
| | | |
| | | Integer result1 = baseMapper.getHouseStatisticsOne(code, AuthUtil.getUserId(), aoiCode, buildingCode, unitCode, roleType); |
| | | Integer result2 = baseMapper.getHouseStatisticsTwo(code, AuthUtil.getUserId(), aoiCode, buildingCode, unitCode, roleType); |
| | | Integer result3 = baseMapper.getHouseStatisticsThree(code, AuthUtil.getUserId(), aoiCode, buildingCode, unitCode, roleType); |
| | | Integer result4 = baseMapper.getHouseStatisticsFour(code, AuthUtil.getUserId(), aoiCode, buildingCode, unitCode, roleType); |
| | | objectObjectHashMap.put("result1", result1); |
| | | objectObjectHashMap.put("result2", result2); |
| | | objectObjectHashMap.put("result3", result3); |
| | |
| | | @Override |
| | | public Object getHouseHoldStatistics(String code, String roleType) { |
| | | Map<String, Object> objectObjectHashMap = new HashMap<>(); |
| | | if (roleType.equals("1")) { |
| | | List<Map<String, Object>> result = baseMapper.getHouseHoldStatistics(code, AuthUtil.getUserId()); |
| | | List<Map<String, Object>> result1 = baseMapper.getHouseHoldStatisticsAge(code, AuthUtil.getUserId()); |
| | | if (roleType.equals("2")) { |
| | | List<Map<String, Object>> result = baseMapper.getHouseHoldStatistics(code, null, roleType); |
| | | List<Map<String, Object>> result1 = baseMapper.getHouseHoldStatisticsAge(code, null, roleType); |
| | | objectObjectHashMap.put("gender", result); |
| | | objectObjectHashMap.put("age", result1); |
| | | return objectObjectHashMap; |
| | | } else { |
| | | List<Map<String, Object>> result = baseMapper.getHouseHoldStatistics(code, null); |
| | | List<Map<String, Object>> result1 = baseMapper.getHouseHoldStatisticsAge(code, null); |
| | | List<Map<String, Object>> result = baseMapper.getHouseHoldStatistics(code, AuthUtil.getUserId(), roleType); |
| | | List<Map<String, Object>> result1 = baseMapper.getHouseHoldStatisticsAge(code, AuthUtil.getUserId(), roleType); |
| | | objectObjectHashMap.put("gender", result); |
| | | objectObjectHashMap.put("age", result1); |
| | | return objectObjectHashMap; |
| | |
| | | <select id="selectTaskPageBy" resultType="org.springblade.modules.task.vo.TaskVO"> |
| | | |
| | | SELECT |
| | | jt.* , |
| | | jda.address_name |
| | | jt.* , |
| | | jda.address_name |
| | | FROM |
| | | jczz_task jt |
| | | LEFT JOIN jczz_doorplate_address jda ON jt.house_code = jda.address_code |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{task.userId} |
| | | AND jt.report_type = '1' |
| | | jczz_task jt |
| | | LEFT JOIN jczz_doorplate_address jda ON jt.house_code = jda.address_code |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | <where> |
| | | <if test="task.reportType != null and task.reportType != '' and task.reportType == 1"> |
| | | AND jt.report_type = #{task.reportType} |
| | | </if> |
| | | |
| | | <if test="task.reportType == null or task.reportType == ''"> |
| | | AND jt.report_type in (2,3,6) |
| | | </if> |
| | | <if test="task.userId != null and task.userId != ''"> |
| | | AND jc.res_police_user_id = #{task.userId} |
| | | </if> |
| | | </where> |
| | | |
| | | |
| | | </select> |
| | | |
| | | |
| | |
| | | */ |
| | | int updateView(GridmanEntity gridman); |
| | | |
| | | Integer getReportForStatistics(String code, Long userId, Integer status,Integer type); |
| | | Integer getReportForStatistics(String code, Long userId, Integer status, Integer type, String roleType); |
| | | } |
| | |
| | | and jtrfr.type = #{type} |
| | | </if> |
| | | |
| | | <if test="userId != null"> |
| | | AND jda.address_code in ( |
| | | SELECT |
| | | <if test="userId != null and roleType == '1'"> |
| | | AND jda.address_code IN ( |
| | | SELECT DISTINCT |
| | | jgr.house_code |
| | | FROM |
| | | jczz_grid jg |
| | |
| | | AND jg.is_deleted = 0 |
| | | ) |
| | | </if> |
| | | <if test="userId != null and roleType == '3'"> |
| | | AND jda.address_code IN (SELECT |
| | | jda.address_code |
| | | FROM |
| | | jczz_doorplate_address jda |
| | | LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code |
| | | WHERE |
| | | jc.res_police_user_id = #{userId}) |
| | | ) |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | |
| | | @Override |
| | | public Object getReportForStatistics(String code, String roleType) { |
| | | Map<String, Object> objectObjectHashMap = new HashMap<>(); |
| | | if (roleType.equals("1")) { |
| | | Integer result1 = baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), null,null); |
| | | Integer result = baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), 1,null); |
| | | if (roleType.equals("2")) { |
| | | Integer result1 = baseMapper.getReportForStatistics(code, null, null, null, roleType); |
| | | Integer result = baseMapper.getReportForStatistics(code, null, 1, null, roleType); |
| | | objectObjectHashMap.put("result", result1); |
| | | objectObjectHashMap.put("result1", result); |
| | | objectObjectHashMap.put("result2", result1.equals(0) ? 0 : BigDecimal.valueOf(result).divide(BigDecimal.valueOf(result1), 2, BigDecimal.ROUND_HALF_UP)); |
| | | objectObjectHashMap.put("result3", baseMapper.getReportForStatistics(code, null, null, 1, roleType)); |
| | | objectObjectHashMap.put("result4", baseMapper.getReportForStatistics(code, null, null, 2, roleType)); |
| | | objectObjectHashMap.put("result5", baseMapper.getReportForStatistics(code, null, null, 3, roleType)); |
| | | objectObjectHashMap.put("result6", baseMapper.getReportForStatistics(code, null, null, 4, roleType)); |
| | | } else { |
| | | Integer result1 = baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), null, null, roleType); |
| | | Integer result = baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), 1, null, roleType); |
| | | // result 总数 result1 已处理 result2 处理率 result3 公共维修 result4 居家维修 result5 矛盾纠纷 result6 投诉举报 |
| | | objectObjectHashMap.put("result", result1); |
| | | objectObjectHashMap.put("result1", result); |
| | | objectObjectHashMap.put("result2", result1.equals(0) ? 0 : BigDecimal.valueOf(result).divide(BigDecimal.valueOf(result1), 2, BigDecimal.ROUND_HALF_UP)); |
| | | objectObjectHashMap.put("result3", baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), null,1)); |
| | | objectObjectHashMap.put("result4", baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), null,2)); |
| | | objectObjectHashMap.put("result5", baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), null,3)); |
| | | objectObjectHashMap.put("result6", baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), null,4)); |
| | | } else { |
| | | Integer result1 = baseMapper.getReportForStatistics(code, null, null,null); |
| | | Integer result = baseMapper.getReportForStatistics(code, null, 1,null); |
| | | objectObjectHashMap.put("result", result1); |
| | | objectObjectHashMap.put("result1", result); |
| | | objectObjectHashMap.put("result2", result1.equals(0) ? 0 : BigDecimal.valueOf(result).divide(BigDecimal.valueOf(result1), 2, BigDecimal.ROUND_HALF_UP)); |
| | | objectObjectHashMap.put("result3", baseMapper.getReportForStatistics(code,null,null,1)); |
| | | objectObjectHashMap.put("result4", baseMapper.getReportForStatistics(code, null, null,2)); |
| | | objectObjectHashMap.put("result5", baseMapper.getReportForStatistics(code, null, null,3)); |
| | | objectObjectHashMap.put("result6", baseMapper.getReportForStatistics(code, null, null,4)); |
| | | objectObjectHashMap.put("result3", baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), null, 1, roleType)); |
| | | objectObjectHashMap.put("result4", baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), null, 2, roleType)); |
| | | objectObjectHashMap.put("result5", baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), null, 3, roleType)); |
| | | objectObjectHashMap.put("result6", baseMapper.getReportForStatistics(code, AuthUtil.getUserId(), null, 4, roleType)); |
| | | } |
| | | return objectObjectHashMap; |
| | | } |