Browse Source

1.创建时间添加

yuanliang 1 year ago
parent
commit
88e58ef35e

+ 10 - 8
cooleshow-app/src/main/java/com/yonge/cooleshow/student/controller/SysSuggestionV2Controller.java

@@ -23,26 +23,22 @@ import com.yonge.cooleshow.biz.dal.wrapper.SysMessageWrapper;
 import com.yonge.cooleshow.biz.dal.wrapper.SysSuggestionWrapper;
 import com.yonge.cooleshow.common.controller.BaseController;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.joda.time.DateTime;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -128,7 +124,11 @@ public class SysSuggestionV2Controller extends BaseController {
                           @RequestHeader(name = "user-agent") String userAgent) {
         com.yonge.cooleshow.auth.api.entity.SysUser sysUser = sysUserFeignService.queryUserInfo();
         suggestion.setUserId(sysUser.getId());
-        suggestion.setUserAgent(userAgent);
+        String userAgent1 = suggestion.getUserAgent();
+        if(StringUtils.isEmpty(userAgent1)){
+            userAgent1 = userAgent;
+        }
+        suggestion.setUserAgent(userAgent1);
 
         Student student = studentService.getById(sysUser.getId());
         if (student.getTenantId() != null && student.getTenantId() != -1) {
@@ -137,7 +137,9 @@ public class SysSuggestionV2Controller extends BaseController {
             suggestion.setClientType(ClientEnum.STUDENT);
         }
 
-        return R.from(sysSuggestionService.add(JSON.parseObject(suggestion.jsonString(), SysSuggestionV2.class)));
+        SysSuggestionV2 sysSuggestion = JSON.parseObject(suggestion.jsonString(), SysSuggestionV2.class);
+        sysSuggestion.setCreateTime(new Date());
+        return R.from(sysSuggestionService.add(sysSuggestion));
     }
 
     @ApiOperation(value = "未读消息统计", notes = "统计当前用户推送未读消息数")

+ 4 - 1
cooleshow-app/src/main/java/com/yonge/cooleshow/teacher/controller/SysSuggestionV2Controller.java

@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -121,7 +122,9 @@ public class SysSuggestionV2Controller extends BaseController {
         suggestion.setUserAgent(userAgent1);
         suggestion.setClientType(ClientEnum.TEACHER);
 
-        return R.from(sysSuggestionService.add(JSON.parseObject(suggestion.jsonString(), SysSuggestionV2.class)));
+        SysSuggestionV2 sysSuggestion = JSON.parseObject(suggestion.jsonString(), SysSuggestionV2.class);
+        sysSuggestion.setCreateTime(new Date());
+        return R.from(sysSuggestionService.add(sysSuggestion));
     }
 
     @ApiOperation(value = "未读消息统计", notes = "统计当前用户推送未读消息数")