Merge remote-tracking branch 'origin/master'
| | |
| | | * @return |
| | | */ |
| | | GridVO getGridDetailByHouseCode(@Param("houseCode") String houseCode); |
| | | |
| | | /** |
| | | * 根据用户id(网格员)查询对应的房屋地址code |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<String> getAddressCodeListByUserId(@Param("userId") Long userId); |
| | | } |
| | |
| | | and jgr.house_code = #{houseCode} |
| | | </select> |
| | | |
| | | <!--根据用户id(网格员)查询对应的房屋地址code--> |
| | | <select id="getAddressCodeListByUserId" resultType="java.lang.String"> |
| | | select jgr.house_code from jczz_grid_range jgr |
| | | left join jczz_grid jg on jg.id = jgr.grid_id |
| | | where jg.is_deleted = 0 |
| | | and jg.user_id = #{userId} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | GridVO getGridDetailByHouseCode(String houseCode); |
| | | |
| | | /** |
| | | * 根据用户id(网格员)查询对应的房屋地址code |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<String> getAddressCodeListByUserId(Long userId); |
| | | } |
| | |
| | | public GridVO getGridDetailByHouseCode(String houseCode) { |
| | | return baseMapper.getGridDetailByHouseCode(houseCode); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id(网格员)查询对应的房屋地址code |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<String> getAddressCodeListByUserId(Long userId) { |
| | | return baseMapper.getAddressCodeListByUserId(userId); |
| | | } |
| | | } |
| | |
| | | * @param houseRental |
| | | * @return |
| | | */ |
| | | List<HouseRentalTenantVO> selectHouseRentalPage(IPage page, @Param("vo") HouseRentalTenantVO houseRental); |
| | | List<HouseRentalTenantVO> selectHouseRentalPage(IPage page, |
| | | @Param("vo") HouseRentalTenantVO houseRental, |
| | | @Param("list") List<String> list); |
| | | |
| | | /** |
| | | * 查询房屋出租情况 |
| | |
| | | * 获取统计数据 |
| | | * @return |
| | | */ |
| | | List<HouseRentalStatistics> getStatistics(@Param("vo") HouseRentalTenantVO houseRental); |
| | | List<HouseRentalStatistics> getStatistics(@Param("vo") HouseRentalTenantVO houseRental, |
| | | @Param("list") List<String> list); |
| | | } |
| | |
| | | AND TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )<4 |
| | | </if> |
| | | </if> |
| | | <include refid="filterHouseGrid"/> |
| | | </select> |
| | | |
| | | <!--查询房屋出租情况--> |
| | |
| | | and house_code = #{code} |
| | | </select> |
| | | |
| | | <sql id="filterHouseGrid"> |
| | | <if test="vo.roleName!=null and vo.roleName!=''"> |
| | | <if test="vo.roleName=='网格员'"> |
| | | <choose> |
| | | <when test="list != null and list.size()>0"> |
| | | and jda.address_code in |
| | | <foreach collection="list" item="houseCode" separator ="," open="(" close=")"> |
| | | #{houseCode} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jda.address_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | </if> |
| | | </sql> |
| | | |
| | | <select id="getStatistics" resultType="org.springblade.modules.house.vo.HouseRentalStatistics"> |
| | | SELECT |
| | | 'longTerm' as term,count(1) total,ifnull(sum(num),0) as personNum |
| | | FROM jczz_house_rental jhr |
| | | LEFT JOIN |
| | | ( |
| | | select housing_rental_id,count(*) num from jczz_house_tenant where is_deleted = 0 GROUP BY housing_rental_id |
| | | select housing_rental_id,count(*) num from jczz_house_tenant |
| | | where is_deleted = 0 |
| | | GROUP BY housing_rental_id |
| | | ) jht |
| | | ON jht.housing_rental_id = jhr.id |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jhr.house_code |
| | | WHERE jhr.is_deleted = 0 |
| | | AND TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )>= 8 |
| | | <if test="vo.auditStatus != null and vo.auditStatus != '' or vo.auditStatus == 0 "> |
| | | AND jhr.audit_status = #{vo.auditStatus} |
| | | </if> |
| | | <include refid="filterHouseGrid"/> |
| | | |
| | | UNION ALL |
| | | |
| | |
| | | select housing_rental_id,count(*) num from jczz_house_tenant where is_deleted = 0 GROUP BY housing_rental_id |
| | | ) jht |
| | | ON jht.housing_rental_id = jhr.id |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jhr.house_code |
| | | WHERE jhr.is_deleted = 0 |
| | | AND 4 <= TIMESTAMPDIFF( MONTH, rental_time, due_time ) AND TIMESTAMPDIFF( MONTH, rental_time, due_time )<=8 |
| | | <if test="vo.auditStatus != null and vo.auditStatus != '' or vo.auditStatus == 0 "> |
| | | AND jhr.audit_status = #{vo.auditStatus} |
| | | </if> |
| | | <include refid="filterHouseGrid"/> |
| | | |
| | | UNION ALL |
| | | |
| | |
| | | select housing_rental_id,count(*) num from jczz_house_tenant where is_deleted = 0 GROUP BY housing_rental_id |
| | | ) jht |
| | | ON jht.housing_rental_id = jhr.id |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jhr.house_code |
| | | WHERE jhr.is_deleted = 0 |
| | | AND TIMESTAMPDIFF( MONTH, rental_time, due_time )<4 |
| | | <if test="vo.auditStatus != null and vo.auditStatus != '' or vo.auditStatus == 0 "> |
| | | AND jhr.audit_status = #{vo.auditStatus} |
| | | </if> |
| | | <include refid="filterHouseGrid"/> |
| | | </select> |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.house.entity.HouseRentalEntity; |
| | | import org.springblade.modules.house.entity.HouseTenantEntity; |
| | | import org.springblade.modules.house.service.IHouseTenantService; |
| | |
| | | @Autowired |
| | | private IHouseTenantService houseTenantService; |
| | | |
| | | @Autowired |
| | | private IGridService gridService; |
| | | |
| | | /** |
| | | * 自定义分页查询 |
| | | * @param page |
| | |
| | | */ |
| | | @Override |
| | | public IPage<HouseRentalTenantVO> selectHouseRentalPage(IPage<HouseRentalTenantVO> page, HouseRentalTenantVO houseRental) { |
| | | return page.setRecords(baseMapper.selectHouseRentalPage(page, houseRental)); |
| | | List<String> list = new ArrayList<>(); |
| | | if (null!=houseRental.getRoleName() && !houseRental.getRoleName().equals("")){ |
| | | if (houseRental.getRoleName().equals("网格员")){ |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | return page.setRecords(baseMapper.selectHouseRentalPage(page, houseRental,list)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Object getStatistics(HouseRentalTenantVO houseRental) { |
| | | List<String> list = new ArrayList<>(); |
| | | if (null!=houseRental.getRoleName() && !houseRental.getRoleName().equals("")){ |
| | | if (houseRental.getRoleName().equals("网格员")){ |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | // 查询 |
| | | List<HouseRentalStatistics> statistics = baseMapper.getStatistics(houseRental); |
| | | List<HouseRentalStatistics> statistics = baseMapper.getStatistics(houseRental,list); |
| | | // 返回 |
| | | return statistics; |
| | | } |
| | |
| | | */ |
| | | private Integer dldType; |
| | | |
| | | /** |
| | | * 角色名称 |
| | | */ |
| | | private String roleName; |
| | | |
| | | |
| | | } |
| | |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | | List<PlaceExtVO> selectPlaceExtPage(IPage page,@Param("placeExt") PlaceExtVO placeExt); |
| | | List<PlaceExtVO> selectPlaceExtPage(IPage page, |
| | | @Param("placeExt") PlaceExtVO placeExt, |
| | | @Param("houseCodeList") List<String> houseCodeList); |
| | | |
| | | /** |
| | | * 场所详情表 自定义详情 |
| | |
| | | <if test="placeExt.confirmFlag != null"> |
| | | and jpe.confirm_flag = #{placeExt.confirmFlag} |
| | | </if> |
| | | <if test="placeExt.roleName!=null and placeExt.roleName!=''"> |
| | | <choose> |
| | | <when test="placeExt.roleName=='网格员'"> |
| | | and |
| | | ( |
| | | jp.create_user = #{placeExt.createUser} |
| | | <if test="houseCodeList != null and houseCodeList.size()>0"> |
| | | or jp.house_code in |
| | | <foreach collection="houseCodeList" item="houseCode" separator ="," open="(" close=")"> |
| | | #{houseCode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </when> |
| | | <otherwise> |
| | | and jp.principal_user_id = #{placeExt.createUser} |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | </select> |
| | | |
| | | <!--自定义详情查询--> |
| | |
| | | * |
| | | * @param page |
| | | * @param place |
| | | * @param houseCodeList |
| | | * @return |
| | | */ |
| | | List<PlaceVO> selectPlacePage(IPage page, @Param("place") PlaceVO place); |
| | | List<PlaceVO> selectPlacePage(IPage page, |
| | | @Param("place") PlaceVO place, |
| | | @Param("houseCodeList") List<String> houseCodeList); |
| | | |
| | | /** |
| | | * 查询场所集合信息 |
| | |
| | | ) b on a.id = b.id |
| | | ) jppl on jppl.place_id = jp.id |
| | | where jp.is_deleted = 0 |
| | | <if test="place.roleName!=null and place.roleName!=''"> |
| | | <choose> |
| | | <when test="place.roleName=='网格员'"> |
| | | and |
| | | ( |
| | | jp.create_user = #{place.createUser} |
| | | <if test="houseCodeList != null and houseCodeList.size()>0"> |
| | | or jp.house_code in |
| | | <foreach collection="houseCodeList" item="houseCode" separator ="," open="(" close=")"> |
| | | #{houseCode} |
| | | </foreach> |
| | | </if> |
| | | ) |
| | | </when> |
| | | <otherwise> |
| | | and jp.principal_user_id = #{place.createUser} |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | <if test="place.placeName!=null and place.placeName!=''"> |
| | | and jp.place_name like concat('%',#{place.placeName},'%') |
| | | </if> |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.house.entity.HouseTenantEntity; |
| | | import org.springblade.modules.house.vo.HouseTenantVO; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | |
| | | @Autowired |
| | | private IPlacePractitionerService placePractitionerService; |
| | | |
| | | @Autowired |
| | | private IGridService gridService; |
| | | |
| | | /** |
| | | * 自定义查询 |
| | | * @param page |
| | |
| | | */ |
| | | @Override |
| | | public IPage<PlaceExtVO> selectPlaceExtPage(IPage<PlaceExtVO> page, PlaceExtVO placeExt) { |
| | | return page.setRecords(baseMapper.selectPlaceExtPage(page, placeExt)); |
| | | List<String> list = new ArrayList<>(); |
| | | if (null!=placeExt.getRoleName() && !placeExt.getRoleName().equals("")){ |
| | | if (placeExt.getRoleName().equals("网格员")){ |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | placeExt.setCreateUser(AuthUtil.getUserId()); |
| | | return page.setRecords(baseMapper.selectPlaceExtPage(page, placeExt,list)); |
| | | } |
| | | |
| | | /** |
| | |
| | | taskEntity.setStatus(placeExt.getConfirmFlag()); |
| | | taskEntity.setType(1); |
| | | taskEntity.setFrequency(3); |
| | | taskEntity.setName(placeEntity.getPlaceName() + "信息完善任务" + System.currentTimeMillis()); |
| | | taskEntity.setName(placeEntity.getPlaceName() + "信息完善"); |
| | | // 新增任务 |
| | | boolean save = taskService.save(taskEntity); |
| | | if (save){ |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | @Autowired |
| | | private IGridService gridService; |
| | | |
| | | /** |
| | | * 自定义列表查询 |
| | | * @param page |
| | | * @param place |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<PlaceVO> selectPlacePage(IPage<PlaceVO> page, PlaceVO place) { |
| | | return page.setRecords(baseMapper.selectPlacePage(page, place)); |
| | | List<String> list = new ArrayList<>(); |
| | | if (null!=place.getRoleName() && !place.getRoleName().equals("")){ |
| | | if (place.getRoleName().equals("网格员")){ |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | place.setCreateUser(AuthUtil.getUserId()); |
| | | return page.setRecords(baseMapper.selectPlacePage(page, place,list)); |
| | | } |
| | | |
| | | /** |
| | |
| | | bindUserHandle(placeVO); |
| | | // 新增场所信息 |
| | | boolean save = save(placeVO); |
| | | // 保存场所详情及任务信息 |
| | | savePlaceExtAndTaskInfo(placeVO); |
| | | // 场所标签信息绑定 |
| | | placeLabelBind(placeVO); |
| | | // 返回结果 |
| | |
| | | if (user != null) { |
| | | //如果用户存在,则该用户id绑定场所 |
| | | placeVO.setPrincipalUserId(user.getId()); |
| | | return user; |
| | | } else { |
| | | //如果用户不存在,则新增一个用户 |
| | | newUser.setAccount(placeVO.getPhone()); |
| | |
| | | placeVO.setPrincipalUserId(newUser.getId()); |
| | | //给人员打上场所负责人的标签 |
| | | baseMapper.saveUserLabel(newUser.getId(),1002); |
| | | // 用户插入后同时给场所详情表插入一条该场所信息 |
| | | if (submit){ |
| | | PlaceExtEntity placeExtEntity = new PlaceExtEntity(); |
| | | placeExtEntity.setPlaceId(placeVO.getId()); |
| | | // 判断是否已存在,已存在则不新增 |
| | | QueryWrapper<PlaceExtEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted",0) |
| | | .eq("place_id",placeVO.getId()); |
| | | PlaceExtEntity one = placeExtService.getOne(wrapper); |
| | | if (null == one) { |
| | | //新增 |
| | | placeExtService.savePlaceExt(placeExtEntity); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return newUser; |
| | | } |
| | | |
| | | /** |
| | | * 保存场所详情及任务信息 |
| | | * @param placeVO |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void savePlaceExtAndTaskInfo(PlaceVO placeVO) { |
| | | PlaceExtEntity placeExtEntity = new PlaceExtEntity(); |
| | | placeExtEntity.setPlaceId(placeVO.getId()); |
| | | // 判断是否已存在,已存在则不新增 |
| | | QueryWrapper<PlaceExtEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted",0) |
| | | .eq("place_id",placeVO.getId()); |
| | | PlaceExtEntity one = placeExtService.getOne(wrapper); |
| | | if (null == one) { |
| | | placeExtEntity.setPlaceId(placeVO.getId()); |
| | | //新增 |
| | | placeExtService.savePlaceExt(placeExtEntity); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 历史场所挂接处理-临时 |
| | | * @param place |
| | | * @return |
| | |
| | | private String houseCode; |
| | | |
| | | /** |
| | | * 角色名称 |
| | | */ |
| | | private String roleName; |
| | | |
| | | /** |
| | | * 从业人员 |
| | | */ |
| | | private List<PlacePractitionerEntity> placePractitioner = new ArrayList<>(); |
| | |
| | | private String phone; |
| | | |
| | | /** |
| | | * 角色名称 |
| | | */ |
| | | private String roleName; |
| | | |
| | | /** |
| | | * 采集人姓名 |
| | | */ |
| | | private String createUserName; |
| | |
| | | * @param taskReportForRepairs |
| | | * @return |
| | | */ |
| | | List<TaskReportForRepairsVO> selectTaskReportForRepairsPage(IPage page,@Param("vo") TaskReportForRepairsVO taskReportForRepairs); |
| | | List<TaskReportForRepairsVO> selectTaskReportForRepairsPage(IPage page, |
| | | @Param("vo") TaskReportForRepairsVO taskReportForRepairs, |
| | | @Param("list") List<String> list); |
| | | |
| | | |
| | | /** |
| | |
| | | <if test="vo.confirmFlag != null"> |
| | | AND jtrfr.confirm_flag = #{vo.confirmFlag} |
| | | </if> |
| | | <if test="vo.roleName!=null and vo.roleName!=''"> |
| | | <if test="vo.roleName=='网格员'"> |
| | | <choose> |
| | | <when test="list != null and list.size()>0"> |
| | | and jda.address_code in |
| | | <foreach collection="list" item="houseCode" separator ="," open="(" close=")"> |
| | | #{houseCode} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jda.address_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | </if> |
| | | ORDER BY jtrfr.create_time DESC |
| | | </select> |
| | | |
| | | <!--统计查询,个人--> |
| | | <select id="getStatisticsCount" resultType="org.springblade.modules.task.vo.TaskReportStatistics"> |
| | | SELECT |
| | | COUNT( 1 ) AS total, |
| | |
| | | package org.springblade.modules.task.service.impl; |
| | | |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.task.entity.TaskEntity; |
| | | import org.springblade.modules.task.entity.TaskReportForRepairsEntity; |
| | | import org.springblade.modules.task.service.ITaskService; |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 报事报修任务表 服务实现类 |
| | |
| | | @Autowired |
| | | private ITaskService taskService; |
| | | |
| | | @Autowired |
| | | private IGridService gridService; |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | * |
| | |
| | | */ |
| | | @Override |
| | | public IPage<TaskReportForRepairsVO> selectTaskReportForRepairsPage(IPage<TaskReportForRepairsVO> page, TaskReportForRepairsVO taskReportForRepairs) { |
| | | return page.setRecords(baseMapper.selectTaskReportForRepairsPage(page, taskReportForRepairs)); |
| | | List<String> list = new ArrayList<>(); |
| | | if (null!=taskReportForRepairs.getRoleName() && !taskReportForRepairs.getRoleName().equals("")){ |
| | | if (taskReportForRepairs.getRoleName().equals("网格员")){ |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | return page.setRecords(baseMapper.selectTaskReportForRepairsPage(page, taskReportForRepairs,list)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | private String addressName; |
| | | |
| | | /** |
| | | * 角色名称 |
| | | */ |
| | | private String roleName; |
| | | |
| | | } |