From cf74cf76707710a08ffcdfc13c46706966f12803 Mon Sep 17 00:00:00 2001
From: shicf <shi_chongfu@163.com>
Date: 星期四, 21 十一月 2024 17:35:45 +0800
Subject: [PATCH] 预警发送用户取当前人

---
 src/main/java/com/product/administration/controller/EarlyWarningManagerController.java |   68 ++++++++++++++++++++++++++++-----
 1 files changed, 57 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/product/administration/controller/EarlyWarningManagerController.java b/src/main/java/com/product/administration/controller/EarlyWarningManagerController.java
index b6ddbfe..29e0ed7 100644
--- a/src/main/java/com/product/administration/controller/EarlyWarningManagerController.java
+++ b/src/main/java/com/product/administration/controller/EarlyWarningManagerController.java
@@ -1,17 +1,7 @@
 package com.product.administration.controller;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import com.product.admin.service.PublicService;
 import com.product.admin.service.idel.IPublicService;
-import com.product.core.spring.context.SpringMVCContextHolder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.product.administration.config.CmnConst;
 import com.product.administration.config.SystemCode;
 import com.product.administration.service.EarlyWarningManagerService;
@@ -25,7 +15,18 @@
 import com.product.core.entity.FieldSetEntity;
 import com.product.core.entity.RequestParameterEntity;
 import com.product.core.exception.BaseException;
+import com.product.core.spring.context.SpringMVCContextHolder;
 import com.product.module.sys.version.ApiVersion;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 
 /**
@@ -484,9 +485,13 @@
                 SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
                 return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
             }
-
+            if(fse.getObject("createDate")==null) {
+            	fse.setValue("createDate", new Date());
+            }
             IPublicService publicService = (IPublicService) getProxyInstance(this.publicService);
+            
             publicService.saveFieldSetEntity(fse);
+            
             earlyWarningManagerService.sendWarnFeedBackMessage(fse);
             return OK_List(earlyWarningManagerService.getWarnFeedBack(fse.getString("parent_uuid")));
         } catch (BaseException e) {
@@ -589,4 +594,45 @@
             return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage());
         }
     }
+
+
+    /**
+     * 鎵归噺淇敼棰勮鏃堕棿
+     *
+     * @param request
+     * @return
+     */
+    @PostMapping("/transmit/{version}")
+    @ApiVersion(1)
+    public String transmit(HttpServletRequest request) {
+        try {
+            //鑾峰彇鍙傛暟
+            FieldSetEntity fse = null;
+            Object bean = request.getAttribute(CoreConst.API_POST_REQUEST_DATA);
+            if (bean != null) {
+                RequestParameterEntity reqp = (RequestParameterEntity) bean;
+                fse = reqp.getFormData();
+            }
+            //鍒ゆ柇鍙傛暟鏄惁涓虹┖
+            if (bean == null || fse == null) {
+                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
+                return this.error(SystemCode.SYSTEM_FORM_NODATA.getValue(), SystemCode.SYSTEM_FORM_NODATA.getText());
+            }
+            if (fse.getTableName() == null) {
+                SpringMVCContextHolder.getSystemLogger().error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
+                return this.error(SystemCode.SYSTEM_TABLE_NODATA.getValue(), SystemCode.SYSTEM_TABLE_NODATA.getText());
+            }
+            IEarlyWarningManager service = (IEarlyWarningManager) getProxyInstance(earlyWarningManagerService);
+            service.transmit(fse);
+            return OK();
+        } catch (BaseException e) {
+            e.printStackTrace();
+            SpringMVCContextHolder.getSystemLogger().error(e);
+            return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage());
+        } catch (Exception e) {
+            e.printStackTrace();
+            SpringMVCContextHolder.getSystemLogger().error(e);
+            return this.error(SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getValue(), SystemCode.SYSTEM_EARLY_WARNING_UPDATE_FAIL.getText() + e.getMessage());
+        }
+    }
 }

--
Gitblit v1.9.2