Merge remote-tracking branch 'origin/master'
27 files modified
1 files added
| | |
| | | * 门牌号 |
| | | */ |
| | | @ApiModelProperty(value = "门牌号") |
| | | private Integer doorplateNum; |
| | | private String doorplateNum; |
| | | /** |
| | | * 门牌名称 |
| | | */ |
| | |
| | | <!--根据小区名称查询楼栋/商铺集合--> |
| | | <select id="getBuildingList" resultType="org.springblade.common.node.TreeNode" > |
| | | ( |
| | | select building_code as id,building_name as name,1 as addressType from jczz_doorplate_address |
| | | select building_code as id,ifnull(building_name,'1栋') as name,1 as addressType from jczz_doorplate_address |
| | | where 1=1 |
| | | and aoi_code = #{code} |
| | | and building_code !='' |
| | | and building_name !='' |
| | | and doorplate_type = '户室牌' |
| | | group by building_code,building_name |
| | | order by building_name |
| | |
| | | <select id="getUnitHouseholdList" resultType="org.springblade.modules.doorplateAddress.vo.FuncNode" > |
| | | ( |
| | | select |
| | | jda.unit_code unitCode,jda.floor,jda.house_name as houseNo,jda.address_code addressCode, |
| | | ifnull(jda.unit_name,"未知单元") unitName,jda.unit_code unitCode,jda.floor,jda.house_name as houseNo, |
| | | jda.address_code addressCode, |
| | | jh.name as realName,jh.role_type as roleType,1 as addressType |
| | | from jczz_doorplate_address jda |
| | | left join |
| | |
| | | ) |
| | | union all |
| | | ( |
| | | select address_code as unitCode,doorplate_name as floor,'' as houseNo,address_code as addressCode, |
| | | select '' as unitName,address_code as unitCode,doorplate_name as floor,'' as houseNo,address_code as addressCode, |
| | | '' as realName,'' as roleType,2 as addressType |
| | | from jczz_doorplate_address |
| | | where 1=1 |
| | |
| | | |
| | | <!--根据街路巷编号查询街路巷门牌名称集合--> |
| | | <select id="getDoorplateNameList" resultType="org.springblade.modules.doorplateAddress.vo.FuncNode"> |
| | | select address_code as addressCode,concat(doorplate_num,sub_door_plate_no) as floor from jczz_doorplate_address |
| | | select address_code as addressCode, |
| | | IFNULL(CONCAT(doorplate_num,sub_door_plate_no), IF(doorplate_num IS NULL, sub_door_plate_no, doorplate_num)) as floor |
| | | from jczz_doorplate_address |
| | | where 1=1 |
| | | and street_ru_code = #{code} |
| | | and nei_code = #{name} |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import liquibase.repackaged.org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.hssf.record.DVALRecord; |
| | | import org.jetbrains.annotations.NotNull; |
| | | import org.springblade.common.node.TreeNode; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | List<TreeNode> shopList = new ArrayList<>(); |
| | | // 根据社区名称查询楼栋或者商铺的集合 |
| | | List<TreeNode> list = baseMapper.getBuildingList(houseParam.getName(),houseParam.getCode()); |
| | | // 排序 StringUtils.getDigits(X.getName()) 取出数字排序 |
| | | List<TreeNode> sortList = list.stream().sorted(Comparator.comparing(X -> StringUtils.getDigits(X.getName()))).collect(Collectors.toList()); |
| | | if (list.size()>0){ |
| | | for (TreeNode treeNode : list) { |
| | | for (TreeNode treeNode : sortList) { |
| | | if (treeNode.getAddressType()==1){ |
| | | aoiList.add(treeNode); |
| | | } |
| | |
| | | } |
| | | // 处理,先按单元分组,再按楼层分组 |
| | | if (aoiNodes.size()>0){ |
| | | Map<String, List<FuncNode>> listMap = aoiNodes.stream().collect(Collectors.groupingBy(FuncNode::getFloor)); |
| | | List<FuncNode> funcNodeList = new ArrayList<>(); |
| | | listMap.forEach((s, temps) -> { |
| | | FuncNode funcNode = new FuncNode(); |
| | | funcNode.setFloor(s); |
| | | funcNode.setChildren(temps); |
| | | funcNode.setAddressType(1); |
| | | funcNodeList.add(funcNode); |
| | | }); |
| | | FuncNode funcNode = new FuncNode(); |
| | | funcNode.setUnitName("一单元"); |
| | | funcNode.setChildren(funcNodeList); |
| | | funcNode.setAddressType(1); |
| | | list.add(funcNode); |
| | | // 按单元分组 |
| | | Map<String, List<FuncNode>> listMap = aoiNodes.stream().collect(Collectors.groupingBy(FuncNode::getUnitName)); |
| | | // 单个单元 |
| | | oneUnitHandle(list, listMap); |
| | | // 多个单元 |
| | | moreUnitHandle(list, listMap); |
| | | } |
| | | list.addAll(shopNodes); |
| | | // 返回 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 单个单元处理 |
| | | * @param list |
| | | * @param listMap |
| | | */ |
| | | private void oneUnitHandle(List<FuncNode> list, Map<String, List<FuncNode>> listMap) { |
| | | if (listMap.size()==1){ |
| | | Set<String> keySet = listMap.keySet(); |
| | | // 获取第一个key |
| | | String firstKey = null; |
| | | for (String key : keySet) { |
| | | firstKey = key; |
| | | break; |
| | | } |
| | | if (firstKey.equals("未知单元")){ |
| | | // 取出数据按楼层分组 |
| | | List<FuncNode> unitList = listMap.get(firstKey); |
| | | Map<String, List<FuncNode>> floorListMap = unitList.stream().collect(Collectors.groupingBy(FuncNode::getFloor)); |
| | | List<FuncNode> funcNodeList = new ArrayList<>(); |
| | | floorListMap.forEach((s, temps) -> { |
| | | FuncNode funcNode = new FuncNode(); |
| | | funcNode.setFloor(s); |
| | | funcNode.setChildren(temps); |
| | | funcNode.setAddressType(1); |
| | | funcNodeList.add(funcNode); |
| | | }); |
| | | FuncNode funcNode = new FuncNode(); |
| | | funcNode.setUnitName("一单元"); |
| | | funcNode.setChildren(funcNodeList); |
| | | funcNode.setAddressType(1); |
| | | list.add(funcNode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 多单元处理 |
| | | * @param list |
| | | * @param listMap |
| | | */ |
| | | private void moreUnitHandle(List<FuncNode> list, Map<String, List<FuncNode>> listMap) { |
| | | // 不止一个单元 |
| | | if (listMap.size()>1){ |
| | | List<FuncNode> tempList = new ArrayList<>(); |
| | | // 遍历 |
| | | listMap.forEach((s, temps) -> { |
| | | FuncNode funcNode = new FuncNode(); |
| | | funcNode.setUnitName(s); |
| | | funcNode.setAddressType(1); |
| | | // 按楼层分组 |
| | | Map<String, List<FuncNode>> floorListMap = temps.stream().collect(Collectors.groupingBy(FuncNode::getFloor)); |
| | | List<FuncNode> floorNodeList = new ArrayList<>(); |
| | | floorListMap.forEach((floor, houseList) -> { |
| | | FuncNode floorNode = new FuncNode(); |
| | | floorNode.setFloor(floor); |
| | | floorNode.setChildren(houseList); |
| | | floorNode.setAddressType(1); |
| | | floorNodeList.add(floorNode); |
| | | }); |
| | | funcNode.setChildren(floorNodeList); |
| | | tempList.add(funcNode); |
| | | }); |
| | | // 排序 |
| | | List<FuncNode> sortList = tempList.stream().sorted(Comparator.comparing(X -> X.getUnitName())).collect(Collectors.toList()); |
| | | list.addAll(sortList); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询房屋及出租详情信息 |
| | | * @param code 门牌地址编号 |
| | | * @return |
| | |
| | | */ |
| | | List<GridVO> selectGridPage(IPage page,@Param("grid") GridVO grid); |
| | | |
| | | |
| | | /** |
| | | * 根据地址编号查询网格数据 |
| | | * @param houseCode |
| | | * @return |
| | | */ |
| | | GridVO getGridDetailByHouseCode(@Param("houseCode") String houseCode); |
| | | } |
| | |
| | | select * from jczz_grid where is_deleted = 0 |
| | | </select> |
| | | |
| | | <!--根据地址编号查询网格数据--> |
| | | <select id="getGridDetailByHouseCode" resultType="org.springblade.modules.grid.vo.GridVO"> |
| | | select jg.* from jczz_grid jg |
| | | left join jczz_grid_range jgr on jg.id = jgr.grid_id |
| | | where jg.is_deleted = 0 |
| | | and jgr.house_code = #{houseCode} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | * @param isCovered |
| | | */ |
| | | void importGrid(List<GridExcel> data, Boolean isCovered); |
| | | |
| | | /** |
| | | * 根据地址编号查询网格数据 |
| | | * @param houseCode |
| | | * @return |
| | | */ |
| | | GridVO getGridDetailByHouseCode(String houseCode); |
| | | } |
| | |
| | | // 批量导入 |
| | | saveBatch(list); |
| | | } |
| | | |
| | | /** |
| | | * 根据地址编号查询网格数据 |
| | | * @param houseCode |
| | | * @return |
| | | */ |
| | | @Override |
| | | public GridVO getGridDetailByHouseCode(String houseCode) { |
| | | return baseMapper.getGridDetailByHouseCode(houseCode); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 出租屋 确认 |
| | | * @param houseRental |
| | | * @return |
| | | */ |
| | | @PostMapping("/confirmHouseRental") |
| | | public R confirmHouseRental(@RequestBody HouseRentalVO houseRental) { |
| | | return R.status(houseRentalService.confirmHouseRental(houseRental)); |
| | | } |
| | | |
| | | /** |
| | | * 出租屋 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | |
| | | return R.status(houseRentalService.removeHouseRental(id)); |
| | | } |
| | | |
| | | /** |
| | | * 获取统计数据 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getStatistics") |
| | | public R getStatistics(){ |
| | | return R.data(houseRentalService.getStatistics()); |
| | | public R getStatistics(HouseRentalTenantVO houseRental){ |
| | | return R.data(houseRentalService.getStatistics(houseRental)); |
| | | } |
| | | |
| | | |
| | |
| | | @ApiModelProperty(value = "租房用途 1:仓库 2:办公 3:商用 4:居住") |
| | | private Integer rentalUse; |
| | | /** |
| | | * 审核状态 0: 待审核 1: 审核通过 2: 审核不通过 |
| | | * 审核状态 0: 待确认 1: 已确认 |
| | | */ |
| | | @ApiModelProperty(value = "审核状态 0: 待审核 1: 审核通过 2: 审核不通过") |
| | | @ApiModelProperty(value = "审核状态 0: 待确认 1: 已确认") |
| | | private Integer auditStatus; |
| | | /** |
| | | * 合同附件URL |
| | |
| | | */ |
| | | List<HouseRentalVO> getHouseRentalListByCode(@Param("code") String code); |
| | | |
| | | List<HouseRentalStatistics> getStatistics(); |
| | | /** |
| | | * 获取统计数据 |
| | | * @return |
| | | */ |
| | | List<HouseRentalStatistics> getStatistics(@Param("vo") HouseRentalTenantVO houseRental); |
| | | } |
| | |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | |
| | | <!--自定义列表查询--> |
| | | <select id="selectHouseRentalPage" resultType="org.springblade.modules.house.vo.HouseRentalTenantVO"> |
| | | SELECT jhr.*,jda.address_name as houseName,b.tenantName,b.phone |
| | | FROM jczz_house_rental jhr |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jhr.house_code |
| | | LEFT JOIN ( |
| | | SELECT jht.housing_rental_id,jht.name as tenantName,jht.phone |
| | | FROM jczz_house_tenant jht RIGHT JOIN ( |
| | | SELECT MAX(ID) as id,housing_rental_id |
| | | FROM jczz_house_tenant |
| | | WHERE is_deleted = 0 |
| | | <if test="vo.tenantName != null and vo.tenantName != ''"> |
| | | AND name LIKE CONCAT('%',#{vo.tenantName},'%') |
| | | </if> |
| | | GROUP BY housing_rental_id |
| | | ) a ON a.id = jht.id |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jhr.house_code |
| | | LEFT JOIN ( |
| | | SELECT jht.housing_rental_id,jht.name as tenantName,jht.phone |
| | | FROM jczz_house_tenant jht RIGHT JOIN ( |
| | | SELECT MAX(ID) as id,housing_rental_id |
| | | FROM jczz_house_tenant |
| | | WHERE is_deleted = 0 |
| | | <if test="vo.tenantName != null and vo.tenantName != ''"> |
| | | AND name LIKE CONCAT('%',#{vo.tenantName},'%') |
| | | </if> |
| | | GROUP BY housing_rental_id |
| | | ) a ON a.id = jht.id |
| | | ) b ON b.housing_rental_id = jhr.id |
| | | WHERE jhr.is_deleted = 0 |
| | | <if test="vo.auditStatus != null and vo.auditStatus != '' or vo.auditStatus == 0 "> |
| | | AND jhr.audit_status = #{vo.auditStatus} |
| | | <if test="vo.auditStatus != null and vo.auditStatus != ''"> |
| | | <if test="vo.auditStatus ==0 || vo.auditStatus ==1"> |
| | | AND jhr.audit_status = #{vo.auditStatus} |
| | | </if> |
| | | <if test="vo.auditStatus ==10"> |
| | | AND date_format(jhr.due_time,'%Y-%m-%d')>= date_format(now(),'%Y-%m-%d') |
| | | </if> |
| | | <if test="vo.auditStatus ==20"> |
| | | AND TIMESTAMPDIFF( day, now(), jhr.due_time )<30 |
| | | </if> |
| | | <if test="vo.auditStatus ==30"> |
| | | AND date_format(jhr.due_time,'%Y-%m-%d')< date_format(now(),'%Y-%m-%d') |
| | | </if> |
| | | </if> |
| | | <if test="vo.tenantName != null and vo.tenantName != ''"> |
| | | AND b.tenantName LIKE CONCAT('%',#{vo.tenantName},'%') |
| | | </if> |
| | | <if test="vo.tenantName != null and vo.tenantName != ''"> |
| | | AND b.tenantName LIKE CONCAT('%',#{vo.tenantName},'%') |
| | | </if> |
| | | <if test="vo.dldType != null"> |
| | | <if test="vo.dldType ==1 "> |
| | | AND TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )>= 8 |
| | | </if> |
| | | <if test="vo.dldType ==2 "> |
| | | AND 4 <= TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time ) |
| | | AND TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )<=8 |
| | | </if> |
| | | <if test="vo.dldType ==3 "> |
| | | AND TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )<4 |
| | | </if> |
| | | </if> |
| | | </select> |
| | | |
| | |
| | | |
| | | <select id="getStatistics" resultType="org.springblade.modules.house.vo.HouseRentalStatistics"> |
| | | SELECT |
| | | 'longTerm' AS term,COUNT( 1 ) total,temp.personNum |
| | | FROM( |
| | | SELECT COUNT( 1 ) personNum |
| | | FROM jczz_house_rental jhr |
| | | LEFT JOIN jczz_house_tenant jht ON jht.housing_rental_id = jhr.id |
| | | WHERE |
| | | TIMESTAMPDIFF( MONTH, jhr.rental_time, jhr.due_time )>= 8 |
| | | AND jhr.is_deleted = 0 and jht.is_deleted = 0 |
| | | GROUP BY jht.housing_rental_id |
| | | ) TEMP |
| | | GROUP BY TEMP.personNum |
| | | '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 |
| | | ) jht |
| | | ON jht.housing_rental_id = jhr.id |
| | | 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> |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT 'middleTerm' AS term,COUNT( 1 ) total, temp.personNum |
| | | FROM( |
| | | SELECT COUNT( 1 ) personNum |
| | | FROM jczz_house_rental jhr |
| | | LEFT JOIN jczz_house_tenant jht ON jht.housing_rental_id = jhr.id |
| | | WHERE |
| | | 4 <= TIMESTAMPDIFF( MONTH, rental_time, due_time ) |
| | | AND TIMESTAMPDIFF( MONTH, rental_time, due_time )<=8 |
| | | AND jhr.is_deleted = 0 and jht.is_deleted = 0 |
| | | GROUP BY jht.housing_rental_id |
| | | ) TEMP |
| | | GROUP BY TEMP.personNum |
| | | SELECT 'middleTerm' 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 |
| | | ) jht |
| | | ON jht.housing_rental_id = jhr.id |
| | | 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> |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT 'shortTerm' AS term,COUNT( 1 ) total,temp.personNum |
| | | FROM( |
| | | SELECT COUNT( 1 ) personNum |
| | | FROM jczz_house_rental jhr |
| | | LEFT JOIN jczz_house_tenant jht ON jht.housing_rental_id = jhr.id |
| | | WHERE |
| | | TIMESTAMPDIFF( MONTH, rental_time, due_time )<4 |
| | | AND jhr.is_deleted = 0 and jht.is_deleted = 0 |
| | | GROUP BY jht.housing_rental_id |
| | | ) TEMP |
| | | GROUP BY TEMP.personNum |
| | | SELECT 'shortTerm' 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 |
| | | ) jht |
| | | ON jht.housing_rental_id = jhr.id |
| | | 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> |
| | | </select> |
| | | |
| | | |
| | |
| | | */ |
| | | Boolean updateHouseRental(HouseRentalVO houseRental); |
| | | |
| | | List<HouseRentalStatistics> getStatistics(); |
| | | /** |
| | | * 获取统计数据 |
| | | * @return |
| | | */ |
| | | Object getStatistics(HouseRentalTenantVO houseRental); |
| | | |
| | | /** |
| | | * 出租屋 确认 |
| | | * @param houseRental |
| | | * @return |
| | | */ |
| | | Boolean confirmHouseRental(HouseRentalVO houseRental); |
| | | } |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | return update && addFlag && updateFlag && removeFlag; |
| | | } |
| | | |
| | | /** |
| | | * 获取统计数据 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<HouseRentalStatistics> getStatistics() { |
| | | return baseMapper.getStatistics(); |
| | | public Object getStatistics(HouseRentalTenantVO houseRental) { |
| | | // 查询 |
| | | List<HouseRentalStatistics> statistics = baseMapper.getStatistics(houseRental); |
| | | // 返回 |
| | | return statistics; |
| | | } |
| | | |
| | | /** |
| | | * 出租屋 确认 |
| | | * @param houseRental |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Boolean confirmHouseRental(HouseRentalVO houseRental) { |
| | | // 修改状态 |
| | | houseRental.setUpdateTime(new Date()); |
| | | // 修改 |
| | | return updateById(houseRental); |
| | | } |
| | | } |
| | |
| | | //电话 |
| | | private String phone; |
| | | |
| | | /** |
| | | * 租房时间类型 1:长期 2:中期 3:短期 |
| | | */ |
| | | private Integer dldType; |
| | | |
| | | |
| | | } |
| | |
| | | return R.status(placeService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | /** |
| | | * 历史场所挂接处理-临时 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | @GetMapping("/historyPlaceHandle") |
| | | public R historyPlaceHandle(PlaceVO place) { |
| | | return R.data(placeService.historyPlaceHandle(place)); |
| | | } |
| | | |
| | | /** |
| | | * 历史场所标签挂接处理-场所标签-临时 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | @GetMapping("/historyPlaceLabelHandle") |
| | | public R historyPlaceLabelHandle(PlaceVO place) { |
| | | return R.data(placeService.historyPlaceLabelHandle(place)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 场所表 自定义详情查询 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | @GetMapping("/getDetail") |
| | | public R<PlaceVO> getDetail(PlaceEntity place) { |
| | | return R.data(placeService.getDetail(place)); |
| | | } |
| | | |
| | | } |
| | |
| | | PlaceExtEntity detail = placeExtService.getOne(Condition.getQueryWrapper(placeExt)); |
| | | return R.data(PlaceExtWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 场所详情表 自定义详情 |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | | @GetMapping("/getDetail") |
| | | @ApiOperation(value = "自定义详情", notes = "传入placeExt") |
| | | public R<PlaceExtVO> getDetail(PlaceExtVO placeExt) { |
| | | return R.data(placeExtService.getDetail(placeExt)); |
| | | } |
| | | |
| | | /** |
| | | * 场所详情表 分页 |
| | | */ |
| | |
| | | */ |
| | | List<PlaceExtVO> selectPlaceExtPage(IPage page,@Param("placeExt") PlaceExtVO placeExt); |
| | | |
| | | |
| | | /** |
| | | * 场所详情表 自定义详情 |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | | PlaceExtVO getDetail(@Param("placeExt") PlaceExtVO placeExt); |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.springblade.modules.place.mapper.PlaceExtMapper"> |
| | | |
| | | <resultMap id="detailMap" type="org.springblade.modules.place.vo.PlaceExtVO" autoMapping="true"> |
| | | <id property="id" column="id"/> |
| | | <collection property="placePractitioner" javaType="java.util.List" |
| | | ofType="org.springblade.modules.place.vo.PlacePractitionerVO" autoMapping="true"> |
| | | <id property="id" column="cid"/> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <!--自定义分页查询--> |
| | | <select id="selectPlaceExtPage" resultType="org.springblade.modules.place.vo.PlaceExtVO"> |
| | | select jpe.*,jp.place_name as placeName from jczz_place_ext jpe |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <!--自定义详情查询--> |
| | | <select id="getDetail" resultType="org.springblade.modules.place.vo.PlaceExtVO"> |
| | | select jpe.*,jp.place_name as placeName from jczz_place_ext jpe |
| | | left join jczz_place jp on jpe.place_id = jp.id and jp.is_deleted = 0 |
| | | where jpe.is_deleted = 0 |
| | | and jpe.place_id = #{placeExt.placeId} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | List<TreeNode> selectPlaceNodeList(@Param("userId") String userId); |
| | | |
| | | /** |
| | | * 插入用户标签 |
| | | * @param userId |
| | | * @param labelId |
| | | */ |
| | | int saveUserLabel(@Param("userId") Long userId,@Param("labelId") int labelId); |
| | | |
| | | /** |
| | | * 查询所有的场所(手机号不为空) |
| | | * @return |
| | | */ |
| | | List<PlaceVO> getPlaceNotNullPhone(); |
| | | |
| | | /** |
| | | * 查询所有的场所 |
| | | * @return |
| | | */ |
| | | List<PlaceVO> getAllHistoryPlace(); |
| | | |
| | | /** |
| | | * 更新场所信息 |
| | | * @param place |
| | | */ |
| | | int updatePlaceEntity(@Param("place") PlaceVO place); |
| | | |
| | | /** |
| | | * 查询场所详情数据 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | PlaceVO getDetail(@Param("place") PlaceEntity place); |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="org.springblade.modules.place.mapper.PlaceMapper"> |
| | | |
| | | <!--详情map--> |
| | | <resultMap id="detailMap" type="org.springblade.modules.place.vo.PlaceVO" autoMapping="true"> |
| | | <id property="id" column="id"/> |
| | | <collection property="placePoiLabelVOList" javaType="java.util.List" ofType="org.springblade.modules.place.vo.PlacePoiLabelVO" |
| | | autoMapping="true"> |
| | | <id property="id" column="plid"/> |
| | | </collection> |
| | | </resultMap> |
| | | |
| | | <!--自定义分页查询--> |
| | | <select id="selectPlacePage" resultType="org.springblade.modules.place.vo.PlaceVO"> |
| | | select jp.*,bu.real_name as username,bu.phone as phone from jczz_place jp |
| | |
| | | and principal_user_id = #{userId} |
| | | </select> |
| | | |
| | | |
| | | <!--插入用户标签--> |
| | | <insert id="saveUserLabel"> |
| | | insert into jczz_user_label(user_id,label_id,create_time,update_time) |
| | | values(#{userId},#{labelId},now(),now()) |
| | | </insert> |
| | | |
| | | <!--查询所有的场所(手机号不为空)--> |
| | | <select id="getPlaceNotNullPhone" resultType="org.springblade.modules.place.vo.PlaceVO"> |
| | | select link_person as username,link_tel as phone,std_id as houseCode from wgccp_place |
| | | WHERE link_person !='' and link_tel!='' |
| | | </select> |
| | | |
| | | <!--查询所有的场所--> |
| | | <select id="getAllHistoryPlace" resultType="org.springblade.modules.place.vo.PlaceVO"> |
| | | select place_id as id,third_level_id as label,std_id as houseCode from wgccp_place |
| | | </select> |
| | | |
| | | <!--更新场所信息--> |
| | | <update id="updatePlaceEntity"> |
| | | update jczz_place set principal_user_id = #{place.principalUserId} |
| | | WHERE house_code = #{place.houseCode} |
| | | </update> |
| | | |
| | | <!--查询场所详情数据--> |
| | | <select id="getDetail" resultMap="detailMap"> |
| | | select |
| | | jp.*, |
| | | bu.real_name as username,bu.phone as phone, |
| | | jppl.id as plid,jppl.*,jcl.category_name as labelName |
| | | from jczz_place jp |
| | | left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0 |
| | | left join jczz_place_poi_label jppl on jppl.place_id = jp.id |
| | | left join jczz_category_label jcl on jcl.category_no = jppl.poi_code |
| | | where jp.is_deleted = 0 |
| | | <if test="place.houseCode!=null and place.houseCode!=''"> |
| | | and jp.house_code = #{place.houseCode} |
| | | </if> |
| | | <if test="place.id!=null"> |
| | | and jp.id = #{place.id} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | * @return |
| | | */ |
| | | boolean savePlaceExt(PlaceExtEntity placeExt); |
| | | |
| | | /** |
| | | * 场所详情表 自定义详情 |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | | PlaceExtVO getDetail(PlaceExtVO placeExt); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | Boolean addVO(PlaceVO placeVO); |
| | | |
| | | /** |
| | | * 历史场所挂接处理-临时 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | Object historyPlaceHandle(PlaceVO place); |
| | | |
| | | /** |
| | | * 历史场所标签挂接处理-临时 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | Object historyPlaceLabelHandle(PlaceVO place); |
| | | |
| | | /** |
| | | * 场所表 自定义详情查询 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | PlaceVO getDetail(PlaceEntity place); |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.place.service.impl; |
| | | |
| | | 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.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.entity.PlaceExtEntity; |
| | | import org.springblade.modules.place.entity.PlacePractitionerEntity; |
| | | import org.springblade.modules.place.service.IPlacePractitionerService; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | import org.springblade.modules.place.vo.PlaceExtVO; |
| | | import org.springblade.modules.place.mapper.PlaceExtMapper; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 场所详情表 服务实现类 |
| | |
| | | |
| | | @Autowired |
| | | private IPlaceService placeService; |
| | | |
| | | @Autowired |
| | | private IPlacePractitionerService placePractitionerService; |
| | | |
| | | /** |
| | | * 自定义查询 |
| | |
| | | boolean flag = false; |
| | | // 设置更新时间 |
| | | placeExt.setConfirmTime(new Date()); |
| | | placeExt.setConfirmUserId(AuthUtil.getUserId()); |
| | | // 更新数据 |
| | | boolean b = updateById(placeExt); |
| | | if (b) { |
| | | PlaceExtEntity entity = getById(placeExt.getId()); |
| | | // 更新任务表状态 |
| | | TaskEntity taskEntity = new TaskEntity(); |
| | | taskEntity.setId(placeExt.getTaskId()); |
| | | taskEntity.setId(entity.getTaskId()); |
| | | taskEntity.setStatus(placeExt.getConfirmFlag()); |
| | | flag = taskService.updateById(taskEntity); |
| | | } |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 场所详情表 自定义详情 |
| | | * @param placeExt |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PlaceExtVO getDetail(PlaceExtVO placeExt) { |
| | | PlaceExtVO detail = baseMapper.getDetail(placeExt); |
| | | if (null!=detail) { |
| | | // 查询从业人员信息 |
| | | QueryWrapper<PlacePractitionerEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("place_id", placeExt.getPlaceId()); |
| | | detail.setPlacePractitioner(placePractitionerService.list(queryWrapper)); |
| | | } |
| | | // 返回 |
| | | return detail; |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.place.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.common.node.TreeNode; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | | import org.springblade.modules.doorplateAddress.service.IDoorplateAddressService; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.entity.PlaceExtEntity; |
| | | import org.springblade.modules.place.entity.PlacePoiLabel; |
| | |
| | | |
| | | @Autowired |
| | | private IPlaceExtService placeExtService; |
| | | |
| | | @Autowired |
| | | private IDoorplateAddressService doorplateAddressService; |
| | | |
| | | @Autowired |
| | | private IGridService gridService; |
| | | |
| | | @Override |
| | | public IPage<PlaceVO> selectPlacePage(IPage<PlaceVO> page, PlaceVO place) { |
| | |
| | | * @param placeVO |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void bindUserHandle(PlaceVO placeVO) { |
| | | public User bindUserHandle(PlaceVO placeVO) { |
| | | User newUser = new User(); |
| | | if (null!=placeVO.getPhone() && !placeVO.getPhone().equals("")) { |
| | | //根据手机号查询库里的数据 |
| | | User userParams = new User(); |
| | |
| | | if (user != null) { |
| | | //如果用户存在,则该用户id绑定场所 |
| | | placeVO.setPrincipalUserId(user.getId()); |
| | | return user; |
| | | } else { |
| | | //如果用户不存在,则新增一个用户 |
| | | User newUser = new User(); |
| | | newUser.setAccount(placeVO.getPhone()); |
| | | newUser.setPhone(placeVO.getPhone()); |
| | | newUser.setName(placeVO.getUsername()); |
| | |
| | | //绑定id |
| | | placeVO.setPrincipalUserId(newUser.getId()); |
| | | //给人员打上场所负责人的标签 |
| | | |
| | | baseMapper.saveUserLabel(newUser.getId(),1002); |
| | | // 用户插入后同时给场所详情表插入一条该场所信息 |
| | | if (submit){ |
| | | PlaceExtEntity placeExtEntity = new PlaceExtEntity(); |
| | | placeExtEntity.setPlaceId(placeVO.getId()); |
| | | //新增 |
| | | placeExtService.savePlaceExt(placeExtEntity); |
| | | // 判断是否已存在,已存在则不新增 |
| | | 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 place |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object historyPlaceHandle(PlaceVO place) { |
| | | // 查询所有的场所(手机号不为空) |
| | | List<PlaceVO> list = baseMapper.getPlaceNotNullPhone(); |
| | | // 遍历 |
| | | for (PlaceVO placeVO : list) { |
| | | User user = bindUserHandle(placeVO); |
| | | if (null!=user){ |
| | | placeVO.setPrincipalUserId(user.getId()); |
| | | //更新场所用户id绑定 |
| | | baseMapper.updatePlaceEntity(placeVO); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 历史场所标签挂接处理-临时 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public Object historyPlaceLabelHandle(PlaceVO place) { |
| | | // 查询所有的场所 |
| | | List<PlaceVO> list = baseMapper.getAllHistoryPlace(); |
| | | // 遍历 |
| | | for (PlaceVO placeVO : list) { |
| | | if (null!=placeVO.getLabel()){ |
| | | String[] split = placeVO.getLabel().split(","); |
| | | for (String s : split) { |
| | | PlacePoiLabel placePoiLabel = new PlacePoiLabel(); |
| | | placePoiLabel.setPlaceId(placeVO.getId()); |
| | | placePoiLabel.setPoiCode(Integer.parseInt(s)); |
| | | placePoiLabelService.save(placePoiLabel); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 场所表 自定义详情查询 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PlaceVO getDetail(PlaceEntity place) { |
| | | // 查询场所信息 |
| | | PlaceVO placeVO = baseMapper.getDetail(place); |
| | | if (null!= placeVO) { |
| | | if (null != placeVO.getHouseCode() && !placeVO.getHouseCode().equals("")){ |
| | | place.setHouseCode(placeVO.getHouseCode()); |
| | | } |
| | | // 查询门牌地址信息 |
| | | if (null != place.getHouseCode() && !place.getHouseCode().equals("")) { |
| | | QueryWrapper<DoorplateAddressEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("address_code", place.getHouseCode()); |
| | | List<DoorplateAddressEntity> list = doorplateAddressService.list(wrapper); |
| | | if (list.size() > 0) { |
| | | placeVO.setDoorplateAddressEntity(list.get(0)); |
| | | } |
| | | // 查询网格数据 |
| | | placeVO.setGrid(gridService.getGridDetailByHouseCode(place.getHouseCode())); |
| | | }else { |
| | | // 通过定位点落面分析网格位置,反向推出社区派出所相关数据 |
| | | } |
| | | } |
| | | // 返回 |
| | | return placeVO; |
| | | } |
| | | } |
| | |
| | | import org.springblade.core.tool.node.INode; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.modules.place.entity.PlacePractitionerEntity; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 场所详情表 视图实体类 |
| | |
| | | */ |
| | | private String houseCode; |
| | | |
| | | /** |
| | | * 从业人员 |
| | | */ |
| | | private List<PlacePractitionerEntity> placePractitioner = new ArrayList<>(); |
| | | |
| | | } |
| New file |
| | |
| | | package org.springblade.modules.place.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springblade.modules.place.entity.PlacePoiLabel; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 场所标签中间表 |
| | | */ |
| | | @Data |
| | | public class PlacePoiLabelVO extends PlacePoiLabel { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 标签名称 |
| | | */ |
| | | private String labelName; |
| | | |
| | | } |
| | |
| | | */ |
| | | package org.springblade.modules.place.vo; |
| | | |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | | import org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO; |
| | | import org.springblade.modules.grid.vo.GridVO; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.core.tool.node.INode; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.modules.place.entity.PlacePoiLabel; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 场所表 视图实体类 |
| | |
| | | */ |
| | | private Integer isPerfect; |
| | | |
| | | /** |
| | | * 门牌地址信息 |
| | | */ |
| | | private DoorplateAddressEntity doorplateAddressEntity; |
| | | |
| | | /** |
| | | * 网格数据 |
| | | */ |
| | | private GridVO grid; |
| | | |
| | | /** |
| | | * 场所标签关联表 |
| | | */ |
| | | private List<PlacePoiLabelVO> placePoiLabelVOList = new ArrayList<>(); |
| | | |
| | | |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean checkReportForRepairs(TaskReportForRepairsEntity taskReportForRepairs) { |
| | | boolean flag = false; |
| | | // 设置更新时间 |
| | | taskReportForRepairs.setConfirmTime(new Date()); |
| | | taskReportForRepairs.setConfirmUserId(AuthUtil.getUserId()); |
| | | // 更新数据 |
| | | boolean b = updateById(taskReportForRepairs); |
| | | if (b) { |
| | | TaskReportForRepairsEntity entity = getById(taskReportForRepairs.getId()); |
| | | // 更新任务表状态 |
| | | TaskEntity taskEntity = new TaskEntity(); |
| | | taskEntity.setId(taskReportForRepairs.getTaskId()); |
| | | taskEntity.setId(entity.getTaskId()); |
| | | taskEntity.setStatus(taskReportForRepairs.getConfirmFlag()); |
| | | flag = taskService.updateById(taskEntity); |
| | | } |