Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
e9e82a85
Commit
e9e82a85
authored
Oct 14, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
评论模块开发
parent
bc302b2f
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
175 additions
and
26 deletions
+175
-26
CompanySearchDTO.java
...m/github/wxiaoqi/security/admin/dto/CompanySearchDTO.java
+2
-0
UserCommentFindDTO.java
...github/wxiaoqi/security/admin/dto/UserCommentFindDTO.java
+4
-0
BranchCompany.java
...m/github/wxiaoqi/security/admin/entity/BranchCompany.java
+4
-0
UserComment.java
...com/github/wxiaoqi/security/admin/entity/UserComment.java
+20
-5
UserCommentVo.java
...a/com/github/wxiaoqi/security/admin/vo/UserCommentVo.java
+9
-0
UserBiz.java
...n/java/com/github/wxiaoqi/security/admin/biz/UserBiz.java
+26
-0
UserCommentBiz.java
...com/github/wxiaoqi/security/admin/biz/UserCommentBiz.java
+19
-3
UserCommentMapper.java
...thub/wxiaoqi/security/admin/mapper/UserCommentMapper.java
+3
-0
AppUserCommentController.java
...wxiaoqi/security/admin/rest/AppUserCommentController.java
+29
-1
BaseController.java
...om/github/wxiaoqi/security/admin/rest/BaseController.java
+23
-0
PublicController.java
.../github/wxiaoqi/security/admin/rest/PublicController.java
+1
-17
BranchCompanyMapper.xml
...e-admin/src/main/resources/mapper/BranchCompanyMapper.xml
+4
-0
UserCommentMapper.xml
...ace-admin/src/main/resources/mapper/UserCommentMapper.xml
+26
-0
BranchCompany.java
.../java/com/xxfc/platform/vehicle/entity/BranchCompany.java
+5
-0
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/CompanySearchDTO.java
View file @
e9e82a85
...
...
@@ -30,5 +30,7 @@ public class CompanySearchDTO extends PageParam implements DataInter {
Integer
bizType
;
Integer
goodsType
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/UserCommentFindDTO.java
View file @
e9e82a85
...
...
@@ -19,4 +19,8 @@ public class UserCommentFindDTO extends PageParam{
private
Integer
soureId
;
private
Integer
rootParentId
;
private
Integer
userId
;
private
Integer
isGoods
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/BranchCompany.java
View file @
e9e82a85
...
...
@@ -38,6 +38,10 @@ public class BranchCompany {
@ApiModelProperty
(
"简称"
)
private
String
shortName
;
@Column
(
name
=
"business_scope"
)
@ApiModelProperty
(
"经营范围(逗号隔开)"
)
private
String
businessScope
;
/**
* 分支机构类型
*/
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/UserComment.java
View file @
e9e82a85
...
...
@@ -32,9 +32,14 @@ public class UserComment {
* 资源ID
*/
@Column
(
name
=
"soure_id"
)
private
Integer
soureId
;
private
String
soureId
;
/**
* 资源类型:1-活动;
* 资源用户id/或店铺id
*/
@Column
(
name
=
"soure_user_id"
)
private
Integer
soureUserId
;
/**
* 资源类型:1-活动;2-商品
*/
@Column
(
name
=
"soure_type"
)
private
Integer
soureType
;
...
...
@@ -43,7 +48,11 @@ public class UserComment {
*/
@Column
(
name
=
"user_id"
)
private
Integer
userId
;
/**
* 店铺id
*/
@Column
(
name
=
"company_id"
)
private
Integer
companyId
;
/**
* 用户ID
*/
...
...
@@ -69,11 +78,17 @@ public class UserComment {
*/
@Column
(
name
=
"create_time"
)
private
Date
createTime
;
/**
* 是否可见:0-否;1是
*/
@Column
(
name
=
"is_show"
)
private
Integer
isShow
;
/**
* 是否删除:0-正常;1-删除
*/
@Column
(
name
=
"is_del"
)
private
Integer
isDel
;
@Transient
private
Integer
isCompany
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/UserCommentVo.java
View file @
e9e82a85
...
...
@@ -20,7 +20,14 @@ public class UserCommentVo extends UserComment {
@ApiModelProperty
(
"用户名称"
)
private
String
userName
;
@ApiModelProperty
(
"公司名称"
)
private
String
companyName
;
@ApiModelProperty
(
"公司封面"
)
private
String
companyPic
;
@ApiModelProperty
(
"用户头像"
)
private
String
headimgurl
;
@ApiModelProperty
(
"用户名称"
)
private
String
toUserName
;
...
...
@@ -28,4 +35,6 @@ public class UserCommentVo extends UserComment {
private
PageDataVO
<
UserCommentVo
>
childer
;
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/UserBiz.java
View file @
e9e82a85
...
...
@@ -8,6 +8,7 @@ import com.github.pagehelper.Page;
import
com.github.pagehelper.PageHelper
;
import
com.github.wxiaoqi.security.admin.dto.BaseUserDTO
;
import
com.github.wxiaoqi.security.admin.entity.User
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.admin.mapper.MenuMapper
;
import
com.github.wxiaoqi.security.admin.mapper.UserMapper
;
import
com.github.wxiaoqi.security.admin.vo.BaseUserVo
;
...
...
@@ -17,6 +18,7 @@ import com.github.wxiaoqi.security.common.constant.UserConstant;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.TableResultResponse
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.vehicle.entity.CompanyInfo
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
...
...
@@ -61,6 +63,9 @@ public class UserBiz extends BaseBiz<UserMapper,User> {
@Autowired
private
GroupBiz
groupBiz
;
@Autowired
BranchCompanyBiz
branchCompanyBiz
;
@Override
public
void
insertSelective
(
User
entity
)
{
String
password
=
new
BCryptPasswordEncoder
(
UserConstant
.
PW_ENCORDER_SALT
).
encode
(
entity
.
getPassword
());
...
...
@@ -229,6 +234,27 @@ public class UserBiz extends BaseBiz<UserMapper,User> {
}
public
ObjectRestResponse
userinfoByAppUserIdV2
(
Integer
appUserId
){
User
user
=
getUserByAppUserId
(
appUserId
);
if
(
user
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
USER_NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
USER_NOTEXIST_CODE
));
}
if
(
user
.
getDataCorporation
()
!=
null
){
com
.
github
.
wxiaoqi
.
security
.
admin
.
dto
.
CompanySearchDTO
companySearchDTO
=
new
com
.
github
.
wxiaoqi
.
security
.
admin
.
dto
.
CompanySearchDTO
();
companySearchDTO
.
setDataCorporationIds
(
Arrays
.
asList
(
user
.
getDataCorporation
().
split
(
","
)).
parallelStream
().
map
(
s
->
Integer
.
valueOf
(
s
)).
collect
(
Collectors
.
toList
()));
List
<
com
.
github
.
wxiaoqi
.
security
.
admin
.
vo
.
CompanySearchVO
>
companySearchVOList
=
branchCompanyBiz
.
getList
(
companySearchDTO
);
if
(
companySearchVOList
!=
null
&&
companySearchVOList
.
size
()
>
0
){
List
<
Integer
>
companyIds
=
companySearchVOList
.
stream
().
map
(
com
.
github
.
wxiaoqi
.
security
.
admin
.
vo
.
CompanySearchVO
::
getId
).
distinct
().
collect
(
Collectors
.
toList
());
user
.
setCompanyIds
(
companyIds
);
}
}
else
if
(
user
.
getDataCompany
()
!=
null
){
List
<
Integer
>
companyIds
=
Arrays
.
asList
(
user
.
getDataCompany
().
split
(
","
)).
parallelStream
().
map
(
s
->
Integer
.
valueOf
(
s
)).
collect
(
Collectors
.
toList
());
user
.
setCompanyIds
(
companyIds
);
}
return
new
ObjectRestResponse
<
User
>().
rel
(
true
).
data
(
user
);
}
public
List
<
BaseUserVo
>
getList
(
BaseUserDTO
baseUserDTO
){
return
mapper
.
selectList
(
baseUserDTO
);
}
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/UserCommentBiz.java
View file @
e9e82a85
...
...
@@ -48,17 +48,20 @@ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{
throw
new
BaseException
(
"参数不能为空"
,
ResultCode
.
FAILED_CODE
);
}
Integer
parentId
=
userComment
.
getParentId
()
==
null
?
0
:
userComment
.
getParentId
();
Integer
rootParentId
=
userComment
.
getRootParentId
()
==
null
?
0
:
userComment
.
getRootParentId
();
if
(
parentId
>
0
){
UserComment
parentComment
=
selectById
(
parentId
);
if
(
parentComment
==
null
){
throw
new
BaseException
(
"该评论不存在"
,
ResultCode
.
FAILED_CODE
);
}
rootParentId
=
parentComment
.
getRootParentId
();
userComment
.
setSoureId
(
parentComment
.
getSoureId
());
userComment
.
setSoureUserId
(
parentComment
.
getSoureUserId
());
userComment
.
setSoureType
(
parentComment
.
getSoureType
());
userComment
.
setToUserId
(
parentComment
.
getUserId
());
userComment
.
setRootParentId
(
parentComment
.
getRootParentId
()
);
userComment
.
setRootParentId
(
rootParentId
);
}
else
{
if
(
userComment
.
getSoureId
()
==
null
||
userComment
.
getSoureId
()
==
0
){
if
(
StringUtils
.
isBlank
(
userComment
.
getSoureId
())
){
throw
new
BaseException
(
"资源ID不能为空"
,
ResultCode
.
FAILED_CODE
);
}
}
...
...
@@ -66,7 +69,6 @@ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{
insertSelective
(
userComment
);
Integer
id
=
userComment
.
getId
();
if
(
id
>
0
){
Integer
rootParentId
=
userComment
.
getRootParentId
()
==
null
?
0
:
userComment
.
getRootParentId
();
if
(
rootParentId
==
0
){
UserComment
userComment1
=
new
UserComment
();
userComment1
.
setId
(
id
);
...
...
@@ -106,4 +108,18 @@ public class UserCommentBiz extends BaseBiz<UserCommentMapper, UserComment>{
}
public
PageDataVO
<
UserCommentVo
>
selectListByToUserId
(
UserCommentFindDTO
userCommentFindDTO
){
PageHelper
.
startPage
(
userCommentFindDTO
.
getPage
(),
userCommentFindDTO
.
getLimit
());
PageInfo
<
UserCommentVo
>
pageInfo
=
new
PageInfo
<>(
getListByToUserId
(
userCommentFindDTO
));
PageDataVO
<
UserCommentVo
>
dataVO
=
PageDataVO
.
pageInfo
(
pageInfo
);
return
dataVO
;
}
public
List
<
UserCommentVo
>
getListByToUserId
(
UserCommentFindDTO
commentFindDTO
){
return
mapper
.
selectListByToUserId
(
commentFindDTO
);
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/UserCommentMapper.java
View file @
e9e82a85
...
...
@@ -18,4 +18,7 @@ public interface UserCommentMapper extends Mapper<UserComment>, SelectByIdListMa
List
<
UserCommentVo
>
selectList
(
UserCommentFindDTO
commentFindDTO
);
List
<
UserCommentVo
>
selectListByToUserId
(
UserCommentFindDTO
commentFindDTO
);
}
\ No newline at end of file
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/AppUserCommentController.java
View file @
e9e82a85
...
...
@@ -13,6 +13,8 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* @author Administrator
*/
...
...
@@ -38,13 +40,39 @@ public class AppUserCommentController extends BaseController<UserCommentBiz> {
@PostMapping
(
"send"
)
@ApiModelProperty
(
"
商家入驻申请
"
)
@ApiModelProperty
(
"
评论
"
)
public
ObjectRestResponse
apply
(
@RequestBody
UserComment
userComment
)
{
userComment
.
setUserId
(
getCurrentUserIdInt
());
Integer
isCompany
=
userComment
.
getIsCompany
()
==
null
?
0
:
userComment
.
getIsCompany
();
if
(
isCompany
==
1
&&
(
userComment
.
getCompanyId
()
==
null
||
userComment
.
getCompanyId
()
==
0
)){
List
<
Integer
>
companyIds
=
getCompanyIds
();
if
(
companyIds
!=
null
&&
companyIds
.
size
()
>
0
){
userComment
.
setCompanyId
(
companyIds
.
get
(
0
));
}
}
baseBiz
.
addOrUpd
(
userComment
);
return
ObjectRestResponse
.
succ
();
}
@GetMapping
(
"selectListByToUserId"
)
@ApiModelProperty
(
"列表"
)
public
ObjectRestResponse
selectListByToUserId
(
UserCommentFindDTO
commentFindDTO
)
{
commentFindDTO
.
setUserId
(
getCurrentUserIdInt
());
return
ObjectRestResponse
.
succ
(
baseBiz
.
selectListByToUserId
(
commentFindDTO
));
}
@PostMapping
(
"del"
)
@ApiModelProperty
(
"评论删除"
)
public
ObjectRestResponse
del
(
@RequestBody
UserComment
userComment
)
{
userComment
.
setIsShow
(
0
);
baseBiz
.
updateSelectiveById
(
userComment
);
return
ObjectRestResponse
.
succ
();
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/BaseController.java
View file @
e9e82a85
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
rest
;
import
com.github.wxiaoqi.security.admin.biz.UserBiz
;
import
com.github.wxiaoqi.security.admin.entity.User
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.CommonBaseController
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.util.List
;
@Slf4j
public
class
BaseController
<
Biz
extends
BaseBiz
>
extends
CommonBaseController
{
...
...
@@ -20,6 +25,9 @@ public class BaseController<Biz extends BaseBiz> extends CommonBaseController {
@Autowired
private
UserAuthUtil
userAuthUtil
;
@Autowired
private
UserBiz
userBiz
;
public
String
getUserName
()
throws
Exception
{
return
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getUniqueName
();
}
...
...
@@ -29,4 +37,19 @@ public class BaseController<Biz extends BaseBiz> extends CommonBaseController {
public
String
getUserId
()
throws
Exception
{
return
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
)).
getId
();
}
public
List
<
Integer
>
getCompanyIds
(){
Integer
currentUserIdInt
=
getCurrentUserIdInt
();
if
(
currentUserIdInt
!=
null
&&
currentUserIdInt
>
0
){
ObjectRestResponse
<
User
>
restResponse
=
userBiz
.
userinfoByAppUserIdV2
(
currentUserIdInt
);
if
(
restResponse
.
getData
()
!=
null
){
User
userDTO
=
restResponse
.
getData
();
if
(
userDTO
!=
null
){
return
userDTO
.
getCompanyIds
();
}
}
}
return
null
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/PublicController.java
View file @
e9e82a85
...
...
@@ -108,23 +108,7 @@ public class PublicController {
@RequestMapping
(
value
=
"v2/userinfo-by-appUserId"
,
method
=
RequestMethod
.
GET
)
public
@ResponseBody
ObjectRestResponse
userinfoByAppUserIdV2
(
Integer
appUserId
){
User
user
=
userBiz
.
getUserByAppUserId
(
appUserId
);
if
(
user
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
USER_NOTEXIST_CODE
,
ResultCode
.
getMsg
(
ResultCode
.
USER_NOTEXIST_CODE
));
}
if
(
user
.
getDataCorporation
()
!=
null
){
com
.
github
.
wxiaoqi
.
security
.
admin
.
dto
.
CompanySearchDTO
companySearchDTO
=
new
com
.
github
.
wxiaoqi
.
security
.
admin
.
dto
.
CompanySearchDTO
();
companySearchDTO
.
setDataCorporationIds
(
Arrays
.
asList
(
user
.
getDataCorporation
().
split
(
","
)).
parallelStream
().
map
(
s
->
Integer
.
valueOf
(
s
)).
collect
(
Collectors
.
toList
()));
List
<
com
.
github
.
wxiaoqi
.
security
.
admin
.
vo
.
CompanySearchVO
>
companySearchVOList
=
branchCompanyBiz
.
getList
(
companySearchDTO
);
if
(
companySearchVOList
!=
null
&&
companySearchVOList
.
size
()
>
0
){
List
<
Integer
>
companyIds
=
companySearchVOList
.
stream
().
map
(
com
.
github
.
wxiaoqi
.
security
.
admin
.
vo
.
CompanySearchVO
::
getId
).
distinct
().
collect
(
Collectors
.
toList
());
user
.
setCompanyIds
(
companyIds
);
}
}
else
if
(
user
.
getDataCompany
()
!=
null
){
List
<
Integer
>
companyIds
=
Arrays
.
asList
(
user
.
getDataCompany
().
split
(
","
)).
parallelStream
().
map
(
s
->
Integer
.
valueOf
(
s
)).
collect
(
Collectors
.
toList
());
user
.
setCompanyIds
(
companyIds
);
}
return
new
ObjectRestResponse
<
User
>().
rel
(
true
).
data
(
user
);
return
userBiz
.
userinfoByAppUserIdV2
(
appUserId
);
}
@RequestMapping
(
value
=
"/app/userinfo-by-token"
,
method
=
RequestMethod
.
GET
)
...
...
ace-modules/ace-admin/src/main/resources/mapper/BranchCompanyMapper.xml
View file @
e9e82a85
...
...
@@ -41,6 +41,10 @@
<if
test=
"addrCity != null"
>
and (c.addr_city = #{addrCity} or c.addr_province = #{addrCity} or c.addr_town = #{addrCity})
</if>
<if
test=
"goodsType != null"
>
and FIND_IN_SET(#{goodsType},business_scope)
</if>
<if
test=
"addrProvince != null"
>
and c.addr_province = #{addrProvince}
</if>
...
...
ace-modules/ace-admin/src/main/resources/mapper/UserCommentMapper.xml
View file @
e9e82a85
...
...
@@ -22,4 +22,30 @@
</where>
order by c.create_time ASC
</select>
<select
id=
"selectListByToUserId"
resultType=
"com.github.wxiaoqi.security.admin.vo.UserCommentVo"
parameterType=
"com.github.wxiaoqi.security.admin.dto.UserCommentFindDTO"
>
SELECT
c.*,
b.`name`as companyName,
b.company_pic as companyPic,
IFNULL(d.realname,d.nickname) as userName,
d.headimgurl
FROM
(
SELECT * FROM user_comment
WHERE id in (SELECT MAX(id) FROM user_comment
WHERE is_show =1
<choose>
<when
test=
"isGoods != null and isGoods == 1"
>
and to_user_id=#{userId}
</when>
<otherwise>
and ((soure_type =1 and soure_user_id=#{userId} and parent_id = 0) or to_user_id=#{userId})
</otherwise>
</choose>
GROUP BY soure_id,to_user_id )
) c
LEFT JOIN branch_company b ON c.company_id=b.id
LEFT JOIN app_user_detail d ON c.user_id=d.userid
order by c.create_time DESC
</select>
</mapper>
\ No newline at end of file
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/entity/BranchCompany.java
View file @
e9e82a85
...
...
@@ -38,6 +38,11 @@ public class BranchCompany {
@ApiModelProperty
(
"简称"
)
private
String
shortName
;
@Column
(
name
=
"business_scope"
)
@ApiModelProperty
(
"经营范围(逗号隔开)"
)
private
String
businessScope
;
/**
* 分支机构类型
*/
...
...
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