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