|
|
|
@ -5,11 +5,12 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.hnac.hzims.middle.process.feign.ProcessDictFeignService; |
|
|
|
|
import com.hnac.hzims.common.logs.utils.StringUtils; |
|
|
|
|
import com.hnac.hzims.message.MessageConstants; |
|
|
|
|
import com.hnac.hzims.message.dto.BusinessMessageDTO; |
|
|
|
|
import com.hnac.hzims.message.dto.MessagePushRecordDto; |
|
|
|
|
import com.hnac.hzims.message.fegin.IMessageClient; |
|
|
|
|
import com.hnac.hzims.middle.process.feign.ProcessDictFeignService; |
|
|
|
|
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; |
|
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
|
import com.hnac.hzims.operational.station.feign.IStationClient; |
|
|
|
@ -41,7 +42,6 @@ import org.springblade.system.feign.ISysClient;
|
|
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.beans.BeansException; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
@ -133,8 +133,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
|
|
|
|
|
//3. 保存操作对象
|
|
|
|
|
this.saveStandardTicketInfo(standardTicketInfoVo); |
|
|
|
|
//5. 保存安全措施
|
|
|
|
|
List<StandardTicketMeasureVo> standardTicketInfoVos = this.saveStandardTicketMeasure( |
|
|
|
|
this.saveStandardTicketMeasureWichTicket(standardTicketInfoVo)); |
|
|
|
|
List<StandardTicketMeasureVo> standardTicketInfoVos = this.saveStandardTicketMeasure(this.saveStandardTicketMeasureWichTicket(standardTicketInfoVo)); |
|
|
|
|
standardTicketInfoVo.setStandardTicketMeasureVos(standardTicketInfoVos); |
|
|
|
|
//6. 查询第操作票值
|
|
|
|
|
String dictValue = processDictFeignService.selectDictValueByKey(OPERATION_TICKET_KEY); |
|
|
|
@ -183,6 +182,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
|
|
|
|
|
StandardTicketInfoEntity newStandardTicketInfoEntity = new StandardTicketInfoEntity(); |
|
|
|
|
BeanUtils.copyProperties(standardTicketInfoVo, newStandardTicketInfoEntity); |
|
|
|
|
newStandardTicketInfoEntity.setId(id); |
|
|
|
|
newStandardTicketInfoEntity.setCreateUser(standardTicketInfoEntity.getCreateUser()); |
|
|
|
|
//填充操作票信息
|
|
|
|
|
saveStandardTicketInfoEntity(newStandardTicketInfoEntity, response); |
|
|
|
|
newStandardTicketInfoEntity.setProcessInstanceId(response.getProcessInstanceId()); |
|
|
|
@ -202,45 +202,69 @@ public class OperationTicketServiceImpl implements OperationTicketService {
|
|
|
|
|
|
|
|
|
|
//推送消息
|
|
|
|
|
if (response.getTaskId() != null) { |
|
|
|
|
MessagePushRecordDto message = new MessagePushRecordDto(); |
|
|
|
|
message.setBusinessClassify("business"); |
|
|
|
|
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getKey()); |
|
|
|
|
message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getDescription()); |
|
|
|
|
message.setTaskId(standardTicketInfoEntity.getId()); |
|
|
|
|
message.setTenantId("200000"); |
|
|
|
|
message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH)); |
|
|
|
|
message.setPushType(MessageConstants.IMMEDIATELY); |
|
|
|
|
// MessagePushRecordDto message = new MessagePushRecordDto();
|
|
|
|
|
// message.setBusinessClassify("business");
|
|
|
|
|
// message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getKey());
|
|
|
|
|
// message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getDescription());
|
|
|
|
|
// message.setTaskId(standardTicketInfoEntity.getId());
|
|
|
|
|
// message.setTenantId("200000");
|
|
|
|
|
// message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
|
|
|
|
|
// message.setPushType(MessageConstants.IMMEDIATELY);
|
|
|
|
|
// //您有一张工作票待审批,工作内容:*****,审批环节:*****;
|
|
|
|
|
// String countent = "您有一张工作票待审批,工作内容:".concat(standardTicketInfoEntity.getTitle()).concat(",审批环节:").concat(response.getTaskName());
|
|
|
|
|
// message.setContent(countent);
|
|
|
|
|
// message.setDeptId(standardTicketInfoEntity.getCreateDept());
|
|
|
|
|
// R<String> deptName = sysClient.getDeptName(standardTicketInfoEntity.getCreateDept());
|
|
|
|
|
// if (deptName.isSuccess()) {
|
|
|
|
|
// message.setDeptName(deptName.getData());
|
|
|
|
|
// }
|
|
|
|
|
// String userIds = response.getUserId();
|
|
|
|
|
// if (StringUtils.isBlank(userIds)) {
|
|
|
|
|
// log.error("推送的消息不能为空哦,{}", userIds);
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// String[] split = userIds.split(",");
|
|
|
|
|
// for (String userId : split) {
|
|
|
|
|
// message.setPusher(userId);
|
|
|
|
|
// User user = UserCache.getUser(NumberUtils.toLong(userId));
|
|
|
|
|
// if (ObjectUtils.isNotEmpty(user)) {
|
|
|
|
|
// message.setPusherName(user.getName());
|
|
|
|
|
// }
|
|
|
|
|
// message.setAccount(userId);
|
|
|
|
|
//
|
|
|
|
|
// message.setCreateUser(NumberUtils.toLong(userId));
|
|
|
|
|
// messageClient.sendMessage(message);
|
|
|
|
|
// }
|
|
|
|
|
BusinessMessageDTO businessMessageDTO = new BusinessMessageDTO(); |
|
|
|
|
businessMessageDTO.setBusinessClassify("business"); |
|
|
|
|
businessMessageDTO.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getKey()); |
|
|
|
|
businessMessageDTO.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONTICKETMESSAGE.getDescription()); |
|
|
|
|
businessMessageDTO.setTaskId(standardTicketInfoEntity.getId()); |
|
|
|
|
businessMessageDTO.setTenantId("200000"); |
|
|
|
|
//您有一张工作票待审批,工作内容:*****,审批环节:*****;
|
|
|
|
|
String countent = |
|
|
|
|
"您有一张工作票待审批,工作内容:".concat(standardTicketInfoEntity.getTitle()) |
|
|
|
|
.concat(",审批环节:") |
|
|
|
|
.concat(response.getTaskName()); |
|
|
|
|
message.setContent(countent); |
|
|
|
|
message.setDeptId(standardTicketInfoEntity.getCreateDept()); |
|
|
|
|
businessMessageDTO.setContent(countent); |
|
|
|
|
businessMessageDTO.setDeptId(standardTicketInfoEntity.getCreateDept()); |
|
|
|
|
R<String> deptName = sysClient.getDeptName(standardTicketInfoEntity.getCreateDept()); |
|
|
|
|
if (deptName.isSuccess()) { |
|
|
|
|
message.setDeptName(deptName.getData()); |
|
|
|
|
businessMessageDTO.setDeptName(deptName.getData()); |
|
|
|
|
} |
|
|
|
|
String userIds = response.getUserId(); |
|
|
|
|
if (StringUtils.isBlank(userIds)) { |
|
|
|
|
log.error("推送的消息不能为空哦,{}", userIds); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
String[] split = userIds.split(","); |
|
|
|
|
for (String userId : split) { |
|
|
|
|
message.setPusher(userId); |
|
|
|
|
User user = UserCache.getUser(NumberUtils.toLong(userId)); |
|
|
|
|
if (ObjectUtils.isNotEmpty(user)) { |
|
|
|
|
message.setPusherName(user.getName()); |
|
|
|
|
} |
|
|
|
|
message.setAccount(userId); |
|
|
|
|
|
|
|
|
|
message.setCreateUser(NumberUtils.toLong(userId)); |
|
|
|
|
messageClient.sendMessage(message); |
|
|
|
|
businessMessageDTO.setUserIds(userIds); |
|
|
|
|
businessMessageDTO.setCreateUser(newStandardTicketInfoEntity.getCreateUser()); |
|
|
|
|
|
|
|
|
|
System.out.println("================================================"); |
|
|
|
|
System.out.println("businessMessageDTO = " + businessMessageDTO); |
|
|
|
|
System.out.println("================================================"); |
|
|
|
|
R booleanR = messageClient.sendAppAndWsMsgByUsers(businessMessageDTO); |
|
|
|
|
if (!booleanR.isSuccess()) { |
|
|
|
|
throw new ServiceException("消息推送失败"); |
|
|
|
|
} |
|
|
|
|
log.info("推送成功~"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -288,8 +312,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
|
|
|
|
|
params.put("taskId", standardTicketInfoVo.getId()); |
|
|
|
|
params.put("guardianUserIds", "taskUser_".concat(standardTicketInfoVo.getGuardian().toString())); |
|
|
|
|
//已开启流程
|
|
|
|
|
R<BladeFlow> processInstanceContainNameByKey = flowClient.startProcessInstanceContainNameByKey(dictValue, |
|
|
|
|
String.valueOf(standardTicketInfoVo.getId()), standardTicketInfoVo.getTitle(), params); |
|
|
|
|
R<BladeFlow> processInstanceContainNameByKey = flowClient.startProcessInstanceContainNameByKey(dictValue, String.valueOf(standardTicketInfoVo.getId()), standardTicketInfoVo.getTitle(), params); |
|
|
|
|
if (!processInstanceContainNameByKey.isSuccess()) { |
|
|
|
|
log.error("processInstanceContainNameByKey {}", processInstanceContainNameByKey.getMsg()); |
|
|
|
|
throw new ServiceException("不好意思,您暂无权限..."); |
|
|
|
@ -311,8 +334,7 @@ public class OperationTicketServiceImpl implements OperationTicketService {
|
|
|
|
|
private List<StandardTicketMeasureEntity> saveStandardTicketMeasureWichTicket(StandardTicketInfoVo standardTicketInfoVo) { |
|
|
|
|
List<StandardTicketMeasureVo> standardTicketMeasureVos = standardTicketInfoVo.getStandardTicketMeasureVos(); |
|
|
|
|
if (CollectionUtils.isNotEmpty(standardTicketMeasureVos)) { |
|
|
|
|
List<StandardTicketMeasureEntity> measureEntityList = BeanUtil.copyProperties(standardTicketMeasureVos, |
|
|
|
|
StandardTicketMeasureEntity.class); |
|
|
|
|
List<StandardTicketMeasureEntity> measureEntityList = BeanUtil.copyProperties(standardTicketMeasureVos, StandardTicketMeasureEntity.class); |
|
|
|
|
List<StandardTicketMeasureEntity> collect = measureEntityList.stream().map(item -> { |
|
|
|
|
item.setTicketId(standardTicketInfoVo.getId()); |
|
|
|
|
return item; |
|
|
|
|