人员同步失败处理

This commit is contained in:
pengjie 2024-06-08 22:00:16 +08:00
parent bca18576bf
commit d177acd242
3 changed files with 24 additions and 5 deletions

View File

@ -25,7 +25,7 @@ public interface IWorkerInfoAuditRecordService extends IService<WorkerInfoAuditR
void editWorkerInfoAuditRecord(WorkerInfoAuditRecord workerInfoAuditRecord);
Long adoptWorkerInfo(Map<String, Object> map);
String adoptWorkerInfo(Map<String, Object> map);
void rejectWorkerInfo(Map<String, Object> map);

View File

@ -106,7 +106,7 @@ public class WorkerInfoAuditRecordServiceImpl extends ServiceImpl<WorkerInfoAudi
}
@Override
public Long adoptWorkerInfo(Map<String, Object> map) {
public String adoptWorkerInfo(Map<String, Object> map) {
WorkerInfoAuditRecord workerInfoAuditRecord=workerInfoAuditRecordMapper.selectById(MapUtils.getString(map,"id"));
if(workerInfoAuditRecord==null){
throw new OpenAlertException(MessageUtil.get("notFindErr"));
@ -125,7 +125,7 @@ public class WorkerInfoAuditRecordServiceImpl extends ServiceImpl<WorkerInfoAudi
} catch (Exception e) {
log.error("同步人员信息失败:" + workerInfo.getWorkerName() + e.getMessage());
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return workerInfoAuditRecord.getId();
return workerInfoAuditRecord.getId() + "#" + e.getMessage();
}
if (StringUtils.isNotBlank(workerInfoAuditRecord.getContractInfo())) {
List<WorkerContract> workerContracts = JSONArray.parseArray(workerInfoAuditRecord.getContractInfo(), WorkerContract.class);

View File

@ -11,6 +11,9 @@ import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.entity.vo.SafeEducationQuestionAnswerDataVo;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
import com.zhgd.xmgl.modules.edu.service.ISafeEducationQuestionAnswerService;
import com.zhgd.xmgl.modules.worker.entity.*;
import com.zhgd.xmgl.modules.worker.service.IUfaceDevService;
@ -49,6 +52,12 @@ public class XzWorkerInfoAuditRecordController {
@Autowired
private IWorkerInfoAuditRecordService workerInfoAuditRecordService;
@Autowired
private INoticeService noticeService;
@Autowired
private ISystemUserService systemUserService;
@Autowired
private ISafeEducationQuestionAnswerService safeEducationQuestionAnswerService;
@ -330,12 +339,22 @@ public class XzWorkerInfoAuditRecordController {
paramMap.put("ufaceDevId", ufaceDevIds);
paramMap.put("accountType", 2);
paramMap.put("registerType", 2);
Long workerId = workerInfoAuditRecordService.adoptWorkerInfo(paramMap);
String workerId = workerInfoAuditRecordService.adoptWorkerInfo(paramMap);
if (workerId != null) {
String[] split = workerId.split("#");
LambdaUpdateWrapper<WorkerInfoAuditRecord> wrapper = Wrappers.<WorkerInfoAuditRecord>lambdaUpdate();
wrapper.set(WorkerInfoAuditRecord::getAsyncState, 1);
wrapper.eq(WorkerInfoAuditRecord::getId, workerId);
wrapper.eq(WorkerInfoAuditRecord::getId, split[0]);
workerInfoAuditRecordService.update(wrapper);
List<SystemUser> systemUserList = systemUserService.list(Wrappers.<SystemUser>lambdaQuery().eq(SystemUser::getAccountType, 5));
systemUserList.addAll(systemUserService.list(Wrappers.<SystemUser>lambdaQuery()
.eq(SystemUser::getAccountType, 10)
.eq(SystemUser::getSn, paramMap.getString("projectSn"))));
List<Long> collect = systemUserList.stream().map(s -> s.getUserId()).collect(Collectors.toList());
collect.add(Long.valueOf(paramMap.getString("startUser")));
for (Long userId : collect) {
noticeService.addUserNotice(userId, "人员同步异常,原因:" + split[1], "人员审批数据同步失败", "1");
}
}
}
}