diff --git a/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionErrorLogMapper.java b/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionErrorLogMapper.java new file mode 100644 index 00000000..cfd3b77e --- /dev/null +++ b/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionErrorLogMapper.java @@ -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); +} diff --git a/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionLogMapper.java b/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionLogMapper.java new file mode 100644 index 00000000..7af26505 --- /dev/null +++ b/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionLogMapper.java @@ -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); +} diff --git a/src/main/java/com/zcloud/service/xgf/XgfUserService.java b/src/main/java/com/zcloud/service/xgf/XgfUserService.java index 56c2a876..d7ab07e4 100644 --- a/src/main/java/com/zcloud/service/xgf/XgfUserService.java +++ b/src/main/java/com/zcloud/service/xgf/XgfUserService.java @@ -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 getWorkTask(PageData condition) throws Exception; void syncPhoto(PageData request) throws Exception; + + void edit4Mq(PageData syncInfo); } diff --git a/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java b/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java index f1605278..af636b9d 100644 --- a/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java +++ b/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java @@ -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); + } + } + } } diff --git a/src/main/java/com/zcloud/syncData/listener/SyncDataListener.java b/src/main/java/com/zcloud/syncData/listener/SyncDataListener.java index 5513ae10..b44c127a 100644 --- a/src/main/java/com/zcloud/syncData/listener/SyncDataListener.java +++ b/src/main/java/com/zcloud/syncData/listener/SyncDataListener.java @@ -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 { -// @Resource -// private MqMessageLogMapper mqMessageLogMapper; - - public static Map 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 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 { } -// 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); } diff --git a/src/main/resources/mybatis/datasource/mq/MqConsumptionErrorLogMapper.xml b/src/main/resources/mybatis/datasource/mq/MqConsumptionErrorLogMapper.xml new file mode 100644 index 00000000..a1475fef --- /dev/null +++ b/src/main/resources/mybatis/datasource/mq/MqConsumptionErrorLogMapper.xml @@ -0,0 +1,41 @@ + + + + + `qa-gwj-prevention`.`mq_consumption_error_log` + + + CONSUMPTION_ID, + MARK, + DATA, + MESSAGE_LOG_ID, + SUCCESS, + CREATE_TIME, + CONSUMPTION_TIME, + CONSUMPTION_TYPE, + ERROR_MESSAGE, + URL + + + #{CONSUMPTION_ID}, + #{MARK}, + #{DATA}, + #{MESSAGE_LOG_ID}, + #{SUCCESS}, + #{CREATE_TIME}, + #{CONSUMPTION_TIME}, + #{CONSUMPTION_TYPE}, + #{ERROR_MESSAGE}, + #{URL} + + + insert into + + ( + + ) values ( + + ) + + + diff --git a/src/main/resources/mybatis/datasource/mq/MqConsumptionLogMapper.xml b/src/main/resources/mybatis/datasource/mq/MqConsumptionLogMapper.xml new file mode 100644 index 00000000..4cb6634a --- /dev/null +++ b/src/main/resources/mybatis/datasource/mq/MqConsumptionLogMapper.xml @@ -0,0 +1,41 @@ + + + + + `qa-gwj-prevention`.`mq_consumption_log` + + + CONSUMPTION_ID, + MARK, + DATA, + MESSAGE_LOG_ID, + SUCCESS, + CREATE_TIME, + CONSUMPTION_TIME, + CONSUMPTION_TYPE, + ERROR_MESSAGE, + URL + + + #{CONSUMPTION_ID}, + #{MARK}, + #{DATA}, + #{MESSAGE_LOG_ID}, + #{SUCCESS}, + #{CREATE_TIME}, + #{CONSUMPTION_TIME}, + #{CONSUMPTION_TYPE}, + #{ERROR_MESSAGE}, + #{URL} + + + insert into + + ( + + ) values ( + + ) + + + diff --git a/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml b/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml index ed640710..0ff0a15d 100644 --- a/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml +++ b/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml @@ -218,65 +218,182 @@ update - set - XGF_USER_DETAILS_ID = #{XGF_USER_DETAILS_ID}, - XGF_USER_ID = #{XGF_USER_ID}, - XGF_USER_NAME = #{XGF_USER_NAME}, - BELONG_TO_CORP = #{BELONG_TO_CORP}, - BELONG_TO_CORP_NAME = #{BELONG_TO_CORP_NAME}, - PHONE = #{PHONE}, - CREATE_TIME = #{CREATE_TIME}, - DEPART_STATE = #{DEPART_STATE}, - IS_DELETE = #{IS_DELETE}, - AGE = #{AGE}, - HKLOCAL = #{HKLOCAL}, - ADDRESS = #{ADDRESS}, - DEGREE_OF_EDUCATION = #{DEGREE_OF_EDUCATION}, - DEGREE_OF_EDUCATION_NAME = #{DEGREE_OF_EDUCATION_NAME}, - CORP_START_DATE = #{CORP_START_DATE}, - POST_ID = #{POST_ID}, - POST_NAME = #{POST_NAME}, - WORK_SIGN = #{WORK_SIGN}, - JOINED_DATE = #{JOINED_DATE}, - WORK_DATE = #{WORK_DATE}, - PHOTO = #{PHOTO}, - DATE_OF_BIRTH = #{DATE_OF_BIRTH}, - ISPAY = #{ISPAY}, - ISPAY_NUMBER = #{ISPAY_NUMBER}, - IS_SAFETY_TELL = #{IS_SAFETY_TELL}, - IS_SAFETY_TIME = #{IS_SAFETY_TIME}, - IS_INJURIES_PAY = #{IS_INJURIES_PAY}, - IS_SIGN_LABOR = #{IS_SIGN_LABOR}, - SEX = #{SEX}, - ENTRY_DATE = #{ENTRY_DATE}, - PERSON_WORK_TYPE = #{PERSON_WORK_TYPE}, - PERSON_WORK_TYPE_NAME = #{PERSON_WORK_TYPE_NAME}, - NATIONALITY = #{NATIONALITY}, - NATIONALITY_NAME = #{NATIONALITY_NAME}, - POLITICAL_TIME = #{POLITICAL_TIME}, - POLITICAL_STATUS = #{POLITICAL_STATUS}, - POLITICAL_STATUS_NAME = #{POLITICAL_STATUS_NAME}, - IS_INJURIES_PAY_TIME = #{IS_INJURIES_PAY_TIME}, - IS_LEVEL_THREE = #{IS_LEVEL_THREE}, - IS_BODY_ADAPT = #{IS_BODY_ADAPT}, - IS_SPECIAL_JOB = #{IS_SPECIAL_JOB}, - CORPINFO_ID = #{CORPINFO_ID}, - MANAGER_DEPARTMENT_ID = #{MANAGER_DEPARTMENT_ID}, - MANAGER_DEPARTMENT_NAME = #{MANAGER_DEPARTMENT_NAME}, - COMPETENT_DEPARTMENT_ID = #{COMPETENT_DEPARTMENT_ID}, - COMPETENT_DEPARTMENT_NAME = #{COMPETENT_DEPARTMENT_NAME}, - MAIN_DEPARTMENT_ID = #{MAIN_DEPARTMENT_ID}, - MAIN_DEPARTMENT_NAME = #{MAIN_DEPARTMENT_NAME}, - CARD_ID = #{CARD_ID}, - DEPARTMENT_ID = #{DEPARTMENT_ID}, - DEPARTMENT_NAME = #{DEPARTMENT_NAME}, - IS_BF = #{IS_BF}, - IS_SOCIAL = #{IS_SOCIAL}, - SOCIAL_NUMBER = #{SOCIAL_NUMBER}, - zzName = #{zzName}, - ANNEX = #{ANNEX}, - ATTORNEY = #{ATTORNEY}, - COMMITMENT_LETTER = #{COMMITMENT_LETTER} + + + XGF_USER_DETAILS_ID = #{XGF_USER_DETAILS_ID}, + + + XGF_USER_ID = #{XGF_USER_ID}, + + + XGF_USER_NAME = #{XGF_USER_NAME}, + + + BELONG_TO_CORP = #{BELONG_TO_CORP}, + + + BELONG_TO_CORP_NAME = #{BELONG_TO_CORP_NAME}, + + + PHONE = #{PHONE}, + + + CREATE_TIME = #{CREATE_TIME}, + + + DEPART_STATE = #{DEPART_STATE}, + + + IS_DELETE = #{IS_DELETE}, + + + AGE = #{AGE}, + + + HKLOCAL = #{HKLOCAL}, + + + ADDRESS = #{ADDRESS}, + + + DEGREE_OF_EDUCATION = #{DEGREE_OF_EDUCATION}, + + + DEGREE_OF_EDUCATION_NAME = #{DEGREE_OF_EDUCATION_NAME}, + + + CORP_START_DATE = #{CORP_START_DATE}, + + + POST_ID = #{POST_ID}, + + + POST_NAME = #{POST_NAME}, + + + WORK_SIGN = #{WORK_SIGN}, + + + JOINED_DATE = #{JOINED_DATE}, + + + WORK_DATE = #{WORK_DATE}, + + + PHOTO = #{PHOTO}, + + + DATE_OF_BIRTH = #{DATE_OF_BIRTH}, + + + ISPAY = #{ISPAY}, + + + ISPAY_NUMBER = #{ISPAY_NUMBER}, + + + IS_SAFETY_TELL = #{IS_SAFETY_TELL}, + + + IS_SAFETY_TIME = #{IS_SAFETY_TIME}, + + + IS_INJURIES_PAY = #{IS_INJURIES_PAY}, + + + IS_SIGN_LABOR = #{IS_SIGN_LABOR}, + + + SEX = #{SEX}, + + + ENTRY_DATE = #{ENTRY_DATE}, + + + PERSON_WORK_TYPE = #{PERSON_WORK_TYPE}, + + + PERSON_WORK_TYPE_NAME = #{PERSON_WORK_TYPE_NAME}, + + + NATIONALITY = #{NATIONALITY}, + + + NATIONALITY_NAME = #{NATIONALITY_NAME}, + + + POLITICAL_TIME = #{POLITICAL_TIME}, + + + POLITICAL_STATUS = #{POLITICAL_STATUS}, + + + POLITICAL_STATUS_NAME = #{POLITICAL_STATUS_NAME}, + + + IS_INJURIES_PAY_TIME = #{IS_INJURIES_PAY_TIME}, + + + IS_LEVEL_THREE = #{IS_LEVEL_THREE}, + + + IS_BODY_ADAPT = #{IS_BODY_ADAPT}, + + + IS_SPECIAL_JOB = #{IS_SPECIAL_JOB}, + + + CORPINFO_ID = #{CORPINFO_ID}, + + + MANAGER_DEPARTMENT_ID = #{MANAGER_DEPARTMENT_ID}, + + + MANAGER_DEPARTMENT_NAME = #{MANAGER_DEPARTMENT_NAME}, + + + COMPETENT_DEPARTMENT_ID = #{COMPETENT_DEPARTMENT_ID}, + + + COMPETENT_DEPARTMENT_NAME = #{COMPETENT_DEPARTMENT_NAME}, + + + MAIN_DEPARTMENT_ID = #{MAIN_DEPARTMENT_ID}, + + + MAIN_DEPARTMENT_NAME = #{MAIN_DEPARTMENT_NAME}, + + + CARD_ID = #{CARD_ID}, + + + DEPARTMENT_ID = #{DEPARTMENT_ID}, + + + DEPARTMENT_NAME = #{DEPARTMENT_NAME}, + + + IS_BF = #{IS_BF}, + + + IS_SOCIAL = #{IS_SOCIAL}, + + + SOCIAL_NUMBER = #{SOCIAL_NUMBER}, + + + zzName = #{zzName}, + + + ANNEX = #{ANNEX}, + + + ATTORNEY = #{ATTORNEY}, + + + COMMITMENT_LETTER = #{COMMITMENT_LETTER} + + where XGF_USER_DETAILS_ID = #{XGF_USER_DETAILS_ID} diff --git a/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml b/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml index ae5dd84d..ca60be51 100644 --- a/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml +++ b/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml @@ -92,22 +92,53 @@ update - set - USERNAME = #{USERNAME}, - NAME = #{NAME}, - VALID_FLAG = #{VALID_FLAG}, - BELONG_TO_CORP = #{BELONG_TO_CORP}, - BELONG_TO_CORP_NAME = #{BELONG_TO_CORP_NAME}, - IS_DELETE = #{IS_DELETE}, - CREATE_TIME = #{CREATE_TIME}, - CORPINFO_ID = #{CORPINFO_ID}, - STATUS = #{STATUS}, - OPERATOR_TIME = #{OPERATOR_TIME}, - ISFLOW = #{ISFLOW}, - STUDY_STATUS = #{STUDY_STATUS}, - CHECK_STATUS = #{CHECK_STATUS}, - CHECK_STEP = #{CHECK_STEP}, - LIMIT_END_TIME = #{LIMIT_END_TIME} + + + USERNAME = #{USERNAME}, + + + NAME = #{NAME}, + + + VALID_FLAG = #{VALID_FLAG}, + + + BELONG_TO_CORP = #{BELONG_TO_CORP}, + + + BELONG_TO_CORP_NAME = #{BELONG_TO_CORP_NAME}, + + + IS_DELETE = #{IS_DELETE}, + + + CREATE_TIME = #{CREATE_TIME}, + + + CORPINFO_ID = #{CORPINFO_ID}, + + + STATUS = #{STATUS}, + + + OPERATOR_TIME = #{OPERATOR_TIME}, + + + ISFLOW = #{ISFLOW}, + + + STUDY_STATUS = #{STUDY_STATUS}, + + + CHECK_STATUS = #{CHECK_STATUS}, + + + CHECK_STEP = #{CHECK_STEP}, + + + LIMIT_END_TIME = #{LIMIT_END_TIME} + + where XGF_USER_ID = #{XGF_USER_ID}