Merge remote-tracking branch 'origin/master'
13 files modified
1 files renamed
2 files added
| | |
| | | import org.springblade.core.tool.jackson.JsonUtil; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.excel.ExportHouseholdExcel; |
| | | import org.springblade.modules.house.excel.ImportHouseholdExcel; |
| | | import org.springblade.modules.house.excel.HouseHoldImporter; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | |
| | | @ApiOperationSupport(order = 13) |
| | | @ApiOperation(value = "导出住户", notes = "传入user") |
| | | public void exportUser(HouseholdVO household, HttpServletResponse response) { |
| | | List<ImportHouseholdExcel> list = householdService.export(household); |
| | | ExcelUtil.export(response, "住户户数据" + DateUtil.time(), "住户数据表", list, ImportHouseholdExcel.class); |
| | | List<ExportHouseholdExcel> list = householdService.export(household); |
| | | ExcelUtil.export(response, "住户户数据" + DateUtil.time(), "住户数据表", list, ExportHouseholdExcel.class); |
| | | } |
| | | |
| | | /** |
| New file |
| | |
| | | package org.springblade.modules.house.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import lombok.Data; |
| | | import org.springblade.common.excel.ExcelDictConverter; |
| | | import org.springblade.common.excel.ExcelDictItem; |
| | | import org.springblade.common.excel.ExcelDictItemLabel; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * ExportHouseholdExcel |
| | | * 导出住户信息 |
| | | * @author Chill |
| | | */ |
| | | @Data |
| | | @ColumnWidth(25) |
| | | @HeadRowHeight(20) |
| | | @ContentRowHeight(18) |
| | | public class ExportHouseholdExcel implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 2L; |
| | | |
| | | // /** |
| | | // * 门牌地址编码 |
| | | // */ |
| | | // @ColumnWidth(25) |
| | | // @ExcelProperty( "门牌地址编码") |
| | | // private String houseCode; |
| | | |
| | | /** 姓名 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "姓名*") |
| | | private String name; |
| | | |
| | | /** 性别 1: 男 0:女 2: 未知 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "性别",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "sex") |
| | | @ExcelDictItem(type = "sex") |
| | | private String gender; |
| | | |
| | | |
| | | /** 手机号 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "手机号*") |
| | | private String phoneNumber; |
| | | |
| | | /** 生日 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "生日") |
| | | private String birthday; |
| | | |
| | | /** 身份证 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "身份证号码") |
| | | private String idCard; |
| | | |
| | | /** 其他联系方式 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "其他联系方式") |
| | | private String otherContact; |
| | | |
| | | /** 所属街道 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "所属街道") |
| | | private String townName; |
| | | |
| | | /** 所属社区 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "所属社区") |
| | | private String communityName; |
| | | |
| | | /** 所属网格 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "所属网格") |
| | | private String gridName; |
| | | |
| | | /** 小区名称 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "小区名称") |
| | | private String aoiName; |
| | | |
| | | /** 与业主关系 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "与业主关系*(业主/妻子/丈夫/女儿/儿子/母亲/父亲/.../租户/其他)",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "roleRelation") |
| | | @ExcelDictItem(type = "roleRelation") |
| | | private String relationship; |
| | | |
| | | /** 是否主要联系人 1:是 0:否 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "是否主要联系人",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "primaryContactType") |
| | | @ExcelDictItem(type = "primaryContactType") |
| | | private String isPrimaryContact; |
| | | |
| | | /** 居住状态 1: 是 0:否 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "居住状态",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "residentialStatusType") |
| | | @ExcelDictItem(type = "residentialStatusType") |
| | | private String residentialStatus; |
| | | |
| | | /** 民族 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "民族",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "nationType") |
| | | @ExcelDictItem(type = "nationType") |
| | | private String ethnicity; |
| | | |
| | | |
| | | /** 户籍地址 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "户籍地址") |
| | | private String hukouRegistration; |
| | | |
| | | /** 现居住地址 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "现居住地址") |
| | | private String currentAddress; |
| | | |
| | | /** 是否党员 1:党员 2:群众 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "是否党员(党员/群众)",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "partyEmberType") |
| | | @ExcelDictItem(type = "partyEmberType") |
| | | private String partyEmber; |
| | | |
| | | /** 学历 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "学历",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "educationType") |
| | | @ExcelDictItem(type = "educationType") |
| | | private String education; |
| | | /** |
| | | * 职业类别 |
| | | */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "职业类别") |
| | | private String occupation; |
| | | |
| | | /** 工作单位 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "工作单位") |
| | | private String employer; |
| | | /** |
| | | * 工作单位地址 |
| | | */ |
| | | @ExcelProperty( "工作单位地址") |
| | | private String cmpyRegAddr; |
| | | |
| | | /** 工作状态 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "工作状态(在职/离职/退休/其他)",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "workStatusType") |
| | | @ExcelDictItem(type = "workStatusType") |
| | | private String workStatus; |
| | | |
| | | |
| | | /** 婚姻状态 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "婚姻状态(未婚/已婚/离异/丧偶/其他)",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "marriageStatusType") |
| | | @ExcelDictItem(type = "marriageStatusType") |
| | | private String maritalStatus; |
| | | /** |
| | | * 宗教信仰 |
| | | */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "宗教信仰") |
| | | private String religiousBelief; |
| | | /** |
| | | * 健康状况 业务字典 healthStatus |
| | | */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( value = "健康状况(健康/良好/较差)",converter = ExcelDictConverter.class) |
| | | @ExcelDictItemLabel(type = "healthStatus") |
| | | @ExcelDictItem(type = "healthStatus") |
| | | private String healthStatus; |
| | | /** |
| | | * 疾病名称 |
| | | */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "疾病名称") |
| | | private String diseaseName; |
| | | /** |
| | | * 外出去向 |
| | | */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "外出去向") |
| | | private String goOutWhere; |
| | | /** |
| | | * 外出原因 |
| | | */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "外出原因") |
| | | private String goOutReason; |
| | | /** |
| | | * 外出时间 |
| | | */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "外出时间") |
| | | private String goOutTime; |
| | | |
| | | /** |
| | | * 外出详址 |
| | | */ |
| | | @ExcelProperty( "外出详址") |
| | | private String goOutAddr; |
| | | |
| | | /** 车牌号 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "车牌号") |
| | | private String cardNumber; |
| | | /** |
| | | * 自愿者组织 |
| | | */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "自愿者组织") |
| | | private String volunteerOrg; |
| | | |
| | | /** 备注 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "备注") |
| | | private String remark; |
| | | |
| | | /** 备注 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "标签") |
| | | private String labelName; |
| | | |
| | | } |
| | | |
| | |
| | | * 门牌地址编码 |
| | | */ |
| | | @ColumnWidth(25) |
| | | @ExcelProperty( "门牌地址编码") |
| | | @ExcelProperty( "门牌地址编码*") |
| | | private String houseCode; |
| | | |
| | | /** 姓名 */ |
| | |
| | | import org.springblade.common.node.TreeIntegerNode; |
| | | import org.springblade.common.node.TreeStringNode; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.excel.ExportHouseholdExcel; |
| | | import org.springblade.modules.house.excel.ImportHouseholdExcel; |
| | | import org.springblade.modules.house.vo.HouseholdOtherVO; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | |
| | | HouseholdVO getHouseholdListById(@Param("household") HouseholdEntity household); |
| | | |
| | | /** |
| | | * 导出 |
| | | * 导出住户信息 |
| | | * |
| | | * @param household |
| | | * @return |
| | | */ |
| | | List<ImportHouseholdExcel> export(@Param("household") HouseholdVO household); |
| | | List<ExportHouseholdExcel> export(@Param("household") HouseholdVO household, |
| | | @Param("isAdministrator") Integer isAdministrator, |
| | | @Param("regionChildCodesList") List<String> regionChildCodesList, |
| | | @Param("gridCodeList") List<String> gridCodeList); |
| | | |
| | | Integer statistics(@Param("household") HouseholdVO household, |
| | | @Param("isAdministrator") Integer isAdministrator, |
| | |
| | | </select> |
| | | |
| | | <!--导出数据--> |
| | | <select id="export" resultType="org.springblade.modules.house.excel.ImportHouseholdExcel"> |
| | | select |
| | | jh.house_code houseCode, |
| | | jh.name,jh.phone_number phoneNumber,jh.role_type roleType,jh.relationship relationship, |
| | | jh.is_primary_contact isPrimaryContact,jh.residential_status residentialStatus,jh.gender, |
| | | jh.birthday,jh.id_card idCard,jh.ethnicity,jh.education, |
| | | jh.hukou_registration hukouRegistration,jh.work_status workStatus,jh.employer,jh.marital_status maritalStatus, |
| | | jh.card_number cardNumber,jh.other_contact otherContact,jh.current_address currentAddress,jh.volunteer_org, |
| | | jh.disability_cert disabilityCert,jh.party_ember partyEmber,jh.remark, |
| | | <select id="export" resultType="org.springblade.modules.house.excel.ExportHouseholdExcel"> |
| | | SELECT |
| | | jh.id, |
| | | jh.house_code, |
| | | jh.NAME, |
| | | jh.phone_number, |
| | | jh.relationship, |
| | | jh.is_primary_contact, |
| | | jh.residential_status, |
| | | jh.birthday, |
| | | jh.id_card, |
| | | jh.card_type, |
| | | ifnull( jh.gender, CASE WHEN substring( jh.id_card, 17, 1 )% 2 = 1 THEN 1 ELSE 0 END ) AS gender, |
| | | 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, |
| | | jhs.district_name aoiName, |
| | | concat(jhs.building," ",unit," ",room) as address |
| | | from |
| | | jczz_household jh join jczz_house jhs on jh.house_code = jhs.house_code and jhs.is_deleted = 0 |
| | | where jh.is_deleted = 0 |
| | | <if test="household.name!=null and household.name !=''"> |
| | | and jh.name like concat('%',#{household.name},'%') |
| | | </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> |
| | | jda.town_street_name AS townName, |
| | | jda.nei_name AS communityName, |
| | | jg.grid_name, |
| | | jhs.building, |
| | | jh.volunteer_org, |
| | | case |
| | | when TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) < 18 then 2 |
| | | when TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) >= 18 then 1 |
| | | end as minors, |
| | | jhs.unit, |
| | | juhl.label_name |
| | | 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 jg on jg.grid_code = jhs.grid_code and jg.is_deleted = 0 |
| | | LEFT JOIN jczz_police_affairs_grid jpag on jhs.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0 |
| | | LEFT JOIN ( |
| | | select household_id,GROUP_CONCAT(label_name) as label_name from jczz_user_house_label where lable_type = 1 and household_id is not null GROUP BY household_id |
| | | ) juhl on juhl.household_id = jh.id |
| | | <where> |
| | | <if test="household.labelIdList !=null and household.labelIdList.size() >0 "> |
| | | EXISTS ( |
| | | SELECT |
| | | * |
| | | FROM |
| | | jczz_user_house_label juhl |
| | | LEFT JOIN jczz_label jl ON juhl.label_id = jl.id |
| | | where juhl.household_id = jh.id |
| | | and juhl.lable_type = 1 |
| | | AND juhl.household_id IS NOT NULL |
| | | AND jl.id in |
| | | <foreach collection="household.labelIdList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | <if test="household.userId!=null"> |
| | | AND jg.grid_code IN ( SELECT DISTINCT jgm.grid_code FROM jczz_gridman jgm WHERE jgm.user_id = |
| | | #{household.userId} |
| | | ) |
| | | </if> |
| | | |
| | | <if test="household.searchKey!=null and household.searchKey!=''"> |
| | | and CONCAT(jh.name,jh.phone_number) like CONCAT ('%', #{household.searchKey},'%') |
| | | </if> |
| | | |
| | | <if test="household.name!=null and household.name !=''"> |
| | | and jh.name like concat('%',#{household.name},'%') |
| | | </if> |
| | | <if test="household.volunteerOrg != null and household.volunteerOrg != ''"> |
| | | and jh.volunteer_org like concat('%',#{household.volunteerOrg},'%') |
| | | </if> |
| | | <if test="household.houseCode!=null and household.houseCode !=''"> |
| | | and jh.house_code = #{household.houseCode} |
| | | </if> |
| | | |
| | | <if test="household.communityCode!=null and household.communityCode !=''"> |
| | | and jg.community_code = #{household.communityCode} |
| | | </if> |
| | | <!-- 等于18 就是租户 --> |
| | | <if test="household.relationship!=null and household.relationship == 18"> |
| | | and jh.relationship = #{household.relationship} |
| | | |
| | | <if test="household.minors!=null and household.minors ==2"> |
| | | and TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) < 18 |
| | | </if> |
| | | <if test="household.minors!=null and household.minors ==1"> |
| | | and TIMESTAMPDIFF(year, substring(jh.id_card, 7, 8), now()) >= 18 |
| | | </if> |
| | | </if> |
| | | <!-- 不等于18 就是非租户 --> |
| | | <if test="household.relationship!=null and household.relationship != 18"> |
| | | and jh.relationship != #{household.relationship} |
| | | </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="isAdministrator==2"> |
| | | <choose> |
| | | <when test="household.roleName != null and household.roleName != ''"> |
| | | <if test="household.roleName=='wgy'"> |
| | | <choose> |
| | | <when test="gridCodeList !=null and gridCodeList.size()>0"> |
| | | and jhs.grid_code in |
| | | <foreach collection="gridCodeList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jhs.grid_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | <if test="household.roleName=='mj'"> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" |
| | | separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jpag.community_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | </when> |
| | | <otherwise> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and |
| | | ( |
| | | jg.grid_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | or |
| | | jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | ) |
| | | </when> |
| | | <otherwise> |
| | | |
| | | </otherwise> |
| | | </choose> |
| | | </otherwise> |
| | | </choose> |
| | | </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 |
| | | </where> |
| | | order by jh.create_time desc |
| | | limit 0,10000 |
| | | </select> |
| | | |
| | | |
| | |
| | | import org.springblade.common.node.TreeIntegerNode; |
| | | import org.springblade.common.node.TreeStringNode; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.excel.ExportHouseholdExcel; |
| | | import org.springblade.modules.house.excel.ImportHouseholdExcel; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | |
| | |
| | | */ |
| | | Object getDetail(HouseholdEntity household); |
| | | |
| | | List<ImportHouseholdExcel> export(HouseholdVO household); |
| | | /** |
| | | * 导出住户信息 |
| | | * @param household |
| | | * @return |
| | | */ |
| | | List<ExportHouseholdExcel> export(HouseholdVO household); |
| | | |
| | | String importUserHouseHold(List<ImportHouseholdExcel> data, Boolean isCovered); |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xxl.job.core.server.EmbedServer; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.param.CommonParamSet; |
| | | import org.springblade.common.utils.IdUtils; |
| | | import org.springblade.common.utils.NodeTreeUtil; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | |
| | | import org.springblade.modules.label.entity.LabelEntity; |
| | | import org.springblade.modules.label.service.ILabelService; |
| | | import org.springblade.modules.label.vo.LabelVO; |
| | | import org.springblade.modules.place.excel.PlaceExcel; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.police.entity.PoliceAffairsGridEntity; |
| | | import org.springblade.modules.police.service.IPoliceAffairsGridService; |
| | | import org.springblade.modules.system.entity.Region; |
| | |
| | | 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.ExportHouseholdExcel; |
| | | import org.springblade.modules.house.excel.ImportHouseholdExcel; |
| | | import org.springblade.modules.house.mapper.HouseholdMapper; |
| | | import org.springblade.modules.house.service.IHouseService; |
| | |
| | | return baseMapper.getHouseholdListById(household); |
| | | } |
| | | |
| | | /** |
| | | * 导出住户信息 |
| | | * @param household |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ImportHouseholdExcel> export(HouseholdVO household) { |
| | | List<ImportHouseholdExcel> userHouseHoldExcels = baseMapper.export(household); |
| | | public List<ExportHouseholdExcel> export(HouseholdVO household) { |
| | | CommonParamSet commonParamSet = new CommonParamSet().invoke(HouseholdVO.class, household); |
| | | // 重点人员与关注人员 |
| | | if (Objects.nonNull(household.getLabelType())) { |
| | | extracted(household); |
| | | } |
| | | List<ExportHouseholdExcel> userHouseHoldExcels = baseMapper.export(household, |
| | | commonParamSet.getIsAdministrator(), |
| | | commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getGridCodeList() |
| | | ); |
| | | return userHouseHoldExcels; |
| | | } |
| | | |
| | |
| | | for (ImportHouseholdExcel houseHoldExcel : data) { |
| | | HouseholdEntity householdEntity = Objects.requireNonNull(BeanUtil.copy(houseHoldExcel, HouseholdEntity.class)); |
| | | // 判断姓名,手机号 |
| | | if (Strings.isBlank(householdEntity.getName()) || Strings.isBlank(householdEntity.getPhoneNumber())){ |
| | | if (Strings.isBlank(householdEntity.getName()) |
| | | || Strings.isBlank(householdEntity.getPhoneNumber()) |
| | | || Strings.isBlank(householdEntity.getHouseCode()) |
| | | ){ |
| | | errorNum ++; |
| | | continue; |
| | | } |
| | |
| | | } |
| | | StringBuilder builder = new StringBuilder("导入完成!"); |
| | | builder.append("其中本次表格共有 ").append(totalNum).append(" 条数据,") |
| | | .append("成功导入 ").append(importNum).append(" 条数据,") |
| | | .append("其中有 ").append(updateNum).append(" 条数据已存在。"); |
| | | .append("成功导入 ").append(importNum).append(" 条数据。"); |
| | | if (updateNum>0) { |
| | | builder.append("其中有 ").append(updateNum).append(" 条数据已存在。"); |
| | | } |
| | | if (errorNum>0){ |
| | | builder.append("共有 ").append(errorNum).append(" 条数据由于无姓名或手机号信息未导入!"); |
| | | builder.append("共有 ").append(errorNum).append(" 条数据由于无姓名或手机号或门牌地址编码信息未导入!"); |
| | | } |
| | | return builder.toString(); |
| | | } |
| | |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/import-place") |
| | | public R importPlace(MultipartFile file, Integer isCovered) { |
| | | PlaceImporter placeImporter = new PlaceImporter(placeService, isCovered == 1); |
| | | ExcelUtil.save(file, placeImporter, PlaceExcel.class); |
| | | return R.success("操作成功"); |
| | | String data = placeService.importPlace(ExcelUtil.read(file, ImportPlaceExcel.class),isCovered==1); |
| | | return R.data(200,data,""); |
| | | } |
| | | |
| | | /** |
| | | * 导出场所信息 |
| | | */ |
| | | @GetMapping("export-place") |
| | | @ApiOperationSupport(order = 13) |
| | | @ApiLog("导出场所信息") |
| | | @ApiOperation(value = "导出场所信息", notes = "传入place") |
| | | public void exportPlace(PlaceVO place, HttpServletResponse response) { |
| | | List<ExportPlaceExcel> list = placeService.exportPlaceList(place); |
| | | ExcelUtil.export(response, "场所数据管理" + DateUtil.time(), "场所数据表", list, ExportPlaceExcel.class); |
| | | } |
| | | |
| | | /** |
| | | * 导出模板 |
| | | */ |
| | | @GetMapping("export-template") |
| | | @ApiOperationSupport(order = 13) |
| | | @ApiLog("导出九小统计") |
| | | @ApiOperation(value = "导出九小统计", notes = "传入place") |
| | | public void exportTemplate(HttpServletResponse response) { |
| | | List<ImportPlaceExcel> list = new ArrayList<>(); |
| | | ImportPlaceExcel importPlaceExcel = new ImportPlaceExcel(); |
| | | importPlaceExcel.setHouseCode("AdiEQ41254122****SXFDK44"); |
| | | importPlaceExcel.setLocation("江西上饶**********"); |
| | | importPlaceExcel.setLng("128.754451241"); |
| | | importPlaceExcel.setLat("28.4521122441"); |
| | | importPlaceExcel.setStreetName("西市街道"); |
| | | importPlaceExcel.setCommunityName("万达社区"); |
| | | importPlaceExcel.setGridName("第一网格"); |
| | | importPlaceExcel.setPlaceName("***场所"); |
| | | importPlaceExcel.setPrincipal("张三"); |
| | | importPlaceExcel.setPrincipalPhone("13112341234"); |
| | | importPlaceExcel.setPrincipalIdCard("360***********0001"); |
| | | importPlaceExcel.setLegalPerson("张三"); |
| | | importPlaceExcel.setLegalTel("13112341234"); |
| | | importPlaceExcel.setLegalIdCard("360***********0001"); |
| | | importPlaceExcel.setNineType("1"); |
| | | importPlaceExcel.setFrontType("1"); |
| | | importPlaceExcel.setThreeFireProtection("是"); |
| | | importPlaceExcel.setNoExplosionCategory("2"); |
| | | importPlaceExcel.setLabelCode("131120"); |
| | | importPlaceExcel.setRemark("测试****"); |
| | | |
| | | list.add(importPlaceExcel); |
| | | ExcelUtil.export(response, "场所数据" + DateUtil.time(), "场所数据表", list, ImportPlaceExcel.class); |
| | | } |
| | | |
| | | /** |
| New file |
| | |
| | | package org.springblade.modules.place.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import lombok.Data; |
| | | import org.springblade.common.excel.ExcelDictConverter; |
| | | import org.springblade.common.excel.ExcelDictItem; |
| | | import org.springblade.common.excel.ExcelDictItemLabel; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * ExportPlaceExcel |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Data |
| | | @ColumnWidth(25) |
| | | @HeadRowHeight(20) |
| | | @ContentRowHeight(18) |
| | | public class ExportPlaceExcel implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 2L; |
| | | |
| | | /** 场所名称 */ |
| | | @ColumnWidth(25) |
| | | @ExcelProperty( "场所名称*") |
| | | private String placeName; |
| | | |
| | | /** 场所负责人 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "场所负责人") |
| | | private String principal; |
| | | |
| | | /** 场所负责人联系电话 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "场所负责人联系电话") |
| | | private String principalPhone; |
| | | |
| | | /** 场所负责人身份证号 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "场所负责人身份证号") |
| | | private String principalIdCard; |
| | | |
| | | /** 地址 */ |
| | | @ColumnWidth(25) |
| | | @ExcelProperty( "地址") |
| | | private String location; |
| | | |
| | | /** 经度 */ |
| | | @ColumnWidth(25) |
| | | @ExcelProperty( "经度") |
| | | private String lng; |
| | | |
| | | /** 纬度 */ |
| | | @ColumnWidth(25) |
| | | @ExcelProperty( "纬度") |
| | | private String lat; |
| | | |
| | | /** 街道名称 */ |
| | | @ExcelProperty( "街道名称") |
| | | private String streetName; |
| | | |
| | | /** 社区名称 */ |
| | | @ExcelProperty( "社区名称") |
| | | private String communityName; |
| | | |
| | | /** 网格名称 */ |
| | | @ExcelProperty( "网格名称") |
| | | private String gridName; |
| | | |
| | | // |
| | | // /** 企业法定代表 */ |
| | | // @ColumnWidth(15) |
| | | // @ExcelProperty( "企业法定代表") |
| | | // private String legalPerson; |
| | | // |
| | | // /** 法定代表联系电话 */ |
| | | // @ColumnWidth(15) |
| | | // @ExcelProperty( "法定代表联系电话") |
| | | // private String legalTel; |
| | | // |
| | | // /** 企业法定代表身份证号码 */ |
| | | // @ColumnWidth(15) |
| | | // @ExcelProperty( "企业法定代表身份证号码") |
| | | // private String legalIdCard; |
| | | |
| | | /** 九小场所类型 */ |
| | | @ExcelProperty( value = "九小场所类型",converter = ExcelDictConverter.class) |
| | | @ExcelDictItem(type = "nineType") |
| | | @ExcelDictItemLabel(type = "nineType") |
| | | private String nineType; |
| | | |
| | | /** 阵地类型 */ |
| | | @ExcelProperty( value = "阵地类型",converter = ExcelDictConverter.class) |
| | | @ExcelDictItem(type = "frontType") |
| | | @ExcelDictItemLabel(type = "frontType") |
| | | private String frontType; |
| | | |
| | | /** 1:是 2:否 三级消防单位 */ |
| | | @ExcelProperty("三级消防单位(是/否)") |
| | | private String threeFireProtection; |
| | | |
| | | /** 无诈类别 */ |
| | | @ExcelProperty(value = "无诈类别", converter = ExcelDictConverter.class) |
| | | @ExcelDictItem(type = "noExplosionCategory") |
| | | @ExcelDictItemLabel(type = "noExplosionCategory") |
| | | private String noExplosionCategory; |
| | | |
| | | /** 标签分类代码 */ |
| | | @ExcelProperty( "标签分类代码") |
| | | private String labelCode; |
| | | |
| | | /** 备注 */ |
| | | @ExcelProperty( "备注") |
| | | private String remark; |
| | | |
| | | /** 审核状态 */ |
| | | @ExcelProperty( "审核状态") |
| | | private String confirmFlag; |
| | | |
| | | /** 是否有二维码 */ |
| | | @ExcelProperty( "是否有二维码") |
| | | private String source; |
| | | |
| | | |
| | | } |
| | | |
| File was renamed from src/main/java/org/springblade/modules/place/excel/PlaceExcel.java |
| | |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import lombok.Data; |
| | | import org.springblade.common.excel.ExcelDictConverter; |
| | | import org.springblade.common.excel.ExcelDictItem; |
| | | import org.springblade.common.excel.ExcelDictItemLabel; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | @ColumnWidth(25) |
| | | @HeadRowHeight(20) |
| | | @ContentRowHeight(18) |
| | | public class PlaceExcel implements Serializable { |
| | | public class ImportPlaceExcel implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 2L; |
| | | |
| | | /** 门牌地址编码 */ |
| | | @ExcelProperty( "门牌地址编码") |
| | | @ExcelProperty( "门牌地址编码*") |
| | | private String houseCode; |
| | | |
| | | /** 街道名称 */ |
| | | @ExcelProperty( "街道名称") |
| | | private String streetName; |
| | | |
| | | /** 社区名称 */ |
| | | @ExcelProperty( "社区名称") |
| | | private String communityName; |
| | | |
| | | /** 网格名称 */ |
| | | @ExcelProperty( "网格名称") |
| | | private String gridName; |
| | | |
| | | /** 场所负责人 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "场所负责人") |
| | | private String principal; |
| | | |
| | | /** 场所负责人联系电话 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "场所负责人联系电话") |
| | | private String principalPhone; |
| | | |
| | | /** 企业法定代表 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "企业法定代表") |
| | | private String legalPerson; |
| | | |
| | | /** 法定代表联系电话 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "法定代表联系电话") |
| | | private String legalTel; |
| | | |
| | | /** 企业法定代表身份证号码 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "企业法定代表身份证号码") |
| | | private String legalIdCard; |
| | | |
| | | /** 企业(店铺)名称 */ |
| | | @ColumnWidth(25) |
| | | @ExcelProperty( "企业(店铺)名称") |
| | | private String placeName; |
| | | |
| | | /** 地址 */ |
| | | @ColumnWidth(25) |
| | |
| | | @ExcelProperty( "纬度") |
| | | private String lat; |
| | | |
| | | /** 街道名称 */ |
| | | @ExcelProperty( "街道名称") |
| | | private String streetName; |
| | | |
| | | /** 社区名称 */ |
| | | @ExcelProperty( "社区名称") |
| | | private String communityName; |
| | | |
| | | /** 网格名称 */ |
| | | @ExcelProperty( "网格名称") |
| | | private String gridName; |
| | | |
| | | /** 场所名称 */ |
| | | @ColumnWidth(25) |
| | | @ExcelProperty( "场所名称*") |
| | | private String placeName; |
| | | |
| | | /** 场所负责人 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "场所负责人") |
| | | private String principal; |
| | | |
| | | /** 场所负责人联系电话 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "场所负责人联系电话") |
| | | private String principalPhone; |
| | | |
| | | /** 场所负责人身份证号 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "场所负责人身份证号") |
| | | private String principalIdCard; |
| | | |
| | | /** 企业法定代表 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "企业法定代表") |
| | | private String legalPerson; |
| | | |
| | | /** 法定代表联系电话 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "法定代表联系电话") |
| | | private String legalTel; |
| | | |
| | | /** 企业法定代表身份证号码 */ |
| | | @ColumnWidth(15) |
| | | @ExcelProperty( "企业法定代表身份证号码") |
| | | private String legalIdCard; |
| | | |
| | | /** 九小场所类型 */ |
| | | @ExcelProperty( value = "九小场所类型",converter = ExcelDictConverter.class) |
| | | @ExcelDictItem(type = "nineType") |
| | | @ExcelDictItemLabel(type = "nineType") |
| | | private String nineType; |
| | | |
| | | /** 阵地类型 */ |
| | | @ExcelProperty( value = "阵地类型",converter = ExcelDictConverter.class) |
| | | @ExcelDictItem(type = "frontType") |
| | | @ExcelDictItemLabel(type = "frontType") |
| | | private String frontType; |
| | | |
| | | /** 1:是 2:否 三级消防单位 */ |
| | | @ExcelProperty("三级消防单位(是/否)") |
| | | private String threeFireProtection; |
| | | |
| | | /** 无诈类别 */ |
| | | @ExcelProperty(value = "无诈类别", converter = ExcelDictConverter.class) |
| | | @ExcelDictItem(type = "noExplosionCategory") |
| | | @ExcelDictItemLabel(type = "noExplosionCategory") |
| | | private String noExplosionCategory; |
| | | |
| | | /** 标签分类代码 */ |
| | | @ExcelProperty( "标签分类代码") |
| | | private String labelCode; |
| | |
| | | * @author Chill |
| | | */ |
| | | @RequiredArgsConstructor |
| | | public class PlaceImporter implements ExcelImporter<PlaceExcel> { |
| | | public class PlaceImporter implements ExcelImporter<ImportPlaceExcel> { |
| | | |
| | | private final IPlaceService placeService; |
| | | private final Boolean isCovered; |
| | | |
| | | @Override |
| | | public void save(List<PlaceExcel> data) { |
| | | public void save(List<ImportPlaceExcel> data) { |
| | | placeService.importPlace(data, isCovered); |
| | | } |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.common.node.TreeStringNode; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.excel.ExportPlaceExcel; |
| | | import org.springblade.modules.place.excel.NinePlaceExcel; |
| | | import org.springblade.modules.place.excel.PlaceAndRelExcel; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | |
| | | * |
| | | * @param page |
| | | * @param place |
| | | * @param houseCodeList |
| | | * @param regionChildCodesList |
| | | * @param isAdministrator |
| | | * @return |
| | |
| | | * @return |
| | | */ |
| | | String getCommunityCode(@Param("id") Long id); |
| | | |
| | | /** |
| | | * 导出场所信息 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | List<ExportPlaceExcel> exportPlaceList(@Param("place") PlaceVO place, |
| | | @Param("gridCodeList") List<String> gridCodeList, |
| | | @Param("regionChildCodesList") List<String> regionChildCodesList, |
| | | @Param("isAdministrator") Integer isAdministrator); |
| | | } |
| | |
| | | and jp.id = #{id} |
| | | </select> |
| | | |
| | | <!--导出场所信息--> |
| | | <select id="exportPlaceList" resultType="org.springblade.modules.place.excel.ExportPlaceExcel"> |
| | | select |
| | | jp.id, |
| | | jp.location, |
| | | jp.lng, |
| | | jp.lat, |
| | | jp.place_name, |
| | | jp.principal, |
| | | jp.principal_phone, |
| | | jp.principal_id_card, |
| | | jp.nine_type, |
| | | jp.front_type, |
| | | jp.no_explosion_category, |
| | | jp.remark, |
| | | case when jp.source=1 then '是' |
| | | else '否' end as source, |
| | | case when jp.three_fire_protection=1 then '是' |
| | | when jp.three_fire_protection=2 then '否' |
| | | end as threeFireProtection, |
| | | jpe.legal_person, |
| | | jpe.legal_tel, |
| | | jpe.legal_id_card, |
| | | jppl.labelCode, |
| | | br.town_name as streetName, |
| | | br.name as communityName, |
| | | jg.grid_name as gridName, |
| | | case when jpe.confirm_flag = 1 then '待审核' |
| | | when jpe.confirm_flag = 2 then '审核通过' |
| | | when jpe.confirm_flag = 3 then '审核不通过' |
| | | when jpe.confirm_flag = 4 then '待完善' |
| | | end as confirmFlag |
| | | 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_ext jpe on jpe.place_id=jp.id and jpe.is_deleted = 0 |
| | | left join jczz_grid jg on jg.grid_code = jp.grid_code and jg.is_deleted = 0 |
| | | LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0 |
| | | left join blade_region br on br.code = jpag.community_code |
| | | left join ( |
| | | select place_id,GROUP_CONCAT(poi_code) as labelCode from jczz_place_poi_label group by place_id |
| | | ) jppl on jppl.place_id = jp.id |
| | | where jp.is_deleted = 0 and jp.source!=3 |
| | | and jp.place_name != '' |
| | | <if test="place.placeName!=null and place.placeName!=''"> |
| | | and jp.place_name like concat('%',#{place.placeName},'%') |
| | | </if> |
| | | <if test="place.principal!=null and place.principal!=''"> |
| | | and jp.principal like concat('%',#{place.principal},'%') |
| | | </if> |
| | | <if test="place.principalPhone!=null and place.principalPhone!=''"> |
| | | and jp.principal_phone like concat('%',#{place.principalPhone},'%') |
| | | </if> |
| | | <if test="place.houseCode!=null and place.houseCode!=''"> |
| | | and jp.house_code like concat('%',#{place.houseCode},'%') |
| | | </if> |
| | | <if test="place.townStreetName!=null and place.townStreetName!=''"> |
| | | and br.town_name like concat('%',#{place.townStreetName},'%') |
| | | </if> |
| | | <if test="place.neiName!=null and place.neiName!=''"> |
| | | and br.name like concat('%',#{place.neiName},'%') |
| | | </if> |
| | | <if test="place.id!=null"> |
| | | and jp.id = #{place.id} |
| | | </if> |
| | | <if test="place.isNine!=null"> |
| | | and jp.is_nine = #{place.isNine} |
| | | </if> |
| | | <if test="place.source!=null"> |
| | | and jp.source = #{place.source} |
| | | </if> |
| | | <if test="place.isPerfect==1"> |
| | | and jp.status = 1 |
| | | </if> |
| | | <if test="place.isPerfect==2"> |
| | | and jp.status = 2 |
| | | </if> |
| | | <if test="isAdministrator==2"> |
| | | <choose> |
| | | <when test="place.roleName != null and place.roleName != ''"> |
| | | <if test="place.roleName=='wgy'"> |
| | | <choose> |
| | | <when test="gridCodeList !=null and gridCodeList.size()>0"> |
| | | and jp.grid_code in |
| | | <foreach collection="gridCodeList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jp.grid_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | <if test="place.roleName=='mj'"> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jpag.community_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | </when> |
| | | <otherwise> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and |
| | | ( |
| | | jg.grid_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | or |
| | | jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | ) |
| | | </when> |
| | | <otherwise> |
| | | and |
| | | ( |
| | | jg.grid_code in ('') or jpag.community_code in ('') |
| | | ) |
| | | </otherwise> |
| | | </choose> |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | order by jp.create_time desc,jp.id desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | package org.springblade.modules.place.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.common.node.TreeStringNode; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.excel.ExportPlaceExcel; |
| | | import org.springblade.modules.place.excel.NinePlaceExcel; |
| | | import org.springblade.modules.place.excel.PlaceAndRelExcel; |
| | | import org.springblade.modules.place.excel.PlaceExcel; |
| | | import org.springblade.modules.place.excel.ImportPlaceExcel; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | |
| | | * @param data |
| | | * @param isCovered |
| | | */ |
| | | void importPlace(List<PlaceExcel> data, Boolean isCovered); |
| | | String importPlace(List<ImportPlaceExcel> data, Boolean isCovered); |
| | | |
| | | /** |
| | | * 场所(商超)导入 |
| | |
| | | * @return |
| | | */ |
| | | String getCommunityCode(Long id); |
| | | |
| | | /** |
| | | * 导出场所信息 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | List<ExportPlaceExcel> exportPlaceList(PlaceVO place); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import liquibase.pro.packaged.P; |
| | | import liquibase.pro.packaged.W; |
| | | import liquibase.repackaged.org.apache.commons.lang3.StringUtils; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.node.TreeStringNode; |
| | | import org.springblade.common.param.CommonParamSet; |
| | | import org.springblade.common.utils.IdUtils; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.SpringUtil; |
| | |
| | | import org.springblade.modules.grid.mapper.GridMapper; |
| | | import org.springblade.modules.grid.service.IGridRangeService; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.grid.service.IGridmanService; |
| | | import org.springblade.modules.grid.vo.GridVO; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.entity.UserHouseLabelEntity; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.house.vo.HouseholdVO; |
| | | import org.springblade.modules.label.entity.LabelEntity; |
| | | import org.springblade.modules.partyOrganization.vo.PartyOrganizationVO; |
| | | import org.springblade.modules.place.entity.*; |
| | | import org.springblade.modules.place.excel.ExportPlaceExcel; |
| | | import org.springblade.modules.place.excel.NinePlaceExcel; |
| | | import org.springblade.modules.place.excel.PlaceAndRelExcel; |
| | | import org.springblade.modules.place.excel.PlaceExcel; |
| | | import org.springblade.modules.place.excel.ImportPlaceExcel; |
| | | import org.springblade.modules.place.service.*; |
| | | import org.springblade.modules.place.vo.PlaceCheckVO; |
| | | import org.springblade.modules.place.vo.PlacePoiLabelVO; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.place.mapper.PlaceMapper; |
| | | import org.springblade.modules.police.entity.PoliceAffairsGridEntity; |
| | | import org.springblade.modules.police.service.IPoliceAffairsGridService; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.entity.DictBiz; |
| | | import org.springblade.modules.system.entity.Region; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.service.IDictBizService; |
| | | import org.springblade.modules.system.service.IRegionService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.task.vo.TaskLabelReportingEventVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | * @param isCovered |
| | | */ |
| | | @Override |
| | | public void importPlace(List<PlaceExcel> data, Boolean isCovered) { |
| | | for (PlaceExcel placeExcel : data) { |
| | | public String importPlace(List<ImportPlaceExcel> data, Boolean isCovered) { |
| | | int totalNum = data.size(); |
| | | int importNum = 0; |
| | | int updateNum = 0; |
| | | int errorNum = 0; |
| | | for (ImportPlaceExcel placeExcel : data) { |
| | | if (Strings.isBlank(placeExcel.getPlaceName()) || Strings.isBlank(placeExcel.getHouseCode())){ |
| | | errorNum++; |
| | | continue; |
| | | } |
| | | PlaceEntity placeEntity = Objects.requireNonNull(BeanUtil.copy(placeExcel, PlaceEntity.class)); |
| | | Long userId = updateUser(placeExcel); |
| | | // 九小场所类型处理 |
| | | if (!Strings.isBlank(placeExcel.getNineType())) { |
| | | placeEntity.setIsNine(1); |
| | | placeEntity.setNineType(Integer.parseInt(placeExcel.getNineType())); |
| | | } |
| | | // 阵地类型处理 |
| | | if (!Strings.isBlank(placeExcel.getFrontType())) { |
| | | placeEntity.setIsFront(1); |
| | | placeEntity.setFrontType(Integer.parseInt(placeExcel.getFrontType())); |
| | | } |
| | | // 无诈类别 |
| | | if (!Strings.isBlank(placeExcel.getNoExplosionCategory())){ |
| | | placeEntity.setNoExplosionCategory(Integer.parseInt(placeExcel.getNoExplosionCategory())); |
| | | } |
| | | // 三级单位 |
| | | if (!Strings.isBlank(placeExcel.getThreeFireProtection())){ |
| | | if (placeExcel.getThreeFireProtection().equals("是")){ |
| | | placeEntity.setThreeFireProtection(1); |
| | | } |
| | | if (placeExcel.getThreeFireProtection().equals("否")){ |
| | | placeEntity.setThreeFireProtection(2); |
| | | } |
| | | } |
| | | String[] split = placeExcel.getHouseCode().split(","); |
| | | placeEntity.setHouseCode(split[0]); |
| | | placeEntity.setHouseCodeBinds(placeExcel.getHouseCode()); |
| | | placeEntity.setPrincipalUserId(userId); |
| | | // houseCode 关联处理 来源 1:地址总表 2:国控采集 3:商超 |
| | | houseCodeHandle(placeExcel, placeEntity); |
| | | // 网格绑定处理 |
| | | importGridHandle(placeExcel, placeEntity); |
| | | // 判断是否存在,不存在则插入,否则不操作 |
| | | QueryWrapper<PlaceEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted", 0) |
| | | .eq("house_code", placeExcel.getHouseCode()); |
| | | PlaceEntity one = getOne(wrapper); |
| | | Long userId = updateUser(placeExcel); |
| | | if (null == one) { |
| | | // 插入场所 |
| | | String[] split = placeExcel.getHouseCode().split(","); |
| | | placeEntity.setHouseCode(split[0]); |
| | | placeEntity.setHouseCodeBinds(placeExcel.getHouseCode()); |
| | | placeEntity.setPrincipalUserId(userId); |
| | | // 默认为未完善 |
| | | placeEntity.setStatus(1); |
| | | // 是否现场采集 1:是 2:否 |
| | | placeEntity.setIsScene(1); |
| | | // houseCode 关联处理 来源 1:地址总表 2:国控采集 3:商超 |
| | | houseCodeHandle(placeExcel, placeEntity); |
| | | // 九小场所类型处理 |
| | | if (!Strings.isBlank(placeExcel.getNineType())) { |
| | | placeEntity.setIsNine(1); |
| | | placeEntity.setNineType(Integer.parseInt(placeExcel.getNineType())); |
| | | } |
| | | // 网格绑定处理 |
| | | importGridHandle(placeExcel, placeEntity); |
| | | // 新增 |
| | | save(placeEntity); |
| | | importNum++; |
| | | // 保存详情 |
| | | savePlaceExt(placeEntity,placeExcel); |
| | | // 场所标签信息处理 |
| | |
| | | // 房屋编号绑定处理 |
| | | houseCodeBindHandle(placeEntity); |
| | | } else { |
| | | // 更新场所 |
| | | one.setPrincipalUserId(userId); |
| | | one.setPrincipal(placeExcel.getPrincipal()); |
| | | one.setPrincipalPhone(placeExcel.getPrincipalPhone()); |
| | | // 默认为未完善 |
| | | one.setStatus(1); |
| | | // 是否现场采集 1:是 2:否 |
| | | one.setIsScene(1); |
| | | // 来源 1:地址总表 2:国控采集 3:商超 |
| | | one.setSource(1); |
| | | // 九小场所类型处理 |
| | | if (!Strings.isBlank(placeExcel.getNineType())) { |
| | | one.setIsNine(1); |
| | | one.setNineType(Integer.parseInt(placeExcel.getNineType())); |
| | | } |
| | | // 网格绑定处理 |
| | | importGridHandle(placeExcel, one); |
| | | // 更新 |
| | | updateById(one); |
| | | // 场所标签信息处理 |
| | | if (!Strings.isBlank(placeExcel.getLabelCode())) { |
| | | PlaceVO placeVO = new PlaceVO(); |
| | | placeVO.setId(one.getId()); |
| | | placeVO.setLabel(placeExcel.getLabelCode()); |
| | | // 处理 |
| | | placeLabelBind(placeVO); |
| | | updateNum++; |
| | | // 是否覆盖更新 |
| | | if (isCovered) { |
| | | // 更新场所 |
| | | placeEntity.setId(one.getId()); |
| | | // 更新 |
| | | updateById(placeEntity); |
| | | importNum++; |
| | | // 场所标签信息处理 |
| | | if (!Strings.isBlank(placeExcel.getLabelCode())) { |
| | | PlaceVO placeVO = new PlaceVO(); |
| | | placeVO.setId(one.getId()); |
| | | placeVO.setLabel(placeExcel.getLabelCode()); |
| | | // 处理 |
| | | placeLabelBind(placeVO); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | StringBuilder builder = new StringBuilder("导入完成!"); |
| | | builder.append("其中本次表格共有 ").append(totalNum).append(" 条数据,") |
| | | .append("成功导入 ").append(importNum).append(" 条数据。"); |
| | | if (updateNum>0) { |
| | | builder.append("其中有 ").append(updateNum).append(" 条数据已存在。"); |
| | | } |
| | | if (errorNum>0){ |
| | | builder.append("共有 ").append(errorNum).append(" 条数据由于无企业(店铺)名称信息或无地址编号未导入!"); |
| | | } |
| | | return builder.toString(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param placeExcel |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void savePlaceExt(PlaceEntity placeEntity,PlaceExcel placeExcel) { |
| | | public void savePlaceExt(PlaceEntity placeEntity, ImportPlaceExcel placeExcel) { |
| | | PlaceVO placeVO = new PlaceVO(); |
| | | placeVO.setId(placeEntity.getId()); |
| | | PlaceExtEntity placeExtEntity = new PlaceExtEntity(); |
| | |
| | | * @param placeExcel |
| | | * @param placeEntity |
| | | */ |
| | | public void houseCodeHandle(PlaceExcel placeExcel, PlaceEntity placeEntity) { |
| | | public void houseCodeHandle(ImportPlaceExcel placeExcel, PlaceEntity placeEntity) { |
| | | if (!Strings.isBlank(placeExcel.getHouseCode())) { |
| | | placeEntity.setSource(1); |
| | | // 设置经纬度及地址 |
| | |
| | | * @param placeExcel |
| | | * @param placeEntity |
| | | */ |
| | | private void importGridHandle(PlaceExcel placeExcel, PlaceEntity placeEntity) { |
| | | private void importGridHandle(ImportPlaceExcel placeExcel, PlaceEntity placeEntity) { |
| | | if (!Strings.isBlank(placeExcel.getCommunityName()) && |
| | | !Strings.isBlank(placeExcel.getGridName())) { |
| | | // 查询对应的网格信息 |
| | |
| | | * @param placeExcel |
| | | * @return |
| | | */ |
| | | public Long updateUser(PlaceExcel placeExcel) { |
| | | public Long updateUser(ImportPlaceExcel placeExcel) { |
| | | if (!Strings.isBlank(placeExcel.getPrincipal()) && |
| | | !Strings.isBlank(placeExcel.getPrincipalPhone())) { |
| | | PlaceVO placeVO = new PlaceVO(); |
| | |
| | | public String getCommunityCode(Long id) { |
| | | return baseMapper.getCommunityCode(id); |
| | | } |
| | | |
| | | /** |
| | | * 导出场所信息 |
| | | * @param place |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ExportPlaceExcel> exportPlaceList(PlaceVO place) { |
| | | // 公共参数设置 |
| | | CommonParamSet commonParamSet = new CommonParamSet().invoke(PlaceVO.class, place); |
| | | return baseMapper.exportPlaceList(place, |
| | | commonParamSet.getGridCodeList(), |
| | | commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getIsAdministrator() |
| | | ); |
| | | } |
| | | } |