|
@@ -160,7 +160,7 @@ public class TblEventController extends BaseController {
|
|
|
// @SaCheckPermission("system:event:generate")
|
|
|
@Log(title = "事件", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/generate/{id}")
|
|
|
- public R<Void> generate(@NotNull(message = "主键不能为空") @PathVariable Long id){
|
|
|
+ public R<Void> generate(@NotNull(message = "主键不能为空") @PathVariable Long id,@RequestParam String type){
|
|
|
TblEventVo tblEventVo = tblEventService.queryById(id);
|
|
|
if(tblEventVo== null){
|
|
|
return R.fail("事件不存在");
|
|
@@ -185,30 +185,34 @@ public class TblEventController extends BaseController {
|
|
|
try{
|
|
|
data.put("事件来源", JSONUtil.parseObj(tblEventVo.getExt2()).getStr("from"));
|
|
|
|
|
|
- data.put("事件首报", Base64Decoder.decodeStr(JSONUtil.parseObj(tblEventVo.getExt2()).getStr("firstContent")));
|
|
|
- data.put("事件核实", JSONUtil.parseObj(tblEventVo.getExt2()).getJSONArray("reports").stream().map(it->{
|
|
|
- if(it!=null && it instanceof JSONObject){
|
|
|
- return ((JSONObject) it).getStr("dept") + ":" + ((JSONObject) it).getStr("content");
|
|
|
- }
|
|
|
- return "";
|
|
|
- }).collect(Collectors.joining(",")));
|
|
|
-
|
|
|
- String eventString = JSONUtil.toJsonStr( data);
|
|
|
- Map<String, Object> workflowInputs = new HashMap<>();
|
|
|
-
|
|
|
- workflowInputs.put("report", data.get("事件首报"));
|
|
|
- workflowInputs.put("event", data.get("事件核实"));
|
|
|
- try {
|
|
|
- String workflowResult = difyUtil.runWorkflow(
|
|
|
- null,
|
|
|
- workflowInputs,
|
|
|
- "blocking",
|
|
|
- "user-12",difykey1
|
|
|
- );
|
|
|
- System.out.println("工作流结果: " + workflowResult);
|
|
|
- return R.ok(workflowResult);
|
|
|
-
|
|
|
- }catch (Exception e){}
|
|
|
+ if(!type.equals("1")){
|
|
|
+ data.put("事件首报", Base64Decoder.decodeStr(JSONUtil.parseObj(tblEventVo.getExt2()).getStr("firstContent")));
|
|
|
+ data.put("事件核实", JSONUtil.parseObj(tblEventVo.getExt2()).getJSONArray("reports").stream().map(it->{
|
|
|
+ if(it!=null && it instanceof JSONObject){
|
|
|
+ return ((JSONObject) it).getStr("dept") + ":" + ((JSONObject) it).getStr("content");
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }).collect(Collectors.joining(",")));
|
|
|
+
|
|
|
+ String eventString = JSONUtil.toJsonStr( data);
|
|
|
+ Map<String, Object> workflowInputs = new HashMap<>();
|
|
|
+
|
|
|
+ workflowInputs.put("report", data.get("事件首报"));
|
|
|
+ workflowInputs.put("event", data.get("事件核实"));
|
|
|
+ try {
|
|
|
+ String workflowResult = difyUtil.runWorkflow(
|
|
|
+ null,
|
|
|
+ workflowInputs,
|
|
|
+ "blocking",
|
|
|
+ "user-12",difykey1
|
|
|
+ );
|
|
|
+ System.out.println("工作流结果: " + workflowResult);
|
|
|
+ return R.ok(workflowResult);
|
|
|
+
|
|
|
+ }catch (Exception e){}
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|