| | |
| | | */ |
| | | package org.springblade.modules.house.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.entity.UserHouseLabelEntity; |
| | | import org.springblade.modules.house.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.excel.HouseHoldImporter; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.house.service.IUserHouseLabelService; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | import org.springblade.modules.house.wrapper.HouseholdWrapper; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 住户 自定义分页 |
| | | */ |
| | | @GetMapping("/getKeynotePersonnelPage") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入household") |
| | | public R<IPage<HouseholdVO>> getKeynotePersonnelPage(HouseholdVO household, Query query) { |
| | | IPage<HouseholdVO> pages = householdService.getKeynotePersonnelPage(Condition.getPage(query), household); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 住户列表查询 |
| | | * |
| | | * @param household |
| | | * @return |
| | | */ |
| | |
| | | */ |
| | | 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.Param; |
| | | import org.springblade.common.node.TreeStringNode; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.vo.HouseholdOtherVO; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.house.excel.HouseHoldExcel; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * 查询所有未入库的业主信息 |
| | | * @return |
| | | */ |
| | | List<HouseholdEntity> getNotInsertUserHousehold(); |
| | | List<HouseholdEntity> getNotInsertUserHousehold(); |
| | | |
| | | /** |
| | | * 住户列表查询 |
| | | * |
| | | * @param household |
| | | * @return |
| | | */ |
| | | List<HouseholdVO> selectHouseholdList(@Param("household")HouseholdVO household); |
| | | List<HouseholdVO> selectHouseholdList(@Param("household") HouseholdVO household); |
| | | |
| | | List<HouseholdVO> getKeynotePersonnelPage(IPage<HouseholdVO> page, HouseholdVO household); |
| | | } |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="getKeynotePersonnelPage" resultType="org.springblade.modules.house.vo.HouseholdVO"> |
| | | |
| | | SELECT |
| | | jh.id, |
| | | jh.house_code, |
| | | jh.NAME, |
| | | jh.phone_number, |
| | | jh.associated_user_id, |
| | | jh.role_type, |
| | | jh.associated_user_name, |
| | | jh.relationship, |
| | | jh.is_primary_contact, |
| | | jh.residential_status, |
| | | jh.gender, |
| | | jh.birthday, |
| | | jh.id_card, |
| | | jh.card_type, |
| | | jh.hkmt_pass, |
| | | ifnull( jh.gender, CASE WHEN substring( jh.id_card, 17, 1 )% 2 = 1 THEN 1 ELSE 0 END ) AS gender, |
| | | jh.passport, |
| | | jh.ethnicity, |
| | | jh.education, |
| | | jh.resident_type, |
| | | jh.hukou_registration, |
| | | jh.resident_adcode, |
| | | jh.native_place_adcode, |
| | | jh.religious_belief, |
| | | jh.health_status, |
| | | jh.disease_name, |
| | | jh.work_status, |
| | | jh.employer, |
| | | jh.occupation, |
| | | jh.cmpy_reg_addr, |
| | | jh.go_out_addr, |
| | | jh.go_out_where, |
| | | jh.go_out_time, |
| | | jh.go_out_reason, |
| | | jh.marital_status, |
| | | jh.card_number, |
| | | jh.other_contact, |
| | | IF |
| | | ( jda.id IS NOT NULL, jda.address_name, jh.current_address ) AS current_address, |
| | | jh.disability_cert, |
| | | jh.party_ember, |
| | | jh.remark, |
| | | jh.confirm_flag, |
| | | jh.housing_rental_id, |
| | | IF |
| | | ( jda.id IS NOT NULL, substring( jda.town_street_code, 1, 9 ), jh.home_adcode ) AS home_adcode, |
| | | jhs.district_name aoiName, |
| | | concat( jhs.building, " ", unit, " ", room ) AS address, |
| | | jda.town_street_name AS townStreetName, |
| | | jda.nei_name AS neiName, |
| | | jg.grid_name, |
| | | jhs.building, |
| | | jhs.district_code aoiCode, |
| | | jhs.unit |
| | | FROM |
| | | jczz_household jh |
| | | LEFT JOIN jczz_house jhs ON jh.house_code = jhs.house_code and jhs.is_deleted = 0 |
| | | LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code |
| | | LEFT JOIN jczz_grid_range jgr on jgr.house_code=jda.address_code |
| | | LEFT JOIN jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0 |
| | | <where> |
| | | <if test="household.userId!=null"> |
| | | AND jg.id IN ( SELECT DISTINCT jgm.grid_id FROM jczz_gridman jgm WHERE jgm.user_id = #{household.userId} |
| | | ) |
| | | </if> |
| | | <if test="household.name!=null and household.name !=''"> |
| | | and jh.name like concat('%',#{household.name},'%') |
| | | </if> |
| | | <if test="household.houseCode!=null and household.houseCode !=''"> |
| | | and jh.house_code = #{household.houseCode} |
| | | </if> |
| | | <if test="household.phoneNumber!=null and household.phoneNumber !=''"> |
| | | and jh.phone_number like concat('%',#{household.phoneNumber},'%') |
| | | </if> |
| | | <if test="household.idCard!=null and household.idCard !=''"> |
| | | and jh.id_card like concat('%',#{household.idCard},'%') |
| | | </if> |
| | | <if test="household.aoiName!=null and household.aoiName !=''"> |
| | | and jhs.district_name like concat('%',#{household.aoiName},'%') |
| | | </if> |
| | | <if test="household.confirmFlag != null "> |
| | | and jh.confirm_flag = #{household.confirmFlag} |
| | | </if> |
| | | <if test="household.townStreetName!=null and household.townStreetName!=''"> |
| | | and jda.town_street_name like concat('%',#{household.townStreetName},'%') |
| | | </if> |
| | | <if test="household.neiName!=null and household.neiName!=''"> |
| | | and jda.nei_name like concat('%',#{household.neiName},'%') |
| | | </if> |
| | | <if test="household.housingRentalId != null "> |
| | | and jh.housing_rental_id = #{household.housingRentalId} |
| | | </if> |
| | | <if test="household.startTime != null and household.startTime != '' and household.endTime != null and household.endTime != '' "> |
| | | AND jh.create_time BETWEEN #{household.startTime} and #{household.endTime} |
| | | </if> |
| | | <if test="household.regionCode!=null and household.regionCode!=''"> |
| | | and jg.community_code like concat(#{household.regionCode},'%') |
| | | </if> |
| | | <if test="household.building!=null and household.building!=''"> |
| | | and jhs.building like concat(#{household.building},'%') |
| | | </if> |
| | | <if test="household.unit!=null and household.unit!=''"> |
| | | and jhs.unit like concat(#{household.unit},'%') |
| | | </if> |
| | | <if test="household.aoiCode!=null and household.aoiCode!=''"> |
| | | and jhs.district_code = #{household.aoiCode} |
| | | </if> |
| | | and jh.is_deleted = 0 |
| | | order by jh.create_time desc |
| | | </where> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | */ |
| | | package org.springblade.modules.house.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.common.node.TreeStringNode; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.house.excel.HouseHoldExcel; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | /** |
| | | * 住户 删除 |
| | | */ |
| | | boolean removeHousehold(String ids); |
| | | boolean removeHousehold(String ids); |
| | | |
| | | List<HouseholdVO> getAllHouseHold(HouseholdVO household); |
| | | |
| | | /** |
| | | * 住户列表查询 |
| | | * |
| | | * @param household |
| | | * @return |
| | | */ |
| | | List<HouseholdVO> selectHouseholdList(HouseholdVO household); |
| | | |
| | | IPage<HouseholdVO> getKeynotePersonnelPage(IPage<HouseholdVO> page, HouseholdVO household); |
| | | } |
| | |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.entity.UserHouseLabelEntity; |
| | | import org.springblade.modules.house.excel.HouseHoldExcel; |
| | |
| | | List<HouseholdVO> householdVOS = baseMapper.selectHouseholdList(household); |
| | | // 遍历 |
| | | for (HouseholdVO householdVO : householdVOS) { |
| | | if (householdVO.getHouseholdLabelList().size()>0){ |
| | | if (householdVO.getHouseholdLabelList().size() > 0) { |
| | | List<String> labelNameList = householdVO.getHouseholdLabelList().stream().map(householdLabelVO -> householdLabelVO.getLabelName()) |
| | | .collect(Collectors.toList()); |
| | | householdVO.setLabelName(String.join(",",labelNameList)); |
| | | householdVO.setLabelName(String.join(",", labelNameList)); |
| | | } |
| | | } |
| | | // 返回 |
| | | return householdVOS; |
| | | return householdVOS; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<HouseholdVO> getKeynotePersonnelPage(IPage<HouseholdVO> page, HouseholdVO household) { |
| | | StopWatch stopWatch = new StopWatch(); |
| | | stopWatch.start(); |
| | | // Dept dept = deptService.getById(AuthUtil.getDeptId()); |
| | | // if (null!=dept){ |
| | | // household.setRegionCode(dept.getRegionCode()); |
| | | // } |
| | | List<HouseholdVO> householdVOS = baseMapper.getKeynotePersonnelPage(page, household); |
| | | stopWatch.stop(); |
| | | System.out.println("selectHouseholdPage:" + stopWatch.getTotalTimeMillis()); |
| | | return page.setRecords(householdVOS); |
| | | } |
| | | } |