jz.kai пре 1 година
родитељ
комит
bd5c95e4d6

+ 15 - 3
web/src/main/java/com/jpsoft/employment/modules/base/api/NewsApi.java

@@ -5,9 +5,11 @@ import com.jpsoft.employment.modules.base.entity.*;
 import com.jpsoft.employment.modules.base.service.ImageWallService;
 import com.jpsoft.employment.modules.base.service.NewsInfoService;
 import com.jpsoft.employment.modules.base.service.NewsRegUserService;
+import com.jpsoft.employment.modules.base.service.RegUserService;
 import com.jpsoft.employment.modules.common.dto.MessageResult;
 import com.jpsoft.employment.modules.common.dto.Sort;
 import com.jpsoft.employment.modules.common.utils.PojoUtils;
+import com.jpsoft.employment.modules.common.utils.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
@@ -31,6 +33,8 @@ public class NewsApi {
     private NewsInfoService newsInfoService;
     @Autowired
     private NewsRegUserService newsRegUserService;
+    @Autowired
+    private RegUserService regUserService;
 
     @ApiOperation(value="列表")
     @RequestMapping(value = "list",method = RequestMethod.POST)
@@ -40,13 +44,21 @@ public class NewsApi {
         MessageResult msgResult = new MessageResult<>();
 
         Map<String,Object> searchParams = new HashMap<>();
-        searchParams.put("types", new String[]{"1","2","3"});
+        searchParams.put("types", new String[]{"1","2","3","5"});
 
         List<Sort> sortList = new ArrayList<>();
         sortList.add(new Sort("is_top","desc"));
         sortList.add(new Sort("create_time","desc"));
 
         Page<NewsInfo> page = newsInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+        for(NewsInfo newsInfo : page.getResult()){
+            if(StringUtils.isEmpty(newsInfo.getCreateByN())){
+                RegUser regUser = regUserService.get(newsInfo.getCreateBy());
+                if(regUser != null){
+                    newsInfo.setCreateByN(regUser.getRealName());
+                }
+            }
+        }
 
         msgResult.setResult(true);
         msgResult.setData(PojoUtils.pageWrapper(page));
@@ -62,7 +74,7 @@ public class NewsApi {
 
         Map<String,Object> searchParams = new HashMap<>();
         searchParams.put("regUserId",subject);
-        searchParams.put("types", new String[]{"1","2","3"});
+        searchParams.put("types", new String[]{"1","2","3","5"});
 
         List<Sort> sortList = new ArrayList<>();
         sortList.add(new Sort("create_time","desc"));
@@ -85,7 +97,7 @@ public class NewsApi {
 
         Map<String,Object> searchParams = new HashMap<>();
         searchParams.put("regUserId",subject);
-        searchParams.put("types", new String[]{"1","2","3"});
+        searchParams.put("types", new String[]{"1","2","3","5"});
 
         List<Sort> sortList = new ArrayList<>();
         sortList.add(new Sort("create_time","desc"));

+ 3 - 3
web/src/main/java/com/jpsoft/employment/modules/base/api/ParticipateApi.java

@@ -111,10 +111,10 @@ public class ParticipateApi {
 
                 NewsInfo newsInfo = new NewsInfo();
                 newsInfo.setId(UUID.randomUUID().toString());
-                newsInfo.setTitle(String.format("{0}参与了{1}项目",regUserService.get(subject).getRealName(),loveProjectService.get(loveProjectId).getTitle()));
-                newsInfo.setType("0");
+                newsInfo.setTitle(String.format("%s参与了%s项目",regUserService.get(subject).getRealName(),loveProjectService.get(loveProjectId).getTitle()));
+                newsInfo.setType("5");
                 newsInfo.setIsTop(false);
-                newsInfo.setContent(String.format("{0}参与了{1}项目",regUserService.get(subject).getRealName(),loveProjectService.get(loveProjectId).getTitle()));
+                newsInfo.setContent(String.format("%s参与了%s项目",regUserService.get(subject).getRealName(),loveProjectService.get(loveProjectId).getTitle()));
                 newsInfo.setDelFlag(false);
                 newsInfo.setCreateBy(subject);
                 newsInfo.setCreateTime(new Date());

+ 3 - 3
web/src/main/java/com/jpsoft/employment/modules/base/api/VolunteerApi.java

@@ -116,10 +116,10 @@ public class VolunteerApi {
 
             NewsInfo newsInfo = new NewsInfo();
             newsInfo.setId(UUID.randomUUID().toString());
-            newsInfo.setTitle(String.format("{0}申请了志愿者项目",regUserService.get(subject).getRealName()));
-            newsInfo.setType("0");
+            newsInfo.setTitle(String.format("%s申请了志愿者项目",regUserService.get(subject).getRealName()));
+            newsInfo.setType("5");
             newsInfo.setIsTop(false);
-            newsInfo.setContent(String.format("{0}申请了志愿者项目“{1}”",regUserService.get(subject).getRealName(),volunteerTasksService.get(tasksId).getIntroduce()));
+            newsInfo.setContent(String.format("%s申请了志愿者项目“%s”",regUserService.get(subject).getRealName(),volunteerTasksService.get(tasksId).getIntroduce()));
             newsInfo.setDelFlag(false);
             newsInfo.setCreateBy(subject);
             newsInfo.setCreateTime(new Date());

+ 3 - 3
web/src/main/java/com/jpsoft/employment/modules/base/api/WishApi.java

@@ -246,10 +246,10 @@ public class WishApi {
 
                 NewsInfo newsInfo = new NewsInfo();
                 newsInfo.setId(UUID.randomUUID().toString());
-                newsInfo.setTitle(String.format("{0}参加了{1}的作品互换",regUserService.get(subject).getRealName(),studentAspirationsService.get(studentAspirationsId).getStudentName()));
-                newsInfo.setType("0");
+                newsInfo.setTitle(String.format("%s参加了%s的作品互换",regUserService.get(subject).getRealName(),studentAspirationsService.get(studentAspirationsId).getStudentName()));
+                newsInfo.setType("5");
                 newsInfo.setIsTop(false);
-                newsInfo.setContent(String.format("{0}参加了{1}的作品互换",regUserService.get(subject).getRealName(),studentAspirationsService.get(studentAspirationsId).getStudentName()));
+                newsInfo.setContent(String.format("%s参加了%s的作品互换",regUserService.get(subject).getRealName(),studentAspirationsService.get(studentAspirationsId).getStudentName()));
                 newsInfo.setDelFlag(false);
                 newsInfo.setCreateBy(subject);
                 newsInfo.setCreateTime(new Date());

+ 6 - 6
web/src/main/resources/application-dev.yml

@@ -5,12 +5,12 @@ server:
 
 spring:
   datasource:
-#     url: jdbc:log4jdbc:mysql://192.168.33.20:3306/love_donation?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-#     username: root
-#     password: jpsoft2016
-    url: jdbc:log4jdbc:mysql://116.62.150.160:3306/love_donation?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-    username: root
-    password: jpsoft
+     url: jdbc:log4jdbc:mysql://192.168.33.20:3306/love_donation?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+     username: root
+     password: jpsoft2016
+#    url: jdbc:log4jdbc:mysql://116.62.150.160:3306/love_donation?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+#    username: root
+#    password: jpsoft
   devtools:
     add-properties: false
     restart: