人员中台 - MQ日志补全&相关方用户更新逻辑

xuyifeng-0724-人员中台对接-dev
water_xu 2024-08-12 10:15:37 +08:00
parent 3fc60743f2
commit 2b3510591b
9 changed files with 383 additions and 113 deletions

View File

@ -0,0 +1,18 @@
package com.zcloud.mapper.datasource.mq;
import com.zcloud.entity.PageData;
/**
* mq
* LLX
* 2024-01-10
* www.zcloudchina.com
*/
public interface MqConsumptionErrorLogMapper {
/**
* add
* @param pd
*/
void save(PageData pd);
}

View File

@ -0,0 +1,18 @@
package com.zcloud.mapper.datasource.mq;
import com.zcloud.entity.PageData;
/**
* mq
* LLX
* 2024-01-08
* www.zcloudchina.com
*/
public interface MqConsumptionLogMapper {
/**
* add
* @param pd
*/
void save(PageData pd);
}

View File

@ -3,7 +3,6 @@ package com.zcloud.service.xgf;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.flow.xgf.util.XgfFlowDto;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -46,4 +45,6 @@ public interface XgfUserService {
List<PageData> getWorkTask(PageData condition) throws Exception;
void syncPhoto(PageData request) throws Exception;
void edit4Mq(PageData syncInfo);
}

View File

@ -1204,4 +1204,29 @@ public class XgfUserServiceImpl implements XgfUserService {
return "0";
}
@Override
@Transactional(rollbackFor = Exception.class)
public void edit4Mq(PageData syncInfo) {
// 相关方推送更新
syncInfo.put("XGF_USER_ID",syncInfo.getString("USER_ID"));
PageData localData = xgfUserMapper.findById(syncInfo);
if (localData != null && !localData.isEmpty()){
syncInfo.put("STUDY_STATUS", syncInfo.getString("STATUS"));
syncInfo.put("STATUS", "");
syncInfo.put("BELONG_TO_CORP", syncInfo.getString("EMPLOYER"));
syncInfo.put("BELONG_TO_CORP_NAME", syncInfo.getString("EMPLOYER_NAME"));
syncInfo.put("XGF_USER_NAME", syncInfo.getString("NAME"));
xgfUserMapper.edit(syncInfo);
// details
syncInfo.put("XGF_USER_DETAILS_ID",localData.getString("XGF_USER_ID"));
PageData localDetailsData = xgfUserDetailsMapper.findById(syncInfo);
if (localDetailsData != null && !localDetailsData.isEmpty()){
xgfUserDetailsMapper.edit(syncInfo);
}
}
}
}

View File

@ -4,9 +4,8 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.zcloud.dto.TenCorpDto;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.xgf.XgfUserDetailsMapper;
import com.zcloud.mapper.datasource.xgf.XgfUserMapper;
import com.zcloud.service.mq.DockSendMessageService;
import com.zcloud.mapper.datasource.mq.MqConsumptionErrorLogMapper;
import com.zcloud.mapper.datasource.mq.MqConsumptionLogMapper;
import com.zcloud.service.system.UsersService;
import com.zcloud.service.xgf.XgfUserService;
import com.zcloud.syncData.SyncTypeEnum;
@ -21,10 +20,7 @@ import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Component
@RocketMQMessageListener(
@ -34,25 +30,17 @@ import java.util.Map;
messageModel = MessageModel.BROADCASTING) // 添加广播模式
public class SyncDataListener implements RocketMQListener<String> {
// @Resource
// private MqMessageLogMapper mqMessageLogMapper;
public static Map<String, String> dockingRelationMap = new HashMap();
// @Autowired
// private MqConsumptionLogMapper mqConsumptionLogMapper;
@Autowired
private MqConsumptionLogMapper mqConsumptionLogMapper;
@Autowired
private UsersService usersService;
@Autowired
private XgfUserMapper xgfUserMapper;
@Autowired
private XgfUserDetailsMapper xgfUserDetailsMapper;
@Autowired
private DockSendMessageService dockSendMessageService;
// @Autowired
// private static MqConsumptionErrorLogMapper mqConsumptionErrorLogMapper;
@Autowired
private XgfUserService xgfUserService;
@Autowired
private static MqConsumptionErrorLogMapper mqConsumptionErrorLogMapper;
@Override
public void onMessage(String message) {
@ -90,18 +78,8 @@ public class SyncDataListener implements RocketMQListener<String> {
String str = tenCorpDto.getData().getString("syncInfo");
PageData syncInfo = JSONUtil.toBean(str, PageData.class);
if ("xgf".equals(tenCorpDto.getMessage())){
// 相关方推送更新
syncInfo.put("XGF_USER_ID",syncInfo.getString("USER_ID"));
PageData localData = xgfUserMapper.findById(syncInfo);
if (localData != null && !localData.isEmpty()){
xgfUserMapper.edit(syncInfo);
syncInfo.put("XGF_USER_DETAILS_ID",localData.getString("XGF_USER_ID"));
PageData localDetailsData = xgfUserDetailsMapper.findById(syncInfo);
if (localDetailsData != null && !localDetailsData.isEmpty()){
xgfUserDetailsMapper.edit(syncInfo);
}
}
// 相关方推送
xgfUserService.edit4Mq(syncInfo);
}
PageData localData = usersService.findById(syncInfo);
if (localData != null && !localData.isEmpty()){
@ -124,14 +102,14 @@ public class SyncDataListener implements RocketMQListener<String> {
}
// mqConsumptionLogMapper.save(productionPD);
// mqConsumptionLogMapper.save(pd);
mqConsumptionLogMapper.save(productionPD);
mqConsumptionLogMapper.save(pd);
} catch (Exception e) {
productionPD.put("SUCCESS",'0');
productionPD.put("ERROR_MESSAGE", StackTraceUtils.printStackTraceToString(e));
// mqConsumptionErrorLogMapper.save(productionPD);
mqConsumptionErrorLogMapper.save(productionPD);
pd.put("ERROR_MESSAGE",e.getMessage());
// mqConsumptionLogMapper.save(pd);
mqConsumptionLogMapper.save(pd);
e.printStackTrace();
throw new RuntimeException(e);
}

View File

@ -0,0 +1,41 @@
<?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.zcloud.mapper.datasource.mq.MqConsumptionErrorLogMapper">
<sql id="tableName">
`qa-gwj-prevention`.`mq_consumption_error_log`
</sql>
<sql id="Field2">
CONSUMPTION_ID,
MARK,
DATA,
MESSAGE_LOG_ID,
SUCCESS,
CREATE_TIME,
CONSUMPTION_TIME,
CONSUMPTION_TYPE,
ERROR_MESSAGE,
URL
</sql>
<sql id="FieldValue">
#{CONSUMPTION_ID},
#{MARK},
#{DATA},
#{MESSAGE_LOG_ID},
#{SUCCESS},
#{CREATE_TIME},
#{CONSUMPTION_TIME},
#{CONSUMPTION_TYPE},
#{ERROR_MESSAGE},
#{URL}
</sql>
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
</mapper>

View File

@ -0,0 +1,41 @@
<?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.zcloud.mapper.datasource.mq.MqConsumptionLogMapper">
<sql id="tableName">
`qa-gwj-prevention`.`mq_consumption_log`
</sql>
<sql id="Field2">
CONSUMPTION_ID,
MARK,
DATA,
MESSAGE_LOG_ID,
SUCCESS,
CREATE_TIME,
CONSUMPTION_TIME,
CONSUMPTION_TYPE,
ERROR_MESSAGE,
URL
</sql>
<sql id="FieldValue">
#{CONSUMPTION_ID},
#{MARK},
#{DATA},
#{MESSAGE_LOG_ID},
#{SUCCESS},
#{CREATE_TIME},
#{CONSUMPTION_TIME},
#{CONSUMPTION_TYPE},
#{ERROR_MESSAGE},
#{URL}
</sql>
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
</mapper>

View File

@ -218,65 +218,182 @@
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
<set>
<if test="XGF_USER_DETAILS_ID != null and XGF_USER_DETAILS_ID != ''">
XGF_USER_DETAILS_ID = #{XGF_USER_DETAILS_ID},
</if>
<if test="XGF_USER_ID != null and XGF_USER_ID != ''">
XGF_USER_ID = #{XGF_USER_ID},
</if>
<if test="XGF_USER_NAME != null and XGF_USER_NAME != ''">
XGF_USER_NAME = #{XGF_USER_NAME},
</if>
<if test="BELONG_TO_CORP != null and BELONG_TO_CORP != ''">
BELONG_TO_CORP = #{BELONG_TO_CORP},
</if>
<if test="BELONG_TO_CORP_NAME != null and BELONG_TO_CORP_NAME != ''">
BELONG_TO_CORP_NAME = #{BELONG_TO_CORP_NAME},
</if>
<if test="PHONE != null and PHONE != ''">
PHONE = #{PHONE},
</if>
<if test="CREATE_TIME != null and CREATE_TIME != ''">
CREATE_TIME = #{CREATE_TIME},
</if>
<if test="DEPART_STATE != null and DEPART_STATE != ''">
DEPART_STATE = #{DEPART_STATE},
</if>
<if test="IS_DELETE != null and IS_DELETE != ''">
IS_DELETE = #{IS_DELETE},
</if>
<if test="AGE != null and AGE != ''">
AGE = #{AGE},
</if>
<if test="HKLOCAL != null and HKLOCAL != ''">
HKLOCAL = #{HKLOCAL},
</if>
<if test="ADDRESS != null and ADDRESS != ''">
ADDRESS = #{ADDRESS},
</if>
<if test="DEGREE_OF_EDUCATION != null and DEGREE_OF_EDUCATION != ''">
DEGREE_OF_EDUCATION = #{DEGREE_OF_EDUCATION},
</if>
<if test="DEGREE_OF_EDUCATION_NAME != null and DEGREE_OF_EDUCATION_NAME != ''">
DEGREE_OF_EDUCATION_NAME = #{DEGREE_OF_EDUCATION_NAME},
</if>
<if test="CORP_START_DATE != null and CORP_START_DATE != ''">
CORP_START_DATE = #{CORP_START_DATE},
</if>
<if test="POST_ID != null and POST_ID != ''">
POST_ID = #{POST_ID},
</if>
<if test="POST_NAME != null and POST_NAME != ''">
POST_NAME = #{POST_NAME},
</if>
<if test="WORK_SIGN != null and WORK_SIGN != ''">
WORK_SIGN = #{WORK_SIGN},
</if>
<if test="JOINED_DATE != null and JOINED_DATE != ''">
JOINED_DATE = #{JOINED_DATE},
</if>
<if test="WORK_DATE != null and WORK_DATE != ''">
WORK_DATE = #{WORK_DATE},
</if>
<if test="PHOTO != null and PHOTO != ''">
PHOTO = #{PHOTO},
</if>
<if test="DATE_OF_BIRTH != null and DATE_OF_BIRTH != ''">
DATE_OF_BIRTH = #{DATE_OF_BIRTH},
</if>
<if test="ISPAY != null and ISPAY != ''">
ISPAY = #{ISPAY},
</if>
<if test="ISPAY_NUMBER != null and ISPAY_NUMBER != ''">
ISPAY_NUMBER = #{ISPAY_NUMBER},
</if>
<if test="IS_SAFETY_TELL != null and IS_SAFETY_TELL != ''">
IS_SAFETY_TELL = #{IS_SAFETY_TELL},
</if>
<if test="IS_SAFETY_TIME != null and IS_SAFETY_TIME != ''">
IS_SAFETY_TIME = #{IS_SAFETY_TIME},
</if>
<if test="IS_INJURIES_PAY != null and IS_INJURIES_PAY != ''">
IS_INJURIES_PAY = #{IS_INJURIES_PAY},
</if>
<if test="IS_SIGN_LABOR != null and IS_SIGN_LABOR != ''">
IS_SIGN_LABOR = #{IS_SIGN_LABOR},
</if>
<if test="SEX != null and SEX != ''">
SEX = #{SEX},
</if>
<if test="ENTRY_DATE != null and ENTRY_DATE != ''">
ENTRY_DATE = #{ENTRY_DATE},
</if>
<if test="PERSON_WORK_TYPE != null and PERSON_WORK_TYPE != ''">
PERSON_WORK_TYPE = #{PERSON_WORK_TYPE},
</if>
<if test="PERSON_WORK_TYPE_NAME != null and PERSON_WORK_TYPE_NAME != ''">
PERSON_WORK_TYPE_NAME = #{PERSON_WORK_TYPE_NAME},
</if>
<if test="NATIONALITY != null and NATIONALITY != ''">
NATIONALITY = #{NATIONALITY},
</if>
<if test="NATIONALITY_NAME != null and NATIONALITY_NAME != ''">
NATIONALITY_NAME = #{NATIONALITY_NAME},
</if>
<if test="POLITICAL_TIME != null and POLITICAL_TIME != ''">
POLITICAL_TIME = #{POLITICAL_TIME},
</if>
<if test="POLITICAL_STATUS != null and POLITICAL_STATUS != ''">
POLITICAL_STATUS = #{POLITICAL_STATUS},
</if>
<if test="POLITICAL_STATUS_NAME != null and POLITICAL_STATUS_NAME != ''">
POLITICAL_STATUS_NAME = #{POLITICAL_STATUS_NAME},
</if>
<if test="IS_INJURIES_PAY_TIME != null and IS_INJURIES_PAY_TIME != ''">
IS_INJURIES_PAY_TIME = #{IS_INJURIES_PAY_TIME},
</if>
<if test="IS_LEVEL_THREE != null and IS_LEVEL_THREE != ''">
IS_LEVEL_THREE = #{IS_LEVEL_THREE},
</if>
<if test="IS_BODY_ADAPT != null and IS_BODY_ADAPT != ''">
IS_BODY_ADAPT = #{IS_BODY_ADAPT},
</if>
<if test="IS_SPECIAL_JOB != null and IS_SPECIAL_JOB != ''">
IS_SPECIAL_JOB = #{IS_SPECIAL_JOB},
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
CORPINFO_ID = #{CORPINFO_ID},
</if>
<if test="MANAGER_DEPARTMENT_ID != null and MANAGER_DEPARTMENT_ID != ''">
MANAGER_DEPARTMENT_ID = #{MANAGER_DEPARTMENT_ID},
</if>
<if test="MANAGER_DEPARTMENT_NAME != null and MANAGER_DEPARTMENT_NAME != ''">
MANAGER_DEPARTMENT_NAME = #{MANAGER_DEPARTMENT_NAME},
</if>
<if test="COMPETENT_DEPARTMENT_ID != null and COMPETENT_DEPARTMENT_ID != ''">
COMPETENT_DEPARTMENT_ID = #{COMPETENT_DEPARTMENT_ID},
</if>
<if test="COMPETENT_DEPARTMENT_NAME != null and COMPETENT_DEPARTMENT_NAME != ''">
COMPETENT_DEPARTMENT_NAME = #{COMPETENT_DEPARTMENT_NAME},
</if>
<if test="MAIN_DEPARTMENT_ID != null and MAIN_DEPARTMENT_ID != ''">
MAIN_DEPARTMENT_ID = #{MAIN_DEPARTMENT_ID},
</if>
<if test="MAIN_DEPARTMENT_NAME != null and MAIN_DEPARTMENT_NAME != ''">
MAIN_DEPARTMENT_NAME = #{MAIN_DEPARTMENT_NAME},
</if>
<if test="CARD_ID != null and CARD_ID != ''">
CARD_ID = #{CARD_ID},
</if>
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
DEPARTMENT_ID = #{DEPARTMENT_ID},
</if>
<if test="DEPARTMENT_NAME != null and DEPARTMENT_NAME != ''">
DEPARTMENT_NAME = #{DEPARTMENT_NAME},
</if>
<if test="IS_BF != null and IS_BF != ''">
IS_BF = #{IS_BF},
</if>
<if test="IS_SOCIAL != null and IS_SOCIAL != ''">
IS_SOCIAL = #{IS_SOCIAL},
</if>
<if test="SOCIAL_NUMBER != null and SOCIAL_NUMBER != ''">
SOCIAL_NUMBER = #{SOCIAL_NUMBER},
</if>
<if test="zzName != null and zzName != ''">
zzName = #{zzName},
</if>
<if test="ANNEX != null and ANNEX != ''">
ANNEX = #{ANNEX},
</if>
<if test="ATTORNEY != null and ATTORNEY != ''">
ATTORNEY = #{ATTORNEY},
</if>
<if test="COMMITMENT_LETTER != null and COMMITMENT_LETTER != ''">
COMMITMENT_LETTER = #{COMMITMENT_LETTER}
</if>
</set>
where
XGF_USER_DETAILS_ID = #{XGF_USER_DETAILS_ID}
</update>

View File

@ -92,22 +92,53 @@
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
<set>
<if test="USERNAME != null and USERNAME != ''">
USERNAME = #{USERNAME},
</if>
<if test="NAME != null and NAME != ''">
NAME = #{NAME},
</if>
<if test="VALID_FLAG != null and VALID_FLAG != ''">
VALID_FLAG = #{VALID_FLAG},
</if>
<if test="BELONG_TO_CORP != null and BELONG_TO_CORP != ''">
BELONG_TO_CORP = #{BELONG_TO_CORP},
</if>
<if test="BELONG_TO_CORP_NAME != null and BELONG_TO_CORP_NAME != ''">
BELONG_TO_CORP_NAME = #{BELONG_TO_CORP_NAME},
</if>
<if test="IS_DELETE != null and IS_DELETE != ''">
IS_DELETE = #{IS_DELETE},
</if>
<if test="CREATE_TIME != null and CREATE_TIME != ''">
CREATE_TIME = #{CREATE_TIME},
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
CORPINFO_ID = #{CORPINFO_ID},
</if>
<if test="STATUS != null and STATUS != ''">
STATUS = #{STATUS},
</if>
<if test="OPERATOR_TIME != null and OPERATOR_TIME != ''">
OPERATOR_TIME = #{OPERATOR_TIME},
</if>
<if test="ISFLOW != null and ISFLOW != ''">
ISFLOW = #{ISFLOW},
</if>
<if test="STUDY_STATUS != null and STUDY_STATUS != ''">
STUDY_STATUS = #{STUDY_STATUS},
</if>
<if test="CHECK_STATUS != null and CHECK_STATUS != ''">
CHECK_STATUS = #{CHECK_STATUS},
</if>
<if test="CHECK_STEP != null and CHECK_STEP != ''">
CHECK_STEP = #{CHECK_STEP},
</if>
<if test="LIMIT_END_TIME != null and LIMIT_END_TIME != ''">
LIMIT_END_TIME = #{LIMIT_END_TIME}
</if>
</set>
where
XGF_USER_ID = #{XGF_USER_ID}
</update>