16 changed files with 1016 additions and 0 deletions
			
			
		@ -0,0 +1,39 @@ | 
				
			|||
package com.epmet.commons.tools.dto.result; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
import lombok.NoArgsConstructor; | 
				
			|||
 | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @Description 根据身份证号和姓名查询公安部备案信息 | 
				
			|||
 */ | 
				
			|||
@NoArgsConstructor | 
				
			|||
@Data | 
				
			|||
public class YtSfhyxxcxdsjjResDTO { | 
				
			|||
    private int code = 200; | 
				
			|||
    private String msg = "请求成功"; | 
				
			|||
    /** | 
				
			|||
     * 响应数据 | 
				
			|||
     */ | 
				
			|||
    private YtSfhyxxcxdsjjDetail data; | 
				
			|||
    private int total; | 
				
			|||
 | 
				
			|||
    @Data | 
				
			|||
    public static class YtSfhyxxcxdsjjDetail { | 
				
			|||
        private String status = "000"; | 
				
			|||
        private String statusMsg = "正常返回"; | 
				
			|||
        private String count = "1"; | 
				
			|||
        //结果数量
 | 
				
			|||
        private String total; | 
				
			|||
        private List<Result> result; | 
				
			|||
    } | 
				
			|||
    @Data | 
				
			|||
    public static class Result { | 
				
			|||
        //身份证号
 | 
				
			|||
        private String GMSFHM; | 
				
			|||
        //姓名
 | 
				
			|||
        private String XM; | 
				
			|||
    } | 
				
			|||
} | 
				
			|||
@ -0,0 +1,105 @@ | 
				
			|||
package com.epmet.dto; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
import java.util.Date; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 居民信息与公安部信息比对记录表 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2022-11-14 | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class IcResiComparisonRecordDTO implements Serializable { | 
				
			|||
 | 
				
			|||
    private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * ID | 
				
			|||
     */ | 
				
			|||
    private String id; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 客户ID | 
				
			|||
     */ | 
				
			|||
    private String customerId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * ic_resi_user.id【比对时的数据值】 | 
				
			|||
     */ | 
				
			|||
    private String resiId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 数字社区人员姓名【比对时的数据值】 | 
				
			|||
     */ | 
				
			|||
    private String resiName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 数据社区身份证号【比对时的数据值】 | 
				
			|||
     */ | 
				
			|||
    private String resiIdCard; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 公安部人员姓名 | 
				
			|||
     */ | 
				
			|||
    private String policeName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 公安部人员证件号 | 
				
			|||
     */ | 
				
			|||
    private String policeIdCard; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 数据状态(0:未处理  1:已处理) | 
				
			|||
     */ | 
				
			|||
    private String type; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 信息一致性(0:否 1:是 2:-)2代表程序比对了没有匹配上 | 
				
			|||
     */ | 
				
			|||
    private String identical; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 是否比对过(0:否 1:是) | 
				
			|||
     */ | 
				
			|||
    private String isComparison; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 比对结果说明 | 
				
			|||
     */ | 
				
			|||
    private String comparisonResult; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * | 
				
			|||
     */ | 
				
			|||
    private Integer delFlag; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 乐观锁 | 
				
			|||
     */ | 
				
			|||
    private Integer revision; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 创建人 | 
				
			|||
     */ | 
				
			|||
    private String createdBy; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 创建时间 | 
				
			|||
     */ | 
				
			|||
    private Date createdTime; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 更新人 | 
				
			|||
     */ | 
				
			|||
    private String updatedBy; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 更新时间 | 
				
			|||
     */ | 
				
			|||
    private Date updatedTime; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,33 @@ | 
				
			|||
package com.epmet.dto.form; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.dto.form.PageFormDTO; | 
				
			|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import javax.validation.constraints.NotBlank; | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
@Data | 
				
			|||
public class ComparisonFormDTO extends PageFormDTO { | 
				
			|||
    private static final long serialVersionUID = 9156247659994638103L; | 
				
			|||
    public interface Update extends CustomerClientShowGroup { | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 居民Id集合 | 
				
			|||
     */ | 
				
			|||
    private List<String> userIdList; | 
				
			|||
    /** | 
				
			|||
     * 比对记录Id | 
				
			|||
     */ | 
				
			|||
    @NotBlank(message = "比对记录Id不能为空", groups = {Update.class}) | 
				
			|||
    private String comparisonRecordId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * token里设置 | 
				
			|||
     */ | 
				
			|||
    private String customerId; | 
				
			|||
    private String userId; | 
				
			|||
    private String agencyId; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,39 @@ | 
				
			|||
package com.epmet.dto.form; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.tools.dto.form.PageFormDTO; | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @Description 数据比对列表-接口入参 | 
				
			|||
 * @Author sun | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class ResiComparisonListFormDTO extends PageFormDTO { | 
				
			|||
    private static final long serialVersionUID = 9156247659994638103L; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 信息一致性(0:否 1:是 2:-)2代表程序比对了没有匹配上 | 
				
			|||
     */ | 
				
			|||
    private String identical; | 
				
			|||
    /** | 
				
			|||
     * 数据状态(0:未处理  1:已处理) | 
				
			|||
     */ | 
				
			|||
    private String type; | 
				
			|||
    /** | 
				
			|||
     * 身份证号 | 
				
			|||
     */ | 
				
			|||
    private String idCard; | 
				
			|||
 | 
				
			|||
    private Integer pageNo = 1; | 
				
			|||
    private Integer pageSize = 20; | 
				
			|||
    private Boolean isPage = true; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * token里设置 | 
				
			|||
     */ | 
				
			|||
    private String customerId; | 
				
			|||
    private String userId; | 
				
			|||
    private String agencyId; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,20 @@ | 
				
			|||
package com.epmet.dto.result; | 
				
			|||
 | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
 | 
				
			|||
@Data | 
				
			|||
public class ComparisonResultDTO implements Serializable { | 
				
			|||
    private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 是否存在异常 | 
				
			|||
     */ | 
				
			|||
    private Boolean result = false; | 
				
			|||
    /** | 
				
			|||
     * 接口反馈说明 | 
				
			|||
     */ | 
				
			|||
    private String resultExplain; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,70 @@ | 
				
			|||
package com.epmet.dto.result; | 
				
			|||
 | 
				
			|||
import com.alibaba.excel.annotation.write.style.HeadStyle; | 
				
			|||
import com.alibaba.excel.enums.poi.FillPatternTypeEnum; | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * @Description 数据比对列表-接口返参 | 
				
			|||
 * @Author sun | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
public class ResiComparisonListResultDTO implements Serializable { | 
				
			|||
    private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 比对记录表Id | 
				
			|||
     */ | 
				
			|||
    private String comparisonRecordId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * ic_resi_user.id【比对时的数据值】 | 
				
			|||
     */ | 
				
			|||
    private String resiId; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 居民库姓名 | 
				
			|||
     */ | 
				
			|||
    private String resiName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 居民库证件号 | 
				
			|||
     */ | 
				
			|||
    private String resiIdCard; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 公安部人员姓名 | 
				
			|||
     */ | 
				
			|||
    private String policeName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 公安部人员证件号 | 
				
			|||
     */ | 
				
			|||
    private String policeIdCard; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 数据状态(0:未处理  1:已处理) | 
				
			|||
     */ | 
				
			|||
    private String type; | 
				
			|||
    private String typeName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 信息一致性(0:否 1:是 2:-)2代表程序比对了没有匹配上 | 
				
			|||
     */ | 
				
			|||
    private String identical; | 
				
			|||
    private String identicalName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 是否比对过(0:否 1:是) | 
				
			|||
     */ | 
				
			|||
    private String isComparison; | 
				
			|||
    private String isComparisonName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 比对结果说明 | 
				
			|||
     */ | 
				
			|||
    private String comparisonResult; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,136 @@ | 
				
			|||
package com.epmet.controller; | 
				
			|||
 | 
				
			|||
import com.alibaba.excel.EasyExcel; | 
				
			|||
import com.alibaba.excel.ExcelWriter; | 
				
			|||
import com.alibaba.excel.write.metadata.WriteSheet; | 
				
			|||
import com.alibaba.fastjson.JSON; | 
				
			|||
import com.epmet.commons.tools.annotation.LoginUser; | 
				
			|||
import com.epmet.commons.tools.annotation.MaskResponse; | 
				
			|||
import com.epmet.commons.tools.aop.NoRepeatSubmit; | 
				
			|||
import com.epmet.commons.tools.constant.NumConstant; | 
				
			|||
import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			|||
import com.epmet.commons.tools.exception.EpmetException; | 
				
			|||
import com.epmet.commons.tools.feign.ResultDataResolver; | 
				
			|||
import com.epmet.commons.tools.page.PageData; | 
				
			|||
import com.epmet.commons.tools.security.dto.TokenDto; | 
				
			|||
import com.epmet.commons.tools.utils.ConvertUtils; | 
				
			|||
import com.epmet.commons.tools.utils.DateUtils; | 
				
			|||
import com.epmet.commons.tools.utils.ExcelUtils; | 
				
			|||
import com.epmet.commons.tools.utils.Result; | 
				
			|||
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; | 
				
			|||
import com.epmet.commons.tools.validator.ValidatorUtils; | 
				
			|||
import com.epmet.dto.form.ComparisonFormDTO; | 
				
			|||
import com.epmet.dto.form.ResiComparisonListFormDTO; | 
				
			|||
import com.epmet.dto.result.ComparisonResultDTO; | 
				
			|||
import com.epmet.dto.result.ResiComparisonListResultDTO; | 
				
			|||
import com.epmet.excel.IcResiComparisonRecordExcel; | 
				
			|||
import com.epmet.service.IcResiComparisonRecordService; | 
				
			|||
import lombok.extern.slf4j.Slf4j; | 
				
			|||
import org.apache.commons.collections4.CollectionUtils; | 
				
			|||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			|||
import org.springframework.web.bind.annotation.PostMapping; | 
				
			|||
import org.springframework.web.bind.annotation.RequestBody; | 
				
			|||
import org.springframework.web.bind.annotation.RequestMapping; | 
				
			|||
import org.springframework.web.bind.annotation.RestController; | 
				
			|||
 | 
				
			|||
import javax.servlet.http.HttpServletResponse; | 
				
			|||
import java.io.IOException; | 
				
			|||
import java.io.PrintWriter; | 
				
			|||
import java.util.Date; | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 居民信息与公安部信息比对记录表 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2022-11-14 | 
				
			|||
 */ | 
				
			|||
@Slf4j | 
				
			|||
@RestController | 
				
			|||
@RequestMapping("icResiComparisonRecord") | 
				
			|||
public class IcResiComparisonRecordController implements ResultDataResolver { | 
				
			|||
 | 
				
			|||
    @Autowired | 
				
			|||
    private IcResiComparisonRecordService icResiComparisonRecordService; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Author sun | 
				
			|||
     * @Description 数据比对列表 | 
				
			|||
     **/ | 
				
			|||
    @PostMapping("resiComparisonList") | 
				
			|||
    @MaskResponse(fieldNames = {"resiIdCard", "policeIdCard"}, fieldsMaskType = {MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD}) | 
				
			|||
    public Result<PageData<ResiComparisonListResultDTO>> resiComparisonList(@LoginUser TokenDto tokenDto, @RequestBody ResiComparisonListFormDTO formDTO) { | 
				
			|||
        formDTO.setCustomerId(tokenDto.getCustomerId()); | 
				
			|||
        formDTO.setUserId(tokenDto.getUserId()); | 
				
			|||
        return new Result<PageData<ResiComparisonListResultDTO>>().ok(icResiComparisonRecordService.resiComparisonList(formDTO)); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Author sun | 
				
			|||
     * @Description 比对、批量比对、组织及下级比对 | 
				
			|||
     **/ | 
				
			|||
    @PostMapping("comparison") | 
				
			|||
    public Result<ComparisonResultDTO> comparison(@LoginUser TokenDto tokenDto, @RequestBody ComparisonFormDTO formDTO) { | 
				
			|||
        formDTO.setCustomerId(tokenDto.getCustomerId()); | 
				
			|||
        formDTO.setUserId(tokenDto.getUserId()); | 
				
			|||
        return new Result<ComparisonResultDTO>().ok(icResiComparisonRecordService.comparison(formDTO)); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Author sun | 
				
			|||
     * @Description 比对后的更新 | 
				
			|||
     **/ | 
				
			|||
    @PostMapping("comparisonUpdate") | 
				
			|||
    public Result comparisonUpdate(@LoginUser TokenDto tokenDto, @RequestBody ComparisonFormDTO formDTO) { | 
				
			|||
        ValidatorUtils.validateEntity(formDTO, ComparisonFormDTO.Update.class); | 
				
			|||
        formDTO.setCustomerId(tokenDto.getCustomerId()); | 
				
			|||
        formDTO.setUserId(tokenDto.getUserId()); | 
				
			|||
        icResiComparisonRecordService.comparisonUpdate(formDTO); | 
				
			|||
        return new Result(); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Author sun | 
				
			|||
     * @Description 比对记录数据导出 | 
				
			|||
     **/ | 
				
			|||
    @NoRepeatSubmit | 
				
			|||
    @PostMapping("export") | 
				
			|||
    public void export(@LoginUser TokenDto tokenDto, @RequestBody ResiComparisonListFormDTO formDTO, HttpServletResponse response) throws IOException { | 
				
			|||
        formDTO.setCustomerId(tokenDto.getCustomerId()); | 
				
			|||
        formDTO.setUserId(tokenDto.getUserId()); | 
				
			|||
        formDTO.setIsPage(false); | 
				
			|||
        ExcelWriter excelWriter = null; | 
				
			|||
        formDTO.setPageNo(NumConstant.ONE); | 
				
			|||
        formDTO.setPageSize(NumConstant.TEN_THOUSAND); | 
				
			|||
        try { | 
				
			|||
            String fileName = "比对记录" + DateUtils.format(new Date()) + ".xlsx"; | 
				
			|||
            excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcResiComparisonRecordExcel.class).build(); | 
				
			|||
            WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").registerWriteHandler(new FreezeAndFilter()).build(); | 
				
			|||
            PageData<ResiComparisonListResultDTO> data = null; | 
				
			|||
            List<IcResiComparisonRecordExcel> list = null; | 
				
			|||
            do { | 
				
			|||
                data = icResiComparisonRecordService.resiComparisonList(formDTO); | 
				
			|||
                list = ConvertUtils.sourceToTarget(data.getList(), IcResiComparisonRecordExcel.class); | 
				
			|||
                formDTO.setPageNo(formDTO.getPageNo() + NumConstant.ONE); | 
				
			|||
                excelWriter.write(list, writeSheet); | 
				
			|||
            } while (CollectionUtils.isNotEmpty(list) && list.size() == formDTO.getPageSize()); | 
				
			|||
        } catch (EpmetException e) { | 
				
			|||
            response.reset(); | 
				
			|||
            response.setCharacterEncoding("UTF-8"); | 
				
			|||
            response.setHeader("content-type", "application/json; charset=UTF-8"); | 
				
			|||
            PrintWriter printWriter = response.getWriter(); | 
				
			|||
            Result<Object> result = new Result<>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), e.getMsg()); | 
				
			|||
            printWriter.write(JSON.toJSONString(result)); | 
				
			|||
            printWriter.close(); | 
				
			|||
        } catch (Exception e) { | 
				
			|||
            log.error("export exception", e); | 
				
			|||
        } finally { | 
				
			|||
            if (excelWriter != null) { | 
				
			|||
                excelWriter.finish(); | 
				
			|||
            } | 
				
			|||
        } | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,40 @@ | 
				
			|||
/** | 
				
			|||
 * Copyright 2018 人人开源 https://www.renren.io
 | 
				
			|||
 * <p> | 
				
			|||
 * This program is free software: you can redistribute it and/or modify | 
				
			|||
 * it under the terms of the GNU General Public License as published by | 
				
			|||
 * the Free Software Foundation, either version 3 of the License, or | 
				
			|||
 * (at your option) any later version. | 
				
			|||
 * <p> | 
				
			|||
 * This program is distributed in the hope that it will be useful, | 
				
			|||
 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
				
			|||
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
				
			|||
 * GNU General Public License for more details. | 
				
			|||
 * <p> | 
				
			|||
 * You should have received a copy of the GNU General Public License | 
				
			|||
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			|||
 */ | 
				
			|||
 | 
				
			|||
package com.epmet.dao; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.mybatis.dao.BaseDao; | 
				
			|||
import com.epmet.dto.form.ResiComparisonListFormDTO; | 
				
			|||
import com.epmet.dto.result.ResiComparisonListResultDTO; | 
				
			|||
import com.epmet.entity.IcResiComparisonRecordEntity; | 
				
			|||
import org.apache.ibatis.annotations.Mapper; | 
				
			|||
 | 
				
			|||
import java.util.List; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 居民信息与公安部信息比对记录表 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2022-11-14 | 
				
			|||
 */ | 
				
			|||
@Mapper | 
				
			|||
public interface IcResiComparisonRecordDao extends BaseDao<IcResiComparisonRecordEntity> { | 
				
			|||
 | 
				
			|||
    List<ResiComparisonListResultDTO> getResiComparisonList(ResiComparisonListFormDTO formDTO); | 
				
			|||
 | 
				
			|||
    void saveInsert(IcResiComparisonRecordEntity recordEntity); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,71 @@ | 
				
			|||
package com.epmet.entity; | 
				
			|||
 | 
				
			|||
import com.baomidou.mybatisplus.annotation.TableName; | 
				
			|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; | 
				
			|||
import lombok.Data; | 
				
			|||
import lombok.EqualsAndHashCode; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 出生管理 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2022-05-10 | 
				
			|||
 */ | 
				
			|||
@Data | 
				
			|||
@EqualsAndHashCode(callSuper=false) | 
				
			|||
@TableName("ic_resi_comparison_record") | 
				
			|||
public class IcResiComparisonRecordEntity extends BaseEpmetEntity { | 
				
			|||
 | 
				
			|||
	private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 客户ID | 
				
			|||
	 */ | 
				
			|||
	private String customerId; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * ic_resi_user.id【比对时的数据值】 | 
				
			|||
	 */ | 
				
			|||
	private String resiId; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 数字社区人员姓名【比对时的数据值】 | 
				
			|||
	 */ | 
				
			|||
	private String resiName; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 数据社区身份证号【比对时的数据值】 | 
				
			|||
	 */ | 
				
			|||
	private String resiIdCard; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 公安部人员姓名 | 
				
			|||
	 */ | 
				
			|||
	private String policeName; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 公安部人员证件号 | 
				
			|||
	 */ | 
				
			|||
	private String policeIdCard; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 数据状态(0:未处理  1:已处理) | 
				
			|||
	 */ | 
				
			|||
	private String type; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 信息一致性(0:否 1:是 2:-)2代表程序比对了没有匹配上 | 
				
			|||
	 */ | 
				
			|||
	private String identical; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 是否比对过(0:否 1:是) | 
				
			|||
	 */ | 
				
			|||
	private String isComparison; | 
				
			|||
 | 
				
			|||
	/** | 
				
			|||
	 * 比对结果说明 | 
				
			|||
	 */ | 
				
			|||
	private String comparisonResult; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,64 @@ | 
				
			|||
package com.epmet.excel; | 
				
			|||
 | 
				
			|||
import com.alibaba.excel.annotation.ExcelProperty; | 
				
			|||
import com.alibaba.excel.annotation.write.style.ColumnWidth; | 
				
			|||
import com.alibaba.excel.annotation.write.style.HeadStyle; | 
				
			|||
import com.alibaba.excel.enums.poi.FillPatternTypeEnum; | 
				
			|||
import lombok.Data; | 
				
			|||
 | 
				
			|||
import java.io.Serializable; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 比对记录 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2022-11-14 | 
				
			|||
 */ | 
				
			|||
@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44) | 
				
			|||
@Data | 
				
			|||
public class IcResiComparisonRecordExcel implements Serializable { | 
				
			|||
    private static final long serialVersionUID = 1L; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 居民库姓名 | 
				
			|||
     */ | 
				
			|||
    @ExcelProperty(value = "居民库-姓名") | 
				
			|||
    @ColumnWidth(15) | 
				
			|||
    private String resiName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 居民库证件号 | 
				
			|||
     */ | 
				
			|||
    @ExcelProperty(value = "居民库=证件号") | 
				
			|||
    @ColumnWidth(20) | 
				
			|||
    private String resiIdCard; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 公安部人员姓名 | 
				
			|||
     */ | 
				
			|||
    @ExcelProperty(value = "公安-姓名") | 
				
			|||
    @ColumnWidth(15) | 
				
			|||
    private String policeName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 公安部人员证件号 | 
				
			|||
     */ | 
				
			|||
    @ExcelProperty(value = "公安-证件号") | 
				
			|||
    @ColumnWidth(20) | 
				
			|||
    private String policeIdCard; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 数据状态(0:未处理  1:已处理) | 
				
			|||
     */ | 
				
			|||
    @ExcelProperty(value = "状态") | 
				
			|||
    @ColumnWidth(12) | 
				
			|||
    private String typeName; | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * 信息一致性(0:否 1:是 2:-)2代表程序比对了没有匹配上 | 
				
			|||
     */ | 
				
			|||
    @ExcelProperty(value = "信息一致") | 
				
			|||
    @ColumnWidth(12) | 
				
			|||
    private String identicalName; | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,24 @@ | 
				
			|||
package com.epmet.service; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.mybatis.service.BaseService; | 
				
			|||
import com.epmet.commons.tools.page.PageData; | 
				
			|||
import com.epmet.dto.form.ComparisonFormDTO; | 
				
			|||
import com.epmet.dto.form.ResiComparisonListFormDTO; | 
				
			|||
import com.epmet.dto.result.ComparisonResultDTO; | 
				
			|||
import com.epmet.dto.result.ResiComparisonListResultDTO; | 
				
			|||
import com.epmet.entity.IcResiComparisonRecordEntity; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 居民信息与公安部信息比对记录表 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2022-11-14 | 
				
			|||
 */ | 
				
			|||
public interface IcResiComparisonRecordService extends BaseService<IcResiComparisonRecordEntity> { | 
				
			|||
 | 
				
			|||
    PageData<ResiComparisonListResultDTO> resiComparisonList(ResiComparisonListFormDTO formDTO); | 
				
			|||
 | 
				
			|||
    ComparisonResultDTO comparison(ComparisonFormDTO formDTO); | 
				
			|||
 | 
				
			|||
    void comparisonUpdate(ComparisonFormDTO formDTO); | 
				
			|||
} | 
				
			|||
@ -0,0 +1,215 @@ | 
				
			|||
package com.epmet.service.impl; | 
				
			|||
 | 
				
			|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | 
				
			|||
import com.epmet.commons.tools.constant.NumConstant; | 
				
			|||
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | 
				
			|||
import com.epmet.commons.tools.dto.result.YtSfhyxxcxdsjjResDTO; | 
				
			|||
import com.epmet.commons.tools.exception.EpmetErrorCode; | 
				
			|||
import com.epmet.commons.tools.exception.EpmetException; | 
				
			|||
import com.epmet.commons.tools.feign.ResultDataResolver; | 
				
			|||
import com.epmet.commons.tools.page.PageData; | 
				
			|||
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | 
				
			|||
import com.epmet.commons.tools.utils.YtHsResUtils; | 
				
			|||
import com.epmet.dao.IcResiComparisonRecordDao; | 
				
			|||
import com.epmet.dao.IcResiUserDao; | 
				
			|||
import com.epmet.dto.IcResiUserDTO; | 
				
			|||
import com.epmet.dto.form.ComparisonFormDTO; | 
				
			|||
import com.epmet.dto.form.ResiComparisonListFormDTO; | 
				
			|||
import com.epmet.dto.result.ComparisonResultDTO; | 
				
			|||
import com.epmet.dto.result.ResiComparisonListResultDTO; | 
				
			|||
import com.epmet.entity.IcResiComparisonRecordEntity; | 
				
			|||
import com.epmet.entity.IcResiUserEntity; | 
				
			|||
import com.epmet.service.IcResiComparisonRecordService; | 
				
			|||
import com.github.pagehelper.PageHelper; | 
				
			|||
import com.github.pagehelper.PageInfo; | 
				
			|||
import lombok.extern.slf4j.Slf4j; | 
				
			|||
import org.apache.commons.collections4.CollectionUtils; | 
				
			|||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			|||
import org.springframework.scheduling.annotation.Async; | 
				
			|||
import org.springframework.stereotype.Service; | 
				
			|||
 | 
				
			|||
/** | 
				
			|||
 * 居民信息与公安部信息比对记录表 | 
				
			|||
 * | 
				
			|||
 * @author generator generator@elink-cn.com | 
				
			|||
 * @since v1.0.0 2022-11-14 | 
				
			|||
 */ | 
				
			|||
@Service | 
				
			|||
@Slf4j | 
				
			|||
public class IcResiComparisonRecordServiceImpl extends BaseServiceImpl<IcResiComparisonRecordDao, IcResiComparisonRecordEntity> implements IcResiComparisonRecordService, ResultDataResolver { | 
				
			|||
    @Autowired | 
				
			|||
    private IcResiUserDao icResiUserDao; | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    @Override | 
				
			|||
    public PageData<ResiComparisonListResultDTO> resiComparisonList(ResiComparisonListFormDTO formDTO) { | 
				
			|||
        //1.获取工作人员信息
 | 
				
			|||
        CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); | 
				
			|||
        if (null == staffInfo) { | 
				
			|||
            throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); | 
				
			|||
        } | 
				
			|||
        formDTO.setAgencyId(staffInfo.getAgencyId()); | 
				
			|||
        //2.按条件分页查询数据s
 | 
				
			|||
        PageInfo<ResiComparisonListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) | 
				
			|||
                .doSelectPageInfo(() -> baseDao.getResiComparisonList(formDTO)); | 
				
			|||
 | 
				
			|||
        return new PageData(data.getList(), data.getTotal()); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Author sun | 
				
			|||
     * @Description 比对、批量比对、组织及下级比对 | 
				
			|||
     **/ | 
				
			|||
    @Override | 
				
			|||
    public ComparisonResultDTO comparison(ComparisonFormDTO formDTO) { | 
				
			|||
        ComparisonResultDTO resultDTO = new ComparisonResultDTO(); | 
				
			|||
        //1.获取工作人员信息
 | 
				
			|||
        CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); | 
				
			|||
        if (null == staffInfo) { | 
				
			|||
            throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); | 
				
			|||
        } | 
				
			|||
        formDTO.setAgencyId(staffInfo.getAgencyId()); | 
				
			|||
        //2.判断是单条比对的则直接处理
 | 
				
			|||
        if (formDTO.getUserIdList().size() == 1) { | 
				
			|||
            IcResiUserEntity entity = icResiUserDao.selectById(formDTO.getUserIdList().get(NumConstant.ZERO)); | 
				
			|||
            if (null == entity) { | 
				
			|||
                resultDTO.setResult(true); | 
				
			|||
                resultDTO.setResultExplain("未查询到居民信息"); | 
				
			|||
                return resultDTO; | 
				
			|||
            } | 
				
			|||
            IcResiComparisonRecordEntity recordEntity = new IcResiComparisonRecordEntity(); | 
				
			|||
            recordEntity.setCustomerId(entity.getCustomerId()); | 
				
			|||
            recordEntity.setResiId(entity.getId()); | 
				
			|||
            recordEntity.setResiName(entity.getName()); | 
				
			|||
            recordEntity.setResiIdCard(entity.getIdCard()); | 
				
			|||
            recordEntity.setIsComparison("1"); | 
				
			|||
            YtSfhyxxcxdsjjResDTO sfhyxxcxdsjjResult = YtHsResUtils.sfhyxxcxdsjj(entity.getIdCard(), entity.getName()); | 
				
			|||
            /*YtSfhyxxcxdsjjResDTO sfhyxxcxdsjjResult = new YtSfhyxxcxdsjjResDTO(); | 
				
			|||
            YtSfhyxxcxdsjjResDTO.YtSfhyxxcxdsjjDetail f = new YtSfhyxxcxdsjjResDTO.YtSfhyxxcxdsjjDetail(); | 
				
			|||
            List<YtSfhyxxcxdsjjResDTO.Result> l = new ArrayList<>(); | 
				
			|||
            YtSfhyxxcxdsjjResDTO.Result d = new YtSfhyxxcxdsjjResDTO.Result(); | 
				
			|||
            d.setGMSFHM("371424188808087654"); | 
				
			|||
            d.setXM("小二"); | 
				
			|||
            l.add(d); | 
				
			|||
            f.setResult(l); | 
				
			|||
            sfhyxxcxdsjjResult.setData(f);*/ | 
				
			|||
            if (sfhyxxcxdsjjResult.getCode() != 200) { | 
				
			|||
                recordEntity.setComparisonResult("公安部接口调用失败"); | 
				
			|||
                resultDTO.setResult(true); | 
				
			|||
                resultDTO.setResultExplain("公安部接口调用失败"); | 
				
			|||
                return resultDTO; | 
				
			|||
            } else { | 
				
			|||
                //数据已处理
 | 
				
			|||
                recordEntity.setType("1"); | 
				
			|||
                //公安部不存在的数据
 | 
				
			|||
                if (CollectionUtils.isEmpty(sfhyxxcxdsjjResult.getData().getResult())) { | 
				
			|||
                    recordEntity.setComparisonResult("公安部身份证号对应数据不存在"); | 
				
			|||
                    //代表程序干活了
 | 
				
			|||
                    recordEntity.setIdentical("2"); | 
				
			|||
                    resultDTO.setResult(true); | 
				
			|||
                    resultDTO.setResultExplain("公安部身份证号对应数据不存在"); | 
				
			|||
                } else {//在公安部查询到了数据
 | 
				
			|||
                    recordEntity.setPoliceName(sfhyxxcxdsjjResult.getData().getResult().get(0).getXM()); | 
				
			|||
                    recordEntity.setPoliceIdCard(sfhyxxcxdsjjResult.getData().getResult().get(0).getGMSFHM()); | 
				
			|||
                    //公安部跟居民库姓名不一致
 | 
				
			|||
                    if (!entity.getName().equals(sfhyxxcxdsjjResult.getData().getResult().get(0).getXM())) { | 
				
			|||
                        recordEntity.setIdentical("0"); | 
				
			|||
                        recordEntity.setComparisonResult("公安部与居民库姓名不相同"); | 
				
			|||
                        resultDTO.setResult(true); | 
				
			|||
                        resultDTO.setResultExplain("公安部与居民库姓名不相同"); | 
				
			|||
                    } else { | 
				
			|||
                        recordEntity.setIdentical("1"); | 
				
			|||
                    } | 
				
			|||
                } | 
				
			|||
            } | 
				
			|||
            recordEntity.setCreatedBy(formDTO.getUserId()); | 
				
			|||
            recordEntity.setUpdatedBy(formDTO.getUserId()); | 
				
			|||
            baseDao.saveInsert(recordEntity); | 
				
			|||
            return resultDTO; | 
				
			|||
        } | 
				
			|||
        //3.判断多条比对则开启子线程执行
 | 
				
			|||
        if (CollectionUtils.isEmpty(formDTO.getUserIdList()) || formDTO.getUserIdList().size() > NumConstant.ONE) { | 
				
			|||
            asyncComparison(formDTO); | 
				
			|||
            resultDTO.setResult(true); | 
				
			|||
            resultDTO.setResultExplain("数据比对中请稍后"); | 
				
			|||
            return resultDTO; | 
				
			|||
        } | 
				
			|||
        return resultDTO; | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Author sun | 
				
			|||
     * @Description 线程逐条比对居民信息 | 
				
			|||
     **/ | 
				
			|||
    @Async | 
				
			|||
    public void asyncComparison(ComparisonFormDTO formDTO) { | 
				
			|||
        PageData<IcResiUserDTO> data = null; | 
				
			|||
        formDTO.setIsPage(false); | 
				
			|||
        formDTO.setPageSize(NumConstant.ONE_THOUSAND); | 
				
			|||
        int pageNo = formDTO.getPageNo(); | 
				
			|||
        do { | 
				
			|||
            data = getResiUserList(formDTO); | 
				
			|||
            data.getList().forEach(o -> { | 
				
			|||
                IcResiComparisonRecordEntity recordEntity = new IcResiComparisonRecordEntity(); | 
				
			|||
                recordEntity.setCustomerId(o.getCustomerId()); | 
				
			|||
                recordEntity.setResiId(o.getId()); | 
				
			|||
                recordEntity.setResiName(o.getName()); | 
				
			|||
                recordEntity.setResiIdCard(o.getIdCard()); | 
				
			|||
                recordEntity.setIsComparison("1"); | 
				
			|||
                YtSfhyxxcxdsjjResDTO sfhyxxcxdsjjResult = YtHsResUtils.sfhyxxcxdsjj(o.getIdCard(), o.getName()); | 
				
			|||
                if (sfhyxxcxdsjjResult.getCode() != 200) { | 
				
			|||
                    recordEntity.setComparisonResult("接口调用失败"); | 
				
			|||
                } else { | 
				
			|||
                    //数据已处理
 | 
				
			|||
                    recordEntity.setType("1"); | 
				
			|||
                    //公安部不存在的数据
 | 
				
			|||
                    if (CollectionUtils.isEmpty(sfhyxxcxdsjjResult.getData().getResult())) { | 
				
			|||
                        recordEntity.setComparisonResult("公安部身份证号对应数据不存在"); | 
				
			|||
                        //代表程序干活了
 | 
				
			|||
                        recordEntity.setIdentical("2"); | 
				
			|||
                    } else {//在公安部查询到了数据
 | 
				
			|||
                        recordEntity.setPoliceName(sfhyxxcxdsjjResult.getData().getResult().get(0).getXM()); | 
				
			|||
                        recordEntity.setPoliceIdCard(sfhyxxcxdsjjResult.getData().getResult().get(0).getGMSFHM()); | 
				
			|||
                        //公安部跟居民库姓名不一致
 | 
				
			|||
                        if (!o.getName().equals(sfhyxxcxdsjjResult.getData().getResult().get(0).getXM())) { | 
				
			|||
                            recordEntity.setIdentical("0"); | 
				
			|||
                            recordEntity.setComparisonResult("公安部与居民库姓名不相同"); | 
				
			|||
                        } else { | 
				
			|||
                            recordEntity.setIdentical("1"); | 
				
			|||
                        } | 
				
			|||
                    } | 
				
			|||
                } | 
				
			|||
                recordEntity.setCreatedBy(formDTO.getUserId()); | 
				
			|||
                recordEntity.setUpdatedBy(formDTO.getUserId()); | 
				
			|||
                baseDao.saveInsert(recordEntity); | 
				
			|||
            }); | 
				
			|||
            formDTO.setPageNo(++pageNo); | 
				
			|||
        } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    private PageData<IcResiUserDTO> getResiUserList(ComparisonFormDTO formDTO) { | 
				
			|||
        PageInfo<IcResiUserDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) | 
				
			|||
                .doSelectPageInfo(() -> icResiUserDao.getResiUserList(formDTO)); | 
				
			|||
        return new PageData(data.getList(), data.getTotal()); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
    /** | 
				
			|||
     * @Author sun | 
				
			|||
     * @Description 比对后的更新 | 
				
			|||
     **/ | 
				
			|||
    @Override | 
				
			|||
    public void comparisonUpdate(ComparisonFormDTO formDTO) { | 
				
			|||
        //1.查询比对记录表数据
 | 
				
			|||
        IcResiComparisonRecordEntity entity = baseDao.selectById(formDTO.getComparisonRecordId()); | 
				
			|||
        if (null == entity) { | 
				
			|||
            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查询到对应比对记录数据", "未查询到对应比对记录数据"); | 
				
			|||
        } | 
				
			|||
        //2.根据居民信息表数据
 | 
				
			|||
        IcResiUserEntity resiUserEntity = new IcResiUserEntity(); | 
				
			|||
        resiUserEntity.setId(entity.getResiId()); | 
				
			|||
        resiUserEntity.setName(entity.getPoliceName()); | 
				
			|||
        icResiUserDao.updateById(resiUserEntity); | 
				
			|||
    } | 
				
			|||
 | 
				
			|||
 | 
				
			|||
} | 
				
			|||
@ -0,0 +1,108 @@ | 
				
			|||
<?xml version="1.0" encoding="UTF-8"?> | 
				
			|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
				
			|||
 | 
				
			|||
<mapper namespace="com.epmet.dao.IcResiComparisonRecordDao"> | 
				
			|||
 | 
				
			|||
    <insert id="saveInsert" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.epmet.entity.IcResiComparisonRecordEntity"> | 
				
			|||
        <selectKey keyProperty="id" resultType="java.lang.String" order="BEFORE"> | 
				
			|||
            SELECT replace(uuid(),'-','') AS ID | 
				
			|||
        </selectKey> | 
				
			|||
        INSERT INTO ic_resi_comparison_record | 
				
			|||
        ( | 
				
			|||
            id, | 
				
			|||
            customer_id, | 
				
			|||
            resi_id, | 
				
			|||
            resi_name, | 
				
			|||
            resi_id_card, | 
				
			|||
            police_name, | 
				
			|||
            police_id_card, | 
				
			|||
            `type`, | 
				
			|||
            identical, | 
				
			|||
            is_comparison, | 
				
			|||
            comparison_result, | 
				
			|||
            del_flag, | 
				
			|||
            revision, | 
				
			|||
            created_by, | 
				
			|||
            created_time, | 
				
			|||
            updated_by, | 
				
			|||
            updated_time | 
				
			|||
        ) VALUE ( | 
				
			|||
            #{id}, | 
				
			|||
            #{customerId}, | 
				
			|||
            #{resiId}, | 
				
			|||
            #{resiName}, | 
				
			|||
            #{resiIdCard}, | 
				
			|||
            #{policeName}, | 
				
			|||
            #{policeIdCard}, | 
				
			|||
            #{type}, | 
				
			|||
            #{identical}, | 
				
			|||
            #{isComparison}, | 
				
			|||
            #{comparisonResult}, | 
				
			|||
            0, | 
				
			|||
            0, | 
				
			|||
            #{createdBy}, | 
				
			|||
            now(), | 
				
			|||
            #{createdBy}, | 
				
			|||
            now() | 
				
			|||
        ) ON DUPLICATE KEY UPDATE | 
				
			|||
            resi_name = values(resi_name), | 
				
			|||
            resi_id_card = values(resi_id_card), | 
				
			|||
            police_name = values(police_name), | 
				
			|||
            police_id_card = values(police_id_card), | 
				
			|||
            `type` = values(`type`), | 
				
			|||
            identical = values(identical), | 
				
			|||
            is_comparison = values(is_comparison), | 
				
			|||
            comparison_result = values(comparison_result), | 
				
			|||
            updated_time = NOW(), | 
				
			|||
            updated_by = #{updatedBy} | 
				
			|||
    </insert> | 
				
			|||
 | 
				
			|||
    <select id="getResiComparisonList" resultType="com.epmet.dto.result.ResiComparisonListResultDTO"> | 
				
			|||
        SELECT | 
				
			|||
            a.id resiId, | 
				
			|||
            a.`name` resiName, | 
				
			|||
            a.id_card resiIdCard, | 
				
			|||
            b.id comparisonRecordId, | 
				
			|||
            b.police_name policeName, | 
				
			|||
            b.police_id_card policeIdCard, | 
				
			|||
            b.type type, | 
				
			|||
            IF (b.type = '1', '已处理', '未处理') typeName, | 
				
			|||
            b.identical identical, | 
				
			|||
            (case b.identical when '0' then '否' when '1' then '是' WHEN '2' THEN '-' else '否' end ) identicalName, | 
				
			|||
            b.is_comparison isComparison, | 
				
			|||
            IF (b.is_comparison = '1', '是', '否') isComparisonName, | 
				
			|||
            b.comparison_result comparisonResult | 
				
			|||
        FROM | 
				
			|||
            ic_resi_user a | 
				
			|||
        <choose> | 
				
			|||
           <when test='identical == null or identical == "" or identical == "0" or type == null and type == "" or type == "0" '> | 
				
			|||
                LEFT JOIN ic_resi_comparison_record b ON a.id = b.resi_id AND b.del_flag = '0' | 
				
			|||
                <if test="identical != null and identical != ''"> | 
				
			|||
                    AND b.identical =#{identical} | 
				
			|||
                </if> | 
				
			|||
                <if test="type != null and type != ''"> | 
				
			|||
                    AND b.type =#{type} | 
				
			|||
                </if> | 
				
			|||
            </when> | 
				
			|||
            <otherwise> | 
				
			|||
                INNER JOIN ic_resi_comparison_record b ON a.id = b.resi_id AND b.del_flag = '0' | 
				
			|||
                <if test="identical != null and identical != ''"> | 
				
			|||
                    AND b.identical =#{identical} | 
				
			|||
                </if> | 
				
			|||
                <if test="type != null and type != ''"> | 
				
			|||
                    AND b.type =#{type} | 
				
			|||
                </if> | 
				
			|||
            </otherwise> | 
				
			|||
        </choose> | 
				
			|||
        WHERE | 
				
			|||
            a.del_flag = '0' | 
				
			|||
        AND a.customer_id = #{customerId} | 
				
			|||
        AND a.pids LIKE CONCAT('%',#{agencyId},'%') | 
				
			|||
        <if test="idCard != null and idCard != ''"> | 
				
			|||
            AND a.id_card =#{idCard} | 
				
			|||
        </if> | 
				
			|||
        ORDER BY a.pids ASC, b.created_time DESC | 
				
			|||
    </select> | 
				
			|||
 | 
				
			|||
 | 
				
			|||
</mapper> | 
				
			|||
					Loading…
					
					
				
		Reference in new issue