98 changed files with 3271 additions and 149 deletions
@ -0,0 +1,24 @@ |
|||
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 List<Result> result; |
|||
@Data |
|||
public static class Result { |
|||
//身份证号
|
|||
private String GMSFHM; |
|||
//姓名
|
|||
private String XM; |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.form.stats; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 人房信息查询dto |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class UserHouseStatsQueryFormDTO { |
|||
|
|||
private String orgId; |
|||
private String orgType; |
|||
|
|||
@NotBlank(message = "dateId不能为空") |
|||
private String dateId; |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.epmet.stats; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 人房信息统计 |
|||
*/ |
|||
@Data |
|||
public class UserHouseStatsResultDTO { |
|||
private Integer houseTotal = 0; |
|||
private Integer zzHouseTotal = 0; |
|||
private Integer czHouseTotal = 0; |
|||
private Integer xzHouseTotal = 0; |
|||
private Integer userTotal = 0; |
|||
private Integer czUserTotal = 0; |
|||
private Integer ldUserTotal = 0; |
|||
private Integer usingCommunityNum = 0; |
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.epmet.datareport.controller.stats; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.datareport.service.stats.UserHouseStatsService; |
|||
import com.epmet.dto.form.stats.UserHouseStatsQueryFormDTO; |
|||
import com.epmet.stats.UserHouseStatsResultDTO; |
|||
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; |
|||
|
|||
@RestController |
|||
@RequestMapping("userHouse") |
|||
public class UserHouseController { |
|||
|
|||
@Autowired |
|||
private UserHouseStatsService userHouseStatsService; |
|||
|
|||
/** |
|||
* 通过dateId查询人房统计信息 |
|||
* @param input |
|||
* @return |
|||
*/ |
|||
@PostMapping("getUserHouseDailyStatsByDateId") |
|||
public Result<UserHouseStatsResultDTO> getUserHouseDailyStatsByDateId(@RequestBody UserHouseStatsQueryFormDTO input) { |
|||
ValidatorUtils.validateEntity(input); |
|||
String orgId = input.getOrgId(); |
|||
String orgType = input.getOrgType(); |
|||
String dateId = input.getDateId(); |
|||
|
|||
UserHouseStatsResultDTO r = userHouseStatsService.getUserHouseDailyStats(orgId, orgType, dateId); |
|||
return new Result<UserHouseStatsResultDTO>().ok(r); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.epmet.datareport.dao.stats; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.datareport.entity.stats.FactAgencyUserHouseDailyEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
|
|||
/** |
|||
* 人房信息统计数,按天统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-27 |
|||
*/ |
|||
@Mapper |
|||
public interface FactAgencyUserHouseDailyDao extends BaseDao<FactAgencyUserHouseDailyEntity> { |
|||
|
|||
} |
@ -0,0 +1,17 @@ |
|||
package com.epmet.datareport.dao.stats; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.datareport.entity.stats.FactGridUserHouseDailyEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
|
|||
/** |
|||
* 网格的人房信息统计数,按天统计 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2022-05-27 |
|||
*/ |
|||
@Mapper |
|||
public interface FactGridUserHouseDailyDao extends BaseDao<FactGridUserHouseDailyEntity> { |
|||
|
|||
} |
@ -0,0 +1,115 @@ |
|||
package com.epmet.datareport.entity.stats; |
|||
|
|||
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-27 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("fact_agency_user_house_daily") |
|||
public class FactAgencyUserHouseDailyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 数据更新至:yyyyMMdd; |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
private String agencyId; |
|||
|
|||
/** |
|||
* agency_id所属的机关级别(社区级:community, |
|||
乡(镇、街道)级:street, |
|||
区县级: district, |
|||
市级: city |
|||
省级:province) |
|||
*/ |
|||
private String level; |
|||
|
|||
/** |
|||
* 组织i所属的组织id |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 组织i所有上级id |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 小区总数 |
|||
*/ |
|||
private Integer neighbourhoodsCount; |
|||
|
|||
/** |
|||
* 房屋总数 |
|||
*/ |
|||
private Integer houseCount; |
|||
|
|||
/** |
|||
* 自住房屋总数 |
|||
*/ |
|||
private Integer houseSelfCount; |
|||
|
|||
/** |
|||
* 出租房屋总数 |
|||
*/ |
|||
private Integer houseLeaseCount; |
|||
|
|||
/** |
|||
* 闲置房屋总数 |
|||
*/ |
|||
private Integer houseIdleCount; |
|||
|
|||
/** |
|||
* 居民总数 |
|||
*/ |
|||
private Integer userCount; |
|||
|
|||
/** |
|||
* 常住居民总数 |
|||
*/ |
|||
private Integer userResiCount; |
|||
|
|||
/** |
|||
* 流动居民总数 |
|||
*/ |
|||
private Integer userFloatCount; |
|||
|
|||
/** |
|||
* 当日新增房屋数 |
|||
*/ |
|||
private Integer houseIncr; |
|||
|
|||
/** |
|||
* 当日修改房屋数 |
|||
*/ |
|||
private Integer houseModify; |
|||
|
|||
/** |
|||
* 当日新增居民数 |
|||
*/ |
|||
private Integer userIncr; |
|||
|
|||
/** |
|||
* 当日修改居民数 |
|||
*/ |
|||
private Integer userModify; |
|||
|
|||
} |
@ -0,0 +1,106 @@ |
|||
package com.epmet.datareport.entity.stats; |
|||
|
|||
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-27 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("fact_grid_user_house_daily") |
|||
public class FactGridUserHouseDailyEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 数据更新至:yyyyMMdd; |
|||
*/ |
|||
private String dateId; |
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 网格所属的组织id |
|||
*/ |
|||
private String pid; |
|||
|
|||
/** |
|||
* 网格所有上级id |
|||
*/ |
|||
private String pids; |
|||
|
|||
/** |
|||
* 小区总数 |
|||
*/ |
|||
private Integer neighbourhoodsCount; |
|||
|
|||
/** |
|||
* 房屋总数 |
|||
*/ |
|||
private Integer houseCount; |
|||
|
|||
/** |
|||
* 自住房屋总数 |
|||
*/ |
|||
private Integer houseSelfCount; |
|||
|
|||
/** |
|||
* 出租房屋总数 |
|||
*/ |
|||
private Integer houseLeaseCount; |
|||
|
|||
/** |
|||
* 闲置房屋总数 |
|||
*/ |
|||
private Integer houseIdleCount; |
|||
|
|||
/** |
|||
* 居民总数 |
|||
*/ |
|||
private Integer userCount; |
|||
|
|||
/** |
|||
* 常住居民总数 |
|||
*/ |
|||
private Integer userResiCount; |
|||
|
|||
/** |
|||
* 流动居民总数 |
|||
*/ |
|||
private Integer userFloatCount; |
|||
|
|||
/** |
|||
* 当日新增房屋数 |
|||
*/ |
|||
private Integer houseIncr; |
|||
|
|||
/** |
|||
* 当日修改房屋数 |
|||
*/ |
|||
private Integer houseModify; |
|||
|
|||
/** |
|||
* 当日新增居民数 |
|||
*/ |
|||
private Integer userIncr; |
|||
|
|||
/** |
|||
* 当日修改居民数 |
|||
*/ |
|||
private Integer userModify; |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.datareport.service.stats; |
|||
|
|||
import com.epmet.stats.UserHouseStatsResultDTO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
|
|||
/** |
|||
* 人房统计service |
|||
*/ |
|||
public interface UserHouseStatsService { |
|||
|
|||
/** |
|||
* 查询指定dateId的人房统计信息 |
|||
* @param orgId |
|||
* @param orgType |
|||
* @param dateId |
|||
* @return |
|||
*/ |
|||
UserHouseStatsResultDTO getUserHouseDailyStats(String orgId, String orgType, String dateId); |
|||
} |
@ -0,0 +1,87 @@ |
|||
package com.epmet.datareport.service.stats.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|||
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|||
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|||
import com.epmet.constant.DataSourceConstant; |
|||
import com.epmet.datareport.dao.stats.FactAgencyUserHouseDailyDao; |
|||
import com.epmet.datareport.dao.stats.FactGridUserHouseDailyDao; |
|||
import com.epmet.datareport.entity.stats.FactAgencyUserHouseDailyEntity; |
|||
import com.epmet.datareport.entity.stats.FactGridUserHouseDailyEntity; |
|||
import com.epmet.datareport.service.stats.UserHouseStatsService; |
|||
import com.epmet.stats.UserHouseStatsResultDTO; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
@DataSource(DataSourceConstant.STATS) |
|||
public class UserHouseStatsServiceImpl implements UserHouseStatsService { |
|||
|
|||
@Autowired |
|||
private FactGridUserHouseDailyDao factGridUserHouseDailyDao; |
|||
|
|||
@Autowired |
|||
private FactAgencyUserHouseDailyDao factAgencyUserHouseDailyDao; |
|||
|
|||
@Override |
|||
public UserHouseStatsResultDTO getUserHouseDailyStats(String orgId, String orgType, String dateId) { |
|||
// 没有传参,使用当前登录人的
|
|||
if (StringUtils.isEmpty(orgId) || StringUtils.isEmpty(orgType)) { |
|||
String userId = EpmetRequestHolder.getLoginUserId(); |
|||
String customerId = EpmetRequestHolder.getLoginUserCustomerId(); |
|||
|
|||
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); |
|||
if (null == staffInfo) { |
|||
throw new EpmetException(String.format("查询工作人员%s缓存信息失败:%s", userId)); |
|||
} |
|||
|
|||
orgId = staffInfo.getAgencyId(); |
|||
orgType = "agency"; |
|||
} |
|||
|
|||
// 结果对象初始化
|
|||
UserHouseStatsResultDTO result = new UserHouseStatsResultDTO(); |
|||
|
|||
if ("agency".equals(orgType)) { |
|||
// 查询的目标是组织
|
|||
LambdaQueryWrapper<FactAgencyUserHouseDailyEntity> query = new LambdaQueryWrapper<>(); |
|||
query.eq(FactAgencyUserHouseDailyEntity::getDateId, dateId); |
|||
query.eq(FactAgencyUserHouseDailyEntity::getAgencyId, orgId); |
|||
FactAgencyUserHouseDailyEntity agencyDailyStats = factAgencyUserHouseDailyDao.selectOne(query); |
|||
if (agencyDailyStats != null) { |
|||
result.setHouseTotal(agencyDailyStats.getHouseCount()); |
|||
result.setCzHouseTotal(agencyDailyStats.getHouseLeaseCount()); |
|||
result.setXzHouseTotal(agencyDailyStats.getHouseIdleCount()); |
|||
result.setZzHouseTotal(agencyDailyStats.getHouseSelfCount()); |
|||
result.setUserTotal(agencyDailyStats.getUserCount()); |
|||
result.setCzUserTotal(agencyDailyStats.getUserResiCount()); |
|||
result.setLdUserTotal(agencyDailyStats.getUserFloatCount()); |
|||
} |
|||
} else { |
|||
// 查询的目标是网格
|
|||
LambdaQueryWrapper<FactGridUserHouseDailyEntity> query = new LambdaQueryWrapper<>(); |
|||
query.eq(FactGridUserHouseDailyEntity::getDateId, dateId); |
|||
query.eq(FactGridUserHouseDailyEntity::getGridId, orgId); |
|||
FactGridUserHouseDailyEntity gridDailyStats = factGridUserHouseDailyDao.selectOne(query); |
|||
if (gridDailyStats != null) { |
|||
result.setHouseTotal(gridDailyStats.getHouseCount()); |
|||
result.setCzHouseTotal(gridDailyStats.getHouseLeaseCount()); |
|||
result.setXzHouseTotal(gridDailyStats.getHouseIdleCount()); |
|||
result.setZzHouseTotal(gridDailyStats.getHouseSelfCount()); |
|||
result.setUserTotal(gridDailyStats.getUserCount()); |
|||
result.setCzUserTotal(gridDailyStats.getUserResiCount()); |
|||
result.setLdUserTotal(gridDailyStats.getUserFloatCount()); |
|||
} |
|||
} |
|||
|
|||
return result; |
|||
} |
|||
} |
@ -0,0 +1,33 @@ |
|||
<?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.datareport.dao.stats.FactAgencyUserHouseDailyDao"> |
|||
|
|||
<resultMap type="com.epmet.datareport.entity.stats.FactAgencyUserHouseDailyEntity" id="factAgencyUserHouseDailyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="dateId" column="DATE_ID"/> |
|||
<result property="agencyId" column="AGENCY_ID"/> |
|||
<result property="level" column="LEVEL"/> |
|||
<result property="pid" column="PID"/> |
|||
<result property="pids" column="PIDS"/> |
|||
<result property="neighbourhoodsCount" column="NEIGHBOURHOODS_COUNT"/> |
|||
<result property="houseCount" column="HOUSE_COUNT"/> |
|||
<result property="houseSelfCount" column="HOUSE_SELF_COUNT"/> |
|||
<result property="houseLeaseCount" column="HOUSE_LEASE_COUNT"/> |
|||
<result property="houseIdleCount" column="HOUSE_IDLE_COUNT"/> |
|||
<result property="userCount" column="USER_COUNT"/> |
|||
<result property="userResiCount" column="USER_RESI_COUNT"/> |
|||
<result property="userFloatCount" column="USER_FLOAT_COUNT"/> |
|||
<result property="houseIncr" column="HOUSE_INCR"/> |
|||
<result property="houseModify" column="HOUSE_MODIFY"/> |
|||
<result property="userIncr" column="USER_INCR"/> |
|||
<result property="userModify" column="USER_MODIFY"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
</mapper> |
@ -0,0 +1,32 @@ |
|||
<?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.datareport.dao.stats.FactGridUserHouseDailyDao"> |
|||
|
|||
<resultMap type="com.epmet.datareport.entity.stats.FactGridUserHouseDailyEntity" id="factGridUserHouseDailyMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="customerId" column="CUSTOMER_ID"/> |
|||
<result property="dateId" column="DATE_ID"/> |
|||
<result property="gridId" column="GRID_ID"/> |
|||
<result property="pid" column="PID"/> |
|||
<result property="pids" column="PIDS"/> |
|||
<result property="neighbourhoodsCount" column="NEIGHBOURHOODS_COUNT"/> |
|||
<result property="houseCount" column="HOUSE_COUNT"/> |
|||
<result property="houseSelfCount" column="HOUSE_SELF_COUNT"/> |
|||
<result property="houseLeaseCount" column="HOUSE_LEASE_COUNT"/> |
|||
<result property="houseIdleCount" column="HOUSE_IDLE_COUNT"/> |
|||
<result property="userCount" column="USER_COUNT"/> |
|||
<result property="userResiCount" column="USER_RESI_COUNT"/> |
|||
<result property="userFloatCount" column="USER_FLOAT_COUNT"/> |
|||
<result property="houseIncr" column="HOUSE_INCR"/> |
|||
<result property="houseModify" column="HOUSE_MODIFY"/> |
|||
<result property="userIncr" column="USER_INCR"/> |
|||
<result property="userModify" column="USER_MODIFY"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
</mapper> |
@ -0,0 +1,15 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class CommunityUserHouseStatsFormDTO { |
|||
private String orgId; |
|||
private String orgType; |
|||
private Integer pageNo = 1; |
|||
private Integer pageSize = 10; |
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class UsingCommunityStatsFormDTO { |
|||
|
|||
private String orgId; |
|||
private String orgType; |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class UsingCommunityStatsResultDTO { |
|||
|
|||
/** |
|||
* 开通平台社区数 |
|||
*/ |
|||
private Integer usingCommunityNum; |
|||
/** |
|||
* 开通平台社区数-较上月 |
|||
*/ |
|||
private Integer usingCommunityNumJSY; |
|||
|
|||
} |
@ -0,0 +1,56 @@ |
|||
alter table ic_form_item_group add COLUMN GROUP_CODE VARCHAR(32) DEFAULT '' COMMENT '组编码,唯一标识' after CHILD_SHOW_FLAG; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='jcxx' |
|||
where g.LABEL='基础信息'; |
|||
|
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='jyxx' |
|||
where g.LABEL='教育信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='xqah' |
|||
where g.LABEL='兴趣爱好'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='zjxy' |
|||
where g.LABEL='宗教信仰'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='jkxx' |
|||
where g.LABEL='健康信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='gzxx' |
|||
where g.LABEL='工作信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='jjzk' |
|||
where g.LABEL='经济状况'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='jzxx' |
|||
where g.LABEL='居住信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='jtxx' |
|||
where g.LABEL='家庭信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='dyxx' |
|||
where g.LABEL='党员信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='bzfxx' |
|||
where g.LABEL='保障房信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='syxx' |
|||
where g.LABEL='失业信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='tyjrxx' |
|||
where g.LABEL='退役军人信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='zyzxx' |
|||
where g.LABEL='志愿者信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='tsrqxx' |
|||
where g.LABEL='特殊人群信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='tzry' |
|||
where g.LABEL='统战人员'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='lnrxx' |
|||
where g.LABEL='老年人信息'; |
|||
|
|||
update ic_form_item_group g set g.GROUP_CODE='resi_demand' |
|||
where g.LABEL='居民需求信息'; |
@ -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,27 @@ |
|||
package com.epmet.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2022/11/11 15:05 |
|||
*/ |
|||
@Data |
|||
public class YTVaccineListDTO implements Serializable { |
|||
private static final long serialVersionUID = -5583350277850076659L; |
|||
|
|||
private String cardno; |
|||
|
|||
/** |
|||
* 接种时间 |
|||
*/ |
|||
private String inoculateDate; |
|||
|
|||
/** |
|||
* 接种地点 |
|||
*/ |
|||
private String lastStationName; |
|||
|
|||
} |
@ -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,32 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2022/11/16 13:26 |
|||
*/ |
|||
@Data |
|||
public class RHZKStatisticsFormDTO implements Serializable { |
|||
private static final long serialVersionUID = -4474168123286467820L; |
|||
|
|||
private String orgId; |
|||
|
|||
/** |
|||
* grid:网格;village:小区; |
|||
*/ |
|||
private String orgType; |
|||
|
|||
/** |
|||
* /epmetuser/icresiuser/rhzkList调用会赋值 |
|||
*/ |
|||
private List<String> orgIds; |
|||
|
|||
//tokenDto中获取
|
|||
private String staffId; |
|||
private String customerId; |
|||
|
|||
} |
@ -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,38 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2022/11/16 09:15 |
|||
*/ |
|||
@Data |
|||
public class RHZKStatisticsResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 6493812449146476415L; |
|||
|
|||
private Integer userTotal = NumConstant.ZERO; |
|||
|
|||
/** |
|||
* 人户一致,人在户不在,户在人不在, |
|||
* 为空的 暂不清楚 |
|||
*/ |
|||
private Integer rhyzUserTotal = NumConstant.ZERO; |
|||
private BigDecimal rhyzUserRatio = NumConstant.ZERO_DECIMAL; |
|||
private Integer rzhbzUserTotal = NumConstant.ZERO; |
|||
private BigDecimal rzhbzUserRatio = NumConstant.ZERO_DECIMAL; |
|||
private Integer hzrbzUserTotal = NumConstant.ZERO; |
|||
private BigDecimal hzrbzUserRatio = NumConstant.ZERO_DECIMAL; |
|||
private Integer zbqcUserTotal = NumConstant.ZERO; |
|||
private BigDecimal zbqcUserRatio = NumConstant.ZERO_DECIMAL; |
|||
|
|||
private String orgId; |
|||
@JsonIgnore |
|||
private Integer total; |
|||
@JsonIgnore |
|||
private String rhzk; |
|||
} |
@ -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,44 @@ |
|||
/** |
|||
* 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.ComparisonFormDTO; |
|||
import com.epmet.dto.form.ResiComparisonListFormDTO; |
|||
import com.epmet.dto.result.ResiComparisonListResultDTO; |
|||
import com.epmet.entity.IcResiComparisonRecordEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
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(@Param("list") List<IcResiComparisonRecordEntity> recordEntity); |
|||
|
|||
List<IcResiComparisonRecordEntity> getComparisonList(ComparisonFormDTO formDTO); |
|||
} |
@ -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,55 @@ |
|||
package com.epmet.enums; |
|||
|
|||
import org.apache.commons.lang3.StringUtils; |
|||
|
|||
/** |
|||
* 居民信息里的人户状况枚举类 |
|||
*/ |
|||
public enum RenHuConditionEnum { |
|||
|
|||
/** |
|||
* 人户一致,人在户不在,户在人不在, |
|||
* 为空的 暂不清楚 |
|||
*/ |
|||
RHYZ("rhyz","人户一致"), |
|||
RZHBZ("rzhbz","人在户不在"), |
|||
HZRBZ("hzrbz","户在人不在"), |
|||
ZBQC("","暂不清楚"), |
|||
; |
|||
|
|||
private String code; |
|||
private String name; |
|||
|
|||
public static String getNameByCode(String code){ |
|||
if (StringUtils.isBlank(code)){ |
|||
return ZBQC.name; |
|||
} |
|||
for (RenHuConditionEnum e : values()) { |
|||
if (e.getCode().equals(code)){ |
|||
return e.getName(); |
|||
} |
|||
} |
|||
return ZBQC.name; |
|||
} |
|||
|
|||
RenHuConditionEnum(String code, String name) { |
|||
this.code = code; |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public void setCode(String code) { |
|||
this.code = code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
|
|||
public void setName(String name) { |
|||
this.name = name; |
|||
} |
|||
} |
@ -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,119 @@ |
|||
package com.epmet.processor; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.epmet.commons.tools.distributedlock.DistributedLock; |
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import com.epmet.constant.EpidemicConstant; |
|||
import com.epmet.dao.IcSyncJobDao; |
|||
import com.epmet.entity.IcSyncJobEntity; |
|||
import com.epmet.service.IcResiComparisonRecordService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.redisson.api.RLock; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.scheduling.annotation.Scheduled; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.List; |
|||
import java.util.concurrent.ExecutorService; |
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
/** |
|||
* @Description 居民一致性对比任务处理器 |
|||
* @Author wxz |
|||
* @Date 2022/11/15 下午5:54 |
|||
*/ |
|||
@Component |
|||
@Slf4j |
|||
public class YanTaiResiComparisonSyncProcessor { |
|||
|
|||
public static final int MAX_EXECUTING_COUNT = 3; |
|||
|
|||
@Autowired |
|||
private ExecutorService executorService; |
|||
|
|||
@Autowired |
|||
private IcSyncJobDao icSyncJobDao; |
|||
|
|||
@Autowired |
|||
private IcResiComparisonRecordService icResiComparisonRecordService; |
|||
|
|||
@Autowired |
|||
private DistributedLock distributedLock; |
|||
|
|||
@Autowired |
|||
RedisUtils redisUtils; |
|||
|
|||
/** |
|||
* 定时扫描和执行同步任务 |
|||
* 10s扫一次库 |
|||
*/ |
|||
@Scheduled(cron = "0/10 * * * * ? ") |
|||
public void scanJobs() { |
|||
//log.info("【异步数据更新】开始同步任务");
|
|||
|
|||
LambdaQueryWrapper<IcSyncJobEntity> executingListQuery = new LambdaQueryWrapper<>(); |
|||
executingListQuery.eq(IcSyncJobEntity::getOperationStatus, EpidemicConstant.OPERATION_STATUS_PROCESSING); |
|||
List<IcSyncJobEntity> executingJobList = icSyncJobDao.selectList(executingListQuery); |
|||
|
|||
if (!CollectionUtils.isEmpty(executingJobList) && executingJobList.size() >= MAX_EXECUTING_COUNT) { |
|||
// 最多只允许同时3条线程运行
|
|||
return; |
|||
} |
|||
|
|||
int executingCount = executingJobList.size(); |
|||
// 还可以运行几条线程
|
|||
int leftCount = MAX_EXECUTING_COUNT - executingCount; |
|||
|
|||
RLock lock = null; |
|||
try { |
|||
lock = distributedLock.getLock("data:sync:comparison:resi", 60L, 60L, TimeUnit.SECONDS); |
|||
// 查询可执行的任务列表,并且异步执行
|
|||
List<IcSyncJobEntity> icSyncJobToExec = icSyncJobDao.selectExecutableJobList( |
|||
EpidemicConstant.JOB_TYPE_COMPARISON_RESI, |
|||
leftCount); |
|||
|
|||
if (!CollectionUtils.isEmpty(icSyncJobToExec)) { |
|||
// 异步提交任务
|
|||
for (IcSyncJobEntity jobEntity : icSyncJobToExec) { |
|||
|
|||
updateJobStatus(jobEntity.getId(), EpidemicConstant.OPERATION_STATUS_PROCESSING); |
|||
executorService.submit(() -> { |
|||
// 将此任务状态修改为执行中
|
|||
|
|||
try { |
|||
icResiComparisonRecordService.comparisonUserData(jobEntity); |
|||
} finally { |
|||
// 更新任务状态为结束
|
|||
updateJobStatus(jobEntity.getId(), EpidemicConstant.OPERATION_STATUS_FINISH); |
|||
} |
|||
|
|||
}); |
|||
} |
|||
} |
|||
} catch (Exception e) { |
|||
log.error("【异步数据更新】出错:{}", ExceptionUtils.getErrorStackTrace(e)); |
|||
} finally { |
|||
if (lock != null) { |
|||
lock.unlock(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 更新任务状态 |
|||
* @param id |
|||
* @param status |
|||
|
|||
*/ |
|||
private void updateJobStatus(String id, String status) { |
|||
LambdaQueryWrapper<IcSyncJobEntity> query = new LambdaQueryWrapper<>(); |
|||
query.eq(IcSyncJobEntity::getId, id); |
|||
|
|||
IcSyncJobEntity updateEntity = new IcSyncJobEntity(); |
|||
updateEntity.setOperationStatus(status); |
|||
icSyncJobDao.update(updateEntity, query); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,112 @@ |
|||
package com.epmet.processor; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.epmet.commons.tools.distributedlock.DistributedLock; |
|||
import com.epmet.commons.tools.exception.ExceptionUtils; |
|||
import com.epmet.commons.tools.redis.RedisUtils; |
|||
import com.epmet.constant.EpidemicConstant; |
|||
import com.epmet.dao.IcSyncJobDao; |
|||
import com.epmet.entity.IcSyncJobEntity; |
|||
import com.epmet.service.DataSyncConfigService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.redisson.api.RLock; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.scheduling.annotation.Scheduled; |
|||
import org.springframework.stereotype.Component; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.List; |
|||
import java.util.concurrent.ExecutorService; |
|||
import java.util.concurrent.TimeUnit; |
|||
|
|||
import static com.epmet.constant.EpidemicConstant.JOB_TYPE_NAT; |
|||
import static com.epmet.constant.EpidemicConstant.JOB_TYPE_VACCINE; |
|||
|
|||
// 烟台核酸检测数据同步处理器
|
|||
@Component |
|||
@Slf4j |
|||
public class YanTaiVaccineSyncProcessor { |
|||
|
|||
public static final int MAX_EXECUTING_COUNT = 3; |
|||
|
|||
@Autowired |
|||
private ExecutorService executorService; |
|||
|
|||
@Autowired |
|||
private IcSyncJobDao icSyncJobDao; |
|||
|
|||
@Autowired |
|||
private DataSyncConfigService dataSyncConfigService; |
|||
|
|||
@Autowired |
|||
private DistributedLock distributedLock; |
|||
|
|||
@Autowired |
|||
RedisUtils redisUtils; |
|||
|
|||
/** |
|||
* @Description 定时扫描和执行同步任务【疫苗接种】 |
|||
* @Author zxc |
|||
* @Date 2022/11/11 10:32 |
|||
*/ |
|||
@Scheduled(cron = "0/10 * * * * ? ") |
|||
public void scanJobs() { |
|||
LambdaQueryWrapper<IcSyncJobEntity> executingListQuery = new LambdaQueryWrapper<>(); |
|||
executingListQuery.eq(IcSyncJobEntity::getOperationStatus, EpidemicConstant.OPERATION_STATUS_PROCESSING); |
|||
List<IcSyncJobEntity> executingJobList = icSyncJobDao.selectList(executingListQuery); |
|||
if (!CollectionUtils.isEmpty(executingJobList) && executingJobList.size() >= MAX_EXECUTING_COUNT) { |
|||
// 最多只允许同时3条线程运行
|
|||
return; |
|||
} |
|||
int executingCount = executingJobList.size(); |
|||
// 还可以运行几条线程
|
|||
int leftCount = MAX_EXECUTING_COUNT - executingCount; |
|||
RLock lock = null; |
|||
try { |
|||
lock = distributedLock.getLock("data:sync:" + JOB_TYPE_VACCINE, 60L, 60L, TimeUnit.SECONDS); |
|||
// 查询可执行的任务列表,并且异步执行
|
|||
List<IcSyncJobEntity> icSyncJobToExec = icSyncJobDao.selectExecutableJobList( |
|||
EpidemicConstant.JOB_TYPE_VACCINE, |
|||
leftCount); |
|||
if (!CollectionUtils.isEmpty(icSyncJobToExec)) { |
|||
// 异步提交任务
|
|||
for (IcSyncJobEntity jobEntity : icSyncJobToExec) { |
|||
updateJobStatus(jobEntity.getId(), EpidemicConstant.OPERATION_STATUS_PROCESSING); |
|||
executorService.submit(() -> { |
|||
// 将此任务状态修改为执行中
|
|||
try { |
|||
dataSyncConfigService.execSyncByJobProcessor(jobEntity); |
|||
} finally { |
|||
// 更新任务状态为结束
|
|||
updateJobStatus(jobEntity.getId(), EpidemicConstant.OPERATION_STATUS_FINISH); |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
} catch (Exception e) { |
|||
log.error("【异步数据更新】出错:{}", ExceptionUtils.getErrorStackTrace(e)); |
|||
} finally { |
|||
if (lock != null) { |
|||
lock.unlock(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 更新任务状态 |
|||
* @author wxz |
|||
* @date 2022/11/8 下午8:25 |
|||
* @param id |
|||
* @param status |
|||
|
|||
*/ |
|||
private void updateJobStatus(String id, String status) { |
|||
LambdaQueryWrapper<IcSyncJobEntity> query = new LambdaQueryWrapper<>(); |
|||
query.eq(IcSyncJobEntity::getId, id); |
|||
|
|||
IcSyncJobEntity updateEntity = new IcSyncJobEntity(); |
|||
updateEntity.setOperationStatus(status); |
|||
icSyncJobDao.update(updateEntity, query); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
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; |
|||
import com.epmet.entity.IcSyncJobEntity; |
|||
|
|||
/** |
|||
* 居民信息与公安部信息比对记录表 |
|||
* |
|||
* @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 comparisonUserData(IcSyncJobEntity jobEntity); |
|||
|
|||
void comparisonUpdate(ComparisonFormDTO formDTO); |
|||
} |
@ -0,0 +1,357 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
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.CustomerOrgRedis; |
|||
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|||
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|||
import com.epmet.commons.tools.utils.YtHsResUtils; |
|||
import com.epmet.constant.EpidemicConstant; |
|||
import com.epmet.dao.IcResiComparisonRecordDao; |
|||
import com.epmet.dao.IcResiUserDao; |
|||
import com.epmet.dao.IcSyncJobDao; |
|||
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.entity.IcSyncJobEntity; |
|||
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.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.scheduling.annotation.Async; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
import static com.epmet.constant.EpidemicConstant.OPERATION_STATUS_PROCESSING; |
|||
import static com.epmet.constant.EpidemicConstant.OPERATION_STATUS_WAITING; |
|||
|
|||
/** |
|||
* 居民信息与公安部信息比对记录表 |
|||
* |
|||
* @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; |
|||
@Autowired |
|||
private IcSyncJobDao icSyncJobDao; |
|||
|
|||
|
|||
@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; |
|||
} |
|||
List<IcResiComparisonRecordEntity> list = new ArrayList<>(); |
|||
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(); |
|||
List<YtSfhyxxcxdsjjResDTO.Result> l = new ArrayList<>(); |
|||
YtSfhyxxcxdsjjResDTO.Result d = new YtSfhyxxcxdsjjResDTO.Result(); |
|||
d.setGMSFHM("371424188808087654"); |
|||
d.setXM("小二"); |
|||
l.add(d); |
|||
sfhyxxcxdsjjResult.setResult(l);*/ |
|||
if (null == sfhyxxcxdsjjResult || sfhyxxcxdsjjResult.getCode() != 200) { |
|||
recordEntity.setComparisonResult("公安部接口调用失败"); |
|||
resultDTO.setResult(true); |
|||
resultDTO.setResultExplain("公安部接口调用失败"); |
|||
return resultDTO; |
|||
} else { |
|||
//公安部不存在的数据
|
|||
if (CollectionUtils.isEmpty(sfhyxxcxdsjjResult.getResult())) { |
|||
recordEntity.setComparisonResult("公安部身份证号对应数据不存在"); |
|||
//数据不一致的赋值为未处理信息不一致(空)
|
|||
recordEntity.setType("0"); |
|||
//代表程序干活了
|
|||
recordEntity.setIdentical("2"); |
|||
resultDTO.setResult(true); |
|||
resultDTO.setResultExplain("公安部身份证号对应数据不存在"); |
|||
} else {//在公安部查询到了数据
|
|||
recordEntity.setPoliceName(sfhyxxcxdsjjResult.getResult().get(0).getXM()); |
|||
recordEntity.setPoliceIdCard(sfhyxxcxdsjjResult.getResult().get(0).getGMSFHM()); |
|||
//公安部跟居民库姓名不一致
|
|||
if (!entity.getName().equals(sfhyxxcxdsjjResult.getResult().get(0).getXM())) { |
|||
//姓名不一致的赋值为未处理信息不一致(否)
|
|||
recordEntity.setType("0"); |
|||
recordEntity.setIdentical("0"); |
|||
recordEntity.setComparisonResult("公安部与居民库姓名不相同"); |
|||
resultDTO.setResult(true); |
|||
resultDTO.setResultExplain("公安部与居民库姓名不相同"); |
|||
} else { |
|||
recordEntity.setType("1"); |
|||
recordEntity.setIdentical("1"); |
|||
} |
|||
} |
|||
} |
|||
recordEntity.setCreatedBy(formDTO.getUserId()); |
|||
recordEntity.setUpdatedBy(formDTO.getUserId()); |
|||
list.add(recordEntity); |
|||
baseDao.saveInsert(list); |
|||
return resultDTO; |
|||
} |
|||
//3.判断多条比对则开启子线程执行
|
|||
if (CollectionUtils.isEmpty(formDTO.getUserIdList()) || formDTO.getUserIdList().size() > NumConstant.ONE) { |
|||
//asyncComparison(formDTO);
|
|||
saveComparison(formDTO); |
|||
saveJob(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); |
|||
List<IcResiComparisonRecordEntity> list = new ArrayList<>(); |
|||
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 (null == sfhyxxcxdsjjResult || sfhyxxcxdsjjResult.getCode() != 200) { |
|||
recordEntity.setComparisonResult("接口调用失败"); |
|||
} else { |
|||
//公安部不存在的数据
|
|||
if (CollectionUtils.isEmpty(sfhyxxcxdsjjResult.getResult())) { |
|||
recordEntity.setComparisonResult("公安部身份证号对应数据不存在"); |
|||
//数据不一致的赋值为未处理信息不一致(空)
|
|||
recordEntity.setType("0"); |
|||
//代表程序干活了
|
|||
recordEntity.setIdentical("2"); |
|||
} else {//在公安部查询到了数据
|
|||
recordEntity.setPoliceName(sfhyxxcxdsjjResult.getResult().get(0).getXM()); |
|||
recordEntity.setPoliceIdCard(sfhyxxcxdsjjResult.getResult().get(0).getGMSFHM()); |
|||
//公安部跟居民库姓名不一致
|
|||
if (!o.getName().equals(sfhyxxcxdsjjResult.getResult().get(0).getXM())) { |
|||
//姓名不一致的赋值为未处理信息不一致(否)
|
|||
recordEntity.setType("0"); |
|||
recordEntity.setIdentical("0"); |
|||
recordEntity.setComparisonResult("公安部与居民库姓名不相同"); |
|||
} else { |
|||
recordEntity.setType("1"); |
|||
recordEntity.setIdentical("1"); |
|||
} |
|||
} |
|||
} |
|||
recordEntity.setCreatedBy(formDTO.getUserId()); |
|||
recordEntity.setUpdatedBy(formDTO.getUserId()); |
|||
list.add(recordEntity); |
|||
}); |
|||
baseDao.saveInsert(list); |
|||
formDTO.setPageNo(++pageNo); |
|||
} while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); |
|||
} |
|||
|
|||
/** |
|||
* 批量将需要比对的人员数据存入比对记录表中 |
|||
* @param formDTO |
|||
*/ |
|||
public void saveComparison(ComparisonFormDTO formDTO) { |
|||
PageData<IcResiUserDTO> data = null; |
|||
formDTO.setIsPage(false); |
|||
formDTO.setPageSize(NumConstant.ONE_THOUSAND); |
|||
int pageNo = formDTO.getPageNo(); |
|||
do { |
|||
data = getResiUserList(formDTO); |
|||
List<IcResiComparisonRecordEntity> list = new ArrayList<>(); |
|||
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.setType("0"); |
|||
recordEntity.setIdentical("0"); |
|||
recordEntity.setIsComparison("0"); |
|||
list.add(recordEntity); |
|||
}); |
|||
insertBatch(list); |
|||
formDTO.setPageNo(++pageNo); |
|||
} while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); |
|||
} |
|||
|
|||
public void saveJob(ComparisonFormDTO formDTO) { |
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId()); |
|||
if (null == agencyInfo) { |
|||
throw new EpmetException("未查询到组织信息:" + formDTO.getAgencyId()); |
|||
} |
|||
|
|||
// 查询该组织是否存在等待中或者进行中的任务
|
|||
LambdaQueryWrapper<IcSyncJobEntity> qw = new LambdaQueryWrapper<>(); |
|||
qw.eq(IcSyncJobEntity::getOrgId, formDTO.getAgencyId()) |
|||
.eq(IcSyncJobEntity::getJobType, EpidemicConstant.JOB_TYPE_COMPARISON_RESI) |
|||
.in(IcSyncJobEntity::getOperationStatus, OPERATION_STATUS_WAITING, OPERATION_STATUS_PROCESSING); |
|||
List<IcSyncJobEntity> icSyncJobEntities = icSyncJobDao.selectList(qw); |
|||
// 当前组织下存在同步任务
|
|||
if (CollectionUtils.isNotEmpty(icSyncJobEntities)) { |
|||
throw new EpmetException(EpmetErrorCode.EXIST_SYNC_JOB_ERROR.getCode()); |
|||
} |
|||
|
|||
// 不存在新增一条记录
|
|||
IcSyncJobEntity e = new IcSyncJobEntity(); |
|||
e.setCustomerId(formDTO.getCustomerId()); |
|||
e.setOrgId(formDTO.getAgencyId()); |
|||
e.setPid(agencyInfo.getPid()); |
|||
e.setOrgIdPath(StringUtils.isBlank(agencyInfo.getPids()) ? agencyInfo.getId() : agencyInfo.getPids() + ":" + agencyInfo.getId()); |
|||
e.setJobType(EpidemicConstant.JOB_TYPE_COMPARISON_RESI); |
|||
e.setOperatorId(formDTO.getUserId()); |
|||
e.setOperationStatus(OPERATION_STATUS_WAITING); |
|||
icSyncJobDao.insert(e); |
|||
} |
|||
@Override |
|||
public void comparisonUserData(IcSyncJobEntity jobEntity) { |
|||
ComparisonFormDTO formDTO = new ComparisonFormDTO(); |
|||
PageData<IcResiComparisonRecordEntity> data = null; |
|||
formDTO.setIsPage(false); |
|||
formDTO.setPageSize(NumConstant.ONE_THOUSAND); |
|||
int pageNo = NumConstant.ONE; |
|||
do { |
|||
data = getComparisonList(formDTO); |
|||
data.getList().forEach(o -> { |
|||
o.setIsComparison("1"); |
|||
YtSfhyxxcxdsjjResDTO sfhyxxcxdsjjResult = YtHsResUtils.sfhyxxcxdsjj(o.getResiIdCard(), o.getResiName()); |
|||
/*YtSfhyxxcxdsjjResDTO sfhyxxcxdsjjResult = new YtSfhyxxcxdsjjResDTO(); |
|||
List<YtSfhyxxcxdsjjResDTO.Result> l = new ArrayList<>(); |
|||
YtSfhyxxcxdsjjResDTO.Result d = new YtSfhyxxcxdsjjResDTO.Result(); |
|||
d.setGMSFHM("371424188808087654"); |
|||
d.setXM("小二"); |
|||
l.add(d); |
|||
sfhyxxcxdsjjResult.setResult(l);*/ |
|||
if (null == sfhyxxcxdsjjResult || sfhyxxcxdsjjResult.getCode() != 200) { |
|||
o.setComparisonResult("接口调用失败"); |
|||
} else { |
|||
//公安部不存在的数据
|
|||
if (CollectionUtils.isEmpty(sfhyxxcxdsjjResult.getResult())) { |
|||
o.setComparisonResult("公安部身份证号对应数据不存在"); |
|||
//数据不一致的赋值为未处理信息不一致(空)
|
|||
o.setType("0"); |
|||
//代表程序干活了
|
|||
o.setIdentical("2"); |
|||
} else {//在公安部查询到了数据
|
|||
o.setPoliceName(sfhyxxcxdsjjResult.getResult().get(0).getXM()); |
|||
o.setPoliceIdCard(sfhyxxcxdsjjResult.getResult().get(0).getGMSFHM()); |
|||
//公安部跟居民库姓名不一致
|
|||
if (!o.getResiName().equals(sfhyxxcxdsjjResult.getResult().get(0).getXM())) { |
|||
//姓名不一致的赋值为未处理信息不一致(否)
|
|||
o.setType("0"); |
|||
o.setIdentical("0"); |
|||
o.setComparisonResult("公安部与居民库姓名不相同"); |
|||
} else { |
|||
o.setType("1"); |
|||
o.setIdentical("1"); |
|||
} |
|||
} |
|||
} |
|||
o.setCreatedBy(formDTO.getUserId()); |
|||
o.setUpdatedBy(formDTO.getUserId()); |
|||
}); |
|||
baseDao.saveInsert(data.getList()); |
|||
formDTO.setPageNo(++pageNo); |
|||
} while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); |
|||
} |
|||
private PageData<IcResiComparisonRecordEntity> getComparisonList(ComparisonFormDTO formDTO) { |
|||
PageInfo<IcResiComparisonRecordEntity> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) |
|||
.doSelectPageInfo(() -> baseDao.getComparisonList(formDTO)); |
|||
return new PageData(data.getList(), data.getTotal()); |
|||
} |
|||
|
|||
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); |
|||
//3.更新比对表数据状态
|
|||
entity.setType("1"); |
|||
entity.setIdentical("1"); |
|||
updateById(entity); |
|||
} |
|||
|
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
CREATE TABLE `ic_resi_comparison_record` ( |
|||
`ID` varchar(64) NOT NULL COMMENT 'ID', |
|||
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', |
|||
`RESI_ID` varchar(64) NOT NULL COMMENT 'ic_resi_user.id【比对时的数据值】', |
|||
`RESI_NAME` varchar(64) NOT NULL COMMENT '数字社区人员姓名【比对时的数据值】', |
|||
`RESI_ID_CARD` varchar(18) NOT NULL COMMENT '数据社区身份证号【比对时的数据值】', |
|||
`POLICE_NAME` varchar(64) DEFAULT NULL COMMENT '公安部人员姓名', |
|||
`POLICE_ID_CARD` varchar(18) DEFAULT NULL COMMENT '公安部人员证件号', |
|||
`TYPE` varchar(1) NOT NULL DEFAULT '0' COMMENT '数据状态(0:未处理 1:已处理)', |
|||
`IDENTICAL` varchar(1) NOT NULL DEFAULT '0' COMMENT '信息一致性(0:否 1:是 2:-)2代表程序比对了没有匹配上', |
|||
`IS_COMPARISON` varchar(1) DEFAULT '0' COMMENT '是否比对过(0:否 1:是)', |
|||
`COMPARISON_RESULT` varchar(255) DEFAULT NULL COMMENT '比对结果说明', |
|||
`DEL_FLAG` int(11) NOT NULL COMMENT '删除标识', |
|||
`REVISION` int(11) NOT NULL COMMENT '乐观锁', |
|||
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', |
|||
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间', |
|||
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', |
|||
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', |
|||
PRIMARY KEY (`ID`), |
|||
UNIQUE KEY `resi_id` (`RESI_ID`) USING BTREE |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='居民信息与公安部信息比对记录表'; |
@ -0,0 +1,4 @@ |
|||
-- 核酸记录表增加非必填字段“试管编号” 对应产蛋4679 |
|||
ALTER TABLE `ic_nat` |
|||
ADD COLUMN `TEST_TUBE_CODE` varchar(255) NULL COMMENT '试管编号' AFTER `ATTACHMENT_URL`; |
|||
|
Binary file not shown.
@ -0,0 +1,114 @@ |
|||
<?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"> |
|||
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 |
|||
<foreach collection="list" item="i" separator=","> |
|||
( |
|||
REPLACE(UUID(), '-', ''), |
|||
#{i.customerId}, |
|||
#{i.resiId}, |
|||
#{i.resiName}, |
|||
#{i.resiIdCard}, |
|||
#{i.policeName}, |
|||
#{i.policeIdCard}, |
|||
#{i.type}, |
|||
#{i.identical}, |
|||
#{i.isComparison}, |
|||
#{i.comparisonResult}, |
|||
0, |
|||
0, |
|||
#{i.createdBy}, |
|||
now(), |
|||
#{i.createdBy}, |
|||
now() |
|||
) |
|||
</foreach> |
|||
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 = values(updated_by) |
|||
</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, |
|||
IFNULL(b.type, '0') type, |
|||
IF (b.type = '1', '已处理', '未处理') typeName, |
|||
IFNULL(b.identical, '0') identical, |
|||
(case b.identical when '0' then '否' when '1' then '是' WHEN '2' THEN '-' else '否' end ) identicalName, |
|||
IFNULL(b.is_comparison, '0') isComparison, |
|||
IF (b.is_comparison = '1', '是', '否') isComparisonName, |
|||
b.comparison_result comparisonResult |
|||
FROM |
|||
ic_resi_user a |
|||
LEFT JOIN ic_resi_comparison_record b ON a.id = b.resi_id AND b.del_flag = '0' |
|||
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> |
|||
<if test='identical != null and identical != "" and identical == "0" '> |
|||
AND (b.id is null or b.identical =#{identical}) |
|||
</if> |
|||
<if test='identical != null and identical != "" and identical != "0" '> |
|||
AND b.identical =#{identical} |
|||
</if> |
|||
<if test='type != null and type != "" and type == "0" '> |
|||
AND (b.id is null or b.type =#{type}) |
|||
</if> |
|||
<if test='type != null and type != "" and type != "0" '> |
|||
AND b.type =#{type} |
|||
</if> |
|||
ORDER BY a.pids ASC, b.created_time DESC, a.`NAME` ASC |
|||
</select> |
|||
|
|||
<select id="getComparisonList" resultType="com.epmet.entity.IcResiComparisonRecordEntity"> |
|||
SELECT |
|||
* |
|||
FROM |
|||
ic_resi_comparison_record |
|||
WHERE |
|||
del_flag = '0' |
|||
AND is_comparison = '0' |
|||
ORDER BY created_time DESC |
|||
</select> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue