manailin
2021-08-04 c2197723fdd911962372c58499171d8c909b8ebc
Merge remote-tracking branch 'remotes/origin/test'
36个文件已修改
16个文件已添加
6589 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/constants/Constants.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/constants/WxSubscribeConstants.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/enums/PopulCultureLevelEnum.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/enums/PopulRelationEnum.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationCorrectExcelListen.java 577 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationDrugExcelListen.java 588 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationMajorExcelListen.java 525 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComSwRotaExcelListen.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/wx/TemplateData.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/wx/TemplateParam.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/wx/WxSubscribeDTO.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ActivitySignVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationCorrectExcelVO.java 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationCorrectMistakeExcelVO.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationCultExcelVO.java 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationDrugExcelVO.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationDrugMistakeExcelVO.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationMajorExcelVO.java 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationMajorMistakeExcelVO.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationRehabilitationExcelVO.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComSwDangerReportVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComSwPatrolRecordStatisticsVO.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComSwPatrolRecordVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComSwRotaExcelVO.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/user/UserService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/HttpUtils.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/WxUtil.java 268 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/WxXCXTempSend.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComSwPatrolRecordApi.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java 100 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityManagerApi.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityPartyBuildingApi.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/DictionaryApi.java 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/PopulationApi.java 1681 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommonDataApi.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/DictionaryApi.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActSignDAO.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActActivityService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMessageServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java 944 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSwDangerReportServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSwPatrolRecordServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSwRotaServiceImpl.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSwSafetyWorkRecordMapper.xml 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/UserService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/timejob/src/main/java/com/panzhihua/timejob/jobhandler/CommunityJobHandler.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/constants/Constants.java
@@ -153,6 +153,12 @@
    public static final String POPULATION_ERROR_LIST = "POPULATION_ERROR_LIST_";
    public static final String DRUG_POPULATION_ERROR_LIST = "DRUG_POPULATION_ERROR_LIST_";
    public static final String CORRECT_POPULATION_ERROR_LIST = "CORRECT_POPULATION_ERROR_LIST_";
    public static final String Major_POPULATION_ERROR_LIST = "Major_POPULATION_ERROR_LIST_";
    /**
     * 高德地图获取天气url
     */
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/constants/WxSubscribeConstants.java
New file
@@ -0,0 +1,76 @@
package com.panzhihua.common.constants;
/**
 * 微信小程序订阅消息常量类
 */
public class WxSubscribeConstants {
    /**
     * 活动变更通知模板id
     */
    public static final String HDBG_ID = "WkyqgQbrQim4Q68uM4628Tb0FVCXR9JuleRWwOc-UTQ";
    /**
     * 作品点赞通知模板id
     */
    public static final String ZPDZ_ID = "xYpsRZLDO_M36B2WBPgZyBk51J-OEPWPAEA4labsL5I";
    /**
     * 留言回复通知模板id
     */
    public static final String LYHF_ID = "XhTPFPUoHrfZbNiIHO95pf5amYMYAPcB1HiHMKOIMXw";
    /**
     * 新动态发布提醒模板id
     */
    public static final String XDTFB_ID = "cRXVFlIqpqxMpjVvf5s5w8aK_P2run8buCeDxm6_5oA";
    /**
     * 新活动提醒模板id
     */
    public static final String XHDTX_ID = "fW5FkhdBsTrmDIFI10UbMa6pEUuLDyK8so3FAvdGoMQ";
    /**
     * 新的评论提醒模板id
     */
    public static final String PLTX_ID = "12cHm4epIrhDTlUYfGcoBD1Kbj7cv16EyBIYvFjV7BA";
    /**
     * 评论回复通知模板id
     */
    public static final String PLHF_ID = "WvSoXRTpx4JUW4YcvLbnk4xhttjQ_EPQSG2tF5DJ1OU";
    /**
     * 评论点赞通知模板id
     */
    public static final String PLDZ_ID = "7p9Dn0IQ0iCYB2JEm0c5nukc0lY90TKijzUlJjDfYqk";
    /**
     * 活动取消通知模板id
     */
    public static final String HDQX_ID = "K0HeNd4Za4Vh0oaihRbauLL9pNY69en0cCU1nzDRzv0";
    /**
     * 审核状态通知模板id
     */
    public static final String SHZT_ID = "IIEAp-7rmj0_Le_mBMK3X-aTRN7-b-bBdXq-pmJIhHo";
    /**
     * 认证审核通知模板id
     */
    public static final String EZSH_ID = "ZMCHtZn_XR118XnbKabF9DuYG5NKsvCfsr59_gIOAe0";
    /**
     * 调研问卷通知模板id
     */
    public static final String DYWJ_ID = "orfmflVy0RkVT-kIPUk8muikfFqJrK_47OjzM-OVINc";
    /**
     * 奖励发放通知模板id
     */
    public static final String JLFF_ID = "vuGJS9WYb0e_99lcoB8USqJk5emGJftbe-G0PjgEvjU";
    /**
     * 报名成功通知模板id
     */
    public static final String BMCG_ID = "NQbyd_2n-DX2urZVrUkAPYER-J5XY6VqIm6QvaYj0NY";
    /**
     * 活动即将开始通知模板id
     */
    public static final String HDJJKS_ID = "__0i0e8-yfDGW3jv3l-qobcWt23Ec3iZEdJhMV3nHWo";
    /**
     * 跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版
     */
    public static final String MINIPROGRAM_STATE = "trial";
    /**
     * 订阅消息推送url
     */
    public static final String DYXX_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=";
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/enums/PopulCultureLevelEnum.java
@@ -10,15 +10,17 @@
@Getter
public enum PopulCultureLevelEnum
{
    XX(1, "小学"),
    CZ(2, "初中"),
    GZ(3, "高中"),
    ZZ(4, "中专"),
    DZ(5, "大专"),
    BK(6, "本科"),
    SS(7, "硕士"),
    BS(8, "博士"),
    QT(9, "其他");
    XX(80, "小学"),
    CZ(70, "初中"),
    GZ(61, "高中"),
    ZZ(40, "中专"),
    DZ(31, "大专"),
    BK(21, "本科"),
    SS(14, "硕士"),
    YJS(10, "研究生"),
    BS(11, "博士"),
    QT(90, "其他"),
    WM(9, "文盲");
    private final Integer code;
    private final String name;
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/enums/PopulRelationEnum.java
@@ -10,12 +10,97 @@
@Getter
public enum PopulRelationEnum
{
    HZ(1, "户主"),
    PO(2, "配偶"),
    ZN(3, "子女"),
    SN(4, "孙女"),
    FM(5, "父母"),
    QT(6, "其他");
    relation01(01, "本人"),
    relation02(02, "户主"),
    relation10(10, "配偶"),
    relation11(11, "夫"),
    relation12(12, "妻"),
    relation20(20, "子"),
    relation21(21, "独生子"),
    relation22(22, "长子"),
    relation23(23, "次子"),
    relation24(24, "三子"),
    relation25(25, "四子"),
    relation26(26, "五子"),
    relation27(27, "养子或继子"),
    relation28(28, "女婿"),
    relation29(29, "其他儿子"),
    relation30(30, "女"),
    relation31(31, "独生女"),
    relation32(32, "长女"),
    relation33(33, "次女"),
    relation434(34, "三女"),
    relation35(35, "四女"),
    relation36(36, "五女"),
    relation37(37, "养女或继女"),
    relation38(38, "儿媳"),
    relation39(39, "其他女儿"),
    relation40(40, "孙子、孙女或外孙子、外孙女"),
    relation41(41, "孙子"),
    relation42(42, "孙女"),
    relation43(43, "外孙子"),
    relation44(44, "外孙女"),
    relation45(45, "孙媳妇或外孙媳妇"),
    relation46(46, "孙女婿或外孙女婿"),
    relation47(47, "曾孙子或外曾孙子"),
    relation48(48, "曾孙女或外曾孙女"),
    relation49(49, "其他孙子、孙女或外孙子、外孙女"),
    relation50(50, "父母"),
    relation51(51, "父亲"),
    relation52(52, "母亲"),
    relation53(53, "公公"),
    relation54(54, "婆婆"),
    relation55(55, "岳父"),
    relation56(56, "岳母"),
    relation57(57, "继父或养父"),
    relation58(58, "继母或养母"),
    relation59(59, "其他父母关系"),
    relation60(60, "祖父母或外祖父母"),
    relation61(61, "祖父"),
    relation62(62, "祖母"),
    relation63(63, "外祖父"),
    relation64(64, "外祖母"),
    relation65(65, "配偶的祖父母或外祖父母"),
    relation66(66, "曾祖父"),
    relation67(67, "曾祖母"),
    relation68(68, "配偶的曾祖父母或外曾祖父母"),
    relation69(69, "其他祖父母或外祖父母关系"),
    relation70(70, "兄弟姐妹"),
    relation71(71, "兄"),
    relation72(72, "嫂"),
    relation73(73, "弟"),
    relation74(74, "弟媳"),
    relation75(75, "姐姐"),
    relation76(76, "姐夫"),
    relation77(77, "妹妹"),
    relation78(78, "妹夫"),
    relation79(79, "其他兄弟姐妹"),
    relation80(80, "其他"),
    relation81(81, "伯父"),
    relation82(82, "伯母"),
    relation83(83, "叔父"),
    relation84(84, "婶母"),
    relation85(85, "舅父"),
    relation86(86, "舅母"),
    relation87(87, "姨夫"),
    relation88(88, "姨母"),
    relation89(89, "姑母"),
    relation90(90, "姑父"),
    relation91(91, "堂兄妹,堂姐妹"),
    relation92(92, "表兄妹,表姐妹"),
    relation93(93, "侄子"),
    relation94(94, "侄女"),
    relation95(95, "外甥"),
    relation96(96, "外甥女"),
    relation97(97, "其他亲属"),
    relation99(99, "非亲属");
    private final Integer code;
    private final String name;
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationCorrectExcelListen.java
New file
@@ -0,0 +1,577 @@
package com.panzhihua.common.listen;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists;
import com.panzhihua.common.constants.BcDictionaryConstants;
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.enums.*;
import com.panzhihua.common.excel.CustomSheetWriteHandler;
import com.panzhihua.common.exceptions.ServiceException;
import com.panzhihua.common.model.vos.BcDictionaryVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.*;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.ListUtils;
import com.panzhihua.common.utlis.PayUtil;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.common.utlis.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
 * @description: 社区矫正人员导入监听
 * @author: txb
 */
@Slf4j
public class ComMngPopulationCorrectExcelListen extends AnalysisEventListener<Map<Integer, String>> {
    private CommunityService communityService;
    private Long communityId;
    private static int headSize = 0;
    private Map<Integer, String> headData;
    private String userName;
    // FTP 登录密码
    private String password;
    // FTP 服务器地址IP地址
    private String host;
    // FTP 端口
    private int port;
    private String excelUrl;
    private StringRedisTemplate stringRedisTemplate;
    public static String loadUrl;
    public ComMngPopulationCorrectExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) {
            this.communityService = communityService;
            this.communityId = communityId;
            this.userName = userName;
            this.password = password;
            this.host = host;
            this.port = port;
            this.excelUrl = excelUrl;
            this.stringRedisTemplate = stringRedisTemplate;
        }
        /**
         * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收
         */
        private static final int BATCH_COUNT = 5000;
        List<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>();
        @Override
        public void invoke(Map<Integer, String> data, AnalysisContext context) {
            list.add(data);
            if (list.size() >= BATCH_COUNT) {
                saveData();
                list.clear();
            }
        }
        /**
         * 这里会一行行的返回头
         *
         * @param headMap
         * @param context
         */
        @Override
        public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
            headSize = headMap.size();
            headData = headMap;
        }
        @Override
        public void doAfterAllAnalysed(AnalysisContext context) {
            saveData();
            log.info("所有数据解析完成!");
        }
        /**
         * 不是固定的列只能手动处理
         */
        private void saveData() {
            R<List<BcDictionaryVO>> dictionaryR = communityService.listDictionaryByKey(BcDictionaryConstants.FAMILY);
            log.info("开始导入吸毒人员数据");
            log.info("表格总数据:" + list.size());
            if (list.size() == 0) {
                throw new ServiceException("500", "导入数据为空!");
            }
            ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue();
            String key = Constants.CORRECT_POPULATION_ERROR_LIST + communityId;
            Map<String,String> dictMap = dictionaryR.getData().stream().collect(Collectors.toMap(BcDictionaryVO::getDictName,BcDictionaryVO::getDictValue));
//        Map<String,Integer> dictMap = new HashMap<>();
//        for(BcDictionaryVO vo : dictionaryR.getData()){
//            dictMap.put(vo.getDictName(),Integer.valueOf(vo.getDictValue()));
//        }
            int index = 2;
            try {
                ArrayList<ComMngPopulationCorrectExcelVO> voList = Lists.newArrayList();
//                List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>();
                ArrayList<ComMngPopulationCorrectMistakeExcelVO> mistakes = Lists.newArrayList();
                for (Map<Integer, String> oneData : list) {
                    ComMngPopulationCorrectExcelVO vo = new ComMngPopulationCorrectExcelVO();
                    if (StringUtils.isNotEmpty(oneData.get(0))){
                        vo.setSerialNumber(oneData.get(0));
                    }
                    //姓名和身份证都为空,为空户,无需操作,否则就解析年龄,性别,出生年月日
                    if(StringUtils.isNotEmpty(oneData.get(1)) || StringUtils.isNotEmpty(oneData.get(3))){
                        if(StringUtils.isEmpty(oneData.get(1))){
                            ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                            index++;
                            setMistake(oneData, mistake);
                            mistake.setMistake("名字不可为空,请填写姓名");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setName(oneData.get(1));
                        if(StringUtils.isEmpty(oneData.get(3))){
                            ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                            index++;
                            setMistake(oneData, mistake);
                            mistake.setMistake("身份证号不可为空,请填写身份证");
                            mistakes.add(mistake);
                            continue;
                        }
                        //判断身份证号码位数
                        if(oneData.get(3).length() != 18){
                            ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                            index++;
                            setMistake(oneData, mistake);
                            mistake.setMistake("身份证号位数有误,请检查身份证号码是否正确");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setCardNo(oneData.get(3).toUpperCase());
                        //根据身份证号码解析年龄以及性别
                        //获取用户生日
                        String birthday = vo.getCardNo().substring(6, 14);
                        if(StringUtils.isNotEmpty(birthday)){
                            String year = birthday.substring(0,4);
                            String month = birthday.substring(4,6);
                            String day = birthday.substring(6,8);
                            vo.setBirthday(year + "-" + month + "-" + day);
                        }
//                    //设置用户年龄
//                    vo.setAge(AgeUtils.getAgeFromBirthTime(birthday));
                        //获取用户性别
                        int sex = Integer.parseInt(vo.getCardNo().substring(16, 17));
                        if(sex%2 == 1){
                            vo.setSex(PopulSexEnum.nan.getCode());
                        }else{
                            vo.setSex(PopulSexEnum.nv.getCode());
                        }
                    }
                    if(StringUtils.isNotEmpty(oneData.get(2))){
                        vo.setNation(oneData.get(2));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(4))){
                        vo.setPhone(oneData.get(4));
                    }
                    if(StringUtils.isEmpty(oneData.get(5))){
                        index++;
                        ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("街路巷不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setRoad(oneData.get(5));
                    if(StringUtils.isEmpty(oneData.get(6))){
                        index++;
                        ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("小区号不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setDoorNo(oneData.get(6).trim());
                    if(StringUtils.isEmpty(oneData.get(7))){
                        index++;
                        ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("楼排号不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setFloor(oneData.get(7).trim());
                    if(StringUtils.isEmpty(oneData.get(8))){
                        index++;
                        ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("单元号不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setUnitNo(oneData.get(8).trim());
                    if(StringUtils.isEmpty(oneData.get(9))){
                        index++;
                        ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("户室不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setHouseNo(oneData.get(9).trim());
                    if(StringUtils.isNotEmpty(oneData.get(10))){
                        Integer isOk = PopulHouseUseEnum.getCodeByName(oneData.get(10));
                        if(isOk.equals(-1)){
                            ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                            index++;
                            setMistake(oneData, mistake);
                            mistake.setMistake("您填写的是否租住有误");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setIsRent(isOk);
                    }else {
                        vo.setIsRent(PopulHouseUseEnum.getCodeByName("否"));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(11))){
                        Integer isOk = PopulHouseStatusEnum.getCodeByName(oneData.get(11).trim());
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                            setMistake(oneData, mistake);
                            mistake.setMistake("您填写的房屋状态有误");
                            mistakes.add(mistake);
                            continue;
                        }
                    vo.setHouseStatus(isOk);
                    }
                    if(StringUtils.isNotEmpty(oneData.get(12))){
                        Integer isOk = PopulHousePurposeEnum.getCodeByName(oneData.get(12).trim());
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                            setMistake(oneData, mistake);
                            mistake.setMistake("您填写的房屋用途有误");
                            mistakes.add(mistake);
                            continue;
                        }
                    vo.setHousePurpose(PopulHousePurposeEnum.getCodeByName(oneData.get(12).trim()));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(13))){
                        Integer isOk = PopulHouseControlStatusEnum.getCodeByName(oneData.get(13));
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                            setMistake(oneData, mistake);
                            mistake.setMistake("您填写的管控状态有误");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setControlStatus(isOk);
                    }
                    if(StringUtils.isNotEmpty(oneData.get(14))){
                        Integer isOk = PopulOutOrLocalEnum.getCodeByName(oneData.get(14));
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                            setMistake(oneData, mistake);
                            mistake.setMistake("您填写的本地/外地有误");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setOutOrLocal(isOk);
                    }else {
                        vo.setOutOrLocal(PopulOutOrLocalEnum.getCodeByName("本地"));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(15))){
                        vo.setCensusRegister(oneData.get(15).trim());
                    }
                    if(StringUtils.isEmpty(oneData.get(16))){
                        ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                        index++;
                        setMistake(oneData, mistake);
                        mistake.setMistake("矫正开始时间不可为空,请填写矫正开始时间");
                        mistakes.add(mistake);
                        continue;
                    }
                    if(StringUtils.isNotEmpty(oneData.get(16))){
                        vo.setCorrectBegin(new SimpleDateFormat("yyyy-MM-dd").parse(oneData.get(16)));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(17))){
                        vo.setCorrectEnd(new SimpleDateFormat("yyyy-MM-dd").parse(oneData.get(17)));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(18))){
                        vo.setCorrectType(oneData.get(18).trim());
                    }
                    if(StringUtils.isNotEmpty(oneData.get(19))){
                        vo.setCharges(oneData.get(19).trim());
                    }
                    if(StringUtils.isNotEmpty(oneData.get(20))){
                        vo.setRemark(oneData.get(20).trim());
                    }
                    vo.getUserTagStr().add("社区矫正人员");
                    for (int i = 21; i < headSize; i++) {
                        if (oneData.get(i) != null && oneData.get(i).equals("是")) {
                            vo.getUserTagStr().add(headData.get(i).substring(0,headData.get(i).indexOf("(")));
                        }
                    }
                    //将重复的数据进行MD5加密实现去重
                    String distinct = vo.getName() + vo.getCardNo() + vo.getRoad() + vo.getDoorNo() + vo.getFloor() + vo.getUnitNo() + vo.getHouseNo();
                    try {
                        String distinctPass = PayUtil.MD5(distinct);
                        if(StringUtils.isNotEmpty(distinctPass)){
                            vo.setDistinctPass(distinctPass);
                        }
                    }catch (Exception e){
                        log.error("组装MD5加密字段失败,数据表格行数:" + index);
                        continue;
                    }
                    voList.add(vo);
                    index++;
                }
                //客户需要暂时注释,等客户处理完成需要恢复
//            if(populationImportErrorVOList.isEmpty()){
//                R r = communityService.listSavePopulationServeExcelVO(voList, communityId);
//                if (!R.isOk(r)) {
//                    throw new ServiceException(r.getMsg());
//                }
//            }else{
//                throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList));
//            }
                //根据list中的IdCard城市来去重
                List<ComMngPopulationCorrectExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationCorrectExcelVO::getDistinctPass)).collect(Collectors.toList());
                log.info("开始进入业务层处理逻辑");
                R r = communityService.listSavePopulationCorrectExcelVO(newVoList, communityId);
                log.info("业务层处理逻辑完成");
                if (!R.isOk(r)) {
                    log.info("业务层处理成功");
                    List<ComMngPopulationCorrectMistakeExcelVO> list = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComMngPopulationCorrectMistakeExcelVO.class);
//                    String errMsg = r.getMsg();
//                    List<ComMngPopulationImportErrorVO> errorList = JSON.parseArray(errMsg,ComMngPopulationImportErrorVO.class);
//                    if(!errorList.isEmpty()){
//                        populationImportErrorVOList.addAll(errorList);
//                    }
                    mistakes.addAll(list);
                    log.info("将错误数据存入redis中");
                    valueOperations.set(key,JSONArray.toJSONString(mistakes),1, TimeUnit.HOURS);
                    log.info("将错误数据存入redis中成功");
                    throw new ServiceException("500", key);
                }else{
                    log.info("业务层处理逻辑失败");
                    if(!mistakes.isEmpty()){
                        log.info("业务层处理逻辑失败,将错误数据缓存到redis中");
                        valueOperations.set(key,JSONArray.toJSONString(mistakes),1, TimeUnit.HOURS);
                        log.info("业务层处理逻辑失败,将错误数据缓存到redis中成功");
                        throw new ServiceException("500", key);
                    }
                }
            } catch (NumberFormatException e) {
                log.info("处理数据时失败");
                e.printStackTrace();
//                List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>();
//                ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
//                importErrorVO.setErrorPosition("第" + index + "行");
//                importErrorVO.setErrorMsg("数据格式有误,请检查文档内数据");
//                populationImportErrorVOList.add(importErrorVO);
                log.error("数据格式有误,第" + index + "行");
                throw new ServiceException("500", "导入失败111");
            } catch (ParseException e1) {
                log.info("处理数据时失败2");
                e1.printStackTrace();
//                List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>();
//                ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
//                importErrorVO.setErrorPosition("第" + index + "行");
//                importErrorVO.setErrorMsg("数据格式有误,请检查文档内数据");
//                populationImportErrorVOList.add(importErrorVO);
                log.error("数据格式有误,第" + index + "行");
                throw new ServiceException("500", "导入失败222");
            }
        }
    private void setMistake(Map<Integer, String> map, ComMngPopulationCorrectMistakeExcelVO vo){
        vo.setName(map.get(1));
        vo.setCardNo(map.get(3));
        vo.setNation(map.get(2));
        vo.setPhone(map.get(4));
        vo.setRoad(map.get(5));
        vo.setDoorNo(map.get(6));
        vo.setFloor(map.get(7));
        vo.setUnitNo(map.get(8));
        vo.setHouseNo(map.get(9));
        vo.setIsRent(map.get(10));
        vo.setHouseStatus(map.get(11));
        vo.setHousePurpose(map.get(12));
        vo.setControlStatus(map.get(13));
        vo.setOutOrLocal(map.get(14));
        vo.setCensusRegister(map.get(15));
        vo.setCorrectBegin(map.get(16));
        vo.setCorrectEnd(map.get(17));
        vo.setCorrectType(map.get(18));
        vo.setCharges(map.get(19));
        vo.setRemark(map.get(20));
    }
        private R mistakeExportPopulation(List<ComMngPopulationMistakeExcelVO> vo) {
            //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
            String ftpUrl = "/mnt/data/web/excel/";
            String name = "实有人口错误数据.xlsx";
            try {
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                boolean existDir = sftp.isExistDir(ftpUrl + name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator + name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, ComMngPopulationMistakeExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("实有人口错误数据").build();
                        excelWriter.write(vo, writeSheet);
                        excelWriter.finish();
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
                            inputStream.close();
                        }
                        if (excelWriter != null) {
                            excelWriter.finish();
                        }
                    }
                }
                return R.ok(excelUrl + name);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
                return R.fail();
            }
        }
        private String convertMarriage(String ma) {
            if(Objects.equals("已",ma) || Objects.equals("一",ma)){
                ma = "已婚";
            }else if(Objects.equals("未",ma) || Objects.equals("未婚婚",ma)){
                ma = "未婚";
            }else if(Objects.equals("初",ma)){
                ma = "初婚";
            }else if(Objects.equals("再",ma)){
                ma = "再婚";
            }else if(Objects.equals("复",ma)){
                ma = "复婚";
            }else if(Objects.equals("丧",ma) || Objects.equals("丧偶偶",ma)){
                ma = "丧偶";
            }else if(Objects.equals("离",ma) || Objects.equals("离异",ma) || Objects.equals("离异婚",ma)){
                ma = "离婚";
            }else if(Objects.equals("分",ma)){
                ma = "分居";
            }
            return ma;
        }
        private String convertRelation(String ra) {
            if(ra.contains("户主")){
                ra = "户主";
            }else if(Objects.equals(ra,"女儿")){
                ra = "女";
            }else if(Objects.equals(ra,"儿子") || Objects.equals(ra,"儿")){
                ra = "子";
            }else if(Objects.equals(ra,"大女")){
                ra = "长女";
            }else if(Objects.equals(ra,"二女") || Objects.equals(ra,"此女")){
                ra = "次女";
            }else if(Objects.equals(ra,"二子")){
                ra = "次子";
            }else if(Objects.equals(ra,"长男") || ra.contains("长子")){
                ra = "长子";
            }else if(Objects.equals(ra,"非亲属") || ra.contains("女友")  || ra.contains("女朋友")
                    || ra.contains("男友") || ra.contains("男朋友")){
                ra = "其他";
            }else if(Objects.equals(ra,"姐")){
                ra = "姐姐";
            }else if(Objects.equals(ra,"户主")){
                ra = "本人";
            }else if(Objects.equals(ra,"妻子") || Objects.equals(ra,"媳妇")){
                ra = "妻";
            }else if(Objects.equals(ra,"哥") || Objects.equals(ra,"哥哥")){
                ra = "兄";
            }else if(Objects.equals(ra,"丈夫")){
                ra = "夫";
            }else if(Objects.equals(ra,"丈母娘")){
                ra = "岳母";
            }else if(Objects.equals(ra,"继子") || Objects.equals(ra,"养子")){
                ra = "养子或继子";
            }else if(Objects.equals(ra,"继女") || Objects.equals(ra,"养女")){
                ra = "养女或继女";
            }else if(ra.contains("儿媳")||ra.contains("长媳")){
                ra = "儿媳";
            }else if(Objects.equals(ra,"三姨") || Objects.equals(ra,"姨姨")){
                ra = "姨母";
            }else if(Objects.equals(ra,"二外孙女")){
                ra = "外孙女";
            }else if(Objects.equals(ra,"外孙")){
                ra = "外孙子";
            }else if(Objects.equals(ra,"侄儿")){
                ra = "侄子";
            }else if(ra.contains("表")){
                ra = "表兄弟、表姐妹";
            }else if(Objects.equals(ra,"继父") || Objects.equals(ra,"养父")){
                ra = "继父或养父";
            }else if(Objects.equals(ra,"父")){
                ra = "父亲";
            }else if(Objects.equals(ra,"弟弟")){
                ra = "弟";
            }else if(Objects.equals(ra,"孙")){
                ra = "孙子";
            }else if(Objects.equals(ra,"孙媳妇") || Objects.equals(ra,"外孙媳妇")){
                ra = "孙媳妇或外孙媳妇";
            }else if(Objects.equals(ra,"妹")){
                ra = "妹妹";
            }else if(Objects.equals(ra,"祖父母")){
                ra = "祖父母或外祖父母";
            }else if(Objects.equals(ra,"姐妹") || Objects.equals(ra,"兄弟")){
                ra = "兄弟姐妹";
            }else if(Objects.equals(ra,"其他姐妹") || Objects.equals(ra,"其他兄弟")){
                ra = "其他兄弟姐妹";
            }else if(Objects.equals(ra,"奶奶")){
                ra = "祖母";
            }else if(Objects.equals(ra,"爷爷")){
                ra = "祖父";
            }else if(Objects.equals(ra,"爷爷")){
                ra = "祖父";
            }else if(ra.contains("堂")){
                ra = "堂兄弟、堂姐妹";
            }
            return ra;
        }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationDrugExcelListen.java
New file
@@ -0,0 +1,588 @@
package com.panzhihua.common.listen;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists;
import com.panzhihua.common.constants.BcDictionaryConstants;
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.enums.*;
import com.panzhihua.common.excel.CustomSheetWriteHandler;
import com.panzhihua.common.exceptions.ServiceException;
import com.panzhihua.common.model.vos.BcDictionaryVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComMngPopulationDrugExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationDrugMistakeExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationMistakeExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationServeExcelVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.ListUtils;
import com.panzhihua.common.utlis.PayUtil;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.common.utlis.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
 * @description: 吸毒人员导入监听
 * @author: txb
 */
@Slf4j
public class ComMngPopulationDrugExcelListen extends AnalysisEventListener<Map<Integer, String>> {
    private CommunityService communityService;
    private Long communityId;
    private static int headSize = 0;
    private Map<Integer, String> headData;
    private String userName;
    // FTP 登录密码
    private String password;
    // FTP 服务器地址IP地址
    private String host;
    // FTP 端口
    private int port;
    private String excelUrl;
    private StringRedisTemplate stringRedisTemplate;
    public static String loadUrl;
    public ComMngPopulationDrugExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) {
            this.communityService = communityService;
            this.communityId = communityId;
            this.userName = userName;
            this.password = password;
            this.host = host;
            this.port = port;
            this.excelUrl = excelUrl;
            this.stringRedisTemplate = stringRedisTemplate;
        }
        /**
         * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收
         */
        private static final int BATCH_COUNT = 5000;
        List<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>();
        @Override
        public void invoke(Map<Integer, String> data, AnalysisContext context) {
            list.add(data);
            if (list.size() >= BATCH_COUNT) {
                saveData();
                list.clear();
            }
        }
        /**
         * 这里会一行行的返回头
         *
         * @param headMap
         * @param context
         */
        @Override
        public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
            headSize = headMap.size();
            headData = headMap;
        }
        @Override
        public void doAfterAllAnalysed(AnalysisContext context) {
            saveData();
            log.info("所有数据解析完成!");
        }
        /**
         * 不是固定的列只能手动处理
         */
        private void saveData() {
            R<List<BcDictionaryVO>> dictionaryR = communityService.listDictionaryByKey(BcDictionaryConstants.FAMILY);
            log.info("开始导入吸毒人员数据");
            log.info("表格总数据:" + list.size());
            if (list.size() == 0) {
                throw new ServiceException("500", "导入数据为空!");
            }
            ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue();
            String key = Constants.DRUG_POPULATION_ERROR_LIST + communityId;
            Map<String,String> dictMap = dictionaryR.getData().stream().collect(Collectors.toMap(BcDictionaryVO::getDictName,BcDictionaryVO::getDictValue));
//        Map<String,Integer> dictMap = new HashMap<>();
//        for(BcDictionaryVO vo : dictionaryR.getData()){
//            dictMap.put(vo.getDictName(),Integer.valueOf(vo.getDictValue()));
//        }
            int index = 2;
            try {
                ArrayList<ComMngPopulationDrugExcelVO> voList = Lists.newArrayList();
//                List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>();
                ArrayList<ComMngPopulationDrugMistakeExcelVO> mistakes = Lists.newArrayList();
                for (Map<Integer, String> oneData : list) {
                    ComMngPopulationDrugExcelVO vo = new ComMngPopulationDrugExcelVO();
                    //姓名和身份证都为空,为空户,无需操作,否则就解析年龄,性别,出生年月日
                    if(StringUtils.isNotEmpty(oneData.get(1)) || StringUtils.isNotEmpty(oneData.get(3))){
                        if(StringUtils.isEmpty(oneData.get(1))){
                            ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                            index++;
                            setDrugMistake(oneData, mistake);
                            mistake.setMistake("名字不可为空,请填写姓名");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setName(oneData.get(1));
                        if(StringUtils.isEmpty(oneData.get(3))){
                            ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                            index++;
                            setDrugMistake(oneData, mistake);
                            mistake.setMistake("身份证号不可为空,请填写身份证");
                            mistakes.add(mistake);
                            continue;
                        }
                        //判断身份证号码位数
                        if(oneData.get(3).length() != 18){
                            ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                            index++;
                            setDrugMistake(oneData, mistake);
                            mistake.setMistake("身份证号位数有误,请检查身份证号码是否正确");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setCardNo(oneData.get(3).toUpperCase());
                        //根据身份证号码解析年龄以及性别
                        //获取用户生日
                        String birthday = vo.getCardNo().substring(6, 14);
                        if(StringUtils.isNotEmpty(birthday)){
                            String year = birthday.substring(0,4);
                            String month = birthday.substring(4,6);
                            String day = birthday.substring(6,8);
                            vo.setBirthday(year + "-" + month + "-" + day);
                        }
//                    //设置用户年龄
//                    vo.setAge(AgeUtils.getAgeFromBirthTime(birthday));
                        //获取用户性别
                        int sex = Integer.parseInt(vo.getCardNo().substring(16, 17));
                        if(sex%2 == 1){
                            vo.setSex(PopulSexEnum.nan.getCode());
                        }else{
                            vo.setSex(PopulSexEnum.nv.getCode());
                        }
                    }
                    if(StringUtils.isNotEmpty(oneData.get(2))){
                        vo.setNation(oneData.get(2));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(4))){
                        vo.setPhone(oneData.get(4));
                    }
                    if(StringUtils.isEmpty(oneData.get(5))){
                        index++;
                        ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                        setDrugMistake(oneData, mistake);
                        mistake.setMistake("街路巷不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setRoad(oneData.get(5));
                    if(StringUtils.isEmpty(oneData.get(6))){
                        index++;
                        ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                        setDrugMistake(oneData, mistake);
                        mistake.setMistake("小区号不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setDoorNo(oneData.get(6).trim());
                    if(StringUtils.isEmpty(oneData.get(7))){
                        index++;
                        ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                        setDrugMistake(oneData, mistake);
                        mistake.setMistake("楼排号不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setFloor(oneData.get(7).trim());
                    if(StringUtils.isEmpty(oneData.get(8))){
                        index++;
                        ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                        setDrugMistake(oneData, mistake);
                        mistake.setMistake("单元号不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setUnitNo(oneData.get(8).trim());
                    if(StringUtils.isEmpty(oneData.get(9))){
                        index++;
                        ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                        setDrugMistake(oneData, mistake);
                        mistake.setMistake("户室不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setHouseNo(oneData.get(9).trim());
                    if(StringUtils.isNotEmpty(oneData.get(10))){
                        Integer isOk = PopulHouseUseEnum.getCodeByName(oneData.get(10));
                        if(isOk.equals(-1)){
                            ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                            index++;
                            setDrugMistake(oneData, mistake);
                            mistake.setMistake("您填写的是否租住有误");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setIsRent(isOk);
                    }else {
                        vo.setIsRent(PopulHouseUseEnum.getCodeByName("否"));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(11))){
                        Integer isOk = PopulHouseStatusEnum.getCodeByName(oneData.get(11).trim());
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                            setDrugMistake(oneData, mistake);
                            mistake.setMistake("您填写的房屋状态有误");
                            mistakes.add(mistake);
                            continue;
                        }
                    vo.setHouseStatus(isOk);
                    }
                    if(StringUtils.isNotEmpty(oneData.get(12))){
                        Integer isOk = PopulHousePurposeEnum.getCodeByName(oneData.get(12).trim());
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                            setDrugMistake(oneData, mistake);
                            mistake.setMistake("您填写的房屋用途有误");
                            mistakes.add(mistake);
                            continue;
                        }
                    vo.setHousePurpose(PopulHousePurposeEnum.getCodeByName(oneData.get(12).trim()));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(13))){
                        Integer isOk = PopulHouseControlStatusEnum.getCodeByName(oneData.get(13));
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                            setDrugMistake(oneData, mistake);
                            mistake.setMistake("您填写的管控状态有误");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setControlStatus(isOk);
                    }
                    if(StringUtils.isNotEmpty(oneData.get(14))){
                        Integer isOk = PopulOutOrLocalEnum.getCodeByName(oneData.get(14));
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                            setDrugMistake(oneData, mistake);
                            mistake.setMistake("您填写的本地/外地有误");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setOutOrLocal(isOk);
                    }else {
                        vo.setOutOrLocal(PopulOutOrLocalEnum.getCodeByName("本地"));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(15))){
                        vo.setCensusRegister(oneData.get(15).trim());
                    }
                    if(StringUtils.isNotEmpty(oneData.get(16))){
                        vo.setRemark(oneData.get(16).trim());
                    }
                    vo.getUserTagStr().add("吸毒人员");
                    for (int i = 17; i < headSize; i++) {
                        if (oneData.get(i) != null && oneData.get(i).equals("是")) {
                            vo.getUserTagStr().add(headData.get(i).substring(0,headData.get(i).indexOf("(")));
                        }
                    }
                    //将重复的数据进行MD5加密实现去重
                    String distinct = vo.getName() + vo.getCardNo() + vo.getRoad() + vo.getDoorNo() + vo.getFloor() + vo.getUnitNo() + vo.getHouseNo();
                    try {
                        String distinctPass = PayUtil.MD5(distinct);
                        if(StringUtils.isNotEmpty(distinctPass)){
                            vo.setDistinctPass(distinctPass);
                        }
                    }catch (Exception e){
                        log.error("组装MD5加密字段失败,数据表格行数:" + index);
                        continue;
                    }
                    voList.add(vo);
                    index++;
                }
                //客户需要暂时注释,等客户处理完成需要恢复
//            if(populationImportErrorVOList.isEmpty()){
//                R r = communityService.listSavePopulationServeExcelVO(voList, communityId);
//                if (!R.isOk(r)) {
//                    throw new ServiceException(r.getMsg());
//                }
//            }else{
//                throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList));
//            }
                //根据list中的IdCard城市来去重
                List<ComMngPopulationDrugExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationDrugExcelVO::getDistinctPass)).collect(Collectors.toList());
                log.info("开始进入业务层处理逻辑");
                R r = communityService.listSavePopulationDrugExcelVO(newVoList, communityId);
                log.info("业务层处理逻辑完成");
                if (!R.isOk(r)) {
                    log.info("业务层处理成功");
                    List<ComMngPopulationDrugMistakeExcelVO> list = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComMngPopulationDrugMistakeExcelVO.class);
//                    String errMsg = r.getMsg();
//                    List<ComMngPopulationImportErrorVO> errorList = JSON.parseArray(errMsg,ComMngPopulationImportErrorVO.class);
//                    if(!errorList.isEmpty()){
//                        populationImportErrorVOList.addAll(errorList);
//                    }
                    mistakes.addAll(list);
                    log.info("将错误数据存入redis中");
                    valueOperations.set(key,JSONArray.toJSONString(mistakes),1, TimeUnit.HOURS);
                    log.info("将错误数据存入redis中成功");
                    throw new ServiceException("500", key);
                }else{
                    log.info("业务层处理逻辑失败");
                    if(!mistakes.isEmpty()){
                        log.info("业务层处理逻辑失败,将错误数据缓存到redis中");
                        valueOperations.set(key,JSONArray.toJSONString(mistakes),1, TimeUnit.HOURS);
                        log.info("业务层处理逻辑失败,将错误数据缓存到redis中成功");
                        throw new ServiceException("500", key);
                    }
                }
            } catch (NumberFormatException e) {
                log.info("处理数据时失败");
                e.printStackTrace();
//                List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>();
//                ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
//                importErrorVO.setErrorPosition("第" + index + "行");
//                importErrorVO.setErrorMsg("数据格式有误,请检查文档内数据");
//                populationImportErrorVOList.add(importErrorVO);
                log.error("数据格式有误,第" + index + "行");
                throw new ServiceException("500", "导入失败111");
            }
        }
        private void setMistake(Map<Integer, String> map, ComMngPopulationMistakeExcelVO vo){
            vo.setName(map.get(0));
            vo.setCardNo(map.get(1));
            vo.setNation(map.get(2));
            vo.setPoliticalOutlook(map.get(3));
            vo.setIsRent(map.get(4));
            vo.setRelation(map.get(5));
            vo.setRoad(map.get(6));
            vo.setDoorNo(map.get(7));
            vo.setFloor(map.get(8));
            vo.setUnitNo(map.get(9));
            vo.setHouseNo(map.get(10));
            vo.setBuildPurpose(map.get(11));
            vo.setBuildArea(map.get(12));
            vo.setHouseStatus(map.get(13));
            vo.setHousePurpose(map.get(14));
            vo.setControlStatus(map.get(15));
            vo.setPhone(map.get(16));
            vo.setNativePlace(map.get(17));
            vo.setCultureLevel(map.get(18));
            vo.setMarriage(map.get(19));
            vo.setHealthy(map.get(20));
            vo.setBloodType(map.get(21));
            vo.setReligion(map.get(22));
            vo.setProfession(map.get(23));
            vo.setWorkCompany(map.get(24));
            vo.setOutOrLocal(map.get(25));
            vo.setCensusRegister(map.get(26));
            vo.setResidence(map.get(27));
//        vo.setAddress(map.get(28));
            vo.setPersonType(map.get(28));
            vo.setCountry(map.get(29));
            vo.setStringOfDeparture(map.get(30));
            vo.setPersonStatus(map.get(31));
            vo.setMonthlyIncome(map.get(32));
            vo.setFamilyStatus(map.get(33));
            vo.setGoalInChina(map.get(34));
            vo.setStringOfArrival(map.get(35));
            vo.setRemark(map.get(36));
            vo.setIdCardPositive(map.get(37));
            vo.setIdCardBack(map.get(38));
            vo.setHouseHold(map.get(39));
            vo.setDeath(map.get(40));
        }
    private void setDrugMistake(Map<Integer, String> map, ComMngPopulationDrugMistakeExcelVO vo){
        vo.setName(map.get(1));
        vo.setCardNo(map.get(3));
        vo.setNation(map.get(2));
        vo.setPhone(map.get(4));
        vo.setRoad(map.get(5));
        vo.setDoorNo(map.get(6));
        vo.setFloor(map.get(7));
        vo.setUnitNo(map.get(8));
        vo.setHouseNo(map.get(9));
        vo.setIsRent(map.get(10));
        vo.setHouseStatus(map.get(11));
        vo.setHousePurpose(map.get(12));
        vo.setControlStatus(map.get(13));
        vo.setOutOrLocal(map.get(14));
        vo.setCensusRegister(map.get(15));
        vo.setRemark(map.get(16));
    }
        private R mistakeExportPopulation(List<ComMngPopulationMistakeExcelVO> vo) {
            //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
            String ftpUrl = "/mnt/data/web/excel/";
            String name = "实有人口错误数据.xlsx";
            try {
                SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
                sftp.login();
                boolean existDir = sftp.isExistDir(ftpUrl + name);
                if (!existDir) {
                    String property = System.getProperty("user.dir");
                    String fileName = property + File.separator + name;
                    // 这里 需要指定写用哪个class去写
                    ExcelWriter excelWriter = null;
                    InputStream inputStream = null;
                    try {
                        excelWriter = EasyExcel.write(fileName, ComMngPopulationMistakeExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                        WriteSheet writeSheet = EasyExcel.writerSheet("实有人口错误数据").build();
                        excelWriter.write(vo, writeSheet);
                        excelWriter.finish();
                        File file = new File(fileName);
                        inputStream = new FileInputStream(file);
                        sftp.uploadMore(ftpUrl, name, inputStream);
                        sftp.logout();
                        inputStream.close();
                        String absolutePath = file.getAbsolutePath();
                        boolean delete = file.delete();
                        log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                    } finally {
                        // 千万别忘记finish 会帮忙关闭流
                        if (inputStream != null) {
                            inputStream.close();
                        }
                        if (excelWriter != null) {
                            excelWriter.finish();
                        }
                    }
                }
                return R.ok(excelUrl + name);
            } catch (Exception e) {
                e.printStackTrace();
                log.error("文件传输失败【{}】", e.getMessage());
                return R.fail();
            }
        }
        private String convertMarriage(String ma) {
            if(Objects.equals("已",ma) || Objects.equals("一",ma)){
                ma = "已婚";
            }else if(Objects.equals("未",ma) || Objects.equals("未婚婚",ma)){
                ma = "未婚";
            }else if(Objects.equals("初",ma)){
                ma = "初婚";
            }else if(Objects.equals("再",ma)){
                ma = "再婚";
            }else if(Objects.equals("复",ma)){
                ma = "复婚";
            }else if(Objects.equals("丧",ma) || Objects.equals("丧偶偶",ma)){
                ma = "丧偶";
            }else if(Objects.equals("离",ma) || Objects.equals("离异",ma) || Objects.equals("离异婚",ma)){
                ma = "离婚";
            }else if(Objects.equals("分",ma)){
                ma = "分居";
            }
            return ma;
        }
        private String convertRelation(String ra) {
            if(ra.contains("户主")){
                ra = "户主";
            }else if(Objects.equals(ra,"女儿")){
                ra = "女";
            }else if(Objects.equals(ra,"儿子") || Objects.equals(ra,"儿")){
                ra = "子";
            }else if(Objects.equals(ra,"大女")){
                ra = "长女";
            }else if(Objects.equals(ra,"二女") || Objects.equals(ra,"此女")){
                ra = "次女";
            }else if(Objects.equals(ra,"二子")){
                ra = "次子";
            }else if(Objects.equals(ra,"长男") || ra.contains("长子")){
                ra = "长子";
            }else if(Objects.equals(ra,"非亲属") || ra.contains("女友")  || ra.contains("女朋友")
                    || ra.contains("男友") || ra.contains("男朋友")){
                ra = "其他";
            }else if(Objects.equals(ra,"姐")){
                ra = "姐姐";
            }else if(Objects.equals(ra,"户主")){
                ra = "本人";
            }else if(Objects.equals(ra,"妻子") || Objects.equals(ra,"媳妇")){
                ra = "妻";
            }else if(Objects.equals(ra,"哥") || Objects.equals(ra,"哥哥")){
                ra = "兄";
            }else if(Objects.equals(ra,"丈夫")){
                ra = "夫";
            }else if(Objects.equals(ra,"丈母娘")){
                ra = "岳母";
            }else if(Objects.equals(ra,"继子") || Objects.equals(ra,"养子")){
                ra = "养子或继子";
            }else if(Objects.equals(ra,"继女") || Objects.equals(ra,"养女")){
                ra = "养女或继女";
            }else if(ra.contains("儿媳")||ra.contains("长媳")){
                ra = "儿媳";
            }else if(Objects.equals(ra,"三姨") || Objects.equals(ra,"姨姨")){
                ra = "姨母";
            }else if(Objects.equals(ra,"二外孙女")){
                ra = "外孙女";
            }else if(Objects.equals(ra,"外孙")){
                ra = "外孙子";
            }else if(Objects.equals(ra,"侄儿")){
                ra = "侄子";
            }else if(ra.contains("表")){
                ra = "表兄弟、表姐妹";
            }else if(Objects.equals(ra,"继父") || Objects.equals(ra,"养父")){
                ra = "继父或养父";
            }else if(Objects.equals(ra,"父")){
                ra = "父亲";
            }else if(Objects.equals(ra,"弟弟")){
                ra = "弟";
            }else if(Objects.equals(ra,"孙")){
                ra = "孙子";
            }else if(Objects.equals(ra,"孙媳妇") || Objects.equals(ra,"外孙媳妇")){
                ra = "孙媳妇或外孙媳妇";
            }else if(Objects.equals(ra,"妹")){
                ra = "妹妹";
            }else if(Objects.equals(ra,"祖父母")){
                ra = "祖父母或外祖父母";
            }else if(Objects.equals(ra,"姐妹") || Objects.equals(ra,"兄弟")){
                ra = "兄弟姐妹";
            }else if(Objects.equals(ra,"其他姐妹") || Objects.equals(ra,"其他兄弟")){
                ra = "其他兄弟姐妹";
            }else if(Objects.equals(ra,"奶奶")){
                ra = "祖母";
            }else if(Objects.equals(ra,"爷爷")){
                ra = "祖父";
            }else if(Objects.equals(ra,"爷爷")){
                ra = "祖父";
            }else if(ra.contains("堂")){
                ra = "堂兄弟、堂姐妹";
            }
            return ra;
        }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationMajorExcelListen.java
New file
@@ -0,0 +1,525 @@
package com.panzhihua.common.listen;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists;
import com.panzhihua.common.constants.BcDictionaryConstants;
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.enums.*;
import com.panzhihua.common.excel.CustomSheetWriteHandler;
import com.panzhihua.common.exceptions.ServiceException;
import com.panzhihua.common.model.vos.BcDictionaryVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComMngPopulationMajorExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationMajorMistakeExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationMistakeExcelVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.utlis.ListUtils;
import com.panzhihua.common.utlis.PayUtil;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.common.utlis.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
 * @description: 重精人员导入监听
 * @author: txb
 */
@Slf4j
public class ComMngPopulationMajorExcelListen extends AnalysisEventListener<Map<Integer, String>> {
    private CommunityService communityService;
    private Long communityId;
    private static int headSize = 0;
    private Map<Integer, String> headData;
    private String userName;
    // FTP 登录密码
    private String password;
    // FTP 服务器地址IP地址
    private String host;
    // FTP 端口
    private int port;
    private String excelUrl;
    private StringRedisTemplate stringRedisTemplate;
    public static String loadUrl;
    public ComMngPopulationMajorExcelListen(CommunityService communityService, Long communityId, String userName, String password, String host, int port, String excelUrl, StringRedisTemplate stringRedisTemplate) {
            this.communityService = communityService;
            this.communityId = communityId;
            this.userName = userName;
            this.password = password;
            this.host = host;
            this.port = port;
            this.excelUrl = excelUrl;
            this.stringRedisTemplate = stringRedisTemplate;
        }
        /**
         * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收
         */
        private static final int BATCH_COUNT = 5000;
        List<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>();
        @Override
        public void invoke(Map<Integer, String> data, AnalysisContext context) {
            list.add(data);
            if (list.size() >= BATCH_COUNT) {
                saveData();
                list.clear();
            }
        }
        /**
         * 这里会一行行的返回头
         *
         * @param headMap
         * @param context
         */
        @Override
        public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
            headSize = headMap.size();
            headData = headMap;
        }
        @Override
        public void doAfterAllAnalysed(AnalysisContext context) {
            saveData();
            log.info("所有数据解析完成!");
        }
        /**
         * 不是固定的列只能手动处理
         */
        private void saveData() {
            R<List<BcDictionaryVO>> dictionaryR = communityService.listDictionaryByKey(BcDictionaryConstants.FAMILY);
            log.info("开始导入吸毒人员数据");
            log.info("表格总数据:" + list.size());
            if (list.size() == 0) {
                throw new ServiceException("500", "导入数据为空!");
            }
            ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue();
            String key = Constants.Major_POPULATION_ERROR_LIST + communityId;
            Map<String,String> dictMap = dictionaryR.getData().stream().collect(Collectors.toMap(BcDictionaryVO::getDictName,BcDictionaryVO::getDictValue));
//        Map<String,Integer> dictMap = new HashMap<>();
//        for(BcDictionaryVO vo : dictionaryR.getData()){
//            dictMap.put(vo.getDictName(),Integer.valueOf(vo.getDictValue()));
//        }
            int index = 2;
            try {
                ArrayList<ComMngPopulationMajorExcelVO> voList = Lists.newArrayList();
//                List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>();
                ArrayList<ComMngPopulationMajorMistakeExcelVO> mistakes = Lists.newArrayList();
                for (Map<Integer, String> oneData : list) {
                    ComMngPopulationMajorExcelVO vo = new ComMngPopulationMajorExcelVO();
                    if (StringUtils.isNotEmpty(oneData.get(0))){
                        vo.setSerialNumber(oneData.get(0));
                    }
                    //姓名和身份证都为空,为空户,无需操作,否则就解析年龄,性别,出生年月日
                    if(StringUtils.isNotEmpty(oneData.get(1)) || StringUtils.isNotEmpty(oneData.get(2))){
                        if(StringUtils.isEmpty(oneData.get(1))){
                            ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                            index++;
                            setMistake(oneData, mistake);
                            mistake.setMistake("名字不可为空,请填写姓名");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setName(oneData.get(1));
                        if(StringUtils.isEmpty(oneData.get(2))){
                            ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                            index++;
                            setMistake(oneData, mistake);
                            mistake.setMistake("身份证号不可为空,请填写身份证");
                            mistakes.add(mistake);
                            continue;
                        }
                        //判断身份证号码位数
                        if(oneData.get(2).length() != 18){
                            ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                            index++;
                            setMistake(oneData, mistake);
                            mistake.setMistake("身份证号位数有误,请检查身份证号码是否正确");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setCardNo(oneData.get(2).toUpperCase());
                        //根据身份证号码解析年龄以及性别
                        //获取用户生日
                        String birthday = vo.getCardNo().substring(6, 14);
                        if(StringUtils.isNotEmpty(birthday)){
                            String year = birthday.substring(0,4);
                            String month = birthday.substring(4,6);
                            String day = birthday.substring(6,8);
                            vo.setBirthday(year + "-" + month + "-" + day);
                        }
//                    //设置用户年龄
//                    vo.setAge(AgeUtils.getAgeFromBirthTime(birthday));
                        //获取用户性别
                        int sex = Integer.parseInt(vo.getCardNo().substring(16, 17));
                        if(sex%2 == 1){
                            vo.setSex(PopulSexEnum.nan.getCode());
                        }else{
                            vo.setSex(PopulSexEnum.nv.getCode());
                        }
                    }
                    if(StringUtils.isEmpty(oneData.get(3))){
                        index++;
                        ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("街路巷不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setRoad(oneData.get(3));
                    if(StringUtils.isEmpty(oneData.get(4))){
                        index++;
                        ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("小区号不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setDoorNo(oneData.get(4).trim());
                    if(StringUtils.isEmpty(oneData.get(5))){
                        index++;
                        ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("楼排号不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setFloor(oneData.get(5).trim());
                    if(StringUtils.isEmpty(oneData.get(6))){
                        index++;
                        ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("单元号不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setUnitNo(oneData.get(6).trim());
                    if(StringUtils.isEmpty(oneData.get(7))){
                        index++;
                        ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                        setMistake(oneData, mistake);
                        mistake.setMistake("户室不可为空");
                        mistakes.add(mistake);
                        continue;
                    }
                    vo.setHouseNo(oneData.get(7).trim());
                    if(StringUtils.isNotEmpty(oneData.get(8))){
                        Integer isOk = PopulHouseUseEnum.getCodeByName(oneData.get(8));
                        if(isOk.equals(-1)){
                            ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                            index++;
                            setMistake(oneData, mistake);
                            mistake.setMistake("您填写的是否租住有误");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setIsRent(isOk);
                    }else {
                        vo.setIsRent(PopulHouseUseEnum.getCodeByName("否"));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(9))){
                        Integer isOk = PopulHouseStatusEnum.getCodeByName(oneData.get(9).trim());
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                            setMistake(oneData, mistake);
                            mistake.setMistake("您填写的房屋状态有误");
                            mistakes.add(mistake);
                            continue;
                        }
                    vo.setHouseStatus(isOk);
                    }
                    if(StringUtils.isNotEmpty(oneData.get(10))){
                        Integer isOk = PopulHousePurposeEnum.getCodeByName(oneData.get(10).trim());
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                            setMistake(oneData, mistake);
                            mistake.setMistake("您填写的房屋用途有误");
                            mistakes.add(mistake);
                            continue;
                        }
                    vo.setHousePurpose(PopulHousePurposeEnum.getCodeByName(oneData.get(10).trim()));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(11))){
                        Integer isOk = PopulHouseControlStatusEnum.getCodeByName(oneData.get(11));
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                            setMistake(oneData, mistake);
                            mistake.setMistake("您填写的管控状态有误");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setControlStatus(isOk);
                    }
                    if(StringUtils.isNotEmpty(oneData.get(12))){
                        Integer isOk = PopulOutOrLocalEnum.getCodeByName(oneData.get(12));
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                            setMistake(oneData, mistake);
                            mistake.setMistake("您填写的本地/外地有误");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setOutOrLocal(isOk);
                    }else {
                        vo.setOutOrLocal(PopulOutOrLocalEnum.getCodeByName("本地"));
                    }
                    if(StringUtils.isNotEmpty(oneData.get(13))){
                        vo.setCensusRegister(oneData.get(13).trim());
                    }
                    if(StringUtils.isEmpty(oneData.get(14))){
                        Integer isOk = PopulCultureLevelEnum.getCodeByName(oneData.get(14));
                        if(isOk.equals(-1)){
                            index++;
                            ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                            setMistake(oneData, mistake);
                            mistake.setMistake("您填写的文化程度有误");
                            mistakes.add(mistake);
                            continue;
                        }
                        vo.setOutOrLocal(isOk);
                    }
                    if(StringUtils.isNotEmpty(oneData.get(15))){
                        vo.setEconomicCondition(oneData.get(15).trim());
                    }
                    if(StringUtils.isNotEmpty(oneData.get(16))){
                        vo.setGuarDian(oneData.get(16).trim());
                    }
                    if(StringUtils.isNotEmpty(oneData.get(17))){
                        vo.setGuarDianPhone(oneData.get(17).trim());
                    }
                    if(StringUtils.isNotEmpty(oneData.get(18))){
                        vo.setPatientRelation(oneData.get(18).trim());
                    }
                    if(StringUtils.isNotEmpty(oneData.get(19))){
                        vo.setDiagnose(oneData.get(19).trim());
                    }
                    if(StringUtils.isNotEmpty(oneData.get(20))){
                        vo.setOther(oneData.get(20).trim());
                    }
                    vo.getUserTagStr().add("重精人员");
                    for (int i = 21; i < headSize; i++) {
                        if (oneData.get(i) != null && oneData.get(i).equals("是")) {
                            vo.getUserTagStr().add(headData.get(i).substring(0,headData.get(i).indexOf("(")));
                        }
                    }
                    //将重复的数据进行MD5加密实现去重
                    String distinct = vo.getName() + vo.getCardNo() + vo.getRoad() + vo.getDoorNo() + vo.getFloor() + vo.getUnitNo() + vo.getHouseNo();
                    try {
                        String distinctPass = PayUtil.MD5(distinct);
                        if(StringUtils.isNotEmpty(distinctPass)){
                            vo.setDistinctPass(distinctPass);
                        }
                    }catch (Exception e){
                        log.error("组装MD5加密字段失败,数据表格行数:" + index);
                        continue;
                    }
                    voList.add(vo);
                    index++;
                }
                //客户需要暂时注释,等客户处理完成需要恢复
//            if(populationImportErrorVOList.isEmpty()){
//                R r = communityService.listSavePopulationServeExcelVO(voList, communityId);
//                if (!R.isOk(r)) {
//                    throw new ServiceException(r.getMsg());
//                }
//            }else{
//                throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList));
//            }
                //根据list中的IdCard城市来去重
                List<ComMngPopulationMajorExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngPopulationMajorExcelVO::getDistinctPass)).collect(Collectors.toList());
                log.info("开始进入业务层处理逻辑");
                R r = communityService.listSavePopulationMajorExcelVO(newVoList, communityId);
                log.info("业务层处理逻辑完成");
                if (!R.isOk(r)) {
                    log.info("业务层处理成功");
                    List<ComMngPopulationMajorMistakeExcelVO> list = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), ComMngPopulationMajorMistakeExcelVO.class);
//                    String errMsg = r.getMsg();
//                    List<ComMngPopulationImportErrorVO> errorList = JSON.parseArray(errMsg,ComMngPopulationImportErrorVO.class);
//                    if(!errorList.isEmpty()){
//                        populationImportErrorVOList.addAll(errorList);
//                    }
                    mistakes.addAll(list);
                    log.info("将错误数据存入redis中");
                    valueOperations.set(key,JSONArray.toJSONString(mistakes),1, TimeUnit.HOURS);
                    log.info("将错误数据存入redis中成功");
                    throw new ServiceException("500", key);
                }else{
                    log.info("业务层处理逻辑失败");
                    if(!mistakes.isEmpty()){
                        log.info("业务层处理逻辑失败,将错误数据缓存到redis中");
                        valueOperations.set(key,JSONArray.toJSONString(mistakes),1, TimeUnit.HOURS);
                        log.info("业务层处理逻辑失败,将错误数据缓存到redis中成功");
                        throw new ServiceException("500", key);
                    }
                }
            } catch (NumberFormatException e) {
                log.info("处理数据时失败");
                e.printStackTrace();
//                List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>();
//                ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
//                importErrorVO.setErrorPosition("第" + index + "行");
//                importErrorVO.setErrorMsg("数据格式有误,请检查文档内数据");
//                populationImportErrorVOList.add(importErrorVO);
                log.error("数据格式有误,第" + index + "行");
                throw new ServiceException("500", "导入失败111");
            }
        }
    private void setMistake(Map<Integer, String> map, ComMngPopulationMajorMistakeExcelVO vo){
        vo.setName(map.get(1));
        vo.setCardNo(map.get(2));
        vo.setRoad(map.get(3));
        vo.setDoorNo(map.get(4));
        vo.setFloor(map.get(5));
        vo.setUnitNo(map.get(6));
        vo.setHouseNo(map.get(7));
        vo.setIsRent(map.get(8));
        vo.setHouseStatus(map.get(9));
        vo.setHousePurpose(map.get(10));
        vo.setControlStatus(map.get(11));
        vo.setOutOrLocal(map.get(12));
        vo.setCensusRegister(map.get(13));
        vo.setCultureLevel(map.get(14));
        vo.setEconomicCondition(map.get(15));
        vo.setGuarDian(map.get(16));
        vo.setGuarDianPhone(map.get(17));
        vo.setPatientRelation(map.get(18));
        vo.setDiagnose(map.get(19));
        vo.setOther(map.get(20));
    }
        private String convertMarriage(String ma) {
            if(Objects.equals("已",ma) || Objects.equals("一",ma)){
                ma = "已婚";
            }else if(Objects.equals("未",ma) || Objects.equals("未婚婚",ma)){
                ma = "未婚";
            }else if(Objects.equals("初",ma)){
                ma = "初婚";
            }else if(Objects.equals("再",ma)){
                ma = "再婚";
            }else if(Objects.equals("复",ma)){
                ma = "复婚";
            }else if(Objects.equals("丧",ma) || Objects.equals("丧偶偶",ma)){
                ma = "丧偶";
            }else if(Objects.equals("离",ma) || Objects.equals("离异",ma) || Objects.equals("离异婚",ma)){
                ma = "离婚";
            }else if(Objects.equals("分",ma)){
                ma = "分居";
            }
            return ma;
        }
        private String convertRelation(String ra) {
            if(ra.contains("户主")){
                ra = "户主";
            }else if(Objects.equals(ra,"女儿")){
                ra = "女";
            }else if(Objects.equals(ra,"儿子") || Objects.equals(ra,"儿")){
                ra = "子";
            }else if(Objects.equals(ra,"大女")){
                ra = "长女";
            }else if(Objects.equals(ra,"二女") || Objects.equals(ra,"此女")){
                ra = "次女";
            }else if(Objects.equals(ra,"二子")){
                ra = "次子";
            }else if(Objects.equals(ra,"长男") || ra.contains("长子")){
                ra = "长子";
            }else if(Objects.equals(ra,"非亲属") || ra.contains("女友")  || ra.contains("女朋友")
                    || ra.contains("男友") || ra.contains("男朋友")){
                ra = "其他";
            }else if(Objects.equals(ra,"姐")){
                ra = "姐姐";
            }else if(Objects.equals(ra,"户主")){
                ra = "本人";
            }else if(Objects.equals(ra,"妻子") || Objects.equals(ra,"媳妇")){
                ra = "妻";
            }else if(Objects.equals(ra,"哥") || Objects.equals(ra,"哥哥")){
                ra = "兄";
            }else if(Objects.equals(ra,"丈夫")){
                ra = "夫";
            }else if(Objects.equals(ra,"丈母娘")){
                ra = "岳母";
            }else if(Objects.equals(ra,"继子") || Objects.equals(ra,"养子")){
                ra = "养子或继子";
            }else if(Objects.equals(ra,"继女") || Objects.equals(ra,"养女")){
                ra = "养女或继女";
            }else if(ra.contains("儿媳")||ra.contains("长媳")){
                ra = "儿媳";
            }else if(Objects.equals(ra,"三姨") || Objects.equals(ra,"姨姨")){
                ra = "姨母";
            }else if(Objects.equals(ra,"二外孙女")){
                ra = "外孙女";
            }else if(Objects.equals(ra,"外孙")){
                ra = "外孙子";
            }else if(Objects.equals(ra,"侄儿")){
                ra = "侄子";
            }else if(ra.contains("表")){
                ra = "表兄弟、表姐妹";
            }else if(Objects.equals(ra,"继父") || Objects.equals(ra,"养父")){
                ra = "继父或养父";
            }else if(Objects.equals(ra,"父")){
                ra = "父亲";
            }else if(Objects.equals(ra,"弟弟")){
                ra = "弟";
            }else if(Objects.equals(ra,"孙")){
                ra = "孙子";
            }else if(Objects.equals(ra,"孙媳妇") || Objects.equals(ra,"外孙媳妇")){
                ra = "孙媳妇或外孙媳妇";
            }else if(Objects.equals(ra,"妹")){
                ra = "妹妹";
            }else if(Objects.equals(ra,"祖父母")){
                ra = "祖父母或外祖父母";
            }else if(Objects.equals(ra,"姐妹") || Objects.equals(ra,"兄弟")){
                ra = "兄弟姐妹";
            }else if(Objects.equals(ra,"其他姐妹") || Objects.equals(ra,"其他兄弟")){
                ra = "其他兄弟姐妹";
            }else if(Objects.equals(ra,"奶奶")){
                ra = "祖母";
            }else if(Objects.equals(ra,"爷爷")){
                ra = "祖父";
            }else if(Objects.equals(ra,"爷爷")){
                ra = "祖父";
            }else if(ra.contains("堂")){
                ra = "堂兄弟、堂姐妹";
            }
            return ra;
        }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComSwRotaExcelListen.java
@@ -36,6 +36,9 @@
    @Override
    public void invoke(ComSwRotaExcelVO comSwRotaExcelVO, AnalysisContext analysisContext) {
        list.add(comSwRotaExcelVO);
        if (list.size() == 0) {
            throw new ServiceException("500", "导入数据为空!");
        }
        // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
        if(list.size() >= BATCH_COUNT){
            log.info("excel导入数据【{}】", JSONObject.toJSONString(list));
@@ -51,6 +54,9 @@
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        log.info("excel导入数据【{}】", JSONObject.toJSONString(list));
        if (list.size() == 0) {
            throw new ServiceException("500", "导入数据为空!");
        }
        R r = this.communityService.listSaveSwRotaExcelVO(list,this.communityId);//确保最后遗留的数据保存在数据库中
        if (!R.isOk(r)) {
            throw new ServiceException(r.getMsg());
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/wx/TemplateData.java
New file
@@ -0,0 +1,17 @@
package com.panzhihua.common.model.dtos.wx;
import lombok.Data;
@Data
public class TemplateData {
    private String value;
    public TemplateData(String value){
        this.value = value;
    }
    public TemplateData(){
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/wx/TemplateParam.java
New file
@@ -0,0 +1,22 @@
package com.panzhihua.common.model.dtos.wx;
import lombok.Data;
@Data
public class TemplateParam {
    private String key;
    private String value;
    public TemplateParam(String key,String value){
        this.key=key;
        this.value=value;
    }
    public TemplateParam(){
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/wx/WxSubscribeDTO.java
New file
@@ -0,0 +1,60 @@
package com.panzhihua.common.model.dtos.wx;
import com.panzhihua.common.utlis.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@ApiModel("微信订阅消息请求参数")
@Data
public class WxSubscribeDTO {
    @ApiModelProperty("用户在小程序的openid")
    private String touser;
    @ApiModelProperty("所需下发的订阅模板id")
    private String template_id;
    @ApiModelProperty("点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。")
    private String page;
    @ApiModelProperty("模板内容,格式形如 { \"key1\": { \"value\": any }, \"key2\": { \"value\": any } }")
    private Object data;
    @ApiModelProperty("跳转小程序类型:developer为开发版;trial为体验版;formal为正式版;默认为正式版")
    private String miniprogram_state;
    @ApiModelProperty("进入小程序查看”的语言类型,支持zh_CN(简体中文)、en_US(英文)、zh_HK(繁体中文)、zh_TW(繁体中文),默认为zh_CN")
    private String lang;
    private List<TemplateParam> templateParamList;
    public String toJSON() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("{");
        buffer.append(String.format("\"touser\":\"%s\"", this.touser)).append(",");
        buffer.append(String.format("\"template_id\":\"%s\"", this.template_id)).append(",");
        if(StringUtils.isNotEmpty(this.page)){
            buffer.append(String.format("\"page\":\"%s\"", this.page)).append(",");
        }
        if(StringUtils.isNotEmpty(this.miniprogram_state)){
            buffer.append(String.format("\"miniprogram_state\":\"%s\"", this.miniprogram_state)).append(",");
        }
        buffer.append("\"data\":{");
        TemplateParam param = null;
        for (int i = 0; i < this.templateParamList.size(); i++) {
            param = templateParamList.get(i);
            // 判断是否追加逗号
            if (i < this.templateParamList.size() - 1) {
                buffer.append(String.format("\"%s\": {\"value\":\"%s\"},", param.getKey(), param.getValue()));
            } else {
                buffer.append(String.format("\"%s\": {\"value\":\"%s\"}", param.getKey(), param.getValue()));
            }
        }
        buffer.append("}");
        buffer.append("}");
        return buffer.toString();
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ActivitySignVO.java
@@ -36,6 +36,8 @@
    private Integer type;
    @ApiModelProperty("人员主键")
    private Long userId;
    @ApiModelProperty("用户openid")
    private String openid;
    @ApiModelProperty(value = "分页-当前页数", example = "1")
    private Long pageNum = 1L;
    @ApiModelProperty(value = "分页-每页记录数", example = "10")
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationCorrectExcelVO.java
New file
@@ -0,0 +1,117 @@
package com.panzhihua.common.model.vos.community;
import com.alibaba.excel.annotation.ExcelProperty;
import com.google.common.collect.Lists;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptClass;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptField;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * @description: 批量导入社区矫正人员
 * @author: txb
 */
@Data
@EncryptDecryptClass
public class ComMngPopulationCorrectExcelVO implements Serializable {
    @ExcelProperty(value = "序号", index = 0)
    private String serialNumber;
    @ExcelProperty(value = "姓名", index = 1)
    private String name;
    @ExcelProperty(value = "身份证号码", index = 3)
    @EncryptDecryptField
    private String cardNo;
    @ExcelProperty(value = "民族", index = 2)
    private String nation;
    @ExcelProperty(value = "联系电话", index = 4)
    private String phone;
    @ExcelProperty(value = "是否租住", index = 10)
    private Integer isRent;
    @ExcelProperty(value = "街/路/巷", index = 5)
    private String road;
    @ExcelProperty(value = "小区号", index = 6)
    private String doorNo;
    @ExcelProperty(value = "楼排号", index = 7)
    private String floor;
    @ExcelProperty(value = "单元号", index = 8)
    private String unitNo;
    @ExcelProperty(value = "户室(房间号)", index = 9)
    private String houseNo;
    @ExcelProperty(value = "房屋状态(1.自住 2.租住 3.其他)", index = 11)
    private Integer houseStatus;
    @ExcelProperty(value = "房屋用途(1.住宅 2.公寓 3.宿舍 4.仓库 5.其他)", index = 12)
    private Integer housePurpose;
    @ExcelProperty(value = "管控状态(1.常规 2.关注 3.管控)", index = 13)
    private Integer controlStatus;
    @ExcelProperty(value = "外地/本地(1.本地  2.外地)", index = 14)
    private Integer outOrLocal;
    @ExcelProperty(value = "户口所在地", index = 15)
    private String censusRegister;
    @ExcelProperty(value = "矫正开始时间", index = 16)
    private Date correctBegin;
    @ExcelProperty(value = "矫正结束时间", index = 17)
    private Date correctEnd;
    @ExcelProperty(value = "矫正类型", index = 18)
    private String correctType;
    @ExcelProperty(value = "罪名", index = 19)
    private String charges;
    @ExcelProperty(value = "罪名", index = 20)
    private String remark;
    /**
     * 去重字段,使用(姓名+身份证号+街路巷+小区号+楼牌号+单元号+户室)组合字段进行MD5加密实现去重
     */
    private String distinctPass;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 性别(1.男  2.女)
     */
    private Integer sex;
    /**
     * 出生年月日
     */
    private String birthday;
    /**
     * 扩展字段用逗号隔开
     */
    private List<String> userTagStr = Lists.newArrayList();
    private Long houseId;
    /**
     * 地址
     */
    private String address;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationCorrectMistakeExcelVO.java
New file
@@ -0,0 +1,84 @@
package com.panzhihua.common.model.vos.community;
import com.alibaba.excel.annotation.ExcelProperty;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptClass;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptField;
import lombok.Data;
import java.io.Serializable;
/**
 * @description: 批量导入社区矫正人员
 * @author: txb
 */
@Data
@EncryptDecryptClass
public class ComMngPopulationCorrectMistakeExcelVO implements Serializable {
    @ExcelProperty(value = "序号", index = 0)
    private String serialNumber;
    @ExcelProperty(value = "姓名", index = 1)
    private String name;
    @ExcelProperty(value = "身份证号码", index = 3)
    @EncryptDecryptField
    private String cardNo;
    @ExcelProperty(value = "民族", index = 2)
    private String nation;
    @ExcelProperty(value = "联系电话", index = 4)
    private String phone;
    @ExcelProperty(value = "是否租住", index = 10)
    private String isRent;
    @ExcelProperty(value = "街/路/巷", index = 5)
    private String road;
    @ExcelProperty(value = "小区号", index = 6)
    private String doorNo;
    @ExcelProperty(value = "楼排号", index = 7)
    private String floor;
    @ExcelProperty(value = "单元号", index = 8)
    private String unitNo;
    @ExcelProperty(value = "户室(房间号)", index = 9)
    private String houseNo;
    @ExcelProperty(value = "房屋状态(1.自住 2.租住 3.其他)", index = 11)
    private String houseStatus;
    @ExcelProperty(value = "房屋用途(1.住宅 2.公寓 3.宿舍 4.仓库 5.其他)", index = 12)
    private String housePurpose;
    @ExcelProperty(value = "管控状态(1.常规 2.关注 3.管控)", index = 13)
    private String controlStatus;
    @ExcelProperty(value = "外地/本地(1.本地  2.外地)", index = 14)
    private String outOrLocal;
    @ExcelProperty(value = "户口所在地", index = 15)
    private String censusRegister;
    @ExcelProperty(value = "矫正开始时间", index = 16)
    private String correctBegin;
    @ExcelProperty(value = "矫正结束时间", index = 17)
    private String correctEnd;
    @ExcelProperty(value = "矫正类型", index = 18)
    private String correctType;
    @ExcelProperty(value = "罪名", index = 19)
    private String charges;
    @ExcelProperty(value = "备注", index = 20)
    private String remark;
    @ExcelProperty(value = "错误信息", index = 21)
    private String mistake;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationCultExcelVO.java
New file
@@ -0,0 +1,111 @@
package com.panzhihua.common.model.vos.community;
import com.alibaba.excel.annotation.ExcelProperty;
import com.google.common.collect.Lists;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptClass;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptField;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
 * @description: 批量导入邪教人员
 * @author: txb
 */
@Data
@EncryptDecryptClass
public class ComMngPopulationCultExcelVO implements Serializable {
    @ExcelProperty(value = "姓名", index = 1)
    private String name;
    @ExcelProperty(value = "身份证号码", index = 2)
    @EncryptDecryptField
    private String cardNo;
    @ExcelProperty(value = "民族", index = 3)
    private String nation;
    @ExcelProperty(value = "职业", index = 4)
    private String profession;
    @ExcelProperty(value = "婚姻状况(1.未婚 2.已婚 3.离异 4.丧偶 5.分居 6.其他)", index = 5)
    private Integer marriage;
    @ExcelProperty(value = "文化程度(1.小学 2.初中 3.高中 4.中专 5.大专 6.本科 7.硕士 8.博士 9.其他)", index = 6)
    private Integer cultureLevel;
    @ExcelProperty(value = "政治面貌", index = 7)
    private Integer politicalOutlook;
    @ExcelProperty(value = "街/路/巷", index = 8)
    private String road;
    @ExcelProperty(value = "小区号", index = 9)
    private String doorNo;
    @ExcelProperty(value = "楼排号", index = 10)
    private String floor;
    @ExcelProperty(value = "单元号", index = 11)
    private String unitNo;
    @ExcelProperty(value = "户室(房间号)", index = 12)
    private String houseNo;
    @ExcelProperty(value = "是否租住", index = 13)
    private Integer isRent;
    @ExcelProperty(value = "房屋状态(1.自住 2.租住 3.其他)", index = 14)
    private Integer houseStatus;
    @ExcelProperty(value = "房屋用途(1.住宅 2.公寓 3.宿舍 4.仓库 5.其他)", index = 15)
    private Integer housePurpose;
    @ExcelProperty(value = "管控状态(1.常规 2.关注 3.管控)", index = 16)
    private Integer controlStatus;
    @ExcelProperty(value = "外地/本地(1.本地  2.外地)", index = 17)
    private Integer outOrLocal;
    @ExcelProperty(value = "户口所在地", index = 18)
    private String censusRegister;
    @ExcelProperty(value = "邪教名称", index = 19)
    private String cultName;
    @ExcelProperty(value = "基本情况", index = 20)
    private String basicSituation;
    @ExcelProperty(value = "备注", index = 21)
    private String remark;
    /**
     * 去重字段,使用(姓名+身份证号+街路巷+小区号+楼牌号+单元号+户室)组合字段进行MD5加密实现去重
     */
    private String distinctPass;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 性别(1.男  2.女)
     */
    private Integer sex;
    /**
     * 出生年月日
     */
    private String birthday;
    /**
     * 扩展字段用逗号隔开
     */
    private List<String> userTagStr = Lists.newArrayList();
    private Long houseId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationDrugExcelVO.java
New file
@@ -0,0 +1,102 @@
package com.panzhihua.common.model.vos.community;
import com.alibaba.excel.annotation.ExcelProperty;
import com.google.common.collect.Lists;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptClass;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptField;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * @description: 批量导入吸毒人员
 * @author: txb
 */
@Data
@EncryptDecryptClass
public class ComMngPopulationDrugExcelVO implements Serializable {
    @ExcelProperty(value = "姓名", index = 1)
    private String name;
    @ExcelProperty(value = "身份证号码", index = 3)
    @EncryptDecryptField
    private String cardNo;
    @ExcelProperty(value = "民族", index = 2)
    private String nation;
    @ExcelProperty(value = "联系电话", index = 4)
    private String phone;
    @ExcelProperty(value = "是否租住", index = 10)
    private Integer isRent;
    @ExcelProperty(value = "街/路/巷", index = 5)
    private String road;
    @ExcelProperty(value = "小区号", index = 6)
    private String doorNo;
    @ExcelProperty(value = "楼排号", index = 7)
    private String floor;
    @ExcelProperty(value = "单元号", index = 8)
    private String unitNo;
    @ExcelProperty(value = "户室(房间号)", index = 9)
    private String houseNo;
    @ExcelProperty(value = "房屋状态(1.自住 2.租住 3.其他)", index = 11)
    private Integer houseStatus;
    @ExcelProperty(value = "房屋用途(1.住宅 2.公寓 3.宿舍 4.仓库 5.其他)", index = 12)
    private Integer housePurpose;
    @ExcelProperty(value = "管控状态(1.常规 2.关注 3.管控)", index = 13)
    private Integer controlStatus;
    @ExcelProperty(value = "外地/本地(1.本地  2.外地)", index = 14)
    private Integer outOrLocal;
    @ExcelProperty(value = "户口所在地", index = 15)
    private String censusRegister;
    @ExcelProperty(value = "备注", index = 16)
    private String remark;
    /**
     * 去重字段,使用(姓名+身份证号+街路巷+小区号+楼牌号+单元号+户室)组合字段进行MD5加密实现去重
     */
    private String distinctPass;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 性别(1.男  2.女)
     */
    private Integer sex;
    /**
     * 出生年月日
     */
    private String birthday;
    /**
     * 扩展字段用逗号隔开
     */
    private List<String> userTagStr = Lists.newArrayList();
    private Long houseId;
    /**
     * 地址
     */
    private String address;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationDrugMistakeExcelVO.java
New file
@@ -0,0 +1,71 @@
package com.panzhihua.common.model.vos.community;
import com.alibaba.excel.annotation.ExcelProperty;
import com.google.common.collect.Lists;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptClass;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptField;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
 * @description: 批量导入吸毒人员
 * @author: txb
 */
@Data
@EncryptDecryptClass
public class ComMngPopulationDrugMistakeExcelVO implements Serializable {
    @ExcelProperty(value = "姓名", index = 0)
    private String name;
    @ExcelProperty(value = "身份证号码", index = 2)
    @EncryptDecryptField
    private String cardNo;
    @ExcelProperty(value = "民族", index = 1)
    private String nation;
    @ExcelProperty(value = "联系电话", index = 3)
    private String phone;
    @ExcelProperty(value = "是否租住", index = 9)
    private String isRent;
    @ExcelProperty(value = "街/路/巷", index = 4)
    private String road;
    @ExcelProperty(value = "小区号", index = 5)
    private String doorNo;
    @ExcelProperty(value = "楼排号", index = 6)
    private String floor;
    @ExcelProperty(value = "单元号", index = 7)
    private String unitNo;
    @ExcelProperty(value = "户室(房间号)", index = 8)
    private String houseNo;
    @ExcelProperty(value = "房屋状态(1.自住 2.租住 3.其他)", index = 10)
    private String houseStatus;
    @ExcelProperty(value = "房屋用途(1.住宅 2.公寓 3.宿舍 4.仓库 5.其他)", index = 11)
    private String housePurpose;
    @ExcelProperty(value = "管控状态(1.常规 2.关注 3.管控)", index = 12)
    private String controlStatus;
    @ExcelProperty(value = "外地/本地(1.本地  2.外地)", index = 13)
    private String outOrLocal;
    @ExcelProperty(value = "户口所在地", index = 14)
    private String censusRegister;
    @ExcelProperty(value = "备注", index = 15)
    private String remark;
    @ExcelProperty(value = "错误信息", index = 16)
    private String mistake;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationMajorExcelVO.java
New file
@@ -0,0 +1,117 @@
package com.panzhihua.common.model.vos.community;
import com.alibaba.excel.annotation.ExcelProperty;
import com.google.common.collect.Lists;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptClass;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptField;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * @description: 批量导入重精人员
 * @author: txb
 */
@Data
@EncryptDecryptClass
public class ComMngPopulationMajorExcelVO implements Serializable {
    @ExcelProperty(value = "序号", index = 0)
    private String serialNumber;
    @ExcelProperty(value = "姓名", index = 1)
    private String name;
    @ExcelProperty(value = "身份证号码", index = 2)
    @EncryptDecryptField
    private String cardNo;
    @ExcelProperty(value = "街/路/巷", index = 3)
    private String road;
    @ExcelProperty(value = "小区号", index = 4)
    private String doorNo;
    @ExcelProperty(value = "楼排号", index = 5)
    private String floor;
    @ExcelProperty(value = "单元号", index = 6)
    private String unitNo;
    @ExcelProperty(value = "户室(房间号)", index = 7)
    private String houseNo;
    @ExcelProperty(value = "是否租住", index = 8)
    private Integer isRent;
    @ExcelProperty(value = "房屋状态(1.自住 2.租住 3.其他)", index = 9)
    private Integer houseStatus;
    @ExcelProperty(value = "房屋用途(1.住宅 2.公寓 3.宿舍 4.仓库 5.其他)", index = 10)
    private Integer housePurpose;
    @ExcelProperty(value = "管控状态(1.常规 2.关注 3.管控)", index = 11)
    private Integer controlStatus;
    @ExcelProperty(value = "外地/本地(1.本地  2.外地)", index = 12)
    private Integer outOrLocal;
    @ExcelProperty(value = "户口所在地", index = 13)
    private String censusRegister;
    @ExcelProperty(value = "文化程度(1.小学 2.初中 3.高中 4.中专 5.大专 6.本科 7.硕士 8.博士 9.其他)", index = 14)
    private Integer cultureLevel;
    @ExcelProperty(value = "经济状况", index = 15)
    private String economicCondition;
    @ExcelProperty(value = "监护人", index = 16)
    private String guarDian;
    @ExcelProperty(value = "监护人联系电话", index = 17)
    private String guarDianPhone;
    @ExcelProperty(value = "与患者关系", index = 18)
    private String patientRelation;
    @ExcelProperty(value = "目前诊断", index = 19)
    private String diagnose;
    @ExcelProperty(value = "其他", index = 20)
    private String other;
    /**
     * 去重字段,使用(姓名+身份证号+街路巷+小区号+楼牌号+单元号+户室)组合字段进行MD5加密实现去重
     */
    private String distinctPass;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 性别(1.男  2.女)
     */
    private Integer sex;
    /**
     * 出生年月日
     */
    private String birthday;
    /**
     * 扩展字段用逗号隔开
     */
    private List<String> userTagStr = Lists.newArrayList();
    private Long houseId;
    /**
     * 地址
     */
    private String address;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationMajorMistakeExcelVO.java
New file
@@ -0,0 +1,86 @@
package com.panzhihua.common.model.vos.community;
import com.alibaba.excel.annotation.ExcelProperty;
import com.google.common.collect.Lists;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptClass;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptField;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
 * @description: 批量导入重精人员
 * @author: txb
 */
@Data
@EncryptDecryptClass
public class ComMngPopulationMajorMistakeExcelVO implements Serializable {
    @ExcelProperty(value = "序号", index = 0)
    private String serialNumber;
    @ExcelProperty(value = "姓名", index = 1)
    private String name;
    @ExcelProperty(value = "身份证号码", index = 2)
    @EncryptDecryptField
    private String cardNo;
    @ExcelProperty(value = "街/路/巷", index = 3)
    private String road;
    @ExcelProperty(value = "小区号", index = 4)
    private String doorNo;
    @ExcelProperty(value = "楼排号", index = 5)
    private String floor;
    @ExcelProperty(value = "单元号", index = 6)
    private String unitNo;
    @ExcelProperty(value = "户室(房间号)", index = 7)
    private String houseNo;
    @ExcelProperty(value = "是否租住", index = 8)
    private String isRent;
    @ExcelProperty(value = "房屋状态(1.自住 2.租住 3.其他)", index = 9)
    private String houseStatus;
    @ExcelProperty(value = "房屋用途(1.住宅 2.公寓 3.宿舍 4.仓库 5.其他)", index = 10)
    private String housePurpose;
    @ExcelProperty(value = "管控状态(1.常规 2.关注 3.管控)", index = 11)
    private String controlStatus;
    @ExcelProperty(value = "外地/本地(1.本地  2.外地)", index = 12)
    private String outOrLocal;
    @ExcelProperty(value = "户口所在地", index = 13)
    private String censusRegister;
    @ExcelProperty(value = "文化程度(1.小学 2.初中 3.高中 4.中专 5.大专 6.本科 7.硕士 8.博士 9.其他)", index = 14)
    private String cultureLevel;
    @ExcelProperty(value = "经济状况", index = 15)
    private String economicCondition;
    @ExcelProperty(value = "监护人", index = 16)
    private String guarDian;
    @ExcelProperty(value = "监护人联系电话", index = 17)
    private String guarDianPhone;
    @ExcelProperty(value = "与患者关系", index = 18)
    private String patientRelation;
    @ExcelProperty(value = "目前诊断", index = 19)
    private String diagnose;
    @ExcelProperty(value = "其他", index = 20)
    private String other;
    @ExcelProperty(value = "错误信息", index = 16)
    private String mistake;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComMngPopulationRehabilitationExcelVO.java
New file
@@ -0,0 +1,109 @@
package com.panzhihua.common.model.vos.community;
import com.alibaba.excel.annotation.ExcelProperty;
import com.google.common.collect.Lists;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptClass;
import com.panzhihua.common.model.helper.encrypt.EncryptDecryptField;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
 * @description: 批量导入刑释人员
 * @author: txb
 */
@Data
@EncryptDecryptClass
public class ComMngPopulationRehabilitationExcelVO implements Serializable {
    @ExcelProperty(value = "姓名", index = 1)
    private String name;
    @ExcelProperty(value = "民族", index = 2)
    private String nation;
    @ExcelProperty(value = "身份证号码", index = 3)
    @EncryptDecryptField
    private String cardNo;
    @ExcelProperty(value = "联系电话", index = 4)
    private String phone;
    @ExcelProperty(value = "籍贯", index = 5)
    private String nativePlace;
    @ExcelProperty(value = "街/路/巷", index = 6)
    private String road;
    @ExcelProperty(value = "小区号", index = 7)
    private String doorNo;
    @ExcelProperty(value = "楼排号", index = 8)
    private String floor;
    @ExcelProperty(value = "单元号", index = 9)
    private String unitNo;
    @ExcelProperty(value = "户室(房间号)", index = 10)
    private String houseNo;
    @ExcelProperty(value = "是否租住", index = 11)
    private Integer isRent;
    @ExcelProperty(value = "房屋状态(1.自住 2.租住 3.其他)", index = 12)
    private Integer houseStatus;
    @ExcelProperty(value = "房屋用途(1.住宅 2.公寓 3.宿舍 4.仓库 5.其他)", index = 13)
    private Integer housePurpose;
    @ExcelProperty(value = "管控状态(1.常规 2.关注 3.管控)", index = 14)
    private Integer controlStatus;
    @ExcelProperty(value = "外地/本地(1.本地  2.外地)", index = 15)
    private Integer outOrLocal;
    @ExcelProperty(value = "户口所在地", index = 16)
    private String censusRegister;
    @ExcelProperty(value = "主要亲属", index = 17)
    private String mainRelatives;
    @ExcelProperty(value = "与人员关系", index = 18)
    private String patientRelation;
    @ExcelProperty(value = "列管原因及类型", index = 19)
    private String rehabReasonAndType;
    @ExcelProperty(value = "是否列管", index = 20)
    private Integer isRehab;
    @ExcelProperty(value = "备注", index = 21)
    private String remark;
    /**
     * 去重字段,使用(姓名+身份证号+街路巷+小区号+楼牌号+单元号+户室)组合字段进行MD5加密实现去重
     */
    private String distinctPass;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 性别(1.男  2.女)
     */
    private Integer sex;
    /**
     * 出生年月日
     */
    private String birthday;
    /**
     * 扩展字段用逗号隔开
     */
    private List<String> userTagStr = Lists.newArrayList();
    private Long houseId;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComSwDangerReportVO.java
@@ -107,7 +107,7 @@
    * 隐患名称
    */
    @ApiModelProperty("隐患名称")
    private String dagerName;
    private String dangerName;
    /**
    * 排查时间
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComSwPatrolRecordStatisticsVO.java
@@ -31,5 +31,75 @@
     */
    @ApiModelProperty("防疫巡查")
    private Integer yiTotal;
    /**
     * 安全工作记录总数
     */
    @ApiModelProperty("安全工作记录总数")
    private Integer safetyWorkTotal;
    /**
     * 隐患报告总数
     */
    @ApiModelProperty("隐患报告总数")
    private Integer dangerTotal;
    /**
     * 已处理隐患总数
     */
    @ApiModelProperty("已处理隐患数")
    private Integer handledDangerTotal;
    /**
     * 火灾隐患总数
     */
    @ApiModelProperty("火灾隐患总数")
    private Integer huoDangerTotal;
    /**
     * 汛情隐患总数
     */
    @ApiModelProperty("汛情隐患总数")
    private Integer xunDangerTotal;
    /**
     * 疫情隐患总数
     */
    @ApiModelProperty("疫情隐患总数")
    private Integer yiDangerTotal;
    /**
     * 已整改火灾隐患总数
     */
    @ApiModelProperty("已整改火灾隐患总数")
    private Integer huoHandledDangerTotal;
    /**
     * 未整改火灾隐患总数
     */
    @ApiModelProperty("未整改火灾隐患总数")
    private Integer huoHandlingDangerTotal;
    /**
     * 已整改汛情隐患总数
     */
    @ApiModelProperty("已整改汛情隐患总数")
    private Integer xunHandledDangerTotal;
    /**
     * 未整改汛情隐患总数
     */
    @ApiModelProperty("未整改汛情隐患总数")
    private Integer xunHandlingDangerTotal;
    /**
     * 已整改疫情隐患总数
     */
    @ApiModelProperty("已整改疫情隐患总数")
    private Integer yiHandledDangerTotal;
    /**
     * 未整改疫情隐患总数
     */
    @ApiModelProperty("未整改疫情隐患总数")
    private Integer yiHandlingDangerTotal;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComSwPatrolRecordVO.java
@@ -218,6 +218,9 @@
    @JsonSerialize(using = ToStringSerializer.class)
    private Long serviceId;
    @ApiModelProperty("隐患or安全记录(1.隐患 2.安全记录)")
    private Integer dangerOrRecord;
    /**
     * 巡查类型
     */
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/ComSwRotaExcelVO.java
@@ -15,39 +15,34 @@
@Data
public class ComSwRotaExcelVO implements Serializable {
    /**
     * 星期
     */
    @ExcelProperty(value = "星期" ,index = 0)
    private String weekDay;
    /**
     * 时间
     */
    @ExcelProperty(value = "时间" ,index = 1)
    @ExcelProperty(value = "时间" ,index = 0)
    private String rotaDate;
    /**
     * 值班领导
     */
    @ExcelProperty(value = "值班领导" ,index = 2)
    private String leaderName;
    /**
     * 值班领导联系电话
     */
    @ExcelProperty(value = "值班领导联系电话" ,index = 3)
    private String leaderPhone;
    /**
     * 值班人员
     */
    @ExcelProperty(value = "值班人员(多个以逗号隔开)" ,index = 4)
    @ExcelProperty(value = "值班人员" ,index = 1)
    private String personName;
    /**
     * 值班人员联系电话
     */
    @ExcelProperty(value = "值班人员联系电话(多个以逗号隔开)" ,index = 5)
    @ExcelProperty(value = "值班人员联系电话" ,index = 2)
    private String personPhone;
    /**
     * 值班领导
     */
    @ExcelProperty(value = "值班领导(多个以逗号隔开)" ,index = 3)
    private String leaderName;
    /**
     * 值班人员联系电话
     */
    @ExcelProperty(value = "值班领导联系电话(多个以逗号隔开)" ,index = 4)
    private String leaderPhone;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -1703,6 +1703,36 @@
    R listSavePopulationServeExcelVO(@RequestBody List<ComMngPopulationServeExcelVO> list, @RequestParam(value = "communityId") Long communityId);
    /**
     * 批量导入吸毒人员
     *
     * @param list        吸毒人员数据
     * @param communityId 社区id
     * @return 导入结果
     */
    @PostMapping("/common/data/population/importDrug")
    R listSavePopulationDrugExcelVO(@RequestBody List<ComMngPopulationDrugExcelVO> list, @RequestParam(value = "communityId") Long communityId);
    /**
     * 批量导入社区矫正人员
     *
     * @param list        社区矫正人员数据
     * @param communityId 社区id
     * @return 导入结果
     */
    @PostMapping("/common/data/population/importCorrect")
    R listSavePopulationCorrectExcelVO(@RequestBody List<ComMngPopulationCorrectExcelVO> list, @RequestParam(value = "communityId") Long communityId);
    /**
     * 批量导入重精人员
     *
     * @param list        重精人员数据
     * @param communityId 社区id
     * @return 导入结果
     */
    @PostMapping("/common/data/population/importMajor")
    R listSavePopulationMajorExcelVO(@RequestBody List<ComMngPopulationMajorExcelVO> list, @RequestParam(value = "communityId") Long communityId);
    /**
     * 确认导入实有人口(有则更新,无则新建)
     *
     * @param list        用户信息
@@ -4034,4 +4064,10 @@
    @PostMapping("/patrolRecord/rota/import")
    R listSaveSwRotaExcelVO(@RequestBody List<ComSwRotaExcelVO> list, @RequestParam("communityId") Long communityId);
    /**
     * 定时任务检测即将开始的社区活动,并使用订阅消息通知用户
     */
    @PostMapping("timedTaskActivityNotice")
    R timedTaskActivityNotice();
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/user/UserService.java
@@ -774,4 +774,12 @@
    @GetMapping("getGridsMemberList")
    R getGridsMemberList(@RequestParam("communityId")Long communityId);
    /**
     * 根据用户id查询用户openid
     * @param userId    用户id
     * @return  openid
     */
    @GetMapping("getUserOpenId")
    R getUserOpenId(@RequestParam("userId")Long userId);
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/HttpUtils.java
@@ -1,6 +1,9 @@
package com.panzhihua.common.utlis;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.model.dtos.wx.WxSubscribeDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ObjectUtils;
@@ -97,6 +100,12 @@
        return result.toString();
    }
    public static String wxMessageModeSendUrl(String token, WxSubscribeDTO subscribeDTO) throws Exception {
        String tmpurl = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=ACCESS_TOKEN";
        String url = tmpurl.replace("ACCESS_TOKEN", token);
        return HttpClientUtil.httpPost(url, subscribeDTO.toJSON());
    }
    public static String sendSSLPost(String url, String param)
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/WxUtil.java
@@ -1,7 +1,12 @@
package com.panzhihua.common.utlis;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.panzhihua.common.constants.WxSubscribeConstants;
import com.panzhihua.common.model.dtos.wx.TemplateParam;
import com.panzhihua.common.model.dtos.wx.WxSubscribeDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
@@ -10,11 +15,15 @@
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.*;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
public class WxUtil {
    //客服消息推送地址
@@ -56,4 +65,263 @@
        return HttpClientUtil.httpPost(kf_url+"?access_token="+access_token,content);
    }
    /**
     * 订阅消息推送
     * @param accessToken   获取会话token
     * @return  消息推送结果
     */
    static void sendSubscribe(String accessToken,WxSubscribeDTO subscribeDTO) throws Exception{
        String resultString =  HttpUtils.wxMessageModeSendUrl(accessToken,subscribeDTO);
        JSONObject jsonResult = JSON.parseObject(resultString);
        if(jsonResult!=null){
            log.info("订阅消息推送返回参数" + jsonResult.toJSONString());
            int errorCode = jsonResult.getIntValue("errcode");
            String errorMessage = jsonResult.getString("errmsg");
            if(errorCode==0){
                log.info("订阅消息推送成功,openId:" + subscribeDTO.getTouser());
            }else{
                log.error("订阅消息发送失败,错误码:"+errorCode+",错误信息:"+errorMessage + "用户openid:" + subscribeDTO.getTouser());
            }
        }
    }
    /**
     * 随手拍奖励到账订阅消息推送
     * @param openId    用户openid
     * @param accessToken   token会话标识
     * @param name  随手拍活动标题
     * @param amount    奖励金额
     * @param remark    备注说明
     */
    public static void sendSubscribeJLDZ(String openId, String accessToken, String name, BigDecimal amount,String remark){
        WxSubscribeDTO subscribeDTO = new WxSubscribeDTO();
        subscribeDTO.setTouser(openId);
        subscribeDTO.setTemplate_id(WxSubscribeConstants.JLFF_ID);
        List<TemplateParam> paras=new ArrayList<TemplateParam>();
        paras.add(new TemplateParam("thing1",name));//活动名称
        paras.add(new TemplateParam("amount3",amount.toString()));//奖励金额
        paras.add(new TemplateParam("thing7",remark));//备注说明
        subscribeDTO.setTemplateParamList(paras);
        try {
            sendSubscribe(accessToken,subscribeDTO);
        }catch (Exception e){
            log.error("随手拍奖励到账订阅消息推送失败,失败原因:" + e.getMessage());
        }
    }
    /**
     * 活动报名成功订阅消息推送
     * @param openId    用户openid
     * @param accessToken   token会话标识
     * @param name  活动名称
     * @param address   活动地址
     * @param activityTime  活动时间
     * @param signTime  报名时间
     */
    public static void sendSubscribeSQHD(String openId, String accessToken, String name, String address,String activityTime,String signTime){
        WxSubscribeDTO subscribeDTO = new WxSubscribeDTO();
        subscribeDTO.setTouser(openId);
        subscribeDTO.setTemplate_id(WxSubscribeConstants.BMCG_ID);
        List<TemplateParam> paras=new ArrayList<TemplateParam>();
        paras.add(new TemplateParam("thing1",name));//活动名称
        paras.add(new TemplateParam("thing2",address));//活动地址
        paras.add(new TemplateParam("date3",activityTime));//活动时间
        paras.add(new TemplateParam("time8",signTime));//报名时间
        subscribeDTO.setTemplateParamList(paras);
        try {
            sendSubscribe(accessToken,subscribeDTO);
        }catch (Exception e){
            log.error("活动报名成功订阅消息推送失败,失败原因:" + e.getMessage());
        }
    }
    /**
     * 新问卷调查订阅消息通知
     * @param openId    用户openid
     * @param accessToken   token会话标识
     * @param name  活动名称
     * @param questionnaireName 问卷名称
     */
    public static void sendSubscribeDYWJ(String openId, String accessToken, String name, String questionnaireName){
        WxSubscribeDTO subscribeDTO = new WxSubscribeDTO();
        subscribeDTO.setTouser(openId);
        subscribeDTO.setTemplate_id(WxSubscribeConstants.DYWJ_ID);
        List<TemplateParam> paras=new ArrayList<TemplateParam>();
        paras.add(new TemplateParam("thing1",name));//活动名称
        paras.add(new TemplateParam("thing2",questionnaireName));//问卷名称
        subscribeDTO.setTemplateParamList(paras);
        try {
            sendSubscribe(accessToken,subscribeDTO);
        }catch (Exception e){
            log.error("新问卷调查订阅消息推送失败,失败原因:" + e.getMessage());
        }
    }
    /**
     * 认证审核订阅消息通知
     * @param openId    用户openid
     * @param accessToken   token会话标识
     * @param name  认证内容
     * @param applyTime 申请时间
     * @param result    审核结果
     */
    public static void sendSubscribeRZSH(String openId, String accessToken, String name, String applyTime,String result){
        WxSubscribeDTO subscribeDTO = new WxSubscribeDTO();
        subscribeDTO.setTouser(openId);
        subscribeDTO.setTemplate_id(WxSubscribeConstants.EZSH_ID);
        List<TemplateParam> paras=new ArrayList<TemplateParam>();
        paras.add(new TemplateParam("thing2",name));//认证内容
        paras.add(new TemplateParam("phrase1",result));//审核结果
        paras.add(new TemplateParam("date3",applyTime));//申请时间
        subscribeDTO.setTemplateParamList(paras);
        try {
            sendSubscribe(accessToken,subscribeDTO);
        }catch (Exception e){
            log.error("认证审核订阅消息推送失败,失败原因:" + e.getMessage());
        }
    }
    /**
     *  随手拍、邻里圈、微心愿、房源审核状态进度通知
     * @param openId    用户openid
     * @param accessToken   token会话标识
     * @param name  审核项目
     * @param applyTime 审核状态
     * @param result    审核时间
     */
    public static void sendSubscribeSHZT(String openId, String accessToken, String name, String applyTime,String result){
        WxSubscribeDTO subscribeDTO = new WxSubscribeDTO();
        subscribeDTO.setTouser(openId);
        subscribeDTO.setTemplate_id(WxSubscribeConstants.SHZT_ID);
        List<TemplateParam> paras=new ArrayList<TemplateParam>();
        paras.add(new TemplateParam("thing1",name));//审核项目
        paras.add(new TemplateParam("phrase2",result));//审核状态
        paras.add(new TemplateParam("time3",applyTime));//审核时间
        subscribeDTO.setTemplateParamList(paras);
        try {
            sendSubscribe(accessToken,subscribeDTO);
        }catch (Exception e){
            log.error("审核状态订阅消息推送失败,失败原因:" + e.getMessage());
        }
    }
    /**
     * 社区活动取消通知
     * @param openId    用户openid
     * @param accessToken   token会话标识
     * @param name  活动名称
     * @param time  活动时间
     */
    public static void sendSubscribeHDQX(String openId, String accessToken, String name, String time){
        WxSubscribeDTO subscribeDTO = new WxSubscribeDTO();
        subscribeDTO.setTouser(openId);
        subscribeDTO.setTemplate_id(WxSubscribeConstants.HDQX_ID);
        List<TemplateParam> paras=new ArrayList<TemplateParam>();
        paras.add(new TemplateParam("thing1",name));//活动标题
        paras.add(new TemplateParam("date2",time));//活动时间
        subscribeDTO.setTemplateParamList(paras);
        try {
            sendSubscribe(accessToken,subscribeDTO);
        }catch (Exception e){
            log.error("活动取消订阅消息推送失败,失败原因:" + e.getMessage());
        }
    }
    /**
     * 留言回复订阅消息通知
     * @param openId    用户openid
     * @param accessToken   token会话标识
     * @param name  回复人名称
     * @param time  回复时间
     * @param content   回复内容
     */
    public static void sendSubscribeLYHF(String openId, String accessToken, String name, String time,String content){
        WxSubscribeDTO subscribeDTO = new WxSubscribeDTO();
        subscribeDTO.setTouser(openId);
        subscribeDTO.setTemplate_id(WxSubscribeConstants.LYHF_ID);
        List<TemplateParam> paras=new ArrayList<TemplateParam>();
        paras.add(new TemplateParam("thing3",content));//回复内容
        paras.add(new TemplateParam("name1",name));//回复者
        paras.add(new TemplateParam("date2",time));//回复时间
        subscribeDTO.setTemplateParamList(paras);
        try {
            sendSubscribe(accessToken,subscribeDTO);
        }catch (Exception e){
            log.error("留言回复订阅消息推送失败,失败原因:" + e.getMessage());
        }
    }
    /**
     *  活动变更订阅消息通知
     * @param openId    用户openid
     * @param accessToken   token会话标识
     * @param name  活动名称
     * @param changeTime    活动时间变更
     * @param changeAddress 活动地点变更
     * @param time  活动时间
     * @param address   活动地点
     */
    public static void sendSubscribeHDBG(String openId, String accessToken, String name, String changeTime,String changeAddress,String time,String address){
        WxSubscribeDTO subscribeDTO = new WxSubscribeDTO();
        subscribeDTO.setTouser(openId);
        subscribeDTO.setTemplate_id(WxSubscribeConstants.HDBG_ID);
        List<TemplateParam> paras=new ArrayList<TemplateParam>();
        paras.add(new TemplateParam("thing1",name));//活动名称
        paras.add(new TemplateParam("time2",changeTime));//活动时间变更
        paras.add(new TemplateParam("thing3",changeAddress));//地址变更
        paras.add(new TemplateParam("time5",time));//活动时间
        paras.add(new TemplateParam("thing6",address));//活动地点
        subscribeDTO.setTemplateParamList(paras);
        try {
            sendSubscribe(accessToken,subscribeDTO);
        }catch (Exception e){
            log.error("留言回复订阅消息推送失败,失败原因:" + e.getMessage());
        }
    }
    /**
     *  活动即将开始订阅消息通知
     * @param openId    用户openid
     * @param accessToken   token会话标识
     * @param name  活动名称
     * @param time  活动时间
     * @param address   活动地点
     * @param num   活动参加人数
     */
    public static void sendSubscribeHDJJKS(String openId, String accessToken, String name, String time,String address,String num){
        WxSubscribeDTO subscribeDTO = new WxSubscribeDTO();
        subscribeDTO.setTouser(openId);
        subscribeDTO.setTemplate_id(WxSubscribeConstants.HDJJKS_ID);
        List<TemplateParam> paras=new ArrayList<TemplateParam>();
        paras.add(new TemplateParam("thing1",name));//活动名称
        paras.add(new TemplateParam("date2",time));//活动时间
        paras.add(new TemplateParam("number3",num));//参与人数
        paras.add(new TemplateParam("thing4",address));//活动地点
        subscribeDTO.setTemplateParamList(paras);
        try {
            sendSubscribe(accessToken,subscribeDTO);
        }catch (Exception e){
            log.error("活动即将开始订阅消息推送失败,失败原因:" + e.getMessage());
        }
    }
    public static void main(String[] args) {
        WxXCXTempSend util = new WxXCXTempSend();
        try {
//            String openId = "oMIR-5S9rpsWAVUUrNKoVDQbn5Mw";//zj的openid
            String openId = "oMIR-5dWyNyWCCKMl7-kYzvyHOjs";//lyq的openid
            String accessToken = util.getAppAccessToken();
//            sendSubscribeHDJJKS(openId,accessToken,"测试活动即将开始标题","2021-08-04 13:00:00","成都市","50");//活动即将开始
//            sendSubscribeHDQX(openId,accessToken,"取消活动测试标题","2021-08-04 13:00:00");//活动取消
//            sendSubscribeHDBG(openId,accessToken,"活动名称","2021-08-05","活动变更地址","2021-08-06","活动地址");//活动变更
//            sendSubscribeRZSH(openId,accessToken,"用户认证审核通知","2021-08-04","通过");//认证审核
//            sendSubscribeJLDZ(openId,accessToken,"随手拍活动DDD",BigDecimal.TEN,"用户参加随手拍活动奖励");//奖励到账
//            sendSubscribeLYHF(openId,accessToken,"社区管理员","2021-08-04 11:26:20","勇敢牛牛 不怕困难!");//留言回复
//            sendSubscribeSHZT(openId,accessToken,"随手拍审核!!","2021-08-04 11:20:00","通过了");//审核状态
        }catch (Exception e){
            System.out.println("错误错误!!!");
        }
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/utlis/WxXCXTempSend.java
@@ -63,7 +63,7 @@
        return getAppAccessToken();
    }
    private String getAppAccessToken() throws Exception{
    public String getAppAccessToken() throws Exception{
        String accessToken = "0";
        try {
            //此处APP_ID APP_SECRET  在微信小程序后端可见
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComSwPatrolRecordApi.java
@@ -6,6 +6,7 @@
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.listen.ComMngPopulationServeExcelListen;
import com.panzhihua.common.listen.ComSwRotaExcelListen;
@@ -31,6 +32,7 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
/**
@@ -377,5 +379,89 @@
        return R.ok();
    }
    @ApiOperation(value = "值班表-下载模板")
    @GetMapping("/export/rota")
    public R exportRota() {
        //获取登陆用户绑定社区id
        Long communityId = 2L;//this.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "值班人员导入模板.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<List<String>> list = new ArrayList<>();
                    list = headDataFilling();
                    List<List<Object>> dataList = new ArrayList<>();
                    List<Object> data = new ArrayList<>();
                    data = formDataFilling();
                    dataList.add(data);
                    EasyExcel.write(fileName).head(list).sheet("值班人员导入模板").doWrite(dataList);
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
            return R.ok(excelUrl + "值班人员导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    private List<List<String>> headDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
        head0.add("值班时间-年-月-日(禁止录入重复项)");
        List<String> head1 = new ArrayList<String>();
        head1.add("值班人员(多个用\"、\"隔开)");
        List<String> head2 = new ArrayList<String>();
        head2.add("值班人员联系电话(多个用\"、\"隔开,请安姓名顺序)");
        List<String> head3 = new ArrayList<String>();
        head3.add("值班领导(多个用\"、\"隔开)");
        List<String> head4 = new ArrayList<String>();
        head4.add("值班领导联系电话(多个用\"、\"隔开,请安姓名顺序)");
        List<String> head5 = new ArrayList<String>();
        head5.add("");
        list.add(head0);
        list.add(head1);
        list.add(head2);
        list.add(head3);
        list.add(head4);
        list.add(head5);
        return list;
    }
    private List<Object> formDataFilling(){
        List<Object> data = new ArrayList<>();
        data.add("2021-01-01");
        data.add("张三、李四、王二");
        data.add("138000000、138000000、138000000");
        data.add("王五、王六");
        data.add("138000000、138000000");
        data.add("示例");
        return data;
    }
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityActivityApi.java
@@ -12,6 +12,9 @@
import com.panzhihua.common.model.vos.user.SysUserNoticeVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.WxUtil;
import com.panzhihua.common.utlis.WxXCXTempSend;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@@ -122,29 +125,39 @@
            if (!R.isOk(r3)) {
                Object data = r3.getData();
                ComActActivityVO comActActivityVO = JSONObject.parseObject(JSONObject.toJSONString(data), ComActActivityVO.class);
                R r1 = communityService.listActivitySign(activitySignVO);
                R r1 = communityService.listActivitySigns(activitySignVO);
                if (R.isOk(r1)) {
                    List<ActivitySignVO> activitySignVOS = JSONArray.parseArray(JSONArray.toJSONString(r1.getData()), ActivitySignVO.class);
                    if (!ObjectUtils.isEmpty(activitySignVOS)) {
                        activitySignVOS.forEach(activitySignVO1 -> {
                            Long aLong = activitySignVO1.getId();
                            int isVolunteer = activitySignVO1.getIsVolunteer().intValue();
                            SysUserNoticeVO sysUserNoticeVO = new SysUserNoticeVO();
                            sysUserNoticeVO.setUserId(aLong);
                            sysUserNoticeVO.setType(1);
                            sysUserNoticeVO.setTitle("活动因故取消");
                            sysUserNoticeVO.setBusinessType(1);
                            sysUserNoticeVO.setBusinessTitle(comActActivityVO.getActivityName());
                            sysUserNoticeVO.setBusinessContent(String.format("取消原因%s", comActActivityVO.getCancelReason()));
                            sysUserNoticeVO.setBusinessId(id);
                            sysUserNoticeVO.setStatus(0);
                            sysUserNoticeVO.setBusinessStatus(1);
                            sysUserNoticeVO.setActivityType(1 == isVolunteer ? 1 : 2);
                            R r2 = userService.addNotice(sysUserNoticeVO);
                            if (R.isOk(r2)) {
                                log.info("新增取消社区活动通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
                            }
                        });
                        try {
                            WxXCXTempSend util = new WxXCXTempSend();
                            String accessToken = util.getAppAccessToken();
                            //遍历参与活动人员列表
                            activitySignVOS.forEach(activitySignVO1 -> {
                                Long aLong = activitySignVO1.getId();
                                int isVolunteer = activitySignVO1.getIsVolunteer().intValue();
                                SysUserNoticeVO sysUserNoticeVO = new SysUserNoticeVO();
                                sysUserNoticeVO.setUserId(aLong);
                                sysUserNoticeVO.setType(1);
                                sysUserNoticeVO.setTitle("活动因故取消");
                                sysUserNoticeVO.setBusinessType(1);
                                sysUserNoticeVO.setBusinessTitle(comActActivityVO.getActivityName());
                                sysUserNoticeVO.setBusinessContent(String.format("取消原因%s", comActActivityVO.getCancelReason()));
                                sysUserNoticeVO.setBusinessId(id);
                                sysUserNoticeVO.setStatus(0);
                                sysUserNoticeVO.setBusinessStatus(1);
                                sysUserNoticeVO.setActivityType(1 == isVolunteer ? 1 : 2);
                                R r2 = userService.addNotice(sysUserNoticeVO);
                                if (R.isOk(r2)) {
                                    log.info("新增取消社区活动通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
                                }
                                //取消社区活动推送订阅消息给用户
                                WxUtil.sendSubscribeHDQX(activitySignVO1.getOpenid(),accessToken,comActActivityVO.getActivityName(), DateUtils.format(comActActivityVO.getBeginAt(),DateUtils.ymdhms_format));
                            });
                        }catch (Exception e){
                            log.error("新增取消社区活动通知失败,错误原因:" + e.getMessage());
                        }
                    }
                }
            }
@@ -297,6 +310,8 @@
                R r1 = communityService.detailMicroWish(id, userId);
                Object data = r1.getData();
                ComActMicroWishVO comActMicroWishVO1 = JSONObject.parseObject(JSONObject.toJSONString(data), ComActMicroWishVO.class);
                //查询用户openid
                R userResult = userService.getUserOpenId(id);
                if (R.isOk(r1)) {
                    SysUserNoticeVO sysUserNoticeVO = new SysUserNoticeVO();
                    sysUserNoticeVO.setUserId(comActMicroWishVO1.getSponsorId());
@@ -313,6 +328,16 @@
                        R r2 = userService.addNotice(sysUserNoticeVO);
                        if (R.isOk(r2)) {
                            log.info("新增微心愿未通过审核通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
                        }
                        if(R.isOk(userResult)){
                            String openid = userResult.getData().toString();
                            WxXCXTempSend util = new WxXCXTempSend();
                            try {
                                WxUtil.sendSubscribeSHZT(openid,util.getAppAccessToken(),"微心愿审核失败"
                                        , DateUtils.format(comActMicroWishVO1.getExamineAt(),DateUtils.ymdhms_format),comActMicroWishVO1.getRejectReason());
                            }catch (Exception e){
                                log.error("消息推送失败,失败原因:" + e.getMessage());
                            }
                        }
                    } else if (type.intValue() == 5) {
                        sysUserNoticeVO.setTitle("微心愿已完成");
@@ -343,6 +368,16 @@
                    if(type.equals(1)){//审核通过给用户增加积分
                        communityService.addIntegralTradeAdmin(new AddComActIntegralUserDTO(id,AddComActIntegralUserDTO.integralType.fbwxy
                                ,this.getCommunityId(),comActMicroWishVO1.getSponsorId()));
                        if(R.isOk(userResult)){
                            String openid = userResult.getData().toString();
                            WxXCXTempSend util = new WxXCXTempSend();
                            try {
                                WxUtil.sendSubscribeSHZT(openid,util.getAppAccessToken(),"微心愿审核"
                                        , DateUtils.format(comActMicroWishVO1.getExamineAt(),DateUtils.ymdhms_format),"审核通过");
                            }catch (Exception e){
                                log.error("消息推送失败,失败原因:" + e.getMessage());
                            }
                        }
                    }
                }
            }
@@ -386,6 +421,8 @@
                sysUserNoticeVO.setBusinessTime(comActEasyPhotoVO1.getExamineAt());
                sysUserNoticeVO.setBusinessId(id);
                sysUserNoticeVO.setStatus(0);
                //查询用户openid
                R userResult = userService.getUserOpenId(comActEasyPhotoVO1.getSponsorId());
                if (type.intValue() == 2) {
                    sysUserNoticeVO.setBusinessTitle(comActEasyPhotoVO1.getDetail());
                    sysUserNoticeVO.setTitle("随手拍未通过审核");
@@ -394,6 +431,17 @@
                    R r2 = userService.addNotice(sysUserNoticeVO);
                    if (R.isOk(r2)) {
                        log.info("新增随手拍未通过审核通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
                    }
                    if(R.isOk(userResult)){
                        String openid = userResult.getData().toString();
                        WxXCXTempSend util = new WxXCXTempSend();
                        try {
                            WxUtil.sendSubscribeSHZT(openid,util.getAppAccessToken(),"随手拍审核失败"
                                    , DateUtils.format(comActEasyPhotoVO1.getExamineAt(),DateUtils.ymdhms_format),comActEasyPhotoVO.getRejectReason());
                        }catch (Exception e){
                            log.error("消息推送失败,失败原因:" + e.getMessage());
                        }
                    }
                } else if (type.intValue() == 3) {
                    sysUserNoticeVO.setTitle("随手拍有反馈");
@@ -409,6 +457,18 @@
                if(type.equals(1)){//审核通过给用户增加积分
                    communityService.addIntegralTradeAdmin(new AddComActIntegralUserDTO(id,AddComActIntegralUserDTO.integralType.fbssp
                            ,this.getCommunityId(),comActEasyPhotoVO1.getSponsorId()));
                    //审核通过发送订阅消息给用户
                    if(R.isOk(userResult)){
                        String openid = userResult.getData().toString();
                        WxXCXTempSend util = new WxXCXTempSend();
                        try {
                            WxUtil.sendSubscribeSHZT(openid,util.getAppAccessToken(),"随手拍审核"
                                    , DateUtils.format(comActEasyPhotoVO1.getExamineAt(),DateUtils.ymdhms_format),"审核通过");
                        }catch (Exception e){
                            log.error("消息推送失败,失败原因:" + e.getMessage());
                        }
                    }
                }
            }
        }
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityManagerApi.java
@@ -20,8 +20,7 @@
import com.panzhihua.common.model.vos.user.SysUserNoticeVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.FileUtil;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.common.utlis.*;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.community_backstage.easyexcel.UploadEexcelUserDTOListener;
import com.panzhihua.community_backstage.excel.CustomSheetWriteHandler;
@@ -407,6 +406,9 @@
            sysUserNoticeVO.setUserId(comMngVolunteerMngVO1.getSubmitUserId());
            sysUserNoticeVO.setBusinessTime(date);
            sysUserNoticeVO.setStatus(0);
            //查询用户openid
            R userResult = userService.getUserOpenId(comMngVolunteerMngVO1.getSubmitUserId());
            if (state==2) {//通过
//                修改用户志愿者审核状态
                //String phone = comMngVolunteerMngVO1.getPhone();
@@ -424,6 +426,17 @@
                if (R.isOk(r2)) {
                    log.info("新增志愿者申请通过审核通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
                }
                if(R.isOk(userResult)){
                    String openid = userResult.getData().toString();
                    WxXCXTempSend util = new WxXCXTempSend();
                    try {
                        WxUtil.sendSubscribeRZSH(openid,util.getAppAccessToken(),"用户志愿者审核"
                                , DateUtils.format(comMngVolunteerMngVO1.getCreateAt(),DateUtils.ymdhms_format),"审核通过");
                    }catch (Exception e){
                        log.error("消息推送失败,失败原因:" + e.getMessage());
                    }
                }
            }else if(state==3){ //驳回
                sysUserNoticeVO.setTitle("志愿者申请未通过");
                sysUserNoticeVO.setBusinessContent(String.format("驳回原因:%s",comMngVolunteerMngVO1.getRejectReson()));
@@ -432,6 +445,17 @@
                if (R.isOk(r2)) {
                    log.info("新增志愿者申请未通过通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
                }
                if(R.isOk(userResult)){
                    String openid = userResult.getData().toString();
                    WxXCXTempSend util = new WxXCXTempSend();
                    try {
                        WxUtil.sendSubscribeRZSH(openid,util.getAppAccessToken(),"用户志愿者审核失败"
                                , DateUtils.format(comMngVolunteerMngVO1.getCreateAt(),DateUtils.ymdhms_format),comMngVolunteerMngVO1.getRejectReson());
                    }catch (Exception e){
                        log.error("消息推送失败,失败原因:" + e.getMessage());
                    }
                }
            }
        }
        return r;
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/CommunityPartyBuildingApi.java
@@ -25,7 +25,10 @@
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.partybuilding.PartyBuildingService;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.common.utlis.WxUtil;
import com.panzhihua.common.utlis.WxXCXTempSend;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.community_backstage.excel.CustomSheetWriteHandler;
import com.panzhihua.community_backstage.listen.PartyBuildingMemberExcelListen;
@@ -307,7 +310,7 @@
        if (R.isOk(r)) {
            R r1 = partyBuildingService.selectAllPartyBuildingActivityMembers(id);
            if (R.isOk(r1)) {
                List<Long> userIds = (List<Long>) r1.getData();
                List<Long> userIds = JSONArray.parseArray(JSONArray.toJSONString(r1.getData()), Long.class);
                userIds.forEach(aLong -> {
                    SysUserNoticeVO sysUserNoticeVO = new SysUserNoticeVO();
                    sysUserNoticeVO.setUserId(aLong);
@@ -591,6 +594,17 @@
                        log.info("新增党员认证已被审核通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
                    }
                }
                R r1 = userService.getUserOpenId(userId);
                if(R.isOk(r1)){
                    String openid = r1.getData().toString();
                    WxXCXTempSend util = new WxXCXTempSend();
                    try {
                        WxUtil.sendSubscribeRZSH(openid,util.getAppAccessToken(),"用户党员认证", DateUtils.format(vo1.getCreateAt(),DateUtils.ymdhms_format),"审核通过");
                    }catch (Exception e){
                        log.error("消息推送失败,失败原因:" + e.getMessage());
                    }
                }
                return r;
            } else if (3 == partyBuildingMemberVO.getAuditResult() && R.isOk(updated)) {
                R r = userService.updateUserNotPartymember(userIdcard);
@@ -609,6 +623,17 @@
                    if (R.isOk(r1)) {
                        log.info("新增党员认证已被审核通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
                    }
                    R r2 = userService.getUserOpenId(userId);
                    if(R.isOk(r2)){
                        String openid = r2.getData().toString();
                        WxXCXTempSend util = new WxXCXTempSend();
                        try {
                            WxUtil.sendSubscribeRZSH(openid,util.getAppAccessToken(),"用户党员认证失败", DateUtils.format(vo1.getCreateAt(),DateUtils.ymdhms_format),partyBuildingMemberVO.getRefuseReason());
                        }catch (Exception e){
                            log.error("消息推送失败,失败原因:" + e.getMessage());
                        }
                    }
                }
                return r;
            }
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/DictionaryApi.java
New file
@@ -0,0 +1,87 @@
package com.panzhihua.community_backstage.api;
import com.panzhihua.common.model.vos.BcDictionaryItemVO;
import com.panzhihua.common.model.vos.BcDictionaryVO;
import com.panzhihua.common.model.vos.DictionaryVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.service.community.CommunityService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
/**
 * 字典
 *
 * @author manailin
 * @date 2021/8/4 17:00
 */
@Slf4j
@RestController
@RequestMapping("/dictionary")
public class DictionaryApi {
    @Resource
    private CommunityService communityService;
    /**
     * 插入字典
     *
     * @param dictionaryVO 字典数据
     * @return Boolean 是否保存成功
     * @author manailin
     * @date 2021/6/10 17:00
     */
    @PostMapping("/insertDiction")
    R insertDiction(@RequestBody @Valid DictionaryVO dictionaryVO, @ApiIgnore BindingResult results) {
        if (results.hasErrors()) {
            return R.fail(results.getFieldError().getDefaultMessage());
        }
        return communityService.insertDiction(dictionaryVO);
    }
    /**
     * 插入字典项
     *
     * @param dictionaryVO 字典数据
     * @return Boolean 是否保存成功
     * @author manailin
     * @date 2021/6/10 17:00
     */
    @PostMapping("/insertDictionItem")
    R insertDictionItem(@RequestBody @Valid BcDictionaryVO dictionaryVO, @ApiIgnore BindingResult results) {
        if (results.hasErrors()) {
            return R.fail(results.getFieldError().getDefaultMessage());
        }
        return communityService.insertDictionItem(dictionaryVO);
    }
    /**
     * 根据字典key查询自典项
     *
     * @param key
     * @return
     */
    @GetMapping("/listDictionaryByKey")
    R<List<BcDictionaryVO>> listDictionaryByKey(@RequestParam("key") String key) {
        return communityService.listDictionaryByKey(key);
    }
    /**
     * description 根据字典code查询自典项
     *
     * @param code 入参参数
     * @return BcDictionaryVO 字典
     * @author manailin
     * @date 2021/6/10 17:00
     */
    @GetMapping("/getByCode")
    BcDictionaryItemVO getByCode(@RequestParam("dictId") String dictId, @RequestParam("code") String code) {
        return communityService.getByCode(dictId, code);
    }
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/PopulationApi.java
@@ -9,8 +9,7 @@
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.enums.*;
import com.panzhihua.common.listen.ComMngPopulationConfirmServeExcelListen;
import com.panzhihua.common.listen.ComMngPopulationServeExcelListen;
import com.panzhihua.common.listen.*;
import com.panzhihua.common.model.dtos.community.*;
import com.panzhihua.common.model.vos.community.ComExServicemanVO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
@@ -98,6 +97,60 @@
            inputStream = file.getInputStream();
            ComMngPopulationServeExcelListen comMngPopulationServeExcelListen = new ComMngPopulationServeExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate);
            EasyExcel.read(inputStream, null, comMngPopulationServeExcelListen).sheet().doRead();
        } catch (IOException e) {
            log.error("导入模板失败【{}】", e.getMessage());
            e.printStackTrace();
        }
        return R.ok();
    }
    @ApiOperation(value = "excel导入吸毒人员")
    @PostMapping(value = "/serve/importDrug", consumes = "multipart/*", headers = "content-type=multipart/form-date")
    public R importDrug(@RequestParam MultipartFile file, HttpServletRequest request) {
        //获取文件名
        String fileName = file.getOriginalFilename();
        log.info("传入文件名字【{}】", fileName);
        InputStream inputStream = null;
        try {
            inputStream = file.getInputStream();
            ComMngPopulationDrugExcelListen comMngPopulationDrugExcelListen = new ComMngPopulationDrugExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate);
            EasyExcel.read(inputStream, null, comMngPopulationDrugExcelListen).sheet().doRead();
        } catch (IOException e) {
            log.error("导入模板失败【{}】", e.getMessage());
            e.printStackTrace();
        }
        return R.ok();
    }
    @ApiOperation(value = "excel导入社区矫正人员")
    @PostMapping(value = "/serve/importCorrect", consumes = "multipart/*", headers = "content-type=multipart/form-date")
    public R importCorrect(@RequestParam MultipartFile file, HttpServletRequest request) {
        //获取文件名
        String fileName = file.getOriginalFilename();
        log.info("传入文件名字【{}】", fileName);
        InputStream inputStream = null;
        try {
            inputStream = file.getInputStream();
            ComMngPopulationCorrectExcelListen comMngPopulationCorrectExcelListen = new ComMngPopulationCorrectExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate);
            EasyExcel.read(inputStream, null, comMngPopulationCorrectExcelListen).sheet().doRead();
        } catch (IOException e) {
            log.error("导入模板失败【{}】", e.getMessage());
            e.printStackTrace();
        }
        return R.ok();
    }
    @ApiOperation(value = "excel导入重精人员")
    @PostMapping(value = "/serve/importMajor", consumes = "multipart/*", headers = "content-type=multipart/form-date")
    public R importMajor(@RequestParam MultipartFile file, HttpServletRequest request) {
        //获取文件名
        String fileName = file.getOriginalFilename();
        log.info("传入文件名字【{}】", fileName);
        InputStream inputStream = null;
        try {
            inputStream = file.getInputStream();
            ComMngPopulationMajorExcelListen comMngPopulationMajorExcelListen = new ComMngPopulationMajorExcelListen(communityService, this.getCommunityId(),userName,password,host,port,excelUrl,stringRedisTemplate);
            EasyExcel.read(inputStream, null, comMngPopulationMajorExcelListen).sheet().doRead();
        } catch (IOException e) {
            log.error("导入模板失败【{}】", e.getMessage());
            e.printStackTrace();
@@ -229,6 +282,586 @@
                }
            }
            return R.ok(excelUrl + "实有人口导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "吸毒人员-下载模板")
    @GetMapping("/export/drug")
    public R exportDrug() {
        //获取登陆用户绑定社区id
        Long communityId = 2L;//this.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "吸毒人员导入模板.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<List<String>> list = new ArrayList<>();
                    List<List<Object>> dataList = new ArrayList<>();
                    list = headDrugDataFilling();
                    //查询当前社区标签列表
                    R tagsResult = userService.listTags(communityId);
                    if(Constants.SUCCESS.equals(tagsResult.getCode())){
                        List<String> TagsList = (List<String>)tagsResult.getData();
                        //动态加载标签列表到表头
                        for (int i = 0; i < TagsList.size(); i++) {
                            List<String> head = new ArrayList<>();
                            head.add(TagsList.get(i) + "(是/否)");
                            list.add(head);
                        }
                    }
                    EasyExcel.write(fileName).head(list).sheet("吸毒人员导入模板").doWrite(dataList);
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
            return R.ok(excelUrl + "吸毒人员导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "社区矫正人员-下载模板")
    @GetMapping("/export/correctr")
    public R exportCorrect() {
        //获取登陆用户绑定社区id
        Long communityId = 2L;//this.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "社区矫正人员导入模板.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<List<String>> list = new ArrayList<>();
                    List<List<Object>> dataList = new ArrayList<>();
                    list = headCorrectDataFilling();
                    //查询当前社区标签列表
                    R tagsResult = userService.listTags(communityId);
                    if(Constants.SUCCESS.equals(tagsResult.getCode())){
                        List<String> TagsList = (List<String>)tagsResult.getData();
                        //动态加载标签列表到表头
                        for (int i = 0; i < TagsList.size(); i++) {
                            List<String> head = new ArrayList<>();
                            head.add(TagsList.get(i) + "(是/否)");
                            list.add(head);
                        }
                    }
                    EasyExcel.write(fileName).head(list).sheet("社区矫正人员导入模板").doWrite(dataList);
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
            return R.ok(excelUrl + "社区矫正人员导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "重精人员-下载模板")
    @GetMapping("/export/major")
    public R exportMajor() {
        //获取登陆用户绑定社区id
        Long communityId = 2L;//this.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "重精人员导入模板.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<List<String>> list = new ArrayList<>();
                    List<List<Object>> dataList = new ArrayList<>();
                    list = headMajorDataFilling();
                    //查询当前社区标签列表
                    R tagsResult = userService.listTags(communityId);
                    if(Constants.SUCCESS.equals(tagsResult.getCode())){
                        List<String> TagsList = (List<String>)tagsResult.getData();
                        //动态加载标签列表到表头
                        for (int i = 0; i < TagsList.size(); i++) {
                            List<String> head = new ArrayList<>();
                            head.add(TagsList.get(i) + "(是/否)");
                            list.add(head);
                        }
                    }
                    EasyExcel.write(fileName).head(list).sheet("重精人员导入模板").doWrite(dataList);
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
            return R.ok(excelUrl + "重精人员导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "邪教人员-下载模板")
    @GetMapping("/export/cult")
    public R exportCult() {
        //获取登陆用户绑定社区id
        Long communityId = 2L;//this.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "邪教人员导入模板.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<List<String>> list = new ArrayList<>();
                    List<List<Object>> dataList = new ArrayList<>();
                    list = headCultDataFilling();
                    //查询当前社区标签列表
                    R tagsResult = userService.listTags(communityId);
                    if(Constants.SUCCESS.equals(tagsResult.getCode())){
                        List<String> TagsList = (List<String>)tagsResult.getData();
                        //动态加载标签列表到表头
                        for (int i = 0; i < TagsList.size(); i++) {
                            List<String> head = new ArrayList<>();
                            head.add(TagsList.get(i) + "(是/否)");
                            list.add(head);
                        }
                    }
                    EasyExcel.write(fileName).head(list).sheet("邪教人员导入模板").doWrite(dataList);
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
            return R.ok(excelUrl + "邪教人员导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "刑释人员-下载模板")
    @GetMapping("/export/rehabilitation")
    public R exportRehabilitation() {
        //获取登陆用户绑定社区id
        Long communityId = 2L;//this.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "刑释人员导入模板.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<List<String>> list = new ArrayList<>();
                    List<List<Object>> dataList = new ArrayList<>();
                    list = headRehabilitationDataFilling();
                    //查询当前社区标签列表
                    R tagsResult = userService.listTags(communityId);
                    if(Constants.SUCCESS.equals(tagsResult.getCode())){
                        List<String> TagsList = (List<String>)tagsResult.getData();
                        //动态加载标签列表到表头
                        for (int i = 0; i < TagsList.size(); i++) {
                            List<String> head = new ArrayList<>();
                            head.add(TagsList.get(i) + "(是/否)");
                            list.add(head);
                        }
                    }
                    EasyExcel.write(fileName).head(list).sheet("刑释人员导入模板").doWrite(dataList);
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
            return R.ok(excelUrl + "刑释人员导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "重点上访人员-下载模板")
    @GetMapping("/export/key")
    public R exportKey() {
        //获取登陆用户绑定社区id
        Long communityId = 2L;//this.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "重点上访人员导入模板.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<List<String>> list = new ArrayList<>();
                    List<List<Object>> dataList = new ArrayList<>();
                    list = headKeyDataFilling();
                    //查询当前社区标签列表
                    R tagsResult = userService.listTags(communityId);
                    if(Constants.SUCCESS.equals(tagsResult.getCode())){
                        List<String> TagsList = (List<String>)tagsResult.getData();
                        //动态加载标签列表到表头
                        for (int i = 0; i < TagsList.size(); i++) {
                            List<String> head = new ArrayList<>();
                            head.add(TagsList.get(i) + "(是/否)");
                            list.add(head);
                        }
                    }
                    EasyExcel.write(fileName).head(list).sheet("重点上访人员导入模板").doWrite(dataList);
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
            return R.ok(excelUrl + "重点上访人员导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "服刑人员-下载模板")
    @GetMapping("/export/sentence")
    public R exportSentence() {
        //获取登陆用户绑定社区id
        Long communityId = 2L;//this.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "服刑人员导入模板.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<List<String>> list = new ArrayList<>();
                    List<List<Object>> dataList = new ArrayList<>();
                    list = headSentenceDataFilling();
                    //查询当前社区标签列表
                    R tagsResult = userService.listTags(communityId);
                    if(Constants.SUCCESS.equals(tagsResult.getCode())){
                        List<String> TagsList = (List<String>)tagsResult.getData();
                        //动态加载标签列表到表头
                        for (int i = 0; i < TagsList.size(); i++) {
                            List<String> head = new ArrayList<>();
                            head.add(TagsList.get(i) + "(是/否)");
                            list.add(head);
                        }
                    }
                    EasyExcel.write(fileName).head(list).sheet("服刑人员导入模板").doWrite(dataList);
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
            return R.ok(excelUrl + "服刑人员导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "退役军人-下载模板")
    @GetMapping("/export/veterans")
    public R exportVeterans() {
        //获取登陆用户绑定社区id
        Long communityId = 2L;//this.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "退役军人导入模板.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<List<String>> list = new ArrayList<>();
                    List<List<Object>> dataList = new ArrayList<>();
                    list = headVeteransDataFilling();
                    //查询当前社区标签列表
                    R tagsResult = userService.listTags(communityId);
                    if(Constants.SUCCESS.equals(tagsResult.getCode())){
                        List<String> TagsList = (List<String>)tagsResult.getData();
                        //动态加载标签列表到表头
                        for (int i = 0; i < TagsList.size(); i++) {
                            List<String> head = new ArrayList<>();
                            head.add(TagsList.get(i) + "(是/否)");
                            list.add(head);
                        }
                    }
                    EasyExcel.write(fileName).head(list).sheet("退役军人导入模板").doWrite(dataList);
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
            return R.ok(excelUrl + "退役军人导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "残疾人-下载模板")
    @GetMapping("/export/disability")
    public R exportDisability() {
        //获取登陆用户绑定社区id
        Long communityId = 2L;//this.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "残疾人导入模板.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<List<String>> list = new ArrayList<>();
                    List<List<Object>> dataList = new ArrayList<>();
                    list = headDisabilityDataFilling();
                    //查询当前社区标签列表
                    R tagsResult = userService.listTags(communityId);
                    if(Constants.SUCCESS.equals(tagsResult.getCode())){
                        List<String> TagsList = (List<String>)tagsResult.getData();
                        //动态加载标签列表到表头
                        for (int i = 0; i < TagsList.size(); i++) {
                            List<String> head = new ArrayList<>();
                            head.add(TagsList.get(i) + "(是/否)");
                            list.add(head);
                        }
                    }
                    EasyExcel.write(fileName).head(list).sheet("残疾人导入模板").doWrite(dataList);
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
            return R.ok(excelUrl + "残疾人导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "低保户-下载模板")
    @GetMapping("/export/lowSecurity")
    public R exportRowSecurity() {
        //获取登陆用户绑定社区id
        Long communityId = 2L;//this.getCommunityId();
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String name = "低保户导入模板.xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    List<List<String>> list = new ArrayList<>();
                    List<List<Object>> dataList = new ArrayList<>();
                    list = headLowSecurityDataFilling();
                    //查询当前社区标签列表
                    R tagsResult = userService.listTags(communityId);
                    if(Constants.SUCCESS.equals(tagsResult.getCode())){
                        List<String> TagsList = (List<String>)tagsResult.getData();
                        //动态加载标签列表到表头
                        for (int i = 0; i < TagsList.size(); i++) {
                            List<String> head = new ArrayList<>();
                            head.add(TagsList.get(i) + "(是/否)");
                            list.add(head);
                        }
                    }
                    EasyExcel.write(fileName).head(list).sheet("低保户导入模板").doWrite(dataList);
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                }
            }
            return R.ok(excelUrl + "低保户导入模板.xlsx");
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
@@ -376,6 +1009,882 @@
        list.add(head38);
        list.add(head39);
        list.add(head40);
        return list;
    }
    //吸毒人员
    private List<List<String>> headDrugDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
        head0.add("序号");
        List<String> head1 = new ArrayList<String>();
        head1.add("*姓名");
        List<String> head2 = new ArrayList<String>();
        head2.add("民族");
        List<String> head3 = new ArrayList<String>();
        head3.add("*身份证号码");
        List<String> head4 = new ArrayList<String>();
        head4.add("联系电话");
        List<String> head5 = new ArrayList<String>();
        head5.add("*街/路/巷");
        List<String> head6 = new ArrayList<String>();
        head6.add("*小区号(政府对于每个小区都有特定编号)");
        List<String> head7 = new ArrayList<String>();
        head7.add("*楼排号");
        List<String> head8 = new ArrayList<String>();
        head8.add("*单元号");
        List<String> head9 = new ArrayList<String>();
        head9.add("*户室(四位数表示。前两位楼层,后两位户号)");
        List<String> head10 = new ArrayList<String>();
        head10.add("*是否租住(自住/租住)");
        List<String> head11 = new ArrayList<String>();
        head11.add("*房屋状态(自住/租住/其他)");
        List<String> head12 = new ArrayList<String>();
        head12.add("*房屋用途(住宅/公寓/宿舍/仓库/其他)");
        List<String> head13 = new ArrayList<String>();
        head13.add("*管控状态(常规/关注/管控)");
        List<String> head14 = new ArrayList<String>();
        head14.add("本地/外地");
        List<String> head15 = new ArrayList<String>();
        head15.add("户口所在地");
        List<String> head16 = new ArrayList<String>();
        head16.add("备注");
        list.add(head0);
        list.add(head1);
        list.add(head2);
        list.add(head3);
        list.add(head4);
        list.add(head5);
        list.add(head6);
        list.add(head7);
        list.add(head8);
        list.add(head9);
        list.add(head10);
        list.add(head11);
        list.add(head12);
        list.add(head13);
        list.add(head14);
        list.add(head15);
        list.add(head16);
        return list;
    }
    //矫正人员
    private List<List<String>> headCorrectDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
        head0.add("序号");
        List<String> head1 = new ArrayList<String>();
        head1.add("*姓名");
        List<String> head2 = new ArrayList<String>();
        head2.add("民族");
        List<String> head3 = new ArrayList<String>();
        head3.add("*身份证号码");
        List<String> head4 = new ArrayList<String>();
        head4.add("联系电话");
        List<String> head5 = new ArrayList<String>();
        head5.add("*街/路/巷");
        List<String> head6 = new ArrayList<String>();
        head6.add("*小区号(政府对于每个小区都有特定编号)");
        List<String> head7 = new ArrayList<String>();
        head7.add("*楼排号");
        List<String> head8 = new ArrayList<String>();
        head8.add("*单元号");
        List<String> head9 = new ArrayList<String>();
        head9.add("*户室(四位数表示。前两位楼层,后两位户号)");
        List<String> head10 = new ArrayList<String>();
        head10.add("*是否租住(自住/租住)");
        List<String> head11 = new ArrayList<String>();
        head11.add("*房屋状态(自住/租住/其他)");
        List<String> head12 = new ArrayList<String>();
        head12.add("*房屋用途(住宅/公寓/宿舍/仓库/其他)");
        List<String> head13 = new ArrayList<String>();
        head13.add("*管控状态(常规/关注/管控)");
        List<String> head14 = new ArrayList<String>();
        head14.add("本地/外地");
        List<String> head15 = new ArrayList<String>();
        head15.add("户口所在地");
        List<String> head16 = new ArrayList<String>();
        head16.add("*矫正开始时间");
        List<String> head17 = new ArrayList<String>();
        head17.add("矫正结束时间");
        List<String> head18 = new ArrayList<String>();
        head18.add("矫正类型");
        List<String> head19 = new ArrayList<String>();
        head19.add("罪名");
        List<String> head20 = new ArrayList<String>();
        head20.add("备注");
        list.add(head0);
        list.add(head1);
        list.add(head2);
        list.add(head3);
        list.add(head4);
        list.add(head5);
        list.add(head6);
        list.add(head7);
        list.add(head8);
        list.add(head9);
        list.add(head10);
        list.add(head11);
        list.add(head12);
        list.add(head13);
        list.add(head14);
        list.add(head15);
        list.add(head16);
        list.add(head17);
        list.add(head18);
        list.add(head19);
        list.add(head20);
        return list;
    }
    //重精人员
    private List<List<String>> headMajorDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
        head0.add("序号");
        List<String> head1 = new ArrayList<String>();
        head1.add("*姓名");
        List<String> head2 = new ArrayList<String>();
        head2.add("*身份证号码");
        List<String> head3 = new ArrayList<String>();
        head3.add("*街/路/巷");
        List<String> head4 = new ArrayList<String>();
        head4.add("*小区号(政府对于每个小区都有特定编号)");
        List<String> head5 = new ArrayList<String>();
        head5.add("*楼排号");
        List<String> head6 = new ArrayList<String>();
        head6.add("*单元号");
        List<String> head7 = new ArrayList<String>();
        head7.add("*户室(四位数表示。前两位楼层,后两位户号)");
        List<String> head8 = new ArrayList<String>();
        head8.add("*是否租住(自住/租住)");
        List<String> head9 = new ArrayList<String>();
        head9.add("*房屋状态(自住/租住/其他)");
        List<String> head10 = new ArrayList<String>();
        head10.add("*房屋用途(住宅/公寓/宿舍/仓库/其他)");
        List<String> head11 = new ArrayList<String>();
        head11.add("*管控状态(常规/关注/管控)");
        List<String> head12 = new ArrayList<String>();
        head12.add("本地/外地");
        List<String> head13 = new ArrayList<String>();
        head13.add("户口所在地");
        List<String> head14 = new ArrayList<String>();
        head14.add("文化程度");
        List<String> head15 = new ArrayList<String>();
        head15.add("经济状况");
        List<String> head16 = new ArrayList<String>();
        head16.add("监护人");
        List<String> head17 = new ArrayList<String>();
        head17.add("监护人电话");
        List<String> head18 = new ArrayList<String>();
        head18.add("与患者关系");
        List<String> head19 = new ArrayList<String>();
        head19.add("目前诊断");
        List<String> head20 = new ArrayList<String>();
        head20.add("其他");
        list.add(head0);
        list.add(head1);
        list.add(head2);
        list.add(head3);
        list.add(head4);
        list.add(head5);
        list.add(head6);
        list.add(head7);
        list.add(head8);
        list.add(head9);
        list.add(head10);
        list.add(head11);
        list.add(head12);
        list.add(head13);
        list.add(head14);
        list.add(head15);
        list.add(head16);
        list.add(head17);
        list.add(head18);
        list.add(head19);
        list.add(head20);
        return list;
    }
    //邪教人员
    private List<List<String>> headCultDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
        head0.add("序号");
        List<String> head1 = new ArrayList<String>();
        head1.add("*姓名");
        List<String> head2 = new ArrayList<String>();
        head2.add("*身份证号码");
        List<String> head3 = new ArrayList<String>();
        head3.add("民族");
        List<String> head4 = new ArrayList<String>();
        head4.add("职业");
        List<String> head5 = new ArrayList<String>();
        head5.add("婚姻状况");
        List<String> head6 = new ArrayList<String>();
        head6.add("文化程度");
        List<String> head7 = new ArrayList<String>();
        head7.add("政治面貌");
        List<String> head8 = new ArrayList<String>();
        head8.add("*街/路/巷");
        List<String> head9 = new ArrayList<String>();
        head9.add("*小区号(政府对于每个小区都有特定编号)");
        List<String> head10 = new ArrayList<String>();
        head10.add("*楼排号");
        List<String> head11 = new ArrayList<String>();
        head11.add("*单元号");
        List<String> head12 = new ArrayList<String>();
        head12.add("*户室(四位数表示。前两位楼层,后两位户号)");
        List<String> head13 = new ArrayList<String>();
        head13.add("*是否租住(自住/租住)");
        List<String> head14 = new ArrayList<String>();
        head14.add("*房屋状态(自住/租住/其他)");
        List<String> head15 = new ArrayList<String>();
        head15.add("*房屋用途(住宅/公寓/宿舍/仓库/其他)");
        List<String> head16 = new ArrayList<String>();
        head16.add("*管控状态(常规/关注/管控)");
        List<String> head17 = new ArrayList<String>();
        head17.add("本地/外地");
        List<String> head18 = new ArrayList<String>();
        head18.add("户口所在地");
        List<String> head19 = new ArrayList<String>();
        head19.add("邪教名称");
        List<String> head20 = new ArrayList<String>();
        head20.add("基本情况");
        List<String> head21 = new ArrayList<String>();
        head21.add("备注");
        list.add(head0);
        list.add(head1);
        list.add(head2);
        list.add(head3);
        list.add(head4);
        list.add(head5);
        list.add(head6);
        list.add(head7);
        list.add(head8);
        list.add(head9);
        list.add(head10);
        list.add(head11);
        list.add(head12);
        list.add(head13);
        list.add(head14);
        list.add(head15);
        list.add(head16);
        list.add(head17);
        list.add(head18);
        list.add(head19);
        list.add(head20);
        list.add(head21);
        return list;
    }
    //刑释人员
    private List<List<String>> headRehabilitationDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
        head0.add("序号");
        List<String> head1 = new ArrayList<String>();
        head1.add("*姓名");
        List<String> head2 = new ArrayList<String>();
        head2.add("民族");
        List<String> head3 = new ArrayList<String>();
        head3.add("*身份证号码");
        List<String> head4 = new ArrayList<String>();
        head4.add("联系电话");
        List<String> head5 = new ArrayList<String>();
        head5.add("籍贯");
        List<String> head6 = new ArrayList<String>();
        head6.add("*街/路/巷");
        List<String> head7 = new ArrayList<String>();
        head7.add("*小区号(政府对于每个小区都有特定编号)");
        List<String> head8 = new ArrayList<String>();
        head8.add("*楼排号");
        List<String> head9 = new ArrayList<String>();
        head9.add("*单元号");
        List<String> head10 = new ArrayList<String>();
        head10.add("*户室(四位数表示。前两位楼层,后两位户号)");
        List<String> head11 = new ArrayList<String>();
        head11.add("*是否租住(自住/租住)");
        List<String> head12 = new ArrayList<String>();
        head12.add("*房屋状态(自住/租住/其他)");
        List<String> head13 = new ArrayList<String>();
        head13.add("*房屋用途(住宅/公寓/宿舍/仓库/其他)");
        List<String> head14 = new ArrayList<String>();
        head14.add("*管控状态(常规/关注/管控)");
        List<String> head15 = new ArrayList<String>();
        head15.add("本地/外地");
        List<String> head16 = new ArrayList<String>();
        head16.add("户口所在地");
        List<String> head17 = new ArrayList<String>();
        head17.add("主要亲属");
        List<String> head18 = new ArrayList<String>();
        head18.add("与人员关系");
        List<String> head19 = new ArrayList<String>();
        head19.add("列管原因及类别");
        List<String> head20 = new ArrayList<String>();
        head20.add("是否列管");
        List<String> head21 = new ArrayList<String>();
        head21.add("备注");
        list.add(head0);
        list.add(head1);
        list.add(head2);
        list.add(head3);
        list.add(head4);
        list.add(head5);
        list.add(head6);
        list.add(head7);
        list.add(head8);
        list.add(head9);
        list.add(head10);
        list.add(head11);
        list.add(head12);
        list.add(head13);
        list.add(head14);
        list.add(head15);
        list.add(head16);
        list.add(head17);
        list.add(head18);
        list.add(head19);
        list.add(head20);
        list.add(head21);
        return list;
    }
    //重点上访人员
    private List<List<String>> headKeyDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
        head0.add("序号");
        List<String> head1 = new ArrayList<String>();
        head1.add("*姓名");
        List<String> head2 = new ArrayList<String>();
        head2.add("民族");
        List<String> head3 = new ArrayList<String>();
        head3.add("*身份证号码");
        List<String> head4 = new ArrayList<String>();
        head4.add("联系电话");
        List<String> head5 = new ArrayList<String>();
        head5.add("籍贯");
        List<String> head6 = new ArrayList<String>();
        head6.add("*街/路/巷");
        List<String> head7 = new ArrayList<String>();
        head7.add("*小区号(政府对于每个小区都有特定编号)");
        List<String> head8 = new ArrayList<String>();
        head8.add("*楼排号");
        List<String> head9 = new ArrayList<String>();
        head9.add("*单元号");
        List<String> head10 = new ArrayList<String>();
        head10.add("*户室(四位数表示。前两位楼层,后两位户号)");
        List<String> head11 = new ArrayList<String>();
        head11.add("*是否租住(自住/租住)");
        List<String> head12 = new ArrayList<String>();
        head12.add("*房屋状态(自住/租住/其他)");
        List<String> head13 = new ArrayList<String>();
        head13.add("*房屋用途(住宅/公寓/宿舍/仓库/其他)");
        List<String> head14 = new ArrayList<String>();
        head14.add("*管控状态(常规/关注/管控)");
        List<String> head15 = new ArrayList<String>();
        head15.add("本地/外地");
        List<String> head16 = new ArrayList<String>();
        head16.add("户口所在地");
        List<String> head17 = new ArrayList<String>();
        head17.add("备注");
        list.add(head0);
        list.add(head1);
        list.add(head2);
        list.add(head3);
        list.add(head4);
        list.add(head5);
        list.add(head6);
        list.add(head7);
        list.add(head8);
        list.add(head9);
        list.add(head10);
        list.add(head11);
        list.add(head12);
        list.add(head13);
        list.add(head14);
        list.add(head15);
        list.add(head16);
        list.add(head17);
        return list;
    }
    //服刑人员
    private List<List<String>> headSentenceDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
        head0.add("序号");
        List<String> head1 = new ArrayList<String>();
        head1.add("*姓名");
        List<String> head2 = new ArrayList<String>();
        head2.add("民族");
        List<String> head3 = new ArrayList<String>();
        head3.add("*身份证号码");
        List<String> head4 = new ArrayList<String>();
        head4.add("联系电话");
        List<String> head5 = new ArrayList<String>();
        head5.add("配偶");
        List<String> head6 = new ArrayList<String>();
        head6.add("职业");
        List<String> head7 = new ArrayList<String>();
        head7.add("*街/路/巷");
        List<String> head8 = new ArrayList<String>();
        head8.add("*小区号(政府对于每个小区都有特定编号)");
        List<String> head9 = new ArrayList<String>();
        head9.add("*楼排号");
        List<String> head10 = new ArrayList<String>();
        head10.add("*单元号");
        List<String> head11 = new ArrayList<String>();
        head11.add("*户室(四位数表示。前两位楼层,后两位户号)");
        List<String> head12 = new ArrayList<String>();
        head12.add("*是否租住(自住/租住)");
        List<String> head13 = new ArrayList<String>();
        head13.add("*房屋状态(自住/租住/其他)");
        List<String> head14 = new ArrayList<String>();
        head14.add("*房屋用途(住宅/公寓/宿舍/仓库/其他)");
        List<String> head15 = new ArrayList<String>();
        head15.add("*管控状态(常规/关注/管控)");
        List<String> head16 = new ArrayList<String>();
        head16.add("本地/外地");
        List<String> head17 = new ArrayList<String>();
        head17.add("户口所在地");
        List<String> head18 = new ArrayList<String>();
        head18.add("服刑地");
        List<String> head19 = new ArrayList<String>();
        head19.add("服刑开始时间");
        List<String> head20 = new ArrayList<String>();
        head20.add("服刑结束时间");
        List<String> head21 = new ArrayList<String>();
        head21.add("罪名");
        List<String> head22 = new ArrayList<String>();
        head22.add("备注");
        list.add(head0);
        list.add(head1);
        list.add(head2);
        list.add(head3);
        list.add(head4);
        list.add(head5);
        list.add(head6);
        list.add(head7);
        list.add(head8);
        list.add(head9);
        list.add(head10);
        list.add(head11);
        list.add(head12);
        list.add(head13);
        list.add(head14);
        list.add(head15);
        list.add(head16);
        list.add(head17);
        list.add(head18);
        list.add(head19);
        list.add(head20);
        list.add(head21);
        list.add(head22);
        return list;
    }
    //退役军人
    private List<List<String>> headVeteransDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
        head0.add("序号");
        List<String> head1 = new ArrayList<String>();
        head1.add("*人员状态");
        List<String> head2 = new ArrayList<String>();
        head2.add("机构");
        List<String> head3 = new ArrayList<String>();
        head3.add("姓名");
        List<String> head4 = new ArrayList<String>();
        head4.add("身份证号码");
        List<String> head5 = new ArrayList<String>();
        head5.add("联系电话");
        List<String> head6 = new ArrayList<String>();
        head6.add("照片");
        List<String> head7 = new ArrayList<String>();
        head7.add("户籍性质");
        List<String> head8 = new ArrayList<String>();
        head8.add("户口所在地(身份证地址)");
        List<String> head9 = new ArrayList<String>();
        head9.add("本地/外地");
        List<String> head10 = new ArrayList<String>();
        head10.add("*街/路/巷");
        List<String> head11 = new ArrayList<String>();
        head11.add("*小区号(政府对于每个小区都有特定编号)");
        List<String> head12 = new ArrayList<String>();
        head12.add("*楼排号");
        List<String> head13 = new ArrayList<String>();
        head13.add("*单元号");
        List<String> head14 = new ArrayList<String>();
        head14.add("*户室(四位数表示。前两位楼层,后两位户号)");
        List<String> head15 = new ArrayList<String>();
        head15.add("*是否租住(自住/租住)");
        List<String> head16 = new ArrayList<String>();
        head16.add("*房屋状态(自住/租住/其他)");
        List<String> head17 = new ArrayList<String>();
        head17.add("*房屋用途(住宅/公寓/宿舍/仓库/其他)");
        List<String> head18 = new ArrayList<String>();
        head18.add("*管控状态(常规/关注/管控)");
        List<String> head19 = new ArrayList<String>();
        head19.add("入伍时间");
        List<String> head20 = new ArrayList<String>();
        head20.add("退伍时间");
        List<String> head21 = new ArrayList<String>();
        head21.add("人员类别");
        List<String> head22 = new ArrayList<String>();
        head22.add("民族");
        List<String> head23 = new ArrayList<String>();
        head23.add("健康状况");
        List<String> head24 = new ArrayList<String>();
        head24.add("政治面貌");
        List<String> head25 = new ArrayList<String>();
        head25.add("婚姻状况");
        List<String> head26 = new ArrayList<String>();
        head26.add("住房情况");
        List<String> head27 = new ArrayList<String>();
        head27.add("住房情况其他(手填)");
        List<String> head28 = new ArrayList<String>();
        head28.add("住房面积");
        List<String> head29 = new ArrayList<String>();
        head29.add("现就业情况");
        List<String> head30 = new ArrayList<String>();
        head30.add("在职情况类型");
        List<String> head31 = new ArrayList<String>();
        head31.add("现就业情况其他(手填)");
        List<String> head32 = new ArrayList<String>();
        head32.add("养老保险");
        List<String> head33 = new ArrayList<String>();
        head33.add("医疗保险");
        List<String> head34 = new ArrayList<String>();
        head34.add("现个人年收入(单位:元)");
        List<String> head35 = new ArrayList<String>();
        head35.add("父亲健康状况");
        List<String> head36 = new ArrayList<String>();
        head36.add("母亲健康状况");
        List<String> head37 = new ArrayList<String>();
        head37.add("配偶健康状况");
        List<String> head38 = new ArrayList<String>();
        head38.add("儿子健康状况");
        List<String> head39 = new ArrayList<String>();
        head39.add("女儿健康状况");
        List<String> head40 = new ArrayList<String>();
        head40.add("主要困难");
        List<String> head41 = new ArrayList<String>();
        head41.add("其他困难(手填)");
        List<String> head42 = new ArrayList<String>();
        head42.add("主要诉求");
        List<String> head43 = new ArrayList<String>();
        head43.add("主要诉求其他事项问题(手填)");
        List<String> head44 = new ArrayList<String>();
        head44.add("需参加的学历培训");
        List<String> head45 = new ArrayList<String>();
        head45.add("是否已参加退役军人培训(政府性质)");
        List<String> head46 = new ArrayList<String>();
        head46.add("入伍前学历");
        List<String> head47 = new ArrayList<String>();
        head47.add("再教育学历");
        List<String> head48 = new ArrayList<String>();
        head48.add("所学专业");
        List<String> head49 = new ArrayList<String>();
        head49.add("所学专业其他(手填)");
        List<String> head50 = new ArrayList<String>();
        head50.add("曾从事行业(含现从事行业)");
        List<String> head51 = new ArrayList<String>();
        head51.add("曾从事行业(含现从事行业)其他(手填)");
        List<String> head52 = new ArrayList<String>();
        head52.add("意向就业地点");
        List<String> head53 = new ArrayList<String>();
        head53.add("意向就业地点其他地区(手填)");
        List<String> head54 = new ArrayList<String>();
        head54.add("待业期间的求职意向");
        List<String> head55 = new ArrayList<String>();
        head55.add("待业期间的求职意向其他(手填)");
        List<String> head56 = new ArrayList<String>();
        head56.add("是否有创业意愿");
        List<String> head57 = new ArrayList<String>();
        head57.add("创业意愿");
        List<String> head58 = new ArrayList<String>();
        head58.add("备注");
        List<String> head59 = new ArrayList<String>();
        head59.add("填表单位");
        List<String> head60 = new ArrayList<String>();
        head60.add("填表人");
        List<String> head61 = new ArrayList<String>();
        head61.add("填表人联系电话");
        list.add(head0);
        list.add(head1);
        list.add(head2);
        list.add(head3);
        list.add(head4);
        list.add(head5);
        list.add(head6);
        list.add(head7);
        list.add(head8);
        list.add(head9);
        list.add(head10);
        list.add(head11);
        list.add(head12);
        list.add(head13);
        list.add(head14);
        list.add(head15);
        list.add(head16);
        list.add(head17);
        list.add(head18);
        list.add(head19);
        list.add(head20);
        list.add(head21);
        list.add(head22);
        list.add(head23);
        list.add(head24);
        list.add(head25);
        list.add(head26);
        list.add(head27);
        list.add(head28);
        list.add(head29);
        list.add(head30);
        list.add(head31);
        list.add(head32);
        list.add(head33);
        list.add(head34);
        list.add(head35);
        list.add(head36);
        list.add(head37);
        list.add(head38);
        list.add(head39);
        list.add(head40);
        list.add(head41);
        list.add(head42);
        list.add(head43);
        list.add(head44);
        list.add(head45);
        list.add(head46);
        list.add(head47);
        list.add(head48);
        list.add(head49);
        list.add(head50);
        list.add(head51);
        list.add(head52);
        list.add(head53);
        list.add(head54);
        list.add(head55);
        list.add(head56);
        list.add(head57);
        list.add(head58);
        list.add(head59);
        list.add(head60);
        list.add(head61);
        return list;
    }
    //残疾人员
    private List<List<String>> headDisabilityDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
        head0.add("序号");
        List<String> head1 = new ArrayList<String>();
        head1.add("*姓名");
        List<String> head2 = new ArrayList<String>();
        head2.add("*身份证号码");
        List<String> head3 = new ArrayList<String>();
        head3.add("办证状况");
        List<String> head4 = new ArrayList<String>();
        head4.add("文化程度");
        List<String> head5 = new ArrayList<String>();
        head5.add("民族");
        List<String> head6 = new ArrayList<String>();
        head6.add("残疾类别");
        List<String> head7 = new ArrayList<String>();
        head7.add("残疾等级");
        List<String> head8 = new ArrayList<String>();
        head8.add("联系电话");
        List<String> head9 = new ArrayList<String>();
        head9.add("*街/路/巷");
        List<String> head10 = new ArrayList<String>();
        head10.add("*小区号(政府对于每个小区都有特定编号)");
        List<String> head11 = new ArrayList<String>();
        head11.add("*楼排号");
        List<String> head12 = new ArrayList<String>();
        head12.add("*单元号");
        List<String> head13 = new ArrayList<String>();
        head13.add("*户室(四位数表示。前两位楼层,后两位户号)");
        List<String> head14 = new ArrayList<String>();
        head14.add("*是否租住(自住/租住)");
        List<String> head15 = new ArrayList<String>();
        head15.add("*房屋状态(自住/租住/其他)");
        List<String> head16 = new ArrayList<String>();
        head16.add("*房屋用途(住宅/公寓/宿舍/仓库/其他)");
        List<String> head17 = new ArrayList<String>();
        head17.add("*管控状态(常规/关注/管控)");
        List<String> head18 = new ArrayList<String>();
        head18.add("本地/外地");
        List<String> head19 = new ArrayList<String>();
        head19.add("户口所在地");
        List<String> head20 = new ArrayList<String>();
        head20.add("备注");
        list.add(head0);
        list.add(head1);
        list.add(head2);
        list.add(head3);
        list.add(head4);
        list.add(head5);
        list.add(head6);
        list.add(head7);
        list.add(head8);
        list.add(head9);
        list.add(head10);
        list.add(head11);
        list.add(head12);
        list.add(head13);
        list.add(head14);
        list.add(head15);
        list.add(head16);
        list.add(head17);
        list.add(head18);
        list.add(head19);
        list.add(head20);
        return list;
    }
    //低保户
    private List<List<String>> headLowSecurityDataFilling(){
        List<List<String>> list = new ArrayList<List<String>>();
        List<String> head0 = new ArrayList<String>();
        head0.add("序号");
        List<String> head1 = new ArrayList<String>();
        head1.add("*姓名");
        List<String> head2 = new ArrayList<String>();
        head2.add("*身份证号码");
        List<String> head3 = new ArrayList<String>();
        head3.add("联系电话");
        List<String> head4 = new ArrayList<String>();
        head4.add("地区");
        List<String> head5 = new ArrayList<String>();
        head5.add("家庭编码");
        List<String> head6 = new ArrayList<String>();
        head6.add("组名称");
        List<String> head7 = new ArrayList<String>();
        head7.add("分类救助类别");
        List<String> head8 = new ArrayList<String>();
        head8.add("申请日期");
        List<String> head9 = new ArrayList<String>();
        head9.add("户主姓名");
        List<String> head10 = new ArrayList<String>();
        head10.add("户主身份证号");
        List<String> head11 = new ArrayList<String>();
        head11.add("*街/路/巷");
        List<String> head12 = new ArrayList<String>();
        head12.add("*小区号(政府对于每个小区都有特定编号)");
        List<String> head13 = new ArrayList<String>();
        head13.add("*楼排号");
        List<String> head14 = new ArrayList<String>();
        head14.add("*单元号");
        List<String> head15 = new ArrayList<String>();
        head15.add("*户室(四位数表示。前两位楼层,后两位户号)");
        List<String> head16 = new ArrayList<String>();
        head16.add("*是否租住(自住/租住)");
        List<String> head17 = new ArrayList<String>();
        head17.add("*房屋状态(自住/租住/其他)");
        List<String> head18 = new ArrayList<String>();
        head18.add("*房屋用途(住宅/公寓/宿舍/仓库/其他)");
        List<String> head19 = new ArrayList<String>();
        head19.add("*管控状态(常规/关注/管控)");
        List<String> head20 = new ArrayList<String>();
        head20.add("本地/外地");
        List<String> head21 = new ArrayList<String>();
        head21.add("户口所在地");
        List<String> head22 = new ArrayList<String>();
        head22.add("居住地邮编");
        List<String> head23 = new ArrayList<String>();
        head23.add("救助证号");
        List<String> head24 = new ArrayList<String>();
        head24.add("保障人口数");
        List<String> head25 = new ArrayList<String>();
        head25.add("家庭人口数");
        List<String> head26 = new ArrayList<String>();
        head26.add("开户人");
        List<String> head27 = new ArrayList<String>();
        head27.add("开户银行");
        List<String> head28 = new ArrayList<String>();
        head28.add("开户人身份证号");
        List<String> head29 = new ArrayList<String>();
        head29.add("银行账号");
        List<String> head30 = new ArrayList<String>();
        head30.add("供养机构");
        List<String> head31 = new ArrayList<String>();
        head31.add("资金发放方式");
        List<String> head32 = new ArrayList<String>();
        head32.add("保障金额");
        List<String> head33 = new ArrayList<String>();
        head33.add("调剂金额");
        List<String> head34 = new ArrayList<String>();
        head34.add("差额救助金额");
        List<String> head35 = new ArrayList<String>();
        head35.add("分类施保金额");
        List<String> head36 = new ArrayList<String>();
        head36.add("家庭月总收入");
        List<String> head37 = new ArrayList<String>();
        head37.add("家庭月均收入");
        List<String> head38 = new ArrayList<String>();
        head38.add("家庭月支出");
        List<String> head39 = new ArrayList<String>();
        head39.add("经度");
        List<String> head40 = new ArrayList<String>();
        head40.add("纬度");
        List<String> head41 = new ArrayList<String>();
        head41.add("始发年月");
        List<String> head42 = new ArrayList<String>();
        head42.add("护理费");
        List<String> head43 = new ArrayList<String>();
        head43.add("申请理由");
        List<String> head44 = new ArrayList<String>();
        head44.add("审核意见");
        list.add(head0);
        list.add(head1);
        list.add(head2);
        list.add(head3);
        list.add(head4);
        list.add(head5);
        list.add(head6);
        list.add(head7);
        list.add(head8);
        list.add(head9);
        list.add(head10);
        list.add(head11);
        list.add(head12);
        list.add(head13);
        list.add(head14);
        list.add(head15);
        list.add(head16);
        list.add(head17);
        list.add(head18);
        list.add(head19);
        list.add(head20);
        list.add(head21);
        list.add(head22);
        list.add(head23);
        list.add(head24);
        list.add(head25);
        list.add(head26);
        list.add(head27);
        list.add(head28);
        list.add(head29);
        list.add(head30);
        list.add(head31);
        list.add(head32);
        list.add(head33);
        list.add(head34);
        list.add(head35);
        list.add(head36);
        list.add(head37);
        list.add(head38);
        list.add(head39);
        list.add(head40);
        list.add(head41);
        list.add(head42);
        list.add(head43);
        list.add(head44);
        return list;
    }
@@ -637,4 +2146,172 @@
            return R.fail();
        }
    }
    @ApiOperation(value = "下载导入失败吸毒人员数据")
    @PostMapping("/download/error/Drugpopulation")
    public R downloadErrorDrugPopulation(@RequestParam(value = "key") String key) {
        List<ComMngPopulationDrugMistakeExcelVO> list = new ArrayList<>();
        Boolean isExits = stringRedisTemplate.hasKey(key);
        ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue();
        if(isExits){
            String json = valueOperations.get(key);
            list= JSONArray.parseArray(json,ComMngPopulationDrugMistakeExcelVO.class);
        }
//        List<ComMngPopulationMistakeExcelVO> list = JSON.parseArray(mistakes,ComMngPopulationMistakeExcelVO.class);
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String nowDate = DateUtils.getCurrentDateString();
        String name =  "吸毒人员错误数据" + nowDate +".xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    excelWriter = EasyExcel.write(fileName, ComMngPopulationDrugMistakeExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                    WriteSheet writeSheet = EasyExcel.writerSheet("吸毒人员错误数据").build();
                    excelWriter.write(list, writeSheet);
                    excelWriter.finish();
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    if (excelWriter != null) {
                        excelWriter.finish();
                    }
                }
            }
            return R.ok(excelUrl + name);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "下载导入失败社区矫正人员数据")
    @PostMapping("/download/error/Correctpopulation")
    public R downloadErrorCorrectPopulation(@RequestParam(value = "key") String key) {
        List<ComMngPopulationCorrectMistakeExcelVO> list = new ArrayList<>();
        Boolean isExits = stringRedisTemplate.hasKey(key);
        ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue();
        if(isExits){
            String json = valueOperations.get(key);
            list= JSONArray.parseArray(json,ComMngPopulationCorrectMistakeExcelVO.class);
        }
//        List<ComMngPopulationMistakeExcelVO> list = JSON.parseArray(mistakes,ComMngPopulationMistakeExcelVO.class);
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String nowDate = DateUtils.getCurrentDateString();
        String name =  "社区矫正人员错误数据" + nowDate +".xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    excelWriter = EasyExcel.write(fileName, ComMngPopulationCorrectMistakeExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                    WriteSheet writeSheet = EasyExcel.writerSheet("社区矫正人员错误数据").build();
                    excelWriter.write(list, writeSheet);
                    excelWriter.finish();
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    if (excelWriter != null) {
                        excelWriter.finish();
                    }
                }
            }
            return R.ok(excelUrl + name);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
    @ApiOperation(value = "下载导入失败重精人员数据")
    @PostMapping("/download/error/Majorpopulation")
    public R downloadErrorMajorPopulation(@RequestParam(value = "key") String key) {
        List<ComMngPopulationMajorMistakeExcelVO> list = new ArrayList<>();
        Boolean isExits = stringRedisTemplate.hasKey(key);
        ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue();
        if(isExits){
            String json = valueOperations.get(key);
            list= JSONArray.parseArray(json,ComMngPopulationMajorMistakeExcelVO.class);
        }
//        List<ComMngPopulationMistakeExcelVO> list = JSON.parseArray(mistakes,ComMngPopulationMistakeExcelVO.class);
        //生成动态模板excel通过ftp工具上传到主节点,然后返回模板下载地址
        String ftpUrl = "/mnt/data/web/excel/";
        String nowDate = DateUtils.getCurrentDateString();
        String name =  "重精人员错误数据" + nowDate +".xlsx";
        try {
            SFTPUtil sftp = new SFTPUtil(userName, password, host, port);
            sftp.login();
            boolean existDir = sftp.isExistDir(ftpUrl + name);
            if (!existDir) {
                String property = System.getProperty("user.dir");
                String fileName = property + File.separator + name;
                // 这里 需要指定写用哪个class去写
                ExcelWriter excelWriter = null;
                InputStream inputStream = null;
                try {
                    excelWriter = EasyExcel.write(fileName, ComMngPopulationMajorMistakeExcelVO.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).registerWriteHandler(new CustomSheetWriteHandler()).build();
                    WriteSheet writeSheet = EasyExcel.writerSheet("重精人员错误数据").build();
                    excelWriter.write(list, writeSheet);
                    excelWriter.finish();
                    File file = new File(fileName);
                    inputStream = new FileInputStream(file);
                    sftp.uploadMore(ftpUrl, name, inputStream);
                    sftp.logout();
                    inputStream.close();
                    String absolutePath = file.getAbsolutePath();
                    boolean delete = file.delete();
                    log.info("删除excel【{}】结果【{}】", absolutePath, delete);
                } finally {
                    // 千万别忘记finish 会帮忙关闭流
                    if (inputStream != null) {
                        inputStream.close();
                    }
                    if (excelWriter != null) {
                        excelWriter.finish();
                    }
                }
            }
            return R.ok(excelUrl + name);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("文件传输失败【{}】", e.getMessage());
            return R.fail();
        }
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommonDataApi.java
@@ -330,6 +330,45 @@
    }
    /**
     * 批量导入吸毒人员
     *
     * @param list        吸毒人员数据
     * @param communityId 社区id
     * @return 导入结果
     */
    @PostMapping("population/importDrug")
    @Transactional(rollbackFor = Exception.class)
    public R listSavePopulationDrugExcelVO(@RequestBody List<ComMngPopulationDrugExcelVO> list, @RequestParam(value = "communityId") Long communityId){
        return comMngPopulationService.listSaveDrugPopulation(list, communityId);
    }
    /**
     * 批量导入社区矫正人员
     *
     * @param list        社区矫正人员数据
     * @param communityId 社区id
     * @return 导入结果
     */
    @PostMapping("population/importCorrect")
    @Transactional(rollbackFor = Exception.class)
    public R listSavePopulationCorrectExcelVO(@RequestBody List<ComMngPopulationCorrectExcelVO> list, @RequestParam(value = "communityId") Long communityId){
        return comMngPopulationService.listSaveCorrectPopulation(list, communityId);
    }
    /**
     * 批量导入重精人员
     *
     * @param list        重精人员数据
     * @param communityId 社区id
     * @return 导入结果
     */
    @Transactional(rollbackFor = Exception.class)
    @PostMapping("population/importMajor")
    public R listSavePopulationMajorExcelVO(@RequestBody List<ComMngPopulationMajorExcelVO> list, @RequestParam(value = "communityId") Long communityId){
        return comMngPopulationService.listSaveMajorPopulation(list, communityId);
    }
    /**
     * 确认导入实有人口(有则更新,无则新建)
     *
     * @param list        用户信息
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -20,6 +20,7 @@
import com.panzhihua.common.model.vos.user.UserPhoneVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.*;
import com.panzhihua.service_community.dao.ComActActSignDAO;
import com.panzhihua.service_community.dao.ComEldersAuthHistoryRecordMapper;
import com.panzhihua.service_community.dao.ComMngPopulationDAO;
import com.panzhihua.service_community.model.dos.*;
@@ -34,10 +35,7 @@
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -82,6 +80,8 @@
    private EldersAuthService eldersAuthService;
    @Resource
    public ComMngPopulationDAO comMngPopulationDAO;
    @Resource
    private ComActActSignDAO comActActSignDAO;
    @Resource
    public ComEldersAuthUserService comEldersAuthUserService;
    @Resource
@@ -1704,8 +1704,21 @@
            if (R.isOk(r1)) {
                log.info("新增用户报名党建活动通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
            }
        }
            //用户高龄认证反馈,推送订阅消息给用户
            Map<String,String> map = comActActSignDAO.getUserOpenId(eldersAuthDO.getSumitUserId());
            if(map != null){
                String openid = map.get("openid");
                try {
                    WxXCXTempSend util = new WxXCXTempSend();
                    String accessToken = util.getAppAccessToken();
                    WxUtil.sendSubscribeRZSH(openid,accessToken,"高龄认证"
                            ,DateUtils.format(eldersAuthDO.getCreateAt(),DateUtils.ymdhms_format),eldersAuthFeedbackAddDTO.getFeedBack());
                }catch (Exception e){
                    log.error("推送审核状态订阅消息失败,失败原因:" + e.getMessage());
                }
            }
        }
        return addR;
    }
@@ -1790,5 +1803,13 @@
        return comActEasyPhotoService.readUserReward(userId,communityId);
    }
    /**
     * 定时任务检测即将开始的社区活动,并使用订阅消息通知用户
     */
    @PostMapping("timedTaskActivityNotice")
    public R timedTaskActivityNotice(){
        return comActActivityService.timedTaskActivityNotice();
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/DictionaryApi.java
@@ -11,7 +11,6 @@
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
/** 字典
@@ -34,7 +33,7 @@
     * @date 2021/6/10 17:00
     */
    @PostMapping("/insertDiction")
    R insertDiction(@RequestBody @Valid DictionaryVO dictionaryVO, @ApiIgnore BindingResult results){
    R insertDiction(@RequestBody DictionaryVO dictionaryVO, @ApiIgnore BindingResult results){
        if (results.hasErrors()) {
            return R.fail(results.getFieldError().getDefaultMessage());
        }
@@ -48,7 +47,7 @@
     * @date 2021/6/10 17:00
     */
    @PostMapping("/insertDictionItem")
    R insertDictionItem(@RequestBody @Valid BcDictionaryVO dictionaryVO, @ApiIgnore BindingResult results){
    R insertDictionItem(@RequestBody BcDictionaryVO dictionaryVO, @ApiIgnore BindingResult results){
        if (results.hasErrors()) {
            return R.fail(results.getFieldError().getDefaultMessage());
        }
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActActSignDAO.java
@@ -12,6 +12,7 @@
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
@@ -67,6 +68,7 @@
            "u.nick_name, " +
            "case WHEN u.is_partymember = 1 THEN '党员' WHEN a.is_volunteer = 1 THEN '志愿者' ELSE '居民' END identity, " +
            "u.phone, " +
            "u.openid, " +
            "a.create_at,  " +
            "a.is_volunteer  " +
            "FROM " +
@@ -120,4 +122,7 @@
            " </if> " +
            " </script>")
    IPage<ActActivityPeopleListVO> getActActivityPeopleList(Page page,@Param("activityPeopleListDTO") ScreenActActivityPeopleListDTO activityPeopleListDTO);
    @Select("select openid from sys_user where user_id = #{userId}")
    Map<String,String> getUserOpenId(@Param("userId")Long userId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActActivityService.java
@@ -121,4 +121,9 @@
    R getActActivityPeopleList(ScreenActActivityPeopleListDTO activityPeopleListDTO);
    /**
     * 定时任务检测即将开始的社区活动,并始用订阅消息通知用户
     */
    R timedTaskActivityNotice();
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngPopulationService.java
@@ -15,12 +15,11 @@
import com.panzhihua.common.model.dtos.grid.admin.PageComMngVillagePopulationDTO;
import com.panzhihua.common.model.dtos.user.PageInputUserDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComMngPopulationServeExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationVO;
import com.panzhihua.common.model.vos.community.EditComMngPopulationVO;
import com.panzhihua.common.model.vos.community.*;
import com.panzhihua.common.model.vos.user.ComMngTagVO;
import com.panzhihua.common.model.vos.user.UserElectronicFileVO;
import com.panzhihua.service_community.model.dos.ComMngPopulationDO;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -83,6 +82,33 @@
    R listSavePopulation(List<ComMngPopulationServeExcelVO> list, Long communityId);
    /**
     * 导入吸毒人员
     * @param list
     * @param communityId
     * @return
     */
    R listSaveDrugPopulation(List<ComMngPopulationDrugExcelVO> list, Long communityId);
    /**
     * 批量导入社区矫正人员
     *
     * @param list        社区矫正人员数据
     * @param communityId 社区id
     * @return 导入结果
     */
    R listSaveCorrectPopulation(List<ComMngPopulationCorrectExcelVO> list, Long communityId);
    /**
     * 批量导入重精人员
     *
     * @param list        重精人员数据
     * @param communityId 社区id
     * @return 导入结果
     */
    R listSaveMajorPopulation(List<ComMngPopulationMajorExcelVO> list, Long communityId);
    /**
     * 确认导入实有人口(有则更新,无则新建)
     *
     * @param list        用户信息
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java
@@ -16,6 +16,8 @@
import com.panzhihua.common.model.vos.community.*;
import com.panzhihua.common.model.vos.community.screen.work.ActActivityListVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.WxUtil;
import com.panzhihua.common.utlis.WxXCXTempSend;
import com.panzhihua.service_community.dao.ComActActSignDAO;
import com.panzhihua.service_community.dao.ComActActivityDAO;
import com.panzhihua.service_community.dao.ComActDiscussOptionUserDAO;
@@ -24,15 +26,13 @@
import com.panzhihua.service_community.service.ComActActivityService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -94,7 +94,34 @@
     */
    @Override
    public R putActivity(ComActActivityVO comActActivityVO) {
        ComActActivityDO comActActivityDO=new ComActActivityDO();
        ComActActivityDO comActActivityDO = this.comActActivityDAO.selectById(comActActivityVO.getId());
        if(comActActivityDO == null){
            return R.fail("未找到社区活动");
        }
        if(!comActActivityDO.getActivityAddr().equals(comActActivityVO.getActivityAddr()) || !comActActivityDO.getBeginAt().equals(comActActivityVO.getBeginAt())){
            //修改活动开始时间与活动地点需要推送订阅消息给用户
            ActivitySignVO activitySignVO = new ActivitySignVO();
            activitySignVO.setId(comActActivityVO.getId());
            List<ActivitySignVO> activitySignVOS = comActActSignDAO.listActivitySigns(activitySignVO);
            if(!activitySignVOS.isEmpty()){
                try {
                    WxXCXTempSend util = new WxXCXTempSend();
                    String accessToken = util.getAppAccessToken();
                    activitySignVOS.forEach(activitySignVO1 -> {
                        //变更社区活动推送订阅消息给用户
                        WxUtil.sendSubscribeHDBG(activitySignVO1.getOpenid(),accessToken,comActActivityVO.getActivityName()
                                , com.panzhihua.common.utlis.DateUtils.format(comActActivityDO.getBeginAt()
                                        , com.panzhihua.common.utlis.DateUtils.ymdhms_format),comActActivityDO.getActivityAddr(),
                                com.panzhihua.common.utlis.DateUtils.format(comActActivityVO.getBeginAt()
                                        , com.panzhihua.common.utlis.DateUtils.ymdhms_format),comActActivityVO.getActivityAddr());
                    });
                }catch (Exception e){
                    log.error("消息推送失败,失败原因:" + e.getMessage());
                }
            }
        }
        BeanUtils.copyProperties(comActActivityVO,comActActivityDO);
        //结束时间大于当前时间则设置为“进行中”
@@ -500,14 +527,43 @@
        return dates;
    }
    public static void main(String[] args) {
        List<Date> dates=new ArrayList<>();
        Date date=new Date();
        for(int i=6;i>=0;i--){
            Date date1= DateUtils.addDays(date,-i);
            dates.add(date1);
    /**
     * 定时任务检测即将开始的社区活动,并使用订阅消息通知用户
     */
    @Override
    public R timedTaskActivityNotice(){
        //查询所有即将开始的活动
        List<ComActActivityDO> actActivityList = comActActivityDAO.selectList(new QueryWrapper<ComActActivityDO>().lambda()
                .le(ComActActivityDO::getBeginAt, DateUtils.addDays(new Date(),1)));
        if(!actActivityList.isEmpty()){
            WxXCXTempSend util = new WxXCXTempSend();
            try {
                String accessToken = util.getAppAccessToken();
                actActivityList.forEach(actActivity -> {
                    //查询报名活动人员列表
                    List<ComActActSignDO> actSignList = comActActSignDAO.selectList(new QueryWrapper<ComActActSignDO>().lambda()
                            .eq(ComActActSignDO::getActivityId,actActivity.getId()));
                    actSignList.forEach(actSign -> {
                        //查询用户openId
                        Map<String,String> map = comActActSignDAO.getUserOpenId(actSign.getUserId());
                        if(map != null){
                            String openid = map.get("openid");
                            //推送消息
                            WxUtil.sendSubscribeHDJJKS(openid,accessToken,actActivity.getActivityName()
                                    , com.panzhihua.common.utlis.DateUtils.format(actActivity.getBeginAt()
                                            ,com.panzhihua.common.utlis.DateUtils.ymdhms_format),actActivity.getActivityAddr()
                                    ,actSignList.size()+"");
                        }
                    });
                });
            }catch (Exception e){
                log.error("推送失败,错误原因:" + e.getMessage());
            }
        }
        System.out.println(dates);
        return R.ok();
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMessageServiceImpl.java
@@ -2,9 +2,14 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.WxUtil;
import com.panzhihua.common.utlis.WxXCXTempSend;
import com.panzhihua.service_community.dao.ComActActSignDAO;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
@@ -35,6 +40,8 @@
    private ComActMessageDAO comActMessageDAO;
    @Resource
    private ComActMessageBackDAO comActMessageBackDAO;
    @Resource
    private ComActActSignDAO comActActSignDAO;
    @Override
    public R addMessage(ComActMessageVO comActMessageVO) {
@@ -186,6 +193,19 @@
            ComActMessageDO selectById = comActMessageDAO.selectById(comActMessageBackDO.getMsgId());
            selectById.setStatus(2);
            comActMessageDAO.updateById(selectById);
            //回复成功给用户推送订阅消息
            Map<String,String> map = comActActSignDAO.getUserOpenId(selectById.getUserId());
            if(map != null){
                String openid = map.get("openid");
                WxXCXTempSend util = new WxXCXTempSend();
                try {
                    WxUtil.sendSubscribeLYHF(openid,util.getAppAccessToken(),comActMessageBackVO.getUserName()
                            , DateUtils.format(comActMessageBackVO.getCreateAt(),DateUtils.ymdhms_format),comActMessageBackVO.getMsgContent());
                }catch (Exception e){
                    log.error("消息推送失败,失败原因:" + e.getMessage());
                }
            }
            return R.ok();
        }
        return R.fail();
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngPopulationServiceImpl.java
@@ -562,6 +562,615 @@
        return R.ok(mistakes);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R listSaveDrugPopulation(List<ComMngPopulationDrugExcelVO> list, Long communityId) {
        //需要新增的房屋集合
        List<ComMngPopulationHouseDO> houseList = new ArrayList<>();
        //需要新增的人口集合
        List<ComMngPopulationDO> saveList = new ArrayList<>();
        //需要修改的人口集合
        List<ComMngPopulationDO> updateList = new ArrayList<>();
        //需要新增的人口与房屋关系集合
        List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>();
        log.info("开始处理导入数据");
        List<ComMngPopulationDrugMistakeExcelVO> mistakes = new ArrayList<>();
        try {
            //查询社区信息
            log.info("开始查询社区信息数据");
            ComPopulationActVO populationActVO = comActDAO.getPopulationActById(communityId);
            if(populationActVO == null){
                log.error("未查询到社区信息");
                return R.fail("未查询到社区信息");
            }
            log.info("开始查询社区信息数据完成");
            //查询当前社区标签列表
            List<String> labelList = new ArrayList<>();
            List<ComMngUserTagDO> comMngUserTagDOS = comMngUserTagDAO.selectList(new QueryWrapper<ComMngUserTagDO>().eq("sys_flag", 1).or().eq("community_id", communityId));
            if (!ObjectUtils.isEmpty(comMngUserTagDOS)) {
                labelList = comMngUserTagDOS.stream().map(comMngUserTagDO -> comMngUserTagDO.getTagName()).collect(Collectors.toList());
            }
            StringBuilder areaPath = new StringBuilder();
            areaPath.append(populationActVO.getProvinceName()).append(">").append(populationActVO.getCityName()).append(">").append(populationActVO.getDistrictName()).append(">");
            //处理实有人口信息
            Integer nub = 1;
            //查询所有人口数据放入HashMap中
            List<ComMngPopulationDO> populationList = this.baseMapper.selectList(null);
            HashMap<String,Object> populationMap = new HashMap<>();
            populationList.forEach(population -> {
                String key = population.getCardNo();
                populationMap.put(key,population);
            });
            //查询所有房屋信息放入到HashMap中
            List<ComMngPopulationHouseDO> houseLists = comMngPopulationHouseDAO.selectList(null);
            HashMap<String,Object> houseMap = new HashMap<>();
            houseLists.forEach(house -> {
                String key = house.getCommunityId() + house.getVillageId() + house.getFloor() + house.getUnitNo() + house.getHouseNo();
                houseMap.put(key,house);
            });
            List<ComMngVillageDO> villageList = comActVillageDAO.selectList(null);
            HashMap<String,Object> villageMap = new HashMap<>();
            villageList.forEach(village -> {
                String key = village.getCommunityId() + village.getAlley() + village.getHouseNum();
                villageMap.put(key,village);
            });
            List<ComMngPopulationHouseUserDO> houseUserLists = comMngPopulationHouseUserDAO.selectList(null);
            HashMap<String,Object> houseUserMap = new HashMap<>();
            houseUserLists.forEach(houseUser -> {
                String key = houseUser.getPopulId() + houseUser.getHouseId() + "";
                houseUserMap.put(key,houseUser);
            });
            for (ComMngPopulationDrugExcelVO vo : list) {
                if (vo.getDoorNo().contains("号")) {
                    vo.setDoorNo(vo.getDoorNo().replace("号",""));
                }
                if(vo.getFloor().contains("栋")){
                    vo.setFloor(vo.getFloor().replace("栋",""));
                }
                if(vo.getUnitNo().contains("单元")){
                    vo.setUnitNo(vo.getUnitNo().replace("单元",""));
                }
                if(vo.getHouseNo().contains("号")){
                    vo.setHouseNo(vo.getHouseNo().replace("号",""));
                }
                log.info("开始查询小区街路巷是否存在");
                //查询小区街路巷是否存在
                ComMngVillageDO comMngVillageDO = null;
                String villageKey = communityId + vo.getRoad() + vo.getDoorNo();
                if(!isOnly(villageKey,villageMap)){
                    comMngVillageDO = (ComMngVillageDO)villageMap.get(villageKey);
                }else{
                    ComMngPopulationDrugMistakeExcelVO mistake = new ComMngPopulationDrugMistakeExcelVO();
                    BeanUtils.copyProperties(vo,mistake);
                    setDrugMistake(mistake, vo);
                    mistake.setMistake("街路巷或小区号不存在,请先在“小区管理”中添加该小区:街路巷:"+ vo.getRoad() +",小区号:" + vo.getDoorNo());
                    mistakes.add(mistake);
                    log.info("未查询到街路巷:"+ vo.getRoad() +",小区号:" + vo.getDoorNo());
                    continue;
                }
                StringBuilder address = new StringBuilder();
                address.append(populationActVO.getProvinceName()).append(populationActVO.getCityName()).append(populationActVO.getDistrictName())
                        .append(populationActVO.getStreetName()).append(comMngVillageDO.getAlley()).append(vo.getDoorNo()).append("号").append(vo.getFloor()).append("栋")
                        .append(vo.getUnitNo()).append("单元").append(vo.getHouseNo()).append("号");
                vo.setAddress(address.toString());
                log.info("开始查询小区街路巷是否存在完成");
                log.info("开始查询房屋是否存在");
                //先判断房屋是否存在
                ComMngPopulationHouseDO populationHouseDO = null;
                String houseKey = communityId + comMngVillageDO.getVillageId() + vo.getFloor() + vo.getUnitNo() + vo.getHouseNo();
                if(isOnly(houseKey,houseMap)){
                    if(!houseList.isEmpty()){
                        for (ComMngPopulationHouseDO house:houseList) {
                            if(house.getVillageId().equals(comMngVillageDO.getVillageId()) && house.getCommunityId().equals(communityId)
                                    && house.getFloor().equals(vo.getFloor()) && house.getUnitNo().equals(vo.getUnitNo())
                                    && house.getHouseNo().equals(vo.getHouseNo())){
                                populationHouseDO = house;
                                break;
                            }
                        }
                    }
                    if(populationHouseDO == null){
                        //房屋信息不存在建立房屋信息
                        populationHouseDO = saveDrugPopulationHouse(vo, comMngVillageDO, communityId, areaPath, populationActVO.getName());
                        houseList.add(populationHouseDO);
                    }
                }else{
                    populationHouseDO = (ComMngPopulationHouseDO)houseMap.get(houseKey);
                }
                vo.setHouseId(populationHouseDO.getId());
                log.info("开始查询房屋是否存在完成");
                if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) {
                    //空户处理完房屋信息,直接返回
                    continue;
                }
                String cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey);
                //判断实有人口是否已存在
                log.info("开始查询实有人口是否已存在");
                ComMngPopulationDO populationDO = null;
                String populationKey = vo.getCardNo();
                if(!isOnly(populationKey,populationMap)){
                    //存在实有人口信息,则更新
                    populationDO = (ComMngPopulationDO)populationMap.get(populationKey);
                    ComMngPopulationDO updatePopulationDO = updateDrugPopulationDO(vo,populationDO,labelList);
                    updateList.add(updatePopulationDO);
                }else{
                    //不存在实有人口,则新增
                    populationDO = saveDrugPopulationDO(vo, populationActVO, comMngVillageDO,labelList);
                    saveList.add(populationDO);
                }
                log.info("开始查询实有人口是否已存在完成");
                log.info("开始查询实有人口房屋居住信息");
                //处理实有人口房屋居住信息
                if (populationDO != null) {
                    ComMngPopulationHouseUserDO populationHouseUserDO = null;
                    String houseUserKey = populationDO.getId() + populationHouseDO.getId() + "";
                    if(isOnly(houseUserKey,houseUserMap)){
                        populationHouseUserDO = new ComMngPopulationHouseUserDO();
                        populationHouseUserDO.setId(Snowflake.getId());
                        populationHouseUserDO.setHouseId(populationHouseDO.getId());
                        populationHouseUserDO.setPopulId(populationDO.getId());
//                        populationHouseUserDO.setRelation(vo.getRelation());
                        populationHouseUserDO.setRelationId(vo.getIsRent());
//                        populationHouseUserDO.setResidence(vo.getResidence());
                        houseUserList.add(populationHouseUserDO);
                    }
                }
                log.info("开始查询实有人口房屋居住信息完成");
            }
        }catch (Exception e){
            log.info("出现错误,错误原因:" + e.getMessage());
        }
        log.info("处理完成导入数据");
        log.info("开始执行数据库导入");
        if(!houseList.isEmpty()){
            log.info("执行数据库导入房屋");
            comMngPopulationHouseDAO.insertAll(houseList);
            log.info("执行数据库导入房屋完成");
        }
        if(!saveList.isEmpty()){
            log.info("执行数据库导入人口");
            this.baseMapper.insertAll(saveList);
            log.info("执行数据库导入人口完成");
        }
        if(!updateList.isEmpty()){
            log.info("执行数据库更新人口");
            this.baseMapper.updateAll(updateList);
//            this.updateBatchById(updateList);
            log.info("执行数据库更新人口完成");
        }
        if(!houseUserList.isEmpty()){
            log.info("执行数据库导入人口房屋关系");
            comMngPopulationHouseUserService.saveBatch(houseUserList);
            log.info("执行数据库导入人口房屋关系完成");
        }
        log.info("执行数据库导入完成");
        if (!mistakes.isEmpty()) {
            log.info("返回错误数据");
            return R.fail(mistakes);
        }
        return R.ok(mistakes);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R listSaveCorrectPopulation(List<ComMngPopulationCorrectExcelVO> list, Long communityId) {
        //需要新增的房屋集合
        List<ComMngPopulationHouseDO> houseList = new ArrayList<>();
        //需要新增的人口集合
        List<ComMngPopulationDO> saveList = new ArrayList<>();
        //需要修改的人口集合
        List<ComMngPopulationDO> updateList = new ArrayList<>();
        //需要新增的人口与房屋关系集合
        List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>();
        log.info("开始处理导入数据");
        List<ComMngPopulationCorrectMistakeExcelVO> mistakes = new ArrayList<>();
        try {
            //查询社区信息
            log.info("开始查询社区信息数据");
            ComPopulationActVO populationActVO = comActDAO.getPopulationActById(communityId);
            if(populationActVO == null){
                log.error("未查询到社区信息");
                return R.fail("未查询到社区信息");
            }
            log.info("开始查询社区信息数据完成");
            //查询当前社区标签列表
            List<String> labelList = new ArrayList<>();
            List<ComMngUserTagDO> comMngUserTagDOS = comMngUserTagDAO.selectList(new QueryWrapper<ComMngUserTagDO>().eq("sys_flag", 1).or().eq("community_id", communityId));
            if (!ObjectUtils.isEmpty(comMngUserTagDOS)) {
                labelList = comMngUserTagDOS.stream().map(comMngUserTagDO -> comMngUserTagDO.getTagName()).collect(Collectors.toList());
            }
            StringBuilder areaPath = new StringBuilder();
            areaPath.append(populationActVO.getProvinceName()).append(">").append(populationActVO.getCityName()).append(">").append(populationActVO.getDistrictName()).append(">");
            //处理实有人口信息
            Integer nub = 1;
            //查询所有人口数据放入HashMap中
            List<ComMngPopulationDO> populationList = this.baseMapper.selectList(null);
            HashMap<String,Object> populationMap = new HashMap<>();
            populationList.forEach(population -> {
                String key = population.getCardNo();
                populationMap.put(key,population);
            });
            //查询所有房屋信息放入到HashMap中
            List<ComMngPopulationHouseDO> houseLists = comMngPopulationHouseDAO.selectList(null);
            HashMap<String,Object> houseMap = new HashMap<>();
            houseLists.forEach(house -> {
                String key = house.getCommunityId() + house.getVillageId() + house.getFloor() + house.getUnitNo() + house.getHouseNo();
                houseMap.put(key,house);
            });
            List<ComMngVillageDO> villageList = comActVillageDAO.selectList(null);
            HashMap<String,Object> villageMap = new HashMap<>();
            villageList.forEach(village -> {
                String key = village.getCommunityId() + village.getAlley() + village.getHouseNum();
                villageMap.put(key,village);
            });
            List<ComMngPopulationHouseUserDO> houseUserLists = comMngPopulationHouseUserDAO.selectList(null);
            HashMap<String,Object> houseUserMap = new HashMap<>();
            houseUserLists.forEach(houseUser -> {
                String key = houseUser.getPopulId() + houseUser.getHouseId() + "";
                houseUserMap.put(key,houseUser);
            });
            for (ComMngPopulationCorrectExcelVO vo : list) {
                if (vo.getDoorNo().contains("号")) {
                    vo.setDoorNo(vo.getDoorNo().replace("号",""));
                }
                if(vo.getFloor().contains("栋")){
                    vo.setFloor(vo.getFloor().replace("栋",""));
                }
                if(vo.getUnitNo().contains("单元")){
                    vo.setUnitNo(vo.getUnitNo().replace("单元",""));
                }
                if(vo.getHouseNo().contains("号")){
                    vo.setHouseNo(vo.getHouseNo().replace("号",""));
                }
                log.info("开始查询小区街路巷是否存在");
                //查询小区街路巷是否存在
                ComMngVillageDO comMngVillageDO = null;
                String villageKey = communityId + vo.getRoad() + vo.getDoorNo();
                if(!isOnly(villageKey,villageMap)){
                    comMngVillageDO = (ComMngVillageDO)villageMap.get(villageKey);
                }else{
                    ComMngPopulationCorrectMistakeExcelVO mistake = new ComMngPopulationCorrectMistakeExcelVO();
                    BeanUtils.copyProperties(vo,mistake);
                    setCorrectMistake(mistake, vo);
                    mistake.setMistake("街路巷或小区号不存在,请先在“小区管理”中添加该小区:街路巷:"+ vo.getRoad() +",小区号:" + vo.getDoorNo());
                    mistakes.add(mistake);
                    log.info("未查询到街路巷:"+ vo.getRoad() +",小区号:" + vo.getDoorNo());
                    continue;
                }
                StringBuilder address = new StringBuilder();
                address.append(populationActVO.getProvinceName()).append(populationActVO.getCityName()).append(populationActVO.getDistrictName())
                        .append(populationActVO.getStreetName()).append(comMngVillageDO.getAlley()).append(vo.getDoorNo()).append("号").append(vo.getFloor()).append("栋")
                        .append(vo.getUnitNo()).append("单元").append(vo.getHouseNo()).append("号");
                vo.setAddress(address.toString());
                log.info("开始查询小区街路巷是否存在完成");
                log.info("开始查询房屋是否存在");
                //先判断房屋是否存在
                ComMngPopulationHouseDO populationHouseDO = null;
                String houseKey = communityId + comMngVillageDO.getVillageId() + vo.getFloor() + vo.getUnitNo() + vo.getHouseNo();
                if(isOnly(houseKey,houseMap)){
                    if(!houseList.isEmpty()){
                        for (ComMngPopulationHouseDO house:houseList) {
                            if(house.getVillageId().equals(comMngVillageDO.getVillageId()) && house.getCommunityId().equals(communityId)
                                    && house.getFloor().equals(vo.getFloor()) && house.getUnitNo().equals(vo.getUnitNo())
                                    && house.getHouseNo().equals(vo.getHouseNo())){
                                populationHouseDO = house;
                                break;
                            }
                        }
                    }
                    if(populationHouseDO == null){
                        //房屋信息不存在建立房屋信息
                        populationHouseDO = saveCorrectPopulationHouse(vo, comMngVillageDO, communityId, areaPath, populationActVO.getName());
                        houseList.add(populationHouseDO);
                    }
                }else{
                    populationHouseDO = (ComMngPopulationHouseDO)houseMap.get(houseKey);
                }
                vo.setHouseId(populationHouseDO.getId());
                log.info("开始查询房屋是否存在完成");
                if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) {
                    //空户处理完房屋信息,直接返回
                    continue;
                }
                String cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey);
                //判断实有人口是否已存在
                log.info("开始查询实有人口是否已存在");
                ComMngPopulationDO populationDO = null;
                String populationKey = vo.getCardNo();
                if(!isOnly(populationKey,populationMap)){
                    //存在实有人口信息,则更新
                    populationDO = (ComMngPopulationDO)populationMap.get(populationKey);
                    ComMngPopulationDO updatePopulationDO = updateCorrectPopulationDO(vo,populationDO,labelList);
                    updateList.add(updatePopulationDO);
                }else{
                    //不存在实有人口,则新增
                    populationDO = saveCorrectPopulationDO(vo, populationActVO, comMngVillageDO,labelList);
                    saveList.add(populationDO);
                }
                log.info("开始查询实有人口是否已存在完成");
                log.info("开始查询实有人口房屋居住信息");
                //处理实有人口房屋居住信息
                if (populationDO != null) {
                    ComMngPopulationHouseUserDO populationHouseUserDO = null;
                    String houseUserKey = populationDO.getId() + populationHouseDO.getId() + "";
                    if(isOnly(houseUserKey,houseUserMap)){
                        populationHouseUserDO = new ComMngPopulationHouseUserDO();
                        populationHouseUserDO.setId(Snowflake.getId());
                        populationHouseUserDO.setHouseId(populationHouseDO.getId());
                        populationHouseUserDO.setPopulId(populationDO.getId());
//                        populationHouseUserDO.setRelation(vo.getRelation());
                        populationHouseUserDO.setRelationId(vo.getIsRent());
//                        populationHouseUserDO.setResidence(vo.getResidence());
                        houseUserList.add(populationHouseUserDO);
                    }
                }
                log.info("开始查询实有人口房屋居住信息完成");
            }
        }catch (Exception e){
            log.info("出现错误,错误原因:" + e.getMessage());
        }
        log.info("处理完成导入数据");
        log.info("开始执行数据库导入");
        if(!houseList.isEmpty()){
            log.info("执行数据库导入房屋");
            comMngPopulationHouseDAO.insertAll(houseList);
            log.info("执行数据库导入房屋完成");
        }
        if(!saveList.isEmpty()){
            log.info("执行数据库导入人口");
            this.baseMapper.insertAll(saveList);
            log.info("执行数据库导入人口完成");
        }
        if(!updateList.isEmpty()){
            log.info("执行数据库更新人口");
            this.baseMapper.updateAll(updateList);
//            this.updateBatchById(updateList);
            log.info("执行数据库更新人口完成");
        }
        if(!houseUserList.isEmpty()){
            log.info("执行数据库导入人口房屋关系");
            comMngPopulationHouseUserService.saveBatch(houseUserList);
            log.info("执行数据库导入人口房屋关系完成");
        }
        log.info("执行数据库导入完成");
        if (!mistakes.isEmpty()) {
            log.info("返回错误数据");
            return R.fail(mistakes);
        }
        return R.ok(mistakes);
    }
    @Override
    public R listSaveMajorPopulation(List<ComMngPopulationMajorExcelVO> list, Long communityId) {
            //需要新增的房屋集合
            List<ComMngPopulationHouseDO> houseList = new ArrayList<>();
            //需要新增的人口集合
            List<ComMngPopulationDO> saveList = new ArrayList<>();
            //需要修改的人口集合
            List<ComMngPopulationDO> updateList = new ArrayList<>();
            //需要新增的人口与房屋关系集合
            List<ComMngPopulationHouseUserDO> houseUserList = new ArrayList<>();
            log.info("开始处理导入数据");
            List<ComMngPopulationMajorMistakeExcelVO> mistakes = new ArrayList<>();
            try {
                //查询社区信息
                log.info("开始查询社区信息数据");
                ComPopulationActVO populationActVO = comActDAO.getPopulationActById(communityId);
                if(populationActVO == null){
                    log.error("未查询到社区信息");
                    return R.fail("未查询到社区信息");
                }
                log.info("开始查询社区信息数据完成");
                //查询当前社区标签列表
                List<String> labelList = new ArrayList<>();
                List<ComMngUserTagDO> comMngUserTagDOS = comMngUserTagDAO.selectList(new QueryWrapper<ComMngUserTagDO>().eq("sys_flag", 1).or().eq("community_id", communityId));
                if (!ObjectUtils.isEmpty(comMngUserTagDOS)) {
                    labelList = comMngUserTagDOS.stream().map(comMngUserTagDO -> comMngUserTagDO.getTagName()).collect(Collectors.toList());
                }
                StringBuilder areaPath = new StringBuilder();
                areaPath.append(populationActVO.getProvinceName()).append(">").append(populationActVO.getCityName()).append(">").append(populationActVO.getDistrictName()).append(">");
                //处理实有人口信息
                Integer nub = 1;
                //查询所有人口数据放入HashMap中
                List<ComMngPopulationDO> populationList = this.baseMapper.selectList(null);
                HashMap<String,Object> populationMap = new HashMap<>();
                populationList.forEach(population -> {
                    String key = population.getCardNo();
                    populationMap.put(key,population);
                });
                //查询所有房屋信息放入到HashMap中
                List<ComMngPopulationHouseDO> houseLists = comMngPopulationHouseDAO.selectList(null);
                HashMap<String,Object> houseMap = new HashMap<>();
                houseLists.forEach(house -> {
                    String key = house.getCommunityId() + house.getVillageId() + house.getFloor() + house.getUnitNo() + house.getHouseNo();
                    houseMap.put(key,house);
                });
                List<ComMngVillageDO> villageList = comActVillageDAO.selectList(null);
                HashMap<String,Object> villageMap = new HashMap<>();
                villageList.forEach(village -> {
                    String key = village.getCommunityId() + village.getAlley() + village.getHouseNum();
                    villageMap.put(key,village);
                });
                List<ComMngPopulationHouseUserDO> houseUserLists = comMngPopulationHouseUserDAO.selectList(null);
                HashMap<String,Object> houseUserMap = new HashMap<>();
                houseUserLists.forEach(houseUser -> {
                    String key = houseUser.getPopulId() + houseUser.getHouseId() + "";
                    houseUserMap.put(key,houseUser);
                });
                for (ComMngPopulationMajorExcelVO vo : list) {
                    if (vo.getDoorNo().contains("号")) {
                        vo.setDoorNo(vo.getDoorNo().replace("号",""));
                    }
                    if(vo.getFloor().contains("栋")){
                        vo.setFloor(vo.getFloor().replace("栋",""));
                    }
                    if(vo.getUnitNo().contains("单元")){
                        vo.setUnitNo(vo.getUnitNo().replace("单元",""));
                    }
                    if(vo.getHouseNo().contains("号")){
                        vo.setHouseNo(vo.getHouseNo().replace("号",""));
                    }
                    log.info("开始查询小区街路巷是否存在");
                    //查询小区街路巷是否存在
                    ComMngVillageDO comMngVillageDO = null;
                    String villageKey = communityId + vo.getRoad() + vo.getDoorNo();
                    if(!isOnly(villageKey,villageMap)){
                        comMngVillageDO = (ComMngVillageDO)villageMap.get(villageKey);
                    }else{
                        ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO();
                        BeanUtils.copyProperties(vo,mistake);
                        setMajorMistake(mistake, vo);
                        mistake.setMistake("街路巷或小区号不存在,请先在“小区管理”中添加该小区:街路巷:"+ vo.getRoad() +",小区号:" + vo.getDoorNo());
                        mistakes.add(mistake);
                        log.info("未查询到街路巷:"+ vo.getRoad() +",小区号:" + vo.getDoorNo());
                        continue;
                    }
                    StringBuilder address = new StringBuilder();
                    address.append(populationActVO.getProvinceName()).append(populationActVO.getCityName()).append(populationActVO.getDistrictName())
                            .append(populationActVO.getStreetName()).append(comMngVillageDO.getAlley()).append(vo.getDoorNo()).append("号").append(vo.getFloor()).append("栋")
                            .append(vo.getUnitNo()).append("单元").append(vo.getHouseNo()).append("号");
                    vo.setAddress(address.toString());
                    log.info("开始查询小区街路巷是否存在完成");
                    log.info("开始查询房屋是否存在");
                    //先判断房屋是否存在
                    ComMngPopulationHouseDO populationHouseDO = null;
                    String houseKey = communityId + comMngVillageDO.getVillageId() + vo.getFloor() + vo.getUnitNo() + vo.getHouseNo();
                    if(isOnly(houseKey,houseMap)){
                        if(!houseList.isEmpty()){
                            for (ComMngPopulationHouseDO house:houseList) {
                                if(house.getVillageId().equals(comMngVillageDO.getVillageId()) && house.getCommunityId().equals(communityId)
                                        && house.getFloor().equals(vo.getFloor()) && house.getUnitNo().equals(vo.getUnitNo())
                                        && house.getHouseNo().equals(vo.getHouseNo())){
                                    populationHouseDO = house;
                                    break;
                                }
                            }
                        }
                        if(populationHouseDO == null){
                            //房屋信息不存在建立房屋信息
                            populationHouseDO = saveMajorPopulationHouse(vo, comMngVillageDO, communityId, areaPath, populationActVO.getName());
                            houseList.add(populationHouseDO);
                        }
                    }else{
                        populationHouseDO = (ComMngPopulationHouseDO)houseMap.get(houseKey);
                    }
                    vo.setHouseId(populationHouseDO.getId());
                    log.info("开始查询房屋是否存在完成");
                    if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) {
                        //空户处理完房屋信息,直接返回
                        continue;
                    }
                    String cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey);
                    //判断实有人口是否已存在
                    log.info("开始查询实有人口是否已存在");
                    ComMngPopulationDO populationDO = null;
                    String populationKey = vo.getCardNo();
                    if(!isOnly(populationKey,populationMap)){
                        //存在实有人口信息,则更新
                        populationDO = (ComMngPopulationDO)populationMap.get(populationKey);
                        ComMngPopulationDO updatePopulationDO = updateMajorPopulationDO(vo,populationDO,labelList);
                        updateList.add(updatePopulationDO);
                    }else{
                        //不存在实有人口,则新增
                        populationDO = saveMajorPopulationDO(vo, populationActVO, comMngVillageDO,labelList);
                        saveList.add(populationDO);
                    }
                    log.info("开始查询实有人口是否已存在完成");
                    log.info("开始查询实有人口房屋居住信息");
                    //处理实有人口房屋居住信息
                    if (populationDO != null) {
                        ComMngPopulationHouseUserDO populationHouseUserDO = null;
                        String houseUserKey = populationDO.getId() + populationHouseDO.getId() + "";
                        if(isOnly(houseUserKey,houseUserMap)){
                            populationHouseUserDO = new ComMngPopulationHouseUserDO();
                            populationHouseUserDO.setId(Snowflake.getId());
                            populationHouseUserDO.setHouseId(populationHouseDO.getId());
                            populationHouseUserDO.setPopulId(populationDO.getId());
//                        populationHouseUserDO.setRelation(vo.getRelation());
                            populationHouseUserDO.setRelationId(vo.getIsRent());
//                        populationHouseUserDO.setResidence(vo.getResidence());
                            houseUserList.add(populationHouseUserDO);
                        }
                    }
                    log.info("开始查询实有人口房屋居住信息完成");
                }
            }catch (Exception e){
                log.info("出现错误,错误原因:" + e.getMessage());
            }
            log.info("处理完成导入数据");
            log.info("开始执行数据库导入");
            if(!houseList.isEmpty()){
                log.info("执行数据库导入房屋");
                comMngPopulationHouseDAO.insertAll(houseList);
                log.info("执行数据库导入房屋完成");
            }
            if(!saveList.isEmpty()){
                log.info("执行数据库导入人口");
                this.baseMapper.insertAll(saveList);
                log.info("执行数据库导入人口完成");
            }
            if(!updateList.isEmpty()){
                log.info("执行数据库更新人口");
                this.baseMapper.updateAll(updateList);
//            this.updateBatchById(updateList);
                log.info("执行数据库更新人口完成");
            }
            if(!houseUserList.isEmpty()){
                log.info("执行数据库导入人口房屋关系");
                comMngPopulationHouseUserService.saveBatch(houseUserList);
                log.info("执行数据库导入人口房屋关系完成");
            }
            log.info("执行数据库导入完成");
            if (!mistakes.isEmpty()) {
                log.info("返回错误数据");
                return R.fail(mistakes);
            }
            return R.ok(mistakes);
        }
    private ComMngPopulationDO updatePopulationDO(ComMngPopulationServeExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){
        BeanUtils.copyProperties(vo, populationDO);
        List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList());
@@ -583,7 +1192,174 @@
        return populationDO;
    }
    private ComMngPopulationDO updateDrugPopulationDO(ComMngPopulationDrugExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){
        BeanUtils.copyProperties(vo, populationDO);
        List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList());
        //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除
        Iterator<String> iterator = userTag.iterator();
        while (iterator.hasNext()) {
            String s = iterator.next();
            if (!labelList.contains(s))
                iterator.remove();
        }
        String cardNoAES = populationDO.getCardNo();
        try {
            cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey);
        }catch (Exception e){
            log.error("身份证加密失败");
        }
        populationDO.setLabel(Joiner.on(",").join(userTag));
        populationDO.setCardNo(cardNoAES);
        return populationDO;
    }
    private ComMngPopulationDO updateCorrectPopulationDO(ComMngPopulationCorrectExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){
        BeanUtils.copyProperties(vo, populationDO);
        List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList());
        //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除
        Iterator<String> iterator = userTag.iterator();
        while (iterator.hasNext()) {
            String s = iterator.next();
            if (!labelList.contains(s))
                iterator.remove();
        }
        String cardNoAES = populationDO.getCardNo();
        try {
            cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey);
        }catch (Exception e){
            log.error("身份证加密失败");
        }
        populationDO.setLabel(Joiner.on(",").join(userTag));
        populationDO.setCardNo(cardNoAES);
        return populationDO;
    }
    private ComMngPopulationDO updateMajorPopulationDO(ComMngPopulationMajorExcelVO vo, ComMngPopulationDO populationDO,List<String> labelList){
        BeanUtils.copyProperties(vo, populationDO);
        List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList());
        //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除
        Iterator<String> iterator = userTag.iterator();
        while (iterator.hasNext()) {
            String s = iterator.next();
            if (!labelList.contains(s))
                iterator.remove();
        }
        String cardNoAES = populationDO.getCardNo();
        try {
            cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey);
        }catch (Exception e){
            log.error("身份证加密失败");
        }
        populationDO.setLabel(Joiner.on(",").join(userTag));
        populationDO.setCardNo(cardNoAES);
        return populationDO;
    }
    private ComMngPopulationDO savePopulationDO(ComMngPopulationServeExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) {
        ComMngPopulationDO populationDO = new ComMngPopulationDO();
        BeanUtils.copyProperties(vo, populationDO);
        populationDO.setId(Snowflake.getId());
        List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList());
        //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除
        Iterator<String> iterator = userTag.iterator();
        while (iterator.hasNext()) {
            String s = iterator.next();
            if (!labelList.contains(s))
                iterator.remove();
        }
        populationDO.setVillageId(comMngVillageDO.getVillageId());
        populationDO.setActId(comActDO.getCommunityId());
        populationDO.setStreetId(comActDO.getStreetId());
        populationDO.setLabel(Joiner.on(",").join(userTag));
        populationDO.setVillageName(comMngVillageDO.getGroupAt());
        populationDO.setCardNoStr(vo.getCardNo());
        populationDO.setUpdateAt(new Date());
        String cardNoAES = populationDO.getCardNo();
        try {
            cardNoAES = AESUtil.encrypt128(vo.getCardNo(), aesKey);
        }catch (Exception e){
            log.error("身份证加密失败");
        }
        populationDO.setCardNo(cardNoAES);
        //新增的时候默认绑定房屋id
//        if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) ||
//                (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) {
//            populationDO.setHouseId(vo.getHouseId());
//        }else{
//            populationDO.setHouseId(null);
//        }
//        this.baseMapper.insert(populationDO);
        return populationDO;
    }
    private ComMngPopulationDO saveDrugPopulationDO(ComMngPopulationDrugExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) {
        ComMngPopulationDO populationDO = new ComMngPopulationDO();
        BeanUtils.copyProperties(vo, populationDO);
        populationDO.setId(Snowflake.getId());
        List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList());
        //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除
        Iterator<String> iterator = userTag.iterator();
        while (iterator.hasNext()) {
            String s = iterator.next();
            if (!labelList.contains(s))
                iterator.remove();
        }
        populationDO.setVillageId(comMngVillageDO.getVillageId());
        populationDO.setActId(comActDO.getCommunityId());
        populationDO.setStreetId(comActDO.getStreetId());
        populationDO.setLabel(Joiner.on(",").join(userTag));
        populationDO.setVillageName(comMngVillageDO.getGroupAt());
        populationDO.setCardNoStr(vo.getCardNo());
        populationDO.setUpdateAt(new Date());
        //新增的时候默认绑定房屋id
//        if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) ||
//                (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) {
//            populationDO.setHouseId(vo.getHouseId());
//        }else{
//            populationDO.setHouseId(null);
//        }
//        this.baseMapper.insert(populationDO);
        return populationDO;
    }
    private ComMngPopulationDO saveCorrectPopulationDO(ComMngPopulationCorrectExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) {
        ComMngPopulationDO populationDO = new ComMngPopulationDO();
        BeanUtils.copyProperties(vo, populationDO);
        populationDO.setId(Snowflake.getId());
        List<String> userTag = vo.getUserTagStr().stream().map(userTagStr -> userTagStr.split("\\(")[0]).collect(Collectors.toList());
        //如果导入数据标签中有当前社区标签列表中不包含的标签,则删除
        Iterator<String> iterator = userTag.iterator();
        while (iterator.hasNext()) {
            String s = iterator.next();
            if (!labelList.contains(s))
                iterator.remove();
        }
        populationDO.setVillageId(comMngVillageDO.getVillageId());
        populationDO.setActId(comActDO.getCommunityId());
        populationDO.setStreetId(comActDO.getStreetId());
        populationDO.setLabel(Joiner.on(",").join(userTag));
        populationDO.setVillageName(comMngVillageDO.getGroupAt());
        populationDO.setCardNoStr(vo.getCardNo());
        populationDO.setUpdateAt(new Date());
        //新增的时候默认绑定房屋id
//        if ((vo.getIsRent() != null && vo.getIsRent().equals(PopulHouseUseEnum.SELF.getCode())) ||
//                (vo.getIsResidence() != null && vo.getIsResidence().intValue() == 1)) {
//            populationDO.setHouseId(vo.getHouseId());
//        }else{
//            populationDO.setHouseId(null);
//        }
//        this.baseMapper.insert(populationDO);
        return populationDO;
    }
    private ComMngPopulationDO saveMajorPopulationDO(ComMngPopulationMajorExcelVO vo, ComPopulationActVO comActDO, ComMngVillageDO comMngVillageDO,List<String> labelList) {
        ComMngPopulationDO populationDO = new ComMngPopulationDO();
        BeanUtils.copyProperties(vo, populationDO);
        populationDO.setId(Snowflake.getId());
@@ -639,6 +1415,129 @@
            populationHouseDO.setConstructArea(new BigDecimal(vo.getBuildArea()));
        } catch (Exception e) {
        }
        if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) {
            populationHouseDO.setIsEmpty(PopulIsOksEnum.YES.getCode());
        }
        if (vo.getHouseStatus() != null) {
            populationHouseDO.setStatus(vo.getHouseStatus());
        }
        if (vo.getHousePurpose() != null) {
            populationHouseDO.setPurpose(vo.getHousePurpose());
        }
        if (vo.getControlStatus() != null) {
            populationHouseDO.setControlStatus(vo.getControlStatus());
        }
//        comMngPopulationHouseDAO.insert(populationHouseDO);
        return populationHouseDO;
    }
    private ComMngPopulationHouseDO saveDrugPopulationHouse(ComMngPopulationDrugExcelVO vo, ComMngVillageDO comMngVillageDO, Long communityId,StringBuilder areaPath, String actName) {
        //查询该房屋未建立,执行建立房屋信息
        ComMngPopulationHouseDO populationHouseDO = new ComMngPopulationHouseDO();
        populationHouseDO.setId(Snowflake.getId());
        populationHouseDO.setStreetId(comMngVillageDO.getStreetId());
        populationHouseDO.setVillageId(comMngVillageDO.getVillageId());
        populationHouseDO.setAlley(vo.getRoad());
        populationHouseDO.setHouseNum(vo.getDoorNo());
        populationHouseDO.setStatus(vo.getIsRent());
        populationHouseDO.setCommunityId(communityId);
        populationHouseDO.setFloor(vo.getFloor());
        populationHouseDO.setUnitNo(vo.getUnitNo());
        populationHouseDO.setHouseNo(vo.getHouseNo());
        populationHouseDO.setCode(vo.getHouseNo());
        populationHouseDO.setAddress(vo.getAddress());
        populationHouseDO.setUpdateAt(new Date());
//        populationHouseDO.setConstructPurpose(vo.getHousePurpose());
        StringBuilder housePath = new StringBuilder();
        housePath.append(populationHouseDO.getAlley()).append(">").append(actName).append(">").append(comMngVillageDO.getName()).append(">").append(vo.getAddress());
        populationHouseDO.setPath(areaPath.toString() + housePath.toString());
//        try {
//            populationHouseDO.setConstructArea(new BigDecimal(vo.getBuildArea()));
//        } catch (Exception e) {
//        }
        if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) {
            populationHouseDO.setIsEmpty(PopulIsOksEnum.YES.getCode());
        }
        if (vo.getHouseStatus() != null) {
            populationHouseDO.setStatus(vo.getHouseStatus());
        }
        if (vo.getHousePurpose() != null) {
            populationHouseDO.setPurpose(vo.getHousePurpose());
        }
        if (vo.getControlStatus() != null) {
            populationHouseDO.setControlStatus(vo.getControlStatus());
        }
//        comMngPopulationHouseDAO.insert(populationHouseDO);
        return populationHouseDO;
    }
    private ComMngPopulationHouseDO saveCorrectPopulationHouse(ComMngPopulationCorrectExcelVO vo, ComMngVillageDO comMngVillageDO, Long communityId,StringBuilder areaPath, String actName) {
        //查询该房屋未建立,执行建立房屋信息
        ComMngPopulationHouseDO populationHouseDO = new ComMngPopulationHouseDO();
        populationHouseDO.setId(Snowflake.getId());
        populationHouseDO.setStreetId(comMngVillageDO.getStreetId());
        populationHouseDO.setVillageId(comMngVillageDO.getVillageId());
        populationHouseDO.setAlley(vo.getRoad());
        populationHouseDO.setHouseNum(vo.getDoorNo());
        populationHouseDO.setStatus(vo.getIsRent());
        populationHouseDO.setCommunityId(communityId);
        populationHouseDO.setFloor(vo.getFloor());
        populationHouseDO.setUnitNo(vo.getUnitNo());
        populationHouseDO.setHouseNo(vo.getHouseNo());
        populationHouseDO.setCode(vo.getHouseNo());
        populationHouseDO.setAddress(vo.getAddress());
        populationHouseDO.setUpdateAt(new Date());
//        populationHouseDO.setConstructPurpose(vo.getHousePurpose());
        StringBuilder housePath = new StringBuilder();
        housePath.append(populationHouseDO.getAlley()).append(">").append(actName).append(">").append(comMngVillageDO.getName()).append(">").append(vo.getAddress());
        populationHouseDO.setPath(areaPath.toString() + housePath.toString());
//        try {
//            populationHouseDO.setConstructArea(new BigDecimal(vo.getBuildArea()));
//        } catch (Exception e) {
//        }
        if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) {
            populationHouseDO.setIsEmpty(PopulIsOksEnum.YES.getCode());
        }
        if (vo.getHouseStatus() != null) {
            populationHouseDO.setStatus(vo.getHouseStatus());
        }
        if (vo.getHousePurpose() != null) {
            populationHouseDO.setPurpose(vo.getHousePurpose());
        }
        if (vo.getControlStatus() != null) {
            populationHouseDO.setControlStatus(vo.getControlStatus());
        }
//        comMngPopulationHouseDAO.insert(populationHouseDO);
        return populationHouseDO;
    }
    private ComMngPopulationHouseDO saveMajorPopulationHouse(ComMngPopulationMajorExcelVO vo, ComMngVillageDO comMngVillageDO, Long communityId,StringBuilder areaPath, String actName) {
        //查询该房屋未建立,执行建立房屋信息
        ComMngPopulationHouseDO populationHouseDO = new ComMngPopulationHouseDO();
        populationHouseDO.setId(Snowflake.getId());
        populationHouseDO.setStreetId(comMngVillageDO.getStreetId());
        populationHouseDO.setVillageId(comMngVillageDO.getVillageId());
        populationHouseDO.setAlley(vo.getRoad());
        populationHouseDO.setHouseNum(vo.getDoorNo());
        populationHouseDO.setStatus(vo.getIsRent());
        populationHouseDO.setCommunityId(communityId);
        populationHouseDO.setFloor(vo.getFloor());
        populationHouseDO.setUnitNo(vo.getUnitNo());
        populationHouseDO.setHouseNo(vo.getHouseNo());
        populationHouseDO.setCode(vo.getHouseNo());
        populationHouseDO.setAddress(vo.getAddress());
        populationHouseDO.setUpdateAt(new Date());
//        populationHouseDO.setConstructPurpose(vo.getHousePurpose());
        StringBuilder housePath = new StringBuilder();
        housePath.append(populationHouseDO.getAlley()).append(">").append(actName).append(">").append(comMngVillageDO.getName()).append(">").append(vo.getAddress());
        populationHouseDO.setPath(areaPath.toString() + housePath.toString());
//        try {
//            populationHouseDO.setConstructArea(new BigDecimal(vo.getBuildArea()));
//        } catch (Exception e) {
//        }
        if (StringUtils.isEmpty(vo.getName()) && StringUtils.isEmpty(vo.getCardNo())) {
            populationHouseDO.setIsEmpty(PopulIsOksEnum.YES.getCode());
@@ -1994,6 +2893,51 @@
        mvo.setDeath(PopulOutOrLocalEnum.getCnDescByName(vo.getDeath()));
    }
    private void setDrugMistake(ComMngPopulationDrugMistakeExcelVO mvo, ComMngPopulationDrugExcelVO vo){
//        mvo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCnDescByName(vo.getPoliticalOutlook()));
        mvo.setIsRent(PopulHouseUseEnum.getCnDescByName(vo.getIsRent()));
//        mvo.setRelation(PopulRelationEnum.getCnDescByName(vo.getRelation()));
        mvo.setHouseStatus(PopulHouseStatusEnum.getCnDescByName(vo.getHouseStatus()));
        mvo.setHousePurpose(PopulHousePurposeEnum.getCnDescByName(vo.getHousePurpose()));
        mvo.setControlStatus(PopulHouseControlStatusEnum.getCnDescByName(vo.getControlStatus()));
//        mvo.setCultureLevel(PopulCultureLevelEnum.getCnDescByName(vo.getCultureLevel()));
//        mvo.setMarriage(PopulMarriageEnum.getCnDescByName(vo.getMarriage()));
        mvo.setOutOrLocal(PopulOutOrLocalEnum.getCnDescByName(vo.getOutOrLocal()));
//        mvo.setResidence(PopulRelationEnum.getCnDescByName(vo.getResidence()));
//        mvo.setPersonType(PopulPersonTypeEnum.getCnDescByName(vo.getPersonType()));
//        mvo.setDeath(PopulOutOrLocalEnum.getCnDescByName(vo.getDeath()));
    }
    private void setCorrectMistake(ComMngPopulationCorrectMistakeExcelVO mvo, ComMngPopulationCorrectExcelVO vo){
//        mvo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCnDescByName(vo.getPoliticalOutlook()));
        mvo.setIsRent(PopulHouseUseEnum.getCnDescByName(vo.getIsRent()));
//        mvo.setRelation(PopulRelationEnum.getCnDescByName(vo.getRelation()));
        mvo.setHouseStatus(PopulHouseStatusEnum.getCnDescByName(vo.getHouseStatus()));
        mvo.setHousePurpose(PopulHousePurposeEnum.getCnDescByName(vo.getHousePurpose()));
        mvo.setControlStatus(PopulHouseControlStatusEnum.getCnDescByName(vo.getControlStatus()));
//        mvo.setCultureLevel(PopulCultureLevelEnum.getCnDescByName(vo.getCultureLevel()));
//        mvo.setMarriage(PopulMarriageEnum.getCnDescByName(vo.getMarriage()));
        mvo.setOutOrLocal(PopulOutOrLocalEnum.getCnDescByName(vo.getOutOrLocal()));
//        mvo.setResidence(PopulRelationEnum.getCnDescByName(vo.getResidence()));
//        mvo.setPersonType(PopulPersonTypeEnum.getCnDescByName(vo.getPersonType()));
//        mvo.setDeath(PopulOutOrLocalEnum.getCnDescByName(vo.getDeath()));
    }
    private void setMajorMistake(ComMngPopulationMajorMistakeExcelVO mvo, ComMngPopulationMajorExcelVO vo){
//        mvo.setPoliticalOutlook(PopulPoliticalOutlookEnum.getCnDescByName(vo.getPoliticalOutlook()));
        mvo.setIsRent(PopulHouseUseEnum.getCnDescByName(vo.getIsRent()));
//        mvo.setRelation(PopulRelationEnum.getCnDescByName(vo.getRelation()));
        mvo.setHouseStatus(PopulHouseStatusEnum.getCnDescByName(vo.getHouseStatus()));
        mvo.setHousePurpose(PopulHousePurposeEnum.getCnDescByName(vo.getHousePurpose()));
        mvo.setControlStatus(PopulHouseControlStatusEnum.getCnDescByName(vo.getControlStatus()));
        mvo.setCultureLevel(PopulCultureLevelEnum.getCnDescByName(vo.getCultureLevel()));
//        mvo.setMarriage(PopulMarriageEnum.getCnDescByName(vo.getMarriage()));
        mvo.setOutOrLocal(PopulOutOrLocalEnum.getCnDescByName(vo.getOutOrLocal()));
//        mvo.setResidence(PopulRelationEnum.getCnDescByName(vo.getResidence()));
//        mvo.setPersonType(PopulPersonTypeEnum.getCnDescByName(vo.getPersonType()));
//        mvo.setDeath(PopulOutOrLocalEnum.getCnDescByName(vo.getDeath()));
    }
    /**
     * 判重方法
     * @param key   主键
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSwDangerReportServiceImpl.java
@@ -73,10 +73,10 @@
        IPage<ComSwDangerReportVO> iPage = comSwDangerReportDAO.pageDangerReport(page, comSwPatrolRecordPageDTO);
        if (!iPage.getRecords().isEmpty()) {
            iPage.getRecords().forEach(comSwDangerReportVO -> {
                if (StringUtils.isNotEmpty(comSwDangerReportVO.getAssignPerson())) {
                    comSwDangerReportVO.setIsAssign(ComSwDangerReportVO.isOk.no);
                }else {
                if (StringUtils.isNotEmpty(comSwDangerReportVO.getStatus()) && "2".equals(comSwDangerReportVO.getStatus())) {
                    comSwDangerReportVO.setIsAssign(ComSwDangerReportVO.isOk.yes);
                }else {
                    comSwDangerReportVO.setIsAssign(ComSwDangerReportVO.isOk.no);
                }
                StringBuilder patrolNameString = new StringBuilder();
                StringBuilder patrolPhoneString = new StringBuilder();
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSwPatrolRecordServiceImpl.java
@@ -65,6 +65,11 @@
                        .lambda().eq(ComSwPatrolRecordReportDO::getPatrolRecordId,patrol.getId()));
                if(recordReportDO != null){
                    patrol.setServiceId(recordReportDO.getReportId());
                    if (null != comSwDangerReportDAO.selectById(recordReportDO.getReportId())) {
                        patrol.setDangerOrRecord(1);
                    }else{
                        patrol.setDangerOrRecord(2);
                    }
                }
            });
        }
@@ -119,6 +124,7 @@
                comSwDangerReportDO.setStatus(String.valueOf(SafeWordStatusEnum.DCL.getCode()));
            }
            BeanUtils.copyProperties(comSwPatrolRecordAddDTO, comSwDangerReportDO);
            comSwDangerReportDO.setDagerDescription(comSwPatrolRecordAddDTO.getDangerDescription());
            comSwDangerReportDO.setPersonName(comSwPatrolRecordAddDTO.getDPersonName());
            comSwDangerReportDO.setPersonPhone(comSwPatrolRecordAddDTO.getDPersonPhone());
            comSwDangerReportDAO.insert(comSwDangerReportDO);
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSwRotaServiceImpl.java
@@ -36,6 +36,8 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * @auther txb
@@ -123,7 +125,9 @@
            return R.fail("该值班表不存在");
        }
        BeanUtils.copyProperties(comSwRotaDO,comSwRotaVO);
        comSwRotaVO.setRotaDate(new SimpleDateFormat("yyyy-MM-dd").format(comSwRotaDO.getRotaDate()));
        if (null != comSwRotaDO.getRotaDate()) {
            comSwRotaVO.setRotaDate(new SimpleDateFormat("yyyy-MM-dd").format(comSwRotaDO.getRotaDate()));
        }
        comSwRotaVO.setWeekDay(DateUtils.dateToWeek(comSwRotaVO.getRotaDate()));
        StringBuilder leaderNameString = new StringBuilder();
        StringBuilder leaderPhoneString = new StringBuilder();
@@ -168,28 +172,39 @@
    @Override
    public R addRota(List<ComSwRotaSaveDTO> comSwRotaSaveDTOs) {
        comSwRotaSaveDTOs.forEach(comSwRotaSaveDTO -> {
                if (comSwRotaSaveDTO.getId() != null && comSwRotaSaveDTO.getId() != 0) {
                    ComSwRotaDO comSwRotaDO = new ComSwRotaDO();
                    BeanUtils.copyProperties(comSwRotaSaveDTO, comSwRotaDO);
                    try {
                        comSwRotaDO.setRotaDate(new SimpleDateFormat("yyyy-MM-dd").parse(comSwRotaSaveDTO.getRotaDate()));
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                    comSwRotaDAO.updateById(comSwRotaDO);
                } else {
                    ComSwRotaDO comSwRotaDO = new ComSwRotaDO();
                    BeanUtils.copyProperties(comSwRotaSaveDTO, comSwRotaDO);
                    comSwRotaDO.setId(Snowflake.getId());
                    try {
                        comSwRotaDO.setRotaDate(new SimpleDateFormat("yyyy-MM-dd").parse(comSwRotaSaveDTO.getRotaDate()));
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                    comSwRotaDAO.insert(comSwRotaDO);
        for (ComSwRotaSaveDTO comSwRotaSaveDTO : comSwRotaSaveDTOs){
            if (comSwRotaSaveDTO.getId() != null && comSwRotaSaveDTO.getId() != 0) {
                ComSwRotaDO comSwRotaDO = comSwRotaDAO.selectById(comSwRotaSaveDTO.getId());
                if (null == comSwRotaDO) {
                    return R.fail("该值班表不存在");
                }
        });
                ComSwRotaDO checkCreditCode = comSwRotaDAO.selectOne(new QueryWrapper<ComSwRotaDO>().lambda().eq(ComSwRotaDO::getRotaDate, comSwRotaSaveDTO.getRotaDate()));
                if (null != checkCreditCode && comSwRotaDO.getId() != checkCreditCode.getId()) {
                    return R.fail("该值班表已存在,值班日期重复");
                }
                BeanUtils.copyProperties(comSwRotaSaveDTO, comSwRotaDO);
                try {
                    comSwRotaDO.setRotaDate(new SimpleDateFormat("yyyy-MM-dd").parse(comSwRotaSaveDTO.getRotaDate()));
                } catch (ParseException e) {
                    e.printStackTrace();
                }
                comSwRotaDAO.updateById(comSwRotaDO);
            } else {
                Integer count = comSwRotaDAO.selectCount(new QueryWrapper<ComSwRotaDO>().lambda().eq(ComSwRotaDO::getRotaDate, comSwRotaSaveDTO.getRotaDate()));
                if (count > 0) {
                    return R.fail("该值班表已存在,值班日期重复");
                }
                ComSwRotaDO comSwRotaDO = new ComSwRotaDO();
                BeanUtils.copyProperties(comSwRotaSaveDTO, comSwRotaDO);
                comSwRotaDO.setId(Snowflake.getId());
                try {
                    comSwRotaDO.setRotaDate(new SimpleDateFormat("yyyy-MM-dd").parse(comSwRotaSaveDTO.getRotaDate()));
                } catch (ParseException e) {
                    e.printStackTrace();
                }
                comSwRotaDAO.insert(comSwRotaDO);
            }
        }
        return R.ok();
    }
@@ -264,33 +279,57 @@
    @Override
    public R listSaveSwRotaExcelVO(List<ComSwRotaExcelVO> list, Long communityId) {
        List<ComSwRotaDO> comSwRotaDOS = new ArrayList<>();
            list.forEach(comSwRotaExcelVO -> {
            for (ComSwRotaExcelVO comSwRotaExcelVO : list){
                Integer count = comSwRotaDAO.selectCount(new QueryWrapper<ComSwRotaDO>().lambda().eq(ComSwRotaDO::getRotaDate, comSwRotaExcelVO.getRotaDate()));
                if (count > 0) {
                    return R.fail("值班日期已存在," + comSwRotaExcelVO.getRotaDate() + "重复");
                }
                ComSwRotaDO comSwRotaDO = new ComSwRotaDO();
                String[] leaderPhones = comSwRotaExcelVO.getLeaderPhone().split(",");
                String[] leaderPhones = comSwRotaExcelVO.getLeaderPhone().split("、");
                String[] leaderNames = comSwRotaExcelVO.getLeaderName().split("、");
                List<String> leaderIds = new ArrayList<>();
                for (String leaderPhone : leaderPhones) {
                    String id = comSwRotaDAO.getTeamIdsByTeamPhone(leaderPhone);
                for (int i = 0; i < leaderPhones.length; i++) {
                    String id = comSwRotaDAO.getTeamIdsByTeamPhone(leaderPhones[i]);
                    if (StringUtils.isEmpty(id)) {
                        return R.fail(leaderNames[i] + "为非社区团队人员或该人员电话未维护!");
                    }
                    leaderIds.add(id);
                }
                String[] personPhones = comSwRotaExcelVO.getPersonPhone().split(",");
                String[] personPhones = comSwRotaExcelVO.getPersonPhone().split("、");
                String[] personNames = comSwRotaExcelVO.getPersonName().split("、");
                List<String> personIds = new ArrayList<>();
                for (String personPhone : personPhones) {
                    String id = comSwRotaDAO.getTeamIdsByTeamPhone(personPhone);
                for (int i = 0; i < leaderPhones.length; i++) {
                    String id = comSwRotaDAO.getTeamIdsByTeamPhone(personPhones[i]);
                    if (StringUtils.isEmpty(id)) {
                        return R.fail(personNames[i] + "为非社区团队人员或该人员电话未维护!");
                    }
                    personIds.add(id);
                }
                BeanUtils.copyProperties(comSwRotaExcelVO, comSwRotaDO);
                comSwRotaDO.setId(Snowflake.getId());
                comSwRotaDO.setCommunityId(communityId);
                if (StringUtils.isNotEmpty(comSwRotaExcelVO.getRotaDate())) {
                    String el = "(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)   \n" +
                            "(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29) ";
                    Pattern p = Pattern.compile(el);
                    Matcher m = p.matcher(comSwRotaExcelVO.getRotaDate());
                    if (!m.matches()) {
                        return R.fail(comSwRotaExcelVO.getRotaDate() + "日期格式不正确");
                    }
                }
                try {
                comSwRotaDO.setRotaDate(new SimpleDateFormat("yyyy-MM-dd").parse(comSwRotaExcelVO.getRotaDate()));
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                    comSwRotaDO.setRotaDate(sdf.parse(comSwRotaExcelVO.getRotaDate()));
                } catch (ParseException e) {
                    e.printStackTrace();
                }
                comSwRotaDO.setRotaLeader(StringUtils.join(leaderIds, ","));
                comSwRotaDO.setRotaPerson(StringUtils.join(personIds, ","));
                comSwRotaDO.setLeaderName(comSwRotaExcelVO.getLeaderName().replace("、",","));
                comSwRotaDO.setPersonName(comSwRotaExcelVO.getPersonName().replace("、",","));
                comSwRotaDOS.add(comSwRotaDO);
            });
            }
        this.saveBatch(comSwRotaDOS);
        return R.ok();
    }
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComSwSafetyWorkRecordMapper.xml
@@ -57,9 +57,21 @@
    <select id="patrolRecordStatistics" resultType="com.panzhihua.common.model.vos.community.ComSwPatrolRecordStatisticsVO">
        select count(id) as patrolRecordTotal
             ,(select count(id) from com_sw_patrol_record where community_id = #{communityId} and patrol_type = 1) as huoTotal
             ,(select count(id) from com_sw_patrol_record where community_id = #{communityId} and patrol_type = 2) as xunTotal
             ,(select count(id) from com_sw_patrol_record where community_id = #{communityId} and patrol_type = 3) as yiTotal
             ,(select count(id) from com_sw_patrol_record where community_id = #{communityId} and patrol_type LIKE concat('%','1','%')) as huoTotal
             ,(select count(id) from com_sw_patrol_record where community_id = #{communityId} and patrol_type LIKE concat('%','2','%')) as xunTotal
             ,(select count(id) from com_sw_patrol_record where community_id = #{communityId} and patrol_type LIKE concat('%','3','%')) as yiTotal
             ,(select count(id) from com_sw_safety_work_record where community_id = #{communityId}) as safetyWorkTotal
             ,(select count(id) from com_sw_danger_report where community_id =  #{communityId}) as dangerTotal
             ,(select count(id) from com_sw_danger_report where community_id =  #{communityId} and status = '3') as handledDangerTotal
             ,(select count(id) from com_sw_danger_report where community_id =  #{communityId} and danger_type like CONCAT('%','1','%')) as huoDangerTotal
             ,(select count(id) from com_sw_danger_report where community_id =  #{communityId} and danger_type like CONCAT('%','2','%')) as xunDangerTotal
             ,(select count(id) from com_sw_danger_report where community_id =  #{communityId} and danger_type like CONCAT('%','3','%')) as yiDangerTotal
             ,(select count(id) from com_sw_danger_report where community_id =  #{communityId} and danger_type like CONCAT('%','1','%') and status = '3' ) as huoHandledDangerTotal
             ,(select count(id) from com_sw_danger_report where community_id =  #{communityId} and danger_type like CONCAT('%','1','%') and status in ('1','2')) as huoHandlingDangerTotal
             ,(select count(id) from com_sw_danger_report where community_id =  #{communityId} and danger_type like CONCAT('%','2','%') and status = '3' ) as xunHandledDangerTotal
             ,(select count(id) from com_sw_danger_report where community_id =  #{communityId} and danger_type like CONCAT('%','2','%') and status in ('1','2')) as xunHandlingDangerTotal
             ,(select count(id) from com_sw_danger_report where community_id =  #{communityId} and danger_type like CONCAT('%','3','%') and status = '3' ) as yiHandledDangerTotal
             ,(select count(id) from com_sw_danger_report where community_id =  #{communityId} and danger_type like CONCAT('%','3','%') and status in ('1','2')) as yiHandlingDangerTotal
        from com_sw_patrol_record as cmp where community_id = #{communityId}
    </select>
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java
@@ -988,4 +988,14 @@
        return userService.getGridsMemberList(communityId);
    }
    /**
     * 根据用户id查询用户openid
     * @param userId    用户id
     * @return  openid
     */
    @GetMapping("getUserOpenId")
    public R getUserOpenId(@RequestParam("userId")Long userId) {
        return userService.getUserOpenId(userId);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/UserService.java
@@ -473,4 +473,11 @@
    R getGridsMemberList(Long communityId);
    /**
     * 根据用户id查询用户openid
     * @param userId    用户id
     * @return  openid
     */
    R getUserOpenId(Long userId);
}
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -24,10 +24,7 @@
import com.panzhihua.common.model.vos.user.*;
//import com.panzhihua.common.service.grid.GridService;
import com.panzhihua.common.service.partybuilding.PartyBuildingService;
import com.panzhihua.common.utlis.IdCard;
import com.panzhihua.common.utlis.RealNameUtil;
import com.panzhihua.common.utlis.SensitiveUtil;
import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.common.utlis.*;
import com.panzhihua.service_user.dao.*;
import com.panzhihua.service_user.model.dos.*;
import com.panzhihua.service_user.model.dtos.DataKanbanDTO;
@@ -175,7 +172,7 @@
        userDao.updateServiceTeam(purePhoneNumber, purePhoneNumber);
        int i = userDao.updateById(sysUserDO);
        if (i > 0) {
            return R.ok();
            return R.ok(purePhoneNumber);
        } else {
            return R.fail("维护微信手机号失败");
        }
@@ -663,6 +660,19 @@
                userDao.updateById(sysUserDO);
                //修改审核绑定的userId
                userDao.updateComPbMemberUserId(idCard,sysUserDO.getUserId());
            }
            SysUserDO user = userDao.selectById(loginUserInfoVO.getUserId());
            if(user != null){
                //实名认证成功推送订阅消息给用户
                try {
                    WxXCXTempSend util = new WxXCXTempSend();
                    String accessToken = util.getAppAccessToken();
                    //用户实名认证推送消息
                    WxUtil.sendSubscribeRZSH(user.getOpenid(),accessToken,"用户实名认证", com.panzhihua.common.utlis.DateUtils.getCurrentDateStr(),"审核通过");
                }catch (Exception e){
                    log.error("推送用户订阅消息失败,失败原因:" + e.getMessage());
                }
            }
            return R.ok();
        }
@@ -2219,4 +2229,18 @@
    public R getGridsMemberList(Long communityId){
        return R.ok(this.userDao.getGridsMemberList(communityId));
    }
    /**
     * 根据用户id查询用户openid
     * @param userId    用户id
     * @return  openid
     */
    @Override
    public R getUserOpenId(Long userId){
        SysUserDO userDO = this.userDao.selectById(userId);
        if(userDO != null){
            return R.ok(userDO.getOpenid());
        }
        return R.fail();
    }
}
springcloud_k8s_panzhihuazhihuishequ/timejob/src/main/java/com/panzhihua/timejob/jobhandler/CommunityJobHandler.java
@@ -156,4 +156,15 @@
        log.info("执行结果【{}】",r.toString());
        return ReturnT.SUCCESS;
    }
    /**
     * 定时任务检测即将开始的社区活动,并使用订阅消息通知用户
     */
    @XxlJob("timedTaskActivityNoticeJobHandler")
    public ReturnT<String> timedTaskActivityNoticeJobHandler(String param){
        log.info("定时任务检测即将开始的社区活动,并使用订阅消息通知用户");
        R r=communityService.timedTaskDynStatus();
        log.info("执行结果【{}】",r.toString());
        return ReturnT.SUCCESS;
    }
}