Commit 9564c3f9 authored by zhangsen's avatar zhangsen

安装告知工作流信息

parent 6770ab6c
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice; import com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice;
import netscape.javascript.JSObject;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Map; import java.util.Map;
...@@ -58,7 +59,7 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot ...@@ -58,7 +59,7 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot
* @param model 数据 * @param model 数据
* @param submitType 保存类型 * @param submitType 保存类型
*/ */
void saveNotice(String submitType, Map<String, JgInstallationNoticeDto> model, ReginParams reginParams); void saveNotice(String submitType, Map<String, JSObject> model, ReginParams reginParams);
/** /**
* 打印告知单 * 打印告知单
......
...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService; ...@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.jg.api.service.IJgInstallationNoticeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import netscape.javascript.JSObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
...@@ -46,7 +47,7 @@ public class JgInstallationNoticeController extends BaseController { ...@@ -46,7 +47,7 @@ public class JgInstallationNoticeController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增安装告知", notes = "新增安装告知") @ApiOperation(httpMethod = "POST", value = "新增安装告知", notes = "新增安装告知")
public ResponseModel<String> save(@RequestParam String submitType, @RequestBody Map<String, JgInstallationNoticeDto> model) { public ResponseModel<String> save(@RequestParam String submitType, @RequestBody Map<String, JSObject> model) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
iJgInstallationNoticeService.saveNotice(submitType, model, reginParams); iJgInstallationNoticeService.saveNotice(submitType, model, reginParams);
......
package com.yeejoin.amos.boot.module.jg.biz.listener;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.model.TaskV2Model;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import javax.annotation.PostConstruct;
import java.util.List;
@Slf4j
@Component
public class PublicWorkFlowMessage extends EmqxListener {
@Autowired
protected EmqKeeper emqKeeper;
/**
* 创建任务主题
*/
public static final String WORKFLOW_TASK_CREATED = "workflow/task/created";
/**
* 执行完成任务主题
*/
public static final String WORKFLOW_TASK_COMPLETED = "workflow/task/completed";
// /**
// * 流程执行结束主题
// */
// public static final String WORKFLOW_PROCESS_COMPLETE = "workflow/process/complete";
@Autowired
private JgInstallationNoticeServiceImpl jgInstallationNoticeService;
@PostConstruct
void init() throws Exception {
emqKeeper.subscript(WORKFLOW_TASK_CREATED, 2, this);
emqKeeper.subscript(WORKFLOW_TASK_COMPLETED, 2, this);
// emqKeeper.subscript(WORKFLOW_PROCESS_COMPLETE, 2, this);
}
@Override
public void processMessage(String topic, MqttMessage message) throws Exception {
JSONObject messageObject = JSON.parseObject(new String(message.getPayload()));
String businessKey = messageObject.get("businessKey").toString();
String[] s = businessKey.split("_");
String businessId = s[0];
String type = s[1];
messageObject.put("businessId", businessId);
if (topic.equals(WORKFLOW_TASK_CREATED)) {
if ("installationNotice".equals(type)) {
jgInstallationNoticeService.updateByWorkFlow(messageObject);
}
} else if (topic.equals(WORKFLOW_TASK_COMPLETED)) {
if ("installationNotice".equals(type)) {
jgInstallationNoticeService.completeWorkFlow(messageObject);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment