@PreFine(source = "com.yunda.service.impl.ComplainActionSaveServiceImpl.doAction", dataType = 1)
@Override
public Result<Object> doAction(ComplainAction req) throws Exception {
log.info("complainId:{},actionType:{}", req.getComplainId(), req.getActionType());
req = assertNull(req);
RLock lock = redissonClient.getLock(LOCK_DO_ACTION + "_" + req.getComplainId() + "_" + req.getActionType());
if (!lock.isLocked()) {
try {
lock.lock(1, TimeUnit.MINUTES);
// redis 标签用
if (ObjectUtils.isNotEmpty(req.getLoginSiteId())) {
String key = COMPLAIN_LABEL + req.getLoginSiteId() + "-" + req.getComplainId();
if (ObjectUtils.isNotEmpty(redisTemplate.boundValueOps(key).get()) && redisTemplate.boundValueOps(key).get().equals("0")) {
redisTemplate.boundValueOps(key).set(String.valueOf(Constant.Status.ONE), 10, TimeUnit.DAYS);
}
}
/**
* * 拆分改造
* 预警首回
*/
if (firstReplyFlag && ExtraWorkEnum.FIRST_REPLY.getDesc().equals(req.getActionType())) {
return firstReplyAction.doAction(req);
} else if (ExtraWorkEnum.WARN_SIT1_FIRST_REPLY.getStatus().equals(req.getActionType())) {
return wFirstReplyAction.doAction(req);
} else if (ExtraWorkEnum.WARNING_SITE_SETTLEMENT1.getStatus().equals(req.getActionType())) {
return wSiteSettlementAction.doAction(req);
} else if (ExtraWorkEnum.WARN_ASSISTANCE.getStatus().equals(req.getActionType())) {
return wAssistanceAction.doAction(req);
} else if (ExtraWorkEnum.WARN_STATEMENT.getStatus().equals(req.getActionType())) {
return wStatementAction.doAction(req);
} else if (ExtraWorkEnum.HQ_ALLOT_TASK.getStatus().equals(req.getActionType())) {
//查询当前账号是否存在超10催的数据
SysReminderLimitConfigReq sysReminderLimitConfigReq = new SysReminderLimitConfigReq();
BeanUtils.copyProperties(req, sysReminderLimitConfigReq);
Result<List<String>> resultSys = iSysReminderLimitConfigService.querySysReminderLimitConfig(sysReminderLimitConfigReq);
if (ObjectUtil.isNotEmpty(resultSys) && resultSys.isSuccess()) {
return Result.fail("您有超10催工单未处理,不允许重新分配任务!" + "单号:" + resultSys.getData());
}
return claimAllotTaskAction.doAction(req);
} else {
return doTransactional(req);
}
} finally {
lock.unlock();
log.info("lock.unlock():{}", req.getComplainId());
}
} else {
log.error("工单操作锁定中,请稍后重试,key:" + JSON.toJSONString(LOCK_DO_ACTION + "_" + req.getComplainId() + "_" + req.getActionType()));
return Result.fail("小主,请稍安勿躁,待我处理好再提交");
}
}
分布式锁(redis)示例
最新推荐文章于 2024-08-26 20:13:51 发布