Browse Source

Merge remote-tracking branch 'origin_elink/master'

dev
yinzuomei 3 years ago
parent
commit
4b245fc5d2
  1. 6
      epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java
  2. 2
      epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java
  3. 29
      epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java
  4. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  5. 1
      epmet-gateway/src/main/resources/bootstrap.yml
  6. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
  7. 1
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java
  8. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml
  9. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  10. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java
  11. 3
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml
  12. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventListFormDTO.java
  13. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java
  14. 14
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java
  15. 5
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormGroupDTO.java
  16. 3
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java
  17. 10
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemGroupEntity.java
  18. 50
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java
  19. 56
      epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.40__itemgroup_code.sql
  20. 7
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml
  21. 1
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java
  22. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EnableStaffFormDTO.java
  23. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java
  24. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovWebOperLoginResultDTO.java
  25. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  26. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java
  27. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSyncJobEntity.java
  28. 213
      epmet-user/epmet-user-server/src/main/java/com/epmet/processor/AbstractDataSyncJobProcessor.java
  29. 121
      epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java
  30. 103
      epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiResiComparisonSyncProcessor.java
  31. 109
      epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiVaccineSyncProcessor.java
  32. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  33. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java
  34. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  35. 3
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.90__alter_ic_move_in_record.sql
  36. 19
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.91__data_sync_job_create.sql
  37. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls
  38. 5
      epmet-user/epmet-user-server/src/main/resources/mapper/ChangeDeathDao.xml
  39. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml
  40. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml
  41. 34
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  42. 17
      epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml

6
epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java

@ -84,6 +84,12 @@ public class GovWebServiceImpl implements GovWebService, ResultDataResolver {
logger.warn("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在");
throw new RenException(EpmetErrorCode.ERR10003.getCode());
}
//未禁用enable,已禁用disabled
if ("disabled".equals(result.getData().getEnableFlag())) {
throw new EpmetException(EpmetErrorCode.GOV_STAFF_DISABLED.getCode(),
String.format("当前账号已被禁用staffId:%s", result.getData().getUserId()),
EpmetErrorCode.GOV_STAFF_DISABLED.getMsg());
}
GovWebOperLoginResultDTO resultDTO = result.getData();
//4.密码是否正确

2
epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java

@ -478,7 +478,7 @@ public class SsoServiceImpl implements SsoService {
customerStaffFormDTO.setMobile(formDTO.getMobile());
Result<CustomerStaffDTO> customerStaffDTOResult = epmetUserOpenFeignClient.getCustomerStaffInfo(customerStaffFormDTO);
if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) {
logger.error(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg()));
logger.warn(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg()));
throw new RenException(customerStaffDTOResult.getCode());
}
CustomerStaffDTO customerStaff = customerStaffDTOResult.getData();

29
epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java

@ -10,9 +10,9 @@ import com.epmet.auth.constants.AuthOperationConstants;
import com.epmet.common.token.constant.LoginConstant;
import com.epmet.commons.rocketmq.messages.LoginMQMsg;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
@ -20,7 +20,6 @@ import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.redis.common.CustomerDingDingRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.DingMiniInfoCache;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.security.dto.TokenDto;
@ -196,6 +195,20 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
throw new RenException(EpmetErrorCode.PLEASE_LOGIN.getCode());
}
StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = latestStaffWechat.getData();
//2022.11.24校验下用户是否被禁用
//2.1根据手机号查询到用户信息 前端不跳转,暂时先注释吧
ThirdCustomerStaffFormDTO dto = new ThirdCustomerStaffFormDTO();
dto.setCustomerId(staffLatestAgencyResultDTO.getCustomerId());
dto.setMobile(staffLatestAgencyResultDTO.getMobile());
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserOpenFeignClient.getCustsomerStaffByIdAndPhone(dto);
if (!customerStaffResult.success()) {
logger.error(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", staffLatestAgencyResultDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode());
}
// 8008 前端会提示:登录失效,请重新登录 跳转到登录界面。所以这里写死返回8008.
if("disabled".equals(customerStaffResult.getData().get(NumConstant.ZERO).getEnableFlag())){
throw new EpmetException(EpmetErrorCode.PLEASE_LOGIN.getCode(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg());
}
//3.记录staff_wechat
this.savestaffwechat(staffLatestAgencyResultDTO.getStaffId(), userWechatDTO.getWxOpenId(), staffLatestAgencyResultDTO.getCustomerId());
@ -405,7 +418,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
customerStaffFormDTO.setMobile(formDTO.getMobile());
Result<CustomerStaffDTO> customerStaffDTOResult = epmetUserOpenFeignClient.getCustomerStaffInfo(customerStaffFormDTO);
if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) {
logger.error(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg()));
logger.warn(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg()));
throw new RenException(customerStaffDTOResult.getCode());
}
CustomerStaffDTO customerStaff = customerStaffDTOResult.getData();
@ -542,7 +555,9 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
logger.error(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode());
}
if("disabled".equals(customerStaffResult.getData().get(NumConstant.ZERO).getEnableFlag())){
throw new EpmetException(EpmetErrorCode.GOV_STAFF_DISABLED.getCode(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg());
}
//3、查询用户所有的组织信息
List<String> customerIdList = new ArrayList<>();
for (CustomerStaffDTO customerStaffDTO : customerStaffResult.getData()) {
@ -575,12 +590,16 @@ public class ThirdLoginServiceImpl implements ThirdLoginService, ResultDataResol
dto.setCustomerId(customer.getId());
dto.setMobile(formDTO.getMobile());
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserOpenFeignClient.getCustsomerStaffByIdAndPhone(dto);
if (!customerStaffResult.success()) {
if (!customerStaffResult.success()||CollectionUtils.isEmpty(customerStaffResult.getData())) {
logger.warn(String.format("手机密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg()));
throw new RenException(customerStaffResult.getCode());
}
//2、密码是否正确
List<CustomerStaffDTO> customerStaffList=customerStaffResult.getData();
// 禁用的给予提示
if("disabled".equals(customerStaffList.get(NumConstant.ZERO).getEnableFlag())){
throw new EpmetException(EpmetErrorCode.GOV_STAFF_DISABLED.getCode(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg());
}
//3、查询用户所有的组织信息
List<String> customerIdList = new ArrayList<>();
//是否设置过密码

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -32,7 +32,8 @@ public enum EpmetErrorCode {
CANNOT_CREATE_GROUP(8002, "只有党员和热心居民才能创建小组,请选择您的身份"),
GROUP_ALREADY_EXISTED(8003,"组名已存在"),
GOV_STAFF_NOT_EXISTS(8004,"手机号未注册,请联系贵单位管理员,确认其录入手机与您所持手机号相同"),
GOV_STAFF_DISABLED(8005,"您好,您的账户已被冻结,请联系管理员。"),
//您好,您的账户已被冻结,请联系管理员。=>您好,服务到期,账户暂时冻结,请联系管理员。
GOV_STAFF_DISABLED(8005,"您好,服务到期,账户暂时冻结,请联系管理员。"),
LOSE_EFFICACY(8006,"此邀请链接已过期"),
ERROR_PHONE(8007,"请输入正确的手机号"),
PLEASE_LOGIN(8008,"请重新登录"),

1
epmet-gateway/src/main/resources/bootstrap.yml

@ -88,6 +88,7 @@ spring:
- Path=${server.servlet.context-path}/job/**
filters:
- StripPrefix=1
- CpAuth=true
#用户服务
- id: epmet-user-server
uri: @gateway.routes.epmet-user-server.uri@

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java

@ -189,7 +189,7 @@ public class GovOrgController {
/**
* 组织下的工作人员 下拉框
*
* 2022.11.23调整已经禁用的人不展示
* @param tokenDto
* @param agencyId
* @return

1
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java

@ -75,6 +75,7 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
/**
* 根据staffId查询姓名手机号
* 禁用的不展示
* @param staffIds
* @return
*/

2
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml

@ -140,6 +140,7 @@
AND USER_ID = #{staffId}
</select>
<!-- 禁用的不展示 -->
<select id="staffSelectList" parameterType="map" resultType="com.epmet.dataaggre.dto.epmetuser.result.StaffSelectResDTO">
SELECT
cs.USER_ID as `value`,
@ -150,6 +151,7 @@
customer_staff cs
WHERE
cs.del_flag = '0'
and cs.ENABLE_FLAG='enable'
<foreach item="staffId" collection="staffIds" open="and (" separator="or" close=")">
cs.user_id = #{staffId}
</foreach>

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -342,6 +342,7 @@ public class CustomerAgencyController {
/**
* @Description 获取客户下组织树不含网格和部门
* 哪些地方用到了比如办事指南-指南管理查询条件
* @Param tokenDTO
* @Return {@link Result< AgencyTreeResultDTO >}
* @Author zhaoqifeng

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java

@ -22,6 +22,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
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.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -140,6 +142,12 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl<CustomerStaf
CustomerStaffDTO customerStaffParam = new CustomerStaffDTO();
customerStaffParam.setUserId(userId);
Result<CustomerStaffDTO> staffInfo = epmetUserFeignClient.getCustomerStaffInfoByUserId(customerStaffParam);
if(!staffInfo.success()||null==staffInfo.getData()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"userId:"+userId+"customer_staff is null","获取用户信息异常");
}
if("disabled".equals(staffInfo.getData().getEnableFlag())){
throw new EpmetException(EpmetErrorCode.GOV_STAFF_DISABLED.getCode(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg(),EpmetErrorCode.GOV_STAFF_DISABLED.getMsg());
}
resultDTO.setStaffHeadPhoto(staffInfo.getData().getHeadPhoto());
resultDTO.setGender(staffInfo.getData().getGender());
//获取客户名称

3
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml

@ -160,7 +160,8 @@
AND a.DEL_FLAG = '0'
</where>
ORDER BY CAST(a.NEIGHBOR_HOOD_NAME AS SIGNED),CONVERT(a.NEIGHBOR_HOOD_NAME using gbk)
ORDER BY a.GRID_ID asc,
CAST(a.NEIGHBOR_HOOD_NAME AS SIGNED),CONVERT(a.NEIGHBOR_HOOD_NAME using gbk)
</select>
<select id="searchAllNeighborhood" resultType="com.epmet.excel.IcNeighborHoodExcel">
select

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/IcEventListFormDTO.java

@ -1,7 +1,6 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ -28,6 +27,7 @@ public class IcEventListFormDTO implements Serializable {
private String icEventId;
/**
* 所属组织
* 前端传入如果没传默认查询登录用户所属组织及下级
*/
private String agencyId;
/**

8
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/IcEventServiceImpl.java

@ -112,9 +112,11 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit
@Override
public PageData<IcEventListResultDTO> list(IcEventListFormDTO formDTO) {
//获取当前工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
formDTO.setAgencyId(staffInfo.getAgencyId());
if(StringUtils.isBlank(formDTO.getAgencyId())){
//获取当前工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
formDTO.setAgencyId(staffInfo.getAgencyId());
}
//分页查询当前组织下网格内事件数据
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage());

14
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java

@ -78,4 +78,18 @@ public class IcFormItemGroupDTO implements Serializable {
*/
private Boolean display;
/**
* 政策人员信息组件;1:展示0不展示默认0
*/
private String policyFlag;
/**
* 1展示0不展示默认0
*/
private String childShowFlag;
/**
* 组编码,唯一标识
*/
private String groupCode;
}

5
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormGroupDTO.java

@ -39,6 +39,11 @@ public class FormGroupDTO implements Serializable {
*/
private String tableName;
/**
*组编码,唯一标识
*/
private String groupCode;
/**
* 分组里面的组件
*/

3
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java

@ -52,9 +52,10 @@ public class IcFormController {
/**
* desc: 初始化 客户表单配置
* 运营端-数字社区初始化
*
* @param customerId
* @param formCode
* @param formCode value: resi_base_info
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.CustomerFormResultDTO>
* @author LiuJanJun
* @date 2021/12/8 4:28 下午

10
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormItemGroupEntity.java

@ -79,4 +79,14 @@ public class IcFormItemGroupEntity extends BaseEpmetEntity {
* 政策人员信息组件;1:展示0不展示默认0
*/
private String policyFlag;
/**
* 1展示0不展示默认0
*/
private String childShowFlag;
/**
* 组编码,唯一标识
*/
private String groupCode;
}

50
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java

@ -172,7 +172,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
defaultIcForm.setCreatedTime(new Date());
defaultIcForm.setUpdatedBy("init_user");
defaultIcForm.setUpdatedTime(new Date());
// 1、设置ic_form
int insert = baseDao.insert(defaultIcForm);
log.info("insert icForm:" + insert);
@ -184,7 +184,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
return "默认配置错误";
}
String defaultBaseInfoGroupId = "default_0";
//设置ic_form_item
//2、设置ic_form_item
itemList.forEach(item -> {
item.setId(newPrefixed + item.getId());
item.setCustomerId(customerId);
@ -215,7 +215,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icFormItemDao.insert(item);
});
//设置ic_form_item_options
//3、设置ic_form_item_options
LambdaQueryWrapper<IcFormItemOptionsEntity> wrapperOptions = new LambdaQueryWrapper<>();
wrapperOptions.eq(IcFormItemOptionsEntity::getCustomerId, defaultCustomerId);
wrapperOptions.eq(IcFormItemOptionsEntity::getFormCode, formCode);
@ -233,7 +233,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icFormItemOptionsDao.insert(item);
});
//设置ic_form_item_group
//4、设置ic_form_item_group
LambdaQueryWrapper<IcFormItemGroupEntity> wrapperGroup = new LambdaQueryWrapper<>();
wrapperGroup.eq(IcFormItemGroupEntity::getCustomerId, defaultCustomerId);
wrapperGroup.eq(IcFormItemGroupEntity::getFormCode, formCode);
@ -255,7 +255,7 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icFormItemGroupDao.insert(item);
});
//设置ic_form_query_builder
//5、设置ic_form_query_builder
LambdaQueryWrapper<IcFormQueryBuilderEntity> wrapperQuery = new LambdaQueryWrapper<>();
wrapperQuery.eq(IcFormQueryBuilderEntity::getCustomerId, defaultCustomerId);
wrapperQuery.eq(IcFormQueryBuilderEntity::getFormCode, formCode);
@ -272,6 +272,26 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icFormQueryBuilderDao.insert(item);
});
//6、设置ic_form_list_item
LambdaQueryWrapper<IcFormListItemEntity> listItemWapper = new LambdaQueryWrapper<>();
listItemWapper.eq(IcFormListItemEntity::getCustomerId, defaultCustomerId);
listItemWapper.eq(IcFormListItemEntity::getFormCode, formCode);
List<IcFormListItemEntity> listItemList = icFormListItemDao.selectList(listItemWapper);
if (CollectionUtils.isEmpty(listItemList)) {
return "默认配置错误";
}
listItemList.forEach(item -> {
item.setId(newPrefixed + item.getId());
item.setCustomerId(customerId);
item.setFormItemId(newPrefixed + item.getFormItemId());
item.setCreatedBy("init_user");
item.setCreatedTime(new Date());
item.setUpdatedBy("init_user");
item.setUpdatedTime(new Date());
log.debug("stats:"+ JSON.toJSONString(item));
icFormListItemDao.insert(item);
});
//设置ic_resi_category_stats_config
LambdaQueryWrapper<IcResiCategoryStatsConfigEntity> wrapperStats = new LambdaQueryWrapper<>();
wrapperStats.eq(IcResiCategoryStatsConfigEntity::getCustomerId, defaultCustomerId);
@ -302,26 +322,6 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
icResiCategoryWarnConfigDao.insert(item);
});
//设置ic_form_list_item
LambdaQueryWrapper<IcFormListItemEntity> listItemWapper = new LambdaQueryWrapper<>();
listItemWapper.eq(IcFormListItemEntity::getCustomerId, defaultCustomerId);
listItemWapper.eq(IcFormListItemEntity::getFormCode, formCode);
List<IcFormListItemEntity> listItemList = icFormListItemDao.selectList(listItemWapper);
if (CollectionUtils.isEmpty(listItemList)) {
return "默认配置错误";
}
listItemList.forEach(item -> {
item.setId(newPrefixed + item.getId());
item.setCustomerId(customerId);
item.setFormItemId(newPrefixed + item.getFormItemId());
item.setCreatedBy("init_user");
item.setCreatedTime(new Date());
item.setUpdatedBy("init_user");
item.setUpdatedTime(new Date());
log.debug("stats:"+ JSON.toJSONString(item));
icFormListItemDao.insert(item);
});
//设置ic_service_item_dict和ic_resi_demand_dict
Result result = epmetHeartOpenFeignClient.customerInit(customerId);
if (!result.success()) {

56
epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.40__itemgroup_code.sql

@ -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='居民需求信息';

7
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml

@ -66,7 +66,8 @@
g.LABEL,
g.sort,
g.SUPPORT_ADD,
g.TABLE_NAME AS TABLE_NAME
g.TABLE_NAME AS TABLE_NAME,
g.GROUP_CODE
FROM
ic_form_item_group g
WHERE
@ -124,6 +125,7 @@
<result property="sort" column="sort"/>
<result property="supportAdd" column="SUPPORT_ADD"/>
<result property="tableName" column="TABLE_NAME"/>
<result property="groupCode" column="GROUP_CODE"/>
<collection property="itemList" ofType="com.epmet.dto.result.FormItemResult2"
column="group_id" select="com.epmet.dao.IcFormDao.selectItemListByGroupId">
</collection>
@ -200,7 +202,8 @@
case when g.table_name is null or g.table_name ='' then 'ic_resi_user'
else g.TABLE_NAME
end
) AS TABLE_NAME
) AS TABLE_NAME,
g.GROUP_CODE
FROM
ic_form_item_group g
WHERE

1
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java

@ -126,6 +126,7 @@ public class CustomerStaffDTO implements Serializable {
/**
* 未禁用enable,已禁用diabled
* disabled
*/
private String enableFlag;

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EnableStaffFormDTO.java

@ -18,5 +18,8 @@ public class EnableStaffFormDTO implements Serializable {
* 被解禁用户Id
*/
private String staffId;
/**
* token中获取
*/
private String customerId;
}

2
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java

@ -111,7 +111,7 @@ public class IcMoveInAddEditFormDTO implements Serializable {
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空", groups = {AddGroup.class})
//@NotBlank(message = "详细地址不能为空", groups = {AddGroup.class})
private String address;
/**
* 迁移证号码

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovWebOperLoginResultDTO.java

@ -13,4 +13,8 @@ public class GovWebOperLoginResultDTO implements Serializable {
private static final long serialVersionUID = -5353521601282463394L;
private String userId;
private String passWord;
/**
* 未禁用enable,已禁用diabled
*/
private String enableFlag;
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -19,8 +19,6 @@ package com.epmet.controller;
import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
@ -564,8 +562,9 @@ public class CustomerStaffController {
* @author sun
*/
@PostMapping("enablestaff")
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_ENABLE)
// @RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_ENABLE)
public Result enableStaff(@LoginUser TokenDto tokenDto, @RequestBody EnableStaffFormDTO fromDTO){
fromDTO.setCustomerId(tokenDto.getCustomerId());
if (tokenDto.getUserId().equals(fromDTO.getStaffId())) {
throw new RenException("工作人员自己不能解禁自己");
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSyncJobDao.java

@ -16,6 +16,8 @@ import java.util.List;
@Mapper
public interface IcSyncJobDao extends BaseDao<IcSyncJobEntity> {
List<IcSyncJobEntity> selectExecutableJobList(@Param("jobType") String jobType,
@Param("itemCount") int itemCount);
List<IcSyncJobEntity> selectJobListByStatus(@Param("status") String status,
@Param("jobType") String jobType,
@Param("processorIp") String processorIp,
@Param("itemCount") Integer itemCount);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSyncJobEntity.java

@ -56,4 +56,13 @@ public class IcSyncJobEntity extends BaseEpmetEntity {
*/
private String operationStatus;
/**
* 处理实例的ip
* @author wxz
* @date 2022/11/19 下午11:02
* * @param null
*
*/
private String processorIp;
}

213
epmet-user/epmet-user-server/src/main/java/com/epmet/processor/AbstractDataSyncJobProcessor.java

@ -0,0 +1,213 @@
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.constant.EpidemicConstant;
import com.epmet.dao.IcSyncJobDao;
import com.epmet.entity.IcSyncJobEntity;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
/**
* @ClassName BaseSyncProcessor
* @Description 抽象数据同步处理器基类所有基于该模式的同步器都应当继承该类自定义Scheduler之后调用基类的scanAndExeJobs()方法
* 实现需要实现的方法(定义分布式锁的key定义同步数据的类型)有特殊逻辑的可以重写相关方法
* @Author wangxianzhang
* @Date 2022/11/19 下午11:16
*/
@Slf4j
public abstract class AbstractDataSyncJobProcessor {
@Autowired
private ExecutorService executorService;
@Autowired
private IcSyncJobDao icSyncJobDao;
@Autowired
private DistributedLock distributedLock;
/**
* 最多能运行几条线程如果有特殊情况可以通过抽象方法每个子类单独定义
*/
private int MAX_EXECUTING_NUMBER = 3;
/**
* 本机ip
*/
private String localIp;
{
try {
// 获取本机ip
InetAddress localHost = Inet4Address.getLocalHost();
localIp = localHost.getHostAddress();
log.info("【抽象定时数据同步器】获取本机ip为:{}", localIp);
} catch (UnknownHostException e) {
log.error("【抽象定时数据同步器】获取本机ip失败");
}
}
/**
* 扫描并执行
* @author wxz
* @date 2022/11/20 上午12:10
*
*
*/
void scanAndExecWaitingJobs() {
int executingTaskNumber = getExecutingTaskNumber();
if (executingTaskNumber >= MAX_EXECUTING_NUMBER) {
// 单个实例下,最多只允许同时3条线程运行
return;
}
// 还可以运行几条线程
int leftCount = MAX_EXECUTING_NUMBER - executingTaskNumber;
RLock lock = null;
try {
lock = distributedLock.getLock(getDistributeLockKey(), getDistributeLockLeaseTime(), getDistributeLockWaitTime(), TimeUnit.SECONDS);
// 查询可执行的任务列表,并且异步执行
List<IcSyncJobEntity> icSyncJobToExec = icSyncJobDao.selectJobListByStatus("waiting", getJobType(), null, leftCount);
if (!CollectionUtils.isEmpty(icSyncJobToExec)) {
// 异步提交任务
submitAsyncJob(icSyncJobToExec);
}
} catch (Exception e) {
log.error("【异步数据更新】出错:{}", ExceptionUtils.getErrorStackTrace(e));
} finally {
if (lock != null) {
lock.unlock();
}
}
}
/**
* 扫描并且执行被中断的任务
* @author wxz
* @date 2022/11/20 下午10:29
*
*
*/
@PostConstruct
void scanAndContinueInteruptedJobs() {
// 此处不需要加锁,因为已经按照ip查询了,查到的一定是本机之前执行过的,其他机器查不到该条
List<IcSyncJobEntity> interuptedJobs = icSyncJobDao.selectJobListByStatus("processing", getJobType(), localIp,null);
if (!CollectionUtils.isEmpty(interuptedJobs)) {
submitAsyncJob(interuptedJobs);
}
}
/**
* 提交异步任务
* @author wxz
* @date 2022/11/20 下午10:37
* * @param icSyncJobToExec
*
*/
void submitAsyncJob(List<IcSyncJobEntity> icSyncJobToExec) {
for (IcSyncJobEntity jobEntity : icSyncJobToExec) {
// 将此任务状态修改为执行中
updateJobStatus(jobEntity.getId(), EpidemicConstant.OPERATION_STATUS_PROCESSING, localIp);
executorService.submit(() -> {
try {
execJobTask(jobEntity);
} finally {
// 更新任务状态为结束
updateJobStatus(jobEntity.getId(), EpidemicConstant.OPERATION_STATUS_FINISH, null);
}
});
}
}
/**
* 先检查一下有几个任务需要执行
* @author wxz
* @date 2022/11/19 下午10:57
* @return int
*/
private int getExecutingTaskNumber() {
// 查询本机正在处理中的任务列表
LambdaQueryWrapper<IcSyncJobEntity> executingListQuery = new LambdaQueryWrapper<>();
executingListQuery.eq(IcSyncJobEntity::getOperationStatus, EpidemicConstant.OPERATION_STATUS_PROCESSING);
executingListQuery.eq(IcSyncJobEntity::getProcessorIp, localIp);
return icSyncJobDao.selectCount(executingListQuery);
}
/**
* 更新任务状态
* @author wxz
* @date 2022/11/8 下午8:25
* @param id
* @param status
*/
private void updateJobStatus(String id, String status, String processorIp) {
LambdaQueryWrapper<IcSyncJobEntity> query = new LambdaQueryWrapper<>();
query.eq(IcSyncJobEntity::getId, id);
IcSyncJobEntity updateEntity = new IcSyncJobEntity();
updateEntity.setOperationStatus(status);
updateEntity.setProcessorIp(processorIp);
icSyncJobDao.update(updateEntity, query);
}
/**
* 执行任务
* @author wxz
* @date 2022/11/20 上午12:06
*
*
*/
protected abstract void execJobTask(IcSyncJobEntity jobEntity);
/**
* 获取分布式锁的key
* @author wxz
* @date 2022/11/20 上午12:21
*
*
*/
protected abstract String getDistributeLockKey();
/**
* 任务类型
* @author wxz
* @date 2022/11/20 上午12:25
*
* * @return String
*/
protected abstract String getJobType();
/**
* 分布式锁的续期时间
* @author wxz
* @date 2022/11/20 下午10:52
*
* * @return long
*/
protected abstract long getDistributeLockLeaseTime();
/**
* 分布式锁的等待时间
* @author wxz
* @date 2022/11/20 下午10:52
*
* * @return long
*/
protected abstract long getDistributeLockWaitTime();
}

121
epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiNatSyncProcessor.java

@ -1,49 +1,27 @@
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 org.springframework.util.StringUtils;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import static com.epmet.constant.EpidemicConstant.JOB_TYPE_NAT;
// 烟台核酸检测数据同步处理器
@Component
/**
* @Description 烟台核酸检测数据同步处理器
* @Author wxz
* @Date 2022/11/20 上午11:43
*/
//@Component
@Slf4j
public class YanTaiNatSyncProcessor {
public static final int MAX_EXECUTING_COUNT = 3;
@Autowired
private ExecutorService executorService;
@Autowired
private IcSyncJobDao icSyncJobDao;
public class YanTaiNatSyncProcessor extends AbstractDataSyncJobProcessor {
@Autowired
private DataSyncConfigService dataSyncConfigService;
@Autowired
private DistributedLock distributedLock;
@Autowired
RedisUtils redisUtils;
/**
* 定时扫描和执行同步任务
* 10s扫一次库
@ -53,76 +31,31 @@ public class YanTaiNatSyncProcessor {
*/
@Scheduled(cron = "0/10 * * * * ? ")
public void scanJobs() {
//log.info("【异步数据更新】开始同步任务");
//String dataSyncEnable = redisUtils.getString("data:sync:enable");
//if (StringUtils.isEmpty(dataSyncEnable)) {
// return;
//}
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_NAT, 60L, 60L, TimeUnit.SECONDS);
// 查询可执行的任务列表,并且异步执行
List<IcSyncJobEntity> icSyncJobToExec = icSyncJobDao.selectExecutableJobList(
EpidemicConstant.JOB_TYPE_NAT,
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);
}
scanAndExecWaitingJobs();
}
});
}
}
} catch (Exception e) {
log.error("【异步数据更新】出错:{}", ExceptionUtils.getErrorStackTrace(e));
} finally {
if (lock != null) {
lock.unlock();
}
}
@Override
protected void execJobTask(IcSyncJobEntity jobEntity) {
dataSyncConfigService.execSyncByJobProcessor(jobEntity);
}
/**
* 更新任务状态
* @author wxz
* @date 2022/11/8 下午8:25
* @param id
* @param status
@Override
protected String getDistributeLockKey() {
return "data:sync:" + JOB_TYPE_NAT;
}
*/
private void updateJobStatus(String id, String status) {
LambdaQueryWrapper<IcSyncJobEntity> query = new LambdaQueryWrapper<>();
query.eq(IcSyncJobEntity::getId, id);
@Override
protected String getJobType() {
return EpidemicConstant.JOB_TYPE_NAT;
}
IcSyncJobEntity updateEntity = new IcSyncJobEntity();
updateEntity.setOperationStatus(status);
icSyncJobDao.update(updateEntity, query);
@Override
protected long getDistributeLockLeaseTime() {
return 60;
}
@Override
protected long getDistributeLockWaitTime() {
return 60;
}
}

103
epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiResiComparisonSyncProcessor.java

@ -1,47 +1,26 @@
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
//@Component
@Slf4j
public class YanTaiResiComparisonSyncProcessor {
public static final int MAX_EXECUTING_COUNT = 3;
@Autowired
private ExecutorService executorService;
@Autowired
private IcSyncJobDao icSyncJobDao;
public class YanTaiResiComparisonSyncProcessor extends AbstractDataSyncJobProcessor {
@Autowired
private IcResiComparisonRecordService icResiComparisonRecordService;
@Autowired
private DistributedLock distributedLock;
@Autowired
RedisUtils redisUtils;
@ -51,69 +30,31 @@ public class YanTaiResiComparisonSyncProcessor {
*/
@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);
}
scanAndExecWaitingJobs();
}
});
}
}
} catch (Exception e) {
log.error("【异步数据更新】出错:{}", ExceptionUtils.getErrorStackTrace(e));
} finally {
if (lock != null) {
lock.unlock();
}
}
@Override
protected void execJobTask(IcSyncJobEntity jobEntity) {
icResiComparisonRecordService.comparisonUserData(jobEntity);
}
/**
* 更新任务状态
* @param id
* @param status
@Override
protected String getDistributeLockKey() {
return "data:sync:comparison:resi";
}
*/
private void updateJobStatus(String id, String status) {
LambdaQueryWrapper<IcSyncJobEntity> query = new LambdaQueryWrapper<>();
query.eq(IcSyncJobEntity::getId, id);
@Override
protected String getJobType() {
return EpidemicConstant.JOB_TYPE_COMPARISON_RESI;
}
IcSyncJobEntity updateEntity = new IcSyncJobEntity();
updateEntity.setOperationStatus(status);
icSyncJobDao.update(updateEntity, query);
@Override
protected long getDistributeLockLeaseTime() {
return 60;
}
@Override
protected long getDistributeLockWaitTime() {
return 60;
}
}

109
epmet-user/epmet-user-server/src/main/java/com/epmet/processor/YanTaiVaccineSyncProcessor.java

@ -1,49 +1,27 @@
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
/**
* @Description 烟台核酸检测数据同步处理器
* @Author wxz
* @Date 2022/11/20 上午11:55
*/
//@Component
@Slf4j
public class YanTaiVaccineSyncProcessor {
public static final int MAX_EXECUTING_COUNT = 3;
@Autowired
private ExecutorService executorService;
@Autowired
private IcSyncJobDao icSyncJobDao;
public class YanTaiVaccineSyncProcessor extends AbstractDataSyncJobProcessor {
@Autowired
private DataSyncConfigService dataSyncConfigService;
@Autowired
private DistributedLock distributedLock;
@Autowired
RedisUtils redisUtils;
/**
* @Description 定时扫描和执行同步任务疫苗接种
* @Author zxc
@ -51,62 +29,31 @@ public class YanTaiVaccineSyncProcessor {
*/
@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();
}
}
scanAndExecWaitingJobs();
}
/**
* 更新任务状态
* @author wxz
* @date 2022/11/8 下午8:25
* @param id
* @param status
@Override
protected void execJobTask(IcSyncJobEntity jobEntity) {
dataSyncConfigService.execSyncByJobProcessor(jobEntity);
}
*/
private void updateJobStatus(String id, String status) {
LambdaQueryWrapper<IcSyncJobEntity> query = new LambdaQueryWrapper<>();
query.eq(IcSyncJobEntity::getId, id);
@Override
protected String getDistributeLockKey() {
return "data:sync:" + JOB_TYPE_VACCINE;
}
@Override
protected String getJobType() {
return EpidemicConstant.JOB_TYPE_VACCINE;
}
IcSyncJobEntity updateEntity = new IcSyncJobEntity();
updateEntity.setOperationStatus(status);
icSyncJobDao.update(updateEntity, query);
@Override
protected long getDistributeLockLeaseTime() {
return 60;
}
@Override
protected long getDistributeLockWaitTime() {
return 60;
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -1055,6 +1055,8 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
staffEntity.setId(customerStaffEntity.getId());
staffEntity.setEnableFlag(CustomerStaffConstant.ENABLE);
baseDao.updateById(staffEntity);
//2021.8.24 sun 人员禁用时删除工作人员的缓存信息
CustomerStaffRedis.delStaffInfoFormCache(fromDTO.getCustomerId(), fromDTO.getStaffId());
}
/**

12
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

@ -6,6 +6,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.bean.ResiImportCategoryData;
@ -452,6 +453,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String currUserAgencyPids, String currentUserId, String tableName) {
String loginUserCustomerId = EpmetRequestHolder.getLoginUserCustomerId();
// 遍历每一行,将行内容转化为
String idCard = null;
for (Map<Integer, String> row : dataRows) {
LinkedHashMap<String, String> columnAndValues = new LinkedHashMap<>();
@ -462,7 +464,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
execSpecifiedCheckAndFill(columnAndValues);
//默认新增
columnAndValues.put("SUB_STATUS", IcResiUserSubStatusEnum.IMPORT.getSubStatus());
String idCard = columnAndValues.get("ID_CARD");
idCard = columnAndValues.get("ID_CARD");
Map<String, String> existingResiMap = icResiUserDao.selectResiInfoMap(loginUserCustomerId, idCard, null);
if (existingResiMap == null) {
@ -579,7 +581,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
errorMsg = e.getMessage();
} else {
errorMsg = "未知系统错误";
log.error(ExceptionUtils.getErrorStackTrace(e));
log.error("【居民信息导入】导入身份证为{}的居民基础信息出现未知错误:{}", idCard == null ? "" : idCard, ExceptionUtils.getErrorStackTrace(e));
}
ErrorRow errorRow = new ErrorRow();
@ -695,12 +697,12 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
// 遍历每一行,将行内容转化为
for (Map<Integer, String> row : dataRows) {
String idCard = null;
try {
convertColumnWrappers2Map4Persist(headerColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel, columnAndValues, false);
// 检验身份证号
String idCard = columnAndValues.get("ID_CARD");
idCard = columnAndValues.get("ID_CARD");
if (StringUtils.isBlank(idCard)) {
String resiName = columnAndValues.get("NAME");
if (resiName == null) {
@ -754,7 +756,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
errorMsg = e.getMessage();
} else {
errorMsg = "未知系统错误";
log.error(ExceptionUtils.getErrorStackTrace(e));
log.error("【居民信息导入】导入身份证为{}的居民扩展信息{}出现未知错误:{}", idCard == null ? "" : idCard, targetTableName, ExceptionUtils.getErrorStackTrace(e));
}
ErrorRow errorRow = new ErrorRow();

3
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -2196,7 +2196,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
images.forEach(item -> icResiUserAttachmentService.save(item));
// 如果是已经存在的居民,并且是租客状态,需要更新原本的状态
if (NumConstant.ONE_STR.equals(formDTO.getType())) {
IcResiUserEntity entity = new IcResiUserEntity();
// IcResiUserEntity entity = new IcResiUserEntity();
IcResiUserEntity entity = ConvertUtils.sourceToTarget(formDTO.getUser(), IcResiUserEntity.class);
entity.setId(resiUserId);
entity.setIsTenant(NumConstant.ONE_STR);
entity.setIsFloating(NumConstant.ONE_STR);

3
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.90__alter_ic_move_in_record.sql

@ -0,0 +1,3 @@
ALTER TABLE `ic_move_in_record`
MODIFY COLUMN `ADDRESS` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '详细地址' AFTER `SOURCE_ADDRESS`;

19
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.91__data_sync_job_create.sql

@ -0,0 +1,19 @@
CREATE TABLE `ic_sync_job` (
`ID` varchar(64) NOT NULL COMMENT 'ID',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`ORG_ID` varchar(64) NOT NULL COMMENT '组织ID',
`PID` varchar(255) NOT NULL COMMENT '组织ID的上级',
`ORG_ID_PATH` varchar(1024) NOT NULL COMMENT '组织ID的所有上级,包括org_id',
`JOB_TYPE` varchar(32) NOT NULL COMMENT '任务类型,残疾:disability;死亡:death;核酸:nat;',
`OPERATOR_ID` varchar(255) NOT NULL COMMENT '操作员ID【staffId】',
`OPERATION_STATUS` varchar(32) DEFAULT NULL COMMENT '操作状态,等待中:waiting;进行中:processing;结束:finish',
`PROCESSOR_IP` varchar(15) DEFAULT NULL COMMENT '处理器实例ip',
`DEL_FLAG` int(11) NOT NULL,
`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`),
KEY `ORG_ID` (`ORG_ID`,`OPERATION_STATUS`,`JOB_TYPE`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='同步任务表'

BIN
epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls

Binary file not shown.

5
epmet-user/epmet-user-server/src/main/resources/mapper/ChangeDeathDao.xml

@ -44,7 +44,10 @@
d.UPDATED_TIME
FROM
pli_change_death d
LEFT JOIN ic_resi_user u ON u.ID_CARD = d.ID_CARD
LEFT JOIN ic_resi_user u
ON (u.ID_CARD = d.ID_CARD
and u.DEL_FLAG='0'
and d.CUSTOMER_ID=u.CUSTOMER_ID)
LEFT JOIN pli_change_welfare w ON d.ID_CARD = w.ID_CARD
AND w.DEL_FLAG = '0'
WHERE

3
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -327,7 +327,8 @@
<select id="selectByCustomerIdAndPhone" resultType="com.epmet.dto.result.GovWebOperLoginResultDTO">
SELECT
user_id AS "userId",
`password` AS "passWord"
`password` AS "passWord",
ENABLE_FLAG as enableFlag
FROM
`customer_staff`
WHERE

3
epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml

@ -55,7 +55,8 @@
a.DEL_FLAG = '0'
AND b.DEL_FLAG = '0'
AND a.customer_id = #{customerId}
AND a.pids like concat('%', #{agencyId}, '%')
<!-- AND a.pids like concat('%', #{agencyId}, '%')-->
AND a.AGENCY_ID = #{agencyId}
<if test='null != name and "" != name'>
AND b.name like concat('%', #{name}, '%')
</if>

34
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -182,6 +182,7 @@
</sql>
<!-- 查询列表用 -->
<!-- 2022.11.18 小寨子写死排序 -->
<select id="selectListResiMap" parameterType="map" resultType="map">
select
ic_resi_user.id as icResiUserId,
@ -200,9 +201,9 @@
<include refid="listWhereForPage"></include>
<if test="keyword != null and keyword != ''">
AND (
NAME = #{keyword}
or MOBILE = #{keyword}
or ID_CARD = #{keyword}
NAME like concat('%', #{keyword},'%')
or MOBILE like concat('%', #{keyword},'%')
or ID_CARD like concat('%', #{keyword},'%')
)
</if>
</where>
@ -212,13 +213,26 @@
${groupTableName}.ID
</foreach>
</if>
ORDER BY
IC_RESI_USER.GRID_ID desc,
IC_RESI_USER.VILLAGE_ID ASC,
IC_RESI_USER.BUILD_ID ASC,
IC_RESI_USER.UNIT_ID ASC,
IC_RESI_USER.HOME_ID ASC,
IC_RESI_USER.ID ASC
<choose>
<when test="customerId == '1536638904600752130' ">
ORDER BY
field( IC_RESI_USER.GRID_ID, '1537272060187049986', '1537272342477508609', '1537275342477501111', '1593432493598076929' ),
IC_RESI_USER.VILLAGE_ID ASC,
IC_RESI_USER.BUILD_ID ASC,
IC_RESI_USER.UNIT_ID ASC,
IC_RESI_USER.HOME_ID ASC,
IC_RESI_USER.ID ASC
</when>
<otherwise>
ORDER BY
IC_RESI_USER.GRID_ID desc,
IC_RESI_USER.VILLAGE_ID ASC,
IC_RESI_USER.BUILD_ID ASC,
IC_RESI_USER.UNIT_ID ASC,
IC_RESI_USER.HOME_ID ASC,
IC_RESI_USER.ID ASC
</otherwise>
</choose>
</select>
<update id="updateToDel" parameterType="map">

17
epmet-user/epmet-user-server/src/main/resources/mapper/IcSyncJobDao.xml

@ -3,8 +3,8 @@
<mapper namespace="com.epmet.dao.IcSyncJobDao">
<!--查询可执行任务列表-->
<select id="selectExecutableJobList" resultType="com.epmet.entity.IcSyncJobEntity">
<!--查询指定状态的任务列表-->
<select id="selectJobListByStatus" resultType="com.epmet.entity.IcSyncJobEntity">
select id,
customer_id,
org_id,
@ -13,6 +13,7 @@
job_type,
operator_id,
operation_status,
processor_ip,
del_flag,
revision,
created_by,
@ -20,10 +21,16 @@
updated_by,
updated_time
from ic_sync_job
where OPERATION_STATUS = 'waiting'
where
DEL_FLAG = 0
and OPERATION_STATUS = #{status}
and JOB_TYPE = #{jobType}
and DEL_FLAG = 0
<if test="processorIp != null">
and PROCESSOR_IP = #{processorIp}
</if>
order by CREATED_TIME asc
limit #{itemCount}
<if test="itemCount != null">
limit #{itemCount}
</if>
</select>
</mapper>
Loading…
Cancel
Save