|
|
@ -41,6 +41,8 @@ import org.springblade.flow.core.feign.IFlowClient; |
|
|
|
import org.springblade.flow.core.utils.FlowUtil; |
|
|
|
import org.springblade.flow.core.utils.FlowUtil; |
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
@ -97,6 +99,15 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
if (ObjectUtil.isEmpty(AuthUtil.getDeptId())) { |
|
|
|
if (ObjectUtil.isEmpty(AuthUtil.getDeptId())) { |
|
|
|
throw new ServiceException("获取当前用户机构失败!"); |
|
|
|
throw new ServiceException("获取当前用户机构失败!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(entity.getFinder())&&StringUtils.isBlank(entity.getFinderName())){ |
|
|
|
|
|
|
|
User user = UserCache.getUser(entity.getFinder()); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(user)&&StringUtils.isNotBlank(user.getName())) { |
|
|
|
|
|
|
|
entity.setFinderName(user.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(AuthUtil.getUserName())){ |
|
|
|
|
|
|
|
entity.setCreateUserName(AuthUtil.getUserName()); |
|
|
|
|
|
|
|
} |
|
|
|
//加锁
|
|
|
|
//加锁
|
|
|
|
Boolean lock = redisTemplate.opsForValue().setIfAbsent("SysUserLock" + AuthUtil.getDeptId(), AuthUtil.getDeptId(), 30, TimeUnit.SECONDS); |
|
|
|
Boolean lock = redisTemplate.opsForValue().setIfAbsent("SysUserLock" + AuthUtil.getDeptId(), AuthUtil.getDeptId(), 30, TimeUnit.SECONDS); |
|
|
|
try { |
|
|
|
try { |
|
|
@ -121,7 +132,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
log.error("保存现象失败!"+e); |
|
|
|
log.error("保存现象失败!"+e); |
|
|
|
//抛出异常,以便回滚
|
|
|
|
//抛出异常,以便回滚
|
|
|
|
throw new ServiceException("保存现象失败!"); |
|
|
|
throw new ServiceException("保存现象失败!"+e.getMessage()); |
|
|
|
}finally { |
|
|
|
}finally { |
|
|
|
redisTemplate.delete("SysUserLock" + AuthUtil.getDeptId()); //删除key,释放锁
|
|
|
|
redisTemplate.delete("SysUserLock" + AuthUtil.getDeptId()); //删除key,释放锁
|
|
|
|
} |
|
|
|
} |
|
|
@ -281,7 +292,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
public R listenAndUpdateDefect(ProcessWorkFlowResponse processWorkFlowResponse) { |
|
|
|
public R listenAndUpdateDefect(ProcessWorkFlowResponse processWorkFlowResponse) { |
|
|
|
long taskId; |
|
|
|
long taskId; |
|
|
|
OperPhenomenonEntity operPhenomenonEntity; |
|
|
|
OperPhenomenonEntity operPhenomenonEntity; |
|
|
|
log.info("消缺消息开始转换"); |
|
|
|
log.info("消缺消息开始转换"+processWorkFlowResponse); |
|
|
|
try { |
|
|
|
try { |
|
|
|
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables(); |
|
|
|
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables(); |
|
|
|
//现象缺陷全表更新
|
|
|
|
//现象缺陷全表更新
|
|
|
@ -294,6 +305,9 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
if (processWorkFlowResponse.getTaskId() != null || processWorkFlowResponse.getUserId() != null) { |
|
|
|
if (processWorkFlowResponse.getTaskId() != null || processWorkFlowResponse.getUserId() != null) { |
|
|
|
operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getTaskName()); |
|
|
|
operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getTaskName()); |
|
|
|
operPhenomenonEntity.setCurrentLinkHandler(processWorkFlowResponse.getNextStepOperator()); |
|
|
|
operPhenomenonEntity.setCurrentLinkHandler(processWorkFlowResponse.getNextStepOperator()); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
operPhenomenonEntity.setCurrentOperator("流程结束"); |
|
|
|
|
|
|
|
operPhenomenonEntity.setCurrentLinkHandler(""); |
|
|
|
} |
|
|
|
} |
|
|
|
//缺陷记录
|
|
|
|
//缺陷记录
|
|
|
|
OperDefectStatisticsEntity statisticsEntity = statisticsService.getOne(new LambdaUpdateWrapper<OperDefectStatisticsEntity>() {{ |
|
|
|
OperDefectStatisticsEntity statisticsEntity = statisticsService.getOne(new LambdaUpdateWrapper<OperDefectStatisticsEntity>() {{ |
|
|
@ -324,8 +338,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
defectService.save(operDefectEntity); |
|
|
|
defectService.save(operDefectEntity); |
|
|
|
taskId = operDefectEntity.getId(); |
|
|
|
taskId = operDefectEntity.getId(); |
|
|
|
log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功"); |
|
|
|
log.info("缺陷ID:" + operPhenomenonEntity.getDefectCode() + "入库成功"); |
|
|
|
operPhenomenonEntity.setCurrentOperator("流程结束"); |
|
|
|
|
|
|
|
operPhenomenonEntity.setCurrentLinkHandler(""); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
//更新数据库
|
|
|
|
//更新数据库
|
|
|
|
Long statisticsEntityId = statisticsEntity.getId(); |
|
|
|
Long statisticsEntityId = statisticsEntity.getId(); |
|
|
@ -341,7 +354,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
operAppearanceService.updateById(appearanceEntity); |
|
|
|
operAppearanceService.updateById(appearanceEntity); |
|
|
|
//推送消息中心相关消息
|
|
|
|
//推送消息中心相关消息
|
|
|
|
sendMessage(processWorkFlowResponse, operPhenomenonEntity,taskId); |
|
|
|
sendMessage(processWorkFlowResponse, operPhenomenonEntity,taskId); |
|
|
|
log.info("消缺消息转换结束"); |
|
|
|
log.info("消缺消息转换结束"+processWorkFlowResponse); |
|
|
|
return R.success("消息保存成功"); |
|
|
|
return R.success("消息保存成功"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|