|
|
@ -36,8 +36,12 @@ import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.flow.core.entity.BladeFlow; |
|
|
|
import org.springblade.flow.core.entity.BladeFlow; |
|
|
|
import org.springblade.flow.core.feign.IFlowClient; |
|
|
|
import org.springblade.flow.core.feign.IFlowClient; |
|
|
|
|
|
|
|
import org.springblade.message.MessageConstants; |
|
|
|
|
|
|
|
import org.springblade.message.dto.BusinessMessageDTO; |
|
|
|
|
|
|
|
import org.springblade.message.fegin.IMessageClient; |
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
import org.springblade.system.entity.Dict; |
|
|
|
import org.springblade.system.entity.Dict; |
|
|
|
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
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.Value; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
@ -56,6 +60,7 @@ import java.util.*; |
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class AccessTicketServiceImpl extends ServiceImpl<AccessTicketMapper, AccessTicketEntity> implements AccessTicketService { |
|
|
|
public class AccessTicketServiceImpl extends ServiceImpl<AccessTicketMapper, AccessTicketEntity> implements AccessTicketService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ISysClient sysClient; |
|
|
|
|
|
|
|
|
|
|
|
private final IUserClient userClient; |
|
|
|
private final IUserClient userClient; |
|
|
|
|
|
|
|
|
|
|
@ -63,6 +68,8 @@ public class AccessTicketServiceImpl extends ServiceImpl<AccessTicketMapper, Acc |
|
|
|
|
|
|
|
|
|
|
|
private final IEmInfoClient deviceClient; |
|
|
|
private final IEmInfoClient deviceClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IMessageClient messageClient; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.ticket.accessTicket.save.pdf}") |
|
|
|
@Value("${hzims.ticket.accessTicket.save.pdf}") |
|
|
|
private String savePdfPath; |
|
|
|
private String savePdfPath; |
|
|
|
|
|
|
|
|
|
|
@ -167,11 +174,44 @@ public class AccessTicketServiceImpl extends ServiceImpl<AccessTicketMapper, Acc |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 消息推送
|
|
|
|
|
|
|
|
String countent = "您有一条检修报单流程待处理!单据名称:".concat(DateUtil.format(entity.getCreateTime(),DateUtil.PATTERN_DATETIME) + "_" + entity.getDeviceName() + "_检修工作票") |
|
|
|
|
|
|
|
.concat(",当前环节:") |
|
|
|
|
|
|
|
.concat(processWorkFlowResponse.getTaskName());; |
|
|
|
|
|
|
|
this.sendMessage(entity,processWorkFlowResponse.getUserId(),countent); |
|
|
|
return this.updateById(entity); |
|
|
|
return this.updateById(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
|
|
|
|
* 推送业务流程消息 |
|
|
|
|
|
|
|
* @param entity |
|
|
|
|
|
|
|
* @param userId |
|
|
|
|
|
|
|
* @param content |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void sendMessage(AccessTicketEntity entity, String userId, String content) { |
|
|
|
|
|
|
|
BusinessMessageDTO message = new BusinessMessageDTO(); |
|
|
|
|
|
|
|
// 计划Id
|
|
|
|
|
|
|
|
message.setTaskId(entity.getId()); |
|
|
|
|
|
|
|
message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.BUSINESS.getKey()); |
|
|
|
|
|
|
|
message.setBusinessKey("access_ticket"); |
|
|
|
|
|
|
|
// 主题
|
|
|
|
|
|
|
|
message.setSubject("检修工作票"); |
|
|
|
|
|
|
|
message.setDeptId(entity.getCreateDept()); |
|
|
|
|
|
|
|
R<String> result = sysClient.getDeptName(entity.getCreateDept()); |
|
|
|
|
|
|
|
if (result.isSuccess()) { |
|
|
|
|
|
|
|
message.setDeptName(result.getData()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 内容
|
|
|
|
|
|
|
|
message.setContent(content); |
|
|
|
|
|
|
|
message.setTenantId(entity.getTenantId()); |
|
|
|
|
|
|
|
User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData(); |
|
|
|
|
|
|
|
message.setCreateUser(admin.getId()); |
|
|
|
|
|
|
|
message.setUserIds(userId); |
|
|
|
|
|
|
|
messageClient.sendAppAndWsMsgByUsers(message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 保存检修工作票 |
|
|
|
* 保存检修工作票 |
|
|
|
* @param param |
|
|
|
* @param param |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -207,26 +247,9 @@ public class AccessTicketServiceImpl extends ServiceImpl<AccessTicketMapper, Acc |
|
|
|
* @param entity |
|
|
|
* @param entity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean start(AccessTicketEntity entity) { |
|
|
|
private boolean start(AccessTicketEntity entity) { |
|
|
|
/* 并行人员设置 |
|
|
|
|
|
|
|
// 项目负责人
|
|
|
|
|
|
|
|
User header = queryRoleUser("200000", Long.valueOf(AuthUtil.getDeptId()), "accessTicketHead"); |
|
|
|
|
|
|
|
variables.put("charge","taskUser_" + header.getId()); |
|
|
|
|
|
|
|
// 许可人
|
|
|
|
|
|
|
|
User licensor = queryRoleUser("200000", Long.valueOf(AuthUtil.getDeptId()), "accessTicketLicensor"); |
|
|
|
|
|
|
|
variables.put("licensor","taskUser_" + licensor.getId()); |
|
|
|
|
|
|
|
// 外部单位负责人
|
|
|
|
|
|
|
|
User external = queryRoleUser("200000", Long.valueOf(AuthUtil.getDeptId()), "external"); |
|
|
|
|
|
|
|
variables.put("external","taskUser_" + external.getId()); |
|
|
|
|
|
|
|
// 设备负责人
|
|
|
|
|
|
|
|
User manage = queryRoleUser("200000", Long.valueOf(AuthUtil.getDeptId()), "deviceManage"); |
|
|
|
|
|
|
|
variables.put("manage","taskUser_" + manage.getId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
variables.put("persons", Arrays.asList("taskUser_" + header.getId(),"taskUser_" + licensor.getId(),"taskUser_" + external.getId(),"taskUser_" + manage.getId())); |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(entity,DateUtil.PATTERN_DATETIME), Map.class); |
|
|
|
Map<String, Object> variables = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(entity,DateUtil.PATTERN_DATETIME), Map.class); |
|
|
|
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(AccessTicketConstants.ACCESS_TICKET_PROCESS_KEY, |
|
|
|
R<BladeFlow> result = flowClient.startProcessInstanceContainNameByKey(AccessTicketConstants.ACCESS_TICKET_PROCESS_KEY, |
|
|
|
StringUtil.format("{}:{}",AccessTicketConstants.ACCESS_TICKET_TABLE, entity.getId()), DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME) +"_" + entity.getDeviceName() + "_检修工作票", variables); |
|
|
|
StringUtil.format("{}:{}",AccessTicketConstants.ACCESS_TICKET_TABLE, entity.getId()), entity.getCreateTime() +"_" + entity.getDeviceName() + "_检修工作票", variables); |
|
|
|
log.info("access_ticket : start_process_result _ {}",result); |
|
|
|
log.info("access_ticket : start_process_result _ {}",result); |
|
|
|
// 更新任务流程Id
|
|
|
|
// 更新任务流程Id
|
|
|
|
if (!result.isSuccess() || 200 != result.getCode()) { |
|
|
|
if (!result.isSuccess() || 200 != result.getCode()) { |
|
|
|