From 0d0ab69d42bcfcd3a980405a0d06bbe51a3564eb Mon Sep 17 00:00:00 2001
From: PerryHsu <perryhsu@163.com>
Date: 星期日, 18 十二月 2022 16:04:26 +0800
Subject: [PATCH] 告警派工单更新

---
 src/main/java/com/whyc/service/WorksheetMainService.java |   42 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/whyc/service/WorksheetMainService.java b/src/main/java/com/whyc/service/WorksheetMainService.java
index 5bb242b..ad10e28 100644
--- a/src/main/java/com/whyc/service/WorksheetMainService.java
+++ b/src/main/java/com/whyc/service/WorksheetMainService.java
@@ -1,12 +1,19 @@
 package com.whyc.service;
 
+import com.whyc.constant.EnumWorksheetType;
 import com.whyc.dto.Response;
 import com.whyc.mapper.WorksheetMainMapper;
 import com.whyc.pojo.UserInf;
+import com.whyc.pojo.WorksheetAlarm;
+import com.whyc.pojo.WorksheetLink;
 import com.whyc.pojo.WorksheetMain;
+import com.whyc.util.DateUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.Date;
 
 /**
  * @author perryhsu
@@ -18,8 +25,39 @@
     @Resource
     private WorksheetMainMapper mapper;
 
+    @Autowired
+    private WorksheetLinkService linkService;
+
+    @Autowired
+    private WorksheetAlarmService alarmService;
+
+    @Transactional
     public Response alarmFlowSubmit(WorksheetMain main, UserInf user) {
-        //TODO 寰呭鐞�
-        return null;
+        WorksheetAlarm worksheetAlarm = main.getWorksheetAlarm();
+        //瀛樺叆涓昏〃淇℃伅,瀛愯〃淇℃伅,闄勮〃鍛婅淇℃伅
+        Date date = new Date();
+        String formatDate = DateUtil.YYYY_MM_DD_HH_MM_SS_UNION.format(date);
+        main.setTitle("鍛婅娲惧伐鍗�-"+user.getUName()+"-"+formatDate);
+        main.setCreateUserId(user.getUId());
+        main.setBeginTime(date);
+        main.setStatus(1);
+        main.setType(EnumWorksheetType.ProductBom.getType());
+        mapper.insert(main);
+        //瀛愯〃
+        Long nextUser = main.getNextUser();
+        WorksheetLink link = new WorksheetLink();
+        link.setMainId(main.getId());
+        link.setParentId(0);
+        link.setDealUserId(nextUser);
+        link.setDealDesc(main.getDescription());
+        link.setLinkStatus(0);
+        link.setCreateTime(date);
+        linkService.add(link);
+        //闄勮〃鍛婅琛�
+        worksheetAlarm.setMainId(main.getId());
+        worksheetAlarm.setCreateTime(date);
+        alarmService.insert(worksheetAlarm);
+
+        return new Response().setII(1,"鎻愪氦瀹屾垚");
     }
 }

--
Gitblit v1.9.1