From c7d5088dbd18cbbcb98d12aeac35e7d38cdf93be Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Sun, 26 Sep 2021 17:31:23 +0800
Subject: [PATCH] 臭氧8小时滑动值算法,分钟,小时数据时间变更为开始时间

---
 screen-manage/src/main/java/com/moral/api/pojo/form/organization/OrganizationInsertForm.java |   44 +++++++++++++++++++++++---------------------
 1 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/screen-manage/src/main/java/com/moral/api/pojo/form/organization/OrganizationInsertForm.java b/screen-manage/src/main/java/com/moral/api/pojo/form/organization/OrganizationInsertForm.java
index 98cc70c..a4aff0e 100644
--- a/screen-manage/src/main/java/com/moral/api/pojo/form/organization/OrganizationInsertForm.java
+++ b/screen-manage/src/main/java/com/moral/api/pojo/form/organization/OrganizationInsertForm.java
@@ -1,11 +1,13 @@
 package com.moral.api.pojo.form.organization;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.moral.api.entity.Organization;
 import com.moral.api.pojo.dto.organization.OrganizationDTO;
 import com.moral.constant.ResponseCodeEnum;
 import com.moral.util.DateUtils;
 import com.moral.util.RegexUtils;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.util.ObjectUtils;
 
 import java.io.Serializable;
@@ -20,7 +22,7 @@
  * @Version TODO
  **/
 @Data
-public class OrganizationInsertForm implements Serializable {
+public class OrganizationInsertForm {
 
     private Integer parentId;
 
@@ -28,15 +30,19 @@
 
     private Integer provinceCode;
 
+    private String provinceName;
+
     private Integer cityCode;
+
+    private String cityName;
 
     private Integer areaCode;
 
-    private Long townCode;
+    private String areaName;
 
-    private Long villageCode;
+    private Integer locationLevelCode;
 
-    private String locationLevel;
+    private String locationLevelName;
 
     private String address;
 
@@ -46,15 +52,17 @@
 
     private String wechat;
 
-    private String expireTime;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    private Date expireTime;
 
     public boolean valid() {
         if (
                 ObjectUtils.isEmpty(name) ||
                         ObjectUtils.isEmpty(provinceCode) ||
-                        ObjectUtils.isEmpty(cityCode) ||
-                        ObjectUtils.isEmpty(areaCode) ||
-                        ObjectUtils.isEmpty(locationLevel) ||
+                        ObjectUtils.isEmpty(provinceName) ||
+                        ObjectUtils.isEmpty(locationLevelCode) ||
+                        ObjectUtils.isEmpty(locationLevelName)||
                         ObjectUtils.isEmpty(address) ||
                         ObjectUtils.isEmpty(expireTime)
                 )
@@ -67,17 +75,18 @@
         organization.setParentId(parentId);
         organization.setName(name);
         organization.setProvinceCode(provinceCode);
+        organization.setProvinceName(provinceName);
         organization.setCityCode(cityCode);
+        organization.setCityName(cityName);
         organization.setAreaCode(areaCode);
-        organization.setTownCode(townCode);
-        organization.setVillageCode(villageCode);
-        organization.setLocationLevel(locationLevel);
+        organization.setAreaName(areaName);
+        organization.setLocationLevelCode(locationLevelCode);
+        organization.setLocationLevelName(locationLevelName);
         organization.setAddress(address);
         organization.setPhone(phone);
         organization.setEmail(email);
         organization.setWechat(wechat);
-        Date expireTimeDate = DateUtils.getDate(expireTime + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
-        organization.setExpireTime(expireTimeDate);
+        organization.setExpireTime(expireTime);
         return organization;
     }
 
@@ -100,16 +109,9 @@
                 return dto;
             }
         }
-        //������������������������
-        if (!RegexUtils.checkDate(expireTime)) {
-            dto.setCode(ResponseCodeEnum.TIME_FORMAT_INVALID.getCode());
-            dto.setMsg(ResponseCodeEnum.TIME_FORMAT_INVALID.getMsg());
-            return dto;
-        }
         //������������������������������������������
-        Date expireDate = DateUtils.getDate(expireTime, "yyyy-MM-dd");
         Date currentDate = new Date();
-        if (DateUtils.compareDateStr(expireDate, currentDate) >= 0) {
+        if (DateUtils.compareDateStr(expireTime, currentDate) >= 0) {
             dto.setCode(ResponseCodeEnum.TIME_INVALID.getCode());
             dto.setMsg(ResponseCodeEnum.TIME_INVALID.getMsg());
             return dto;

--
Gitblit v1.8.0