From 220bdea9288ee5b07f124900eb71ac1f56552b55 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 07 十二月 2019 15:26:30 +0800
Subject: [PATCH] 分享记录

---
 fanli/src/main/java/com/yeshi/fanli/controller/admin/AppPageNotificationAdminController.java |   45 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/AppPageNotificationAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/AppPageNotificationAdminController.java
index 7e967e9..bafe564 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/AppPageNotificationAdminController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/AppPageNotificationAdminController.java
@@ -1,13 +1,12 @@
 package com.yeshi.fanli.controller.admin;
 
 import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
 import javax.annotation.Resource;
-
-import net.sf.json.JSONObject;
 
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -22,6 +21,8 @@
 import com.yeshi.fanli.tag.PageEntity;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.StringUtil;
+
+import net.sf.json.JSONObject;
 
 @Controller
 @RequestMapping("admin/new/api/v1/notification")
@@ -62,6 +63,17 @@
 				appPageNotification.setMd5(StringUtil.Md5(null + "#" + content + "#" + appPageNotification.getContentUrl()));
 			}
 			
+			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+			
+			String beginTimeVO = appPageNotification.getBeginTimeVO();
+			if (!StringUtil.isNullOrEmpty(beginTimeVO)) {
+				appPageNotification.setBeginTime(format.parse(beginTimeVO.replaceAll("T", " ")));
+			}
+				
+			String endTimeVO = appPageNotification.getEndTimeVO();
+			if (!StringUtil.isNullOrEmpty(endTimeVO)) {
+				appPageNotification.setEndTime(format.parse(endTimeVO.replaceAll("T", " ")));
+			}
 			
 			appPageNotification.setCreateTime(new Date());
 			appPageNotification.setUpdateTime(new Date());
@@ -84,7 +96,6 @@
 	@RequestMapping(value = "saveModify")
 	public void saveModify(String callback, AppPageNotification appPageNotification, PrintWriter out) {
 		try {
-			
 			AppPageNotificationTypeEnum type = appPageNotification.getType();
 			if (type == null) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("ID涓嶈兘涓虹┖"));
@@ -101,6 +112,18 @@
 			if (StringUtil.isNullOrEmpty(content) ) {
 				JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏄剧ず鍐呭涓嶈兘涓虹┖"));
 				return;
+			}
+			
+			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+			
+			String beginTimeVO = appPageNotification.getBeginTimeVO();
+			if (!StringUtil.isNullOrEmpty(beginTimeVO)) {
+				appPageNotification.setBeginTime(format.parse(beginTimeVO.replaceAll("T", " ")));
+			}
+				
+			String endTimeVO = appPageNotification.getEndTimeVO();
+			if (!StringUtil.isNullOrEmpty(endTimeVO)) {
+				appPageNotification.setEndTime(format.parse(endTimeVO.replaceAll("T", " ")));
 			}
 			
 			appPageNotification.setMd5(StringUtil.Md5(type.name() + "#" + content + "#" + appPageNotification.getContentUrl()));
@@ -148,9 +171,25 @@
 				return;
 			}
 			
+			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
 			for (AppPageNotification notification: list) {
 				AppPageNotificationTypeEnum type = notification.getType();
 				notification.setPageName(type.getDesc());
+				
+				
+				Date startTime = notification.getBeginTime();
+				if (startTime == null) {
+					notification.setBeginTimeVO("");
+				} else {
+					notification.setBeginTimeVO(sdf.format(startTime));
+				}
+				
+				Date endTime = notification.getEndTime();
+				if (endTime == null) {
+					notification.setEndTimeVO("");
+				} else {
+					notification.setEndTimeVO(sdf.format(endTime));
+				}
 			}
 			
 			

--
Gitblit v1.8.0