Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
77124794
Commit
77124794
authored
Feb 22, 2022
by
刘基明
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2.3.1' into 'dev'
时间格式化 See merge request
!58
parents
0baa359f
20365d17
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
14 deletions
+23
-14
FundCompanyVO.java
...u/community/api/beans/vo/feign/product/FundCompanyVO.java
+3
-1
HomePageController.java
...va/com/tanpu/community/controller/HomePageController.java
+2
-3
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+1
-1
TopicService.java
...c/main/java/com/tanpu/community/service/TopicService.java
+3
-1
TimeUtils.java
...ice/src/main/java/com/tanpu/community/util/TimeUtils.java
+14
-8
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/vo/feign/product/FundCompanyVO.java
View file @
77124794
package
com
.
tanpu
.
community
.
api
.
beans
.
vo
.
feign
.
product
;
import
com.tanpu.community.api.beans.vo.feign.product.Net
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -16,6 +15,9 @@ public class FundCompanyVO {
@ApiModelProperty
(
"icon"
)
private
String
img
;
@ApiModelProperty
(
"公司类型,0 公募,1 私募,2 白名单,3 私有 "
)
private
String
type
;
@ApiModelProperty
(
"公司简介"
)
private
String
companyProfile
;
...
...
community-service/src/main/java/com/tanpu/community/controller/HomePageController.java
View file @
77124794
...
...
@@ -23,7 +23,6 @@ import io.swagger.annotations.ApiOperation;
import
io.swagger.annotations.ApiParam
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -41,10 +40,10 @@ import java.util.List;
@RequestMapping
(
value
=
"/api/homepage"
)
public
class
HomePageController
{
@
Autowired
@
Resource
private
HomePageManager
homePageManager
;
@
Autowired
@
Resource
private
ThemeManager
themeManager
;
@Resource
...
...
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
77124794
...
...
@@ -126,7 +126,7 @@ public class TopicManager {
return
CommonResp
.
error
(
ErrorCodeConstant
.
TOPIC_NOT_FOUND
.
getCode
(),
"抱歉!该话题已下线。"
);
}
//
//
检验权限
if
(
TopicSpecialPermissionEnum
.
TRUE
.
getCode
().
equals
(
topicEntity
.
getSpecialPermission
())
&&
!
topicService
.
checkPermission
(
topicId
,
userHolder
.
getUserId
()))
{
return
CommonResp
.
error
(
ErrorCodeConstant
.
TOPIC_PERMISSION_ABORT
.
getCode
(),
topicService
.
getPermissionToast
(
topicId
));
...
...
community-service/src/main/java/com/tanpu/community/service/TopicService.java
View file @
77124794
...
...
@@ -204,8 +204,10 @@ public class TopicService {
}
else
if
(
RelTypeEnum
.
FUND_COMPANY
.
type
.
equals
(
entity
.
getSubjectType
().
toString
()))
{
// 资管人
List
<
FundCompanyVO
>
fundCompany
=
feignService
.
getFundCompany
(
Collections
.
singletonList
(
entity
.
getSubjectId
()));
FundCompanyVO
company
=
fundCompany
.
get
(
0
);
company
.
setType
(
String
.
valueOf
(
entity
.
getSubjectSubType
()));
// 公司类型
TopicAttachment
attach
=
TopicAttachment
.
builder
().
type
(
RelTypeEnum
.
FUND_COMPANY
.
type
)
.
detail
(
TopicAttachmentDetail
.
builder
().
fundCompany
(
fundCompany
.
get
(
0
)
).
build
()).
build
();
.
detail
(
TopicAttachmentDetail
.
builder
().
fundCompany
(
company
).
build
()).
build
();
attachements
.
add
(
attach
);
}
else
if
(
RelTypeEnum
.
NEW_COURSE_WARE
.
type
.
equals
(
entity
.
getSubjectType
().
toString
()))
{
...
...
community-service/src/main/java/com/tanpu/community/util/TimeUtils.java
View file @
77124794
...
...
@@ -2,7 +2,9 @@ package com.tanpu.community.util;
import
java.time.Duration
;
import
java.time.Instant
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.ZoneId
;
import
java.time.format.DateTimeFormatter
;
...
...
@@ -41,16 +43,20 @@ public class TimeUtils {
/**
* 格式化话题列表时间
* 发布时间 = Today,显示时间格式:00:00 ,24小时制
* 发布时间 = Today-1,显示时间格式:昨日 00:00 ,24小时制
* 发布时间 <Today-1,显示时间格式:yyyy年mm月dd日
*/
public
static
String
formatTopicListTime
(
LocalDateTime
start
)
{
Duration
between
=
Duration
.
between
(
start
,
LocalDateTime
.
now
());
long
duration
=
between
.
toMinutes
();
if
(
duration
<
60
*
24
)
{
return
start
.
format
(
DateTimeFormatter
.
ofPattern
(
" HH:mm"
));
}
else
if
(
duration
<
60
*
48
)
{
return
start
.
format
(
DateTimeFormatter
.
ofPattern
(
"昨天 HH:mm"
));
public
static
String
formatTopicListTime
(
LocalDateTime
target
)
{
LocalDateTime
dayBegin
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
LocalTime
.
MIN
);
LocalDateTime
lastDayBegin
=
dayBegin
.
minusDays
(
1
);
if
(
target
.
isAfter
(
dayBegin
))
{
return
target
.
format
(
DateTimeFormatter
.
ofPattern
(
" HH:mm"
));
}
else
if
(
target
.
isAfter
(
lastDayBegin
))
{
return
target
.
format
(
DateTimeFormatter
.
ofPattern
(
"昨天 HH:mm"
));
}
return
star
t
.
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy年MM月dd日"
));
return
targe
t
.
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy年MM月dd日"
));
}
public
static
String
format
(
LocalDateTime
start
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment