git 5 years ago
parent
commit
83823fd790

+ 1 - 0
core/src/main/java/com/mooctest/crowd/domain/domainobject/TechnicalArticles.java

@@ -2,6 +2,7 @@ package com.mooctest.crowd.domain.domainobject;
 
 import lombok.Data;
 
+import java.sql.Date;
 import java.sql.Timestamp;
 
 @Data

+ 5 - 4
site/src/main/java/com/mooctest/crowd/site/data/vo/TechnicalArticlesVO.java

@@ -1,7 +1,6 @@
 package com.mooctest.crowd.site.data.vo;
 
 import com.mooctest.crowd.domain.domainobject.TechnicalArticles;
-import com.mooctest.crowd.domain.model.TechnicalArticlesPO;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
@@ -11,6 +10,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
+
 @Data
 @NoArgsConstructor
 public class TechnicalArticlesVO {
@@ -36,7 +36,7 @@ public class TechnicalArticlesVO {
         this.publicTime=project.getPublicTime();
         DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         try {
-            Date date = df.parse(df.format(project.getPublicTime()));
+            Date date =  df.parse(df.format(project.getPublicTime()));
             long[] times = getDistanceTimes(date);
             if(times[0]>0){
                 this.time_interval=times[0]+"天前发布";
@@ -44,8 +44,8 @@ public class TechnicalArticlesVO {
                 this.time_interval=times[1]+"小时前发布";
             }else if(times[2]>0){
                 this.time_interval=times[2]+"分钟前发布";
-            }else if(times[3]<0){
-                this.time_interval=times[3]*-1+"秒前发布";
+            }else{
+                this.time_interval=times[3]+"秒前发布";
             }
         } catch (ParseException e) {
             e.printStackTrace();
@@ -57,6 +57,7 @@ public class TechnicalArticlesVO {
         long min = 0;
         long sec = 0;
         long diff;
+
         diff = System.currentTimeMillis() - date.getTime();
         day = diff / (24 * 60 * 60 * 1000);
         hour = (diff / (60 * 60 * 1000) - day * 24);

+ 9 - 10
site/src/main/java/com/mooctest/crowd/site/mediator/impl/WebMediatorImpl.java

@@ -766,16 +766,15 @@ public class WebMediatorImpl implements ViewMediator {
     @Override
     public UserDTO updateInformation(long userId, UserVO userVO) {
         Optional<UserPO> userPO = userDao.findById(userId);
-        userPO.get().setUnit(userVO.getUnit());
-        userPO.get().setGender(userVO.getGender());
-        userPO.get().setBirthday(userVO.getBirthday());
-        userPO.get().setProvince(userVO.getProvince());
-        userPO.get().setCity(userVO.getCity());
-        userPO.get().setCounty(userVO.getCounty());
-        userPO.get().setDetailedAddress(userVO.getDetailedAddress());
-        userPO.get().setPersonalCompetence(userVO.getPersonalCompetence());
-        userDao.save(userPO.get());
-        this.getInformation(userId);
+            userPO.get().setUnit(userVO.getUnit());
+            userPO.get().setGender(userVO.getGender());
+            userPO.get().setBirthday(userVO.getBirthday());
+            userPO.get().setProvince(userVO.getProvince());
+            userPO.get().setCity(userVO.getCity());
+            userPO.get().setCounty(userVO.getCounty());
+            userPO.get().setDetailedAddress(userVO.getDetailedAddress());
+            userPO.get().setPersonalCompetence(userVO.getPersonalCompetence());
+            userDao.save(userPO.get());
         return this.getInformation(userId);
     }
 

+ 4 - 1
site/src/main/resources/application.yml

@@ -60,6 +60,7 @@ spring:
   profiles: dev
   datasource:
     url: jdbc:mysql://101.37.175.111:3306/crowd-test-service?useSSL=false&useUnicode=yes&characterEncoding=UTF-8
+
     username: mooctest
     password: secr3t!
   redis:
@@ -84,7 +85,8 @@ website:
 spring:
   profiles: dev-localhost
   datasource:
-    url: jdbc:mysql://101.37.175.111:3306/crowd-test-service?useSSL=false&useUnicode=yes&characterEncoding=UTF-8
+    url: jdbc:mysql://101.37.175.111:3306/crowd-test-service?useSSL=false&useUnicode=yes&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
+
     username: mooctest
     password: secr3t!
   redis:
@@ -110,6 +112,7 @@ spring:
   profiles: dev-pre
   datasource:
     url: jdbc:mysql://101.37.175.111:3306/crowd-test-service-pre?useSSL=false&useUnicode=yes&characterEncoding=UTF-8
+
     username: mooctest
     password: secr3t!
   redis: