Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
向汉
/
uc-engine
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
87410231
...
87410231672cd7c244b1c582610265cb45beb293
authored
2022-03-22 15:51:49 +0800
by
xianghan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.优化
1 parent
5f7c8284
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
228 additions
and
343 deletions
member-service-impl/src/main/java/com/topdraw/business/module/coupon/service/CouponService.java
member-service-impl/src/main/java/com/topdraw/business/module/exp/history/service/ExpHistoryService.java
member-service-impl/src/main/java/com/topdraw/business/module/points/available/domain/PointsAvailable.java
member-service-impl/src/main/java/com/topdraw/business/module/points/available/service/PointsAvailableService.java
member-service-impl/src/main/java/com/topdraw/business/module/points/available/service/dto/PointsAvailableDTO.java
member-service-impl/src/main/java/com/topdraw/business/module/points/available/service/impl/PointsAvailableServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/module/points/detail/service/PointsDetailService.java
member-service-impl/src/main/java/com/topdraw/business/module/points/detail/service/impl/PointsDetailServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/module/points/domain/Points.java
member-service-impl/src/main/java/com/topdraw/business/module/points/service/PointsService.java
member-service-impl/src/main/java/com/topdraw/business/module/points/service/dto/PointsDTO.java
member-service-impl/src/main/java/com/topdraw/business/module/points/service/dto/PointsQueryCriteria.java
member-service-impl/src/main/java/com/topdraw/business/module/points/service/impl/PointsServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/module/rights/domain/Rights.java
member-service-impl/src/main/java/com/topdraw/business/module/rights/service/dto/RightsDTO.java
member-service-impl/src/main/java/com/topdraw/business/module/rights/service/dto/RightsQueryCriteria.java
member-service-impl/src/main/java/com/topdraw/business/module/rights/service/dto/RightsQueryType.java
member-service-impl/src/main/java/com/topdraw/business/module/rights/service/impl/RightsServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/module/user/iptv/service/UserTvService.java
member-service-impl/src/main/java/com/topdraw/business/module/user/iptv/service/impl/UserTvServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/rest/CouponOperationController.java
member-service-impl/src/main/java/com/topdraw/business/process/rest/ExpOperationController.java
member-service-impl/src/main/java/com/topdraw/business/process/rest/PointsOperationController.java
member-service-impl/src/main/java/com/topdraw/business/process/rest/RightsOperationController.java
member-service-impl/src/main/java/com/topdraw/business/process/service/ExpOperationService.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/ExpOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/PointsOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/module/coupon/service/CouponService.java
View file @
8741023
package
com
.
topdraw
.
business
.
module
.
coupon
.
service
;
import
com.topdraw.business.module.coupon.domain.Coupon
;
import
com.topdraw.business.module.coupon.service.dto.CouponDTO
;
import
java.util.List
;
/**
* @author XiangHan
* @date 2021-10-22
...
...
member-service-impl/src/main/java/com/topdraw/business/module/exp/history/service/ExpHistoryService.java
View file @
8741023
...
...
@@ -12,6 +12,7 @@ import java.util.List;
* @date 2021-10-22
*/
public
interface
ExpHistoryService
{
/**
* 根据ID查询
* @param id ID
...
...
member-service-impl/src/main/java/com/topdraw/business/module/points/available/domain/PointsAvailable.java
View file @
8741023
...
...
@@ -28,47 +28,47 @@ import java.io.Serializable;
@Table
(
name
=
"uc_points_available"
)
public
class
PointsAvailable
extends
AsyncMqModule
implements
Serializable
{
/
/ 主键
/
** 主键 */
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
private
Long
id
;
/
/ 标识
/
** 标识 */
@Column
(
name
=
"code"
)
private
String
code
;
/
/ 积分类型 0:通用型
/
** 积分类型 0:通用型 */
@Column
(
name
=
"points_type"
)
private
Integer
pointsType
;
/
/ 设备类型 1:大屏;2:小屏(微信)3.小屏(xx)
/
** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */
@Column
(
name
=
"device_type"
)
private
Integer
deviceType
;
/
/ 会员id
/
** 会员id */
@Column
(
name
=
"member_id"
,
nullable
=
false
)
private
Long
memberId
;
/
/ 积分值
/
** 积分值 */
@Column
(
name
=
"points"
)
private
Long
points
;
/
/ 过期时间
//
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",locale = "")
/
** 过期时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
""
)
@Column
(
name
=
"expire_time"
)
private
LocalDateTime
expireTime
;
/
/ 描述
/
** 描述 */
@Column
(
name
=
"description"
)
private
String
description
;
/
/ 创建时间
/
** 创建时间 */
@CreatedDate
@Column
(
name
=
"create_time"
)
private
Timestamp
createTime
;
/
/ 更新时间
/
** 更新时间 */
@LastModifiedDate
@Column
(
name
=
"update_time"
)
private
Timestamp
updateTime
;
...
...
member-service-impl/src/main/java/com/topdraw/business/module/points/available/service/PointsAvailableService.java
View file @
8741023
...
...
@@ -26,13 +26,13 @@ public interface PointsAvailableService {
*
* @param resources
*/
void
create
(
PointsAvailable
resources
);
PointsAvailableDTO
create
(
PointsAvailable
resources
);
/**
*
* @param resources
*/
void
update
(
PointsAvailable
resources
);
PointsAvailableDTO
update
(
PointsAvailable
resources
);
/**
*
...
...
@@ -90,7 +90,15 @@ public interface PointsAvailableService {
*/
long
findTotalPointsByMemberId
(
Long
memberId
);
/**
*
* @param id
*/
void
delete4Custom
(
Long
id
);
void
create4Custom
(
PointsAvailable
pointsAvailable
);
/**
*
* @param pointsAvailable
*/
PointsAvailableDTO
create4Custom
(
PointsAvailable
pointsAvailable
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/points/available/service/dto/PointsAvailableDTO.java
View file @
8741023
...
...
@@ -13,33 +13,33 @@ import java.time.LocalDateTime;
@Data
public
class
PointsAvailableDTO
implements
Serializable
{
/
/ 主键
/
** 主键 */
private
Long
id
;
/
/ 标识
/
** 标识 */
private
String
code
;
/
/ 积分类型 0:通用型
/
** 积分类型 0:通用型 */
private
Integer
pointsType
;
/
/ 设备类型 1:大屏;2:小屏(微信)3.小屏(xx)
/
** 设备类型 1:大屏;2:小屏(微信)3.小屏(xx) */
private
Integer
deviceType
;
/
/ 会员id
/
** 会员id */
private
Long
memberId
;
/
/ 积分值
/
** 积分值 */
private
Long
points
;
/
/ 过期时间
/
** 过期时间 */
private
LocalDateTime
expireTime
;
/
/ 描述
/
** 描述 */
private
String
description
;
/
/ 创建时间
/
** 创建时间 */
private
Timestamp
createTime
;
/
/ 更新时间
/
** 更新时间 */
private
Timestamp
updateTime
;
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/points/available/service/impl/PointsAvailableServiceImpl.java
View file @
8741023
...
...
@@ -27,32 +27,33 @@ import java.util.*;
public
class
PointsAvailableServiceImpl
implements
PointsAvailableService
{
@Autowired
private
PointsAvailableRepository
PointsAvailableRepository
;
private
PointsAvailableRepository
pointsAvailableRepository
;
@Autowired
private
PointsAvailableMapper
PointsAvailableMapper
;
private
PointsAvailableMapper
pointsAvailableMapper
;
@Autowired
private
RedisUtils
redisUtils
;
@Override
public
List
<
PointsAvailableDTO
>
findByMemberIdOrderByExpireTime
(
Long
memberId
)
{
return
PointsAvailableMapper
.
toDto
(
P
ointsAvailableRepository
.
findByMemberIdOrderByExpireTime
(
memberId
));
return
this
.
pointsAvailableMapper
.
toDto
(
this
.
p
ointsAvailableRepository
.
findByMemberIdOrderByExpireTime
(
memberId
));
}
@Override
public
PointsAvailableDTO
findById
(
Long
id
)
{
PointsAvailable
PointsAvailable
=
P
ointsAvailableRepository
.
findById
(
id
).
orElseGet
(
PointsAvailable:
:
new
);
ValidationUtil
.
isNull
(
P
ointsAvailable
.
getId
(),
"PointsAvailable"
,
"id"
,
id
);
return
PointsAvailableMapper
.
toDto
(
P
ointsAvailable
);
PointsAvailable
pointsAvailable
=
this
.
p
ointsAvailableRepository
.
findById
(
id
).
orElseGet
(
PointsAvailable:
:
new
);
ValidationUtil
.
isNull
(
p
ointsAvailable
.
getId
(),
"PointsAvailable"
,
"id"
,
id
);
return
this
.
pointsAvailableMapper
.
toDto
(
p
ointsAvailable
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
create
(
PointsAvailable
resources
)
{
this
.
redisUtils
.
doLock
(
"PointsAvailable::create::id"
+
resources
.
getMemberId
().
toString
());
public
PointsAvailableDTO
create
(
PointsAvailable
resources
)
{
try
{
PointsAvailableRepository
.
save
(
resources
);
this
.
redisUtils
.
doLock
(
"PointsAvailable::create::id"
+
resources
.
getMemberId
().
toString
());
PointsAvailable
pointsAvailable
=
this
.
pointsAvailableRepository
.
save
(
resources
);
return
this
.
pointsAvailableMapper
.
toDto
(
pointsAvailable
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
...
...
@@ -63,13 +64,15 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
PointsAvailable
resources
)
{
this
.
redisUtils
.
doLock
(
"PointsAvailable::update::id"
+
resources
.
getMemberId
().
toString
());
public
PointsAvailableDTO
update
(
PointsAvailable
resources
)
{
try
{
PointsAvailable
PointsAvailable
=
PointsAvailableRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
PointsAvailable:
:
new
);
ValidationUtil
.
isNull
(
PointsAvailable
.
getId
(),
"PointsAvailable"
,
"id"
,
resources
.
getId
());
PointsAvailable
.
copy
(
resources
);
PointsAvailableRepository
.
save
(
PointsAvailable
);
this
.
redisUtils
.
doLock
(
"PointsAvailable::update::id"
+
resources
.
getMemberId
().
toString
());
PointsAvailable
pointsAvailable
=
this
.
pointsAvailableRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
PointsAvailable:
:
new
);
ValidationUtil
.
isNull
(
pointsAvailable
.
getId
(),
"PointsAvailable"
,
"id"
,
resources
.
getId
());
pointsAvailable
.
copy
(
resources
);
PointsAvailable
_pointsAvailable
=
this
.
pointsAvailableRepository
.
save
(
pointsAvailable
);
return
this
.
pointsAvailableMapper
.
toDto
(
_pointsAvailable
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
...
...
@@ -84,9 +87,9 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
Assert
.
notNull
(
id
,
"The given id must not be null!"
);
this
.
redisUtils
.
doLock
(
"PointsAvailable::delete::id"
+
id
);
try
{
PointsAvailable
PointsAvailable
=
P
ointsAvailableRepository
.
findById
(
id
).
orElseThrow
(
PointsAvailable
PointsAvailable
=
this
.
p
ointsAvailableRepository
.
findById
(
id
).
orElseThrow
(
()
->
new
EmptyResultDataAccessException
(
String
.
format
(
"No %s entity "
+
"with id %s "
+
"exists!"
,
PointsAvailable
.
class
,
id
),
1
));
P
ointsAvailableRepository
.
delete
(
PointsAvailable
);
this
.
p
ointsAvailableRepository
.
delete
(
PointsAvailable
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
...
...
@@ -100,7 +103,7 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
public
void
deleteBatchByIds
(
List
<
Long
>
id
)
{
this
.
redisUtils
.
doLock
(
"PointsAvailable::create::id"
+
id
);
try
{
P
ointsAvailableRepository
.
deleteBatchByIds
(
id
);
this
.
p
ointsAvailableRepository
.
deleteBatchByIds
(
id
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
...
...
@@ -112,31 +115,31 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
@Override
public
PointsAvailableDTO
getByCode
(
String
code
)
{
return
StringUtils
.
isNotEmpty
(
code
)
?
PointsAvailableMapper
.
toDto
(
P
ointsAvailableRepository
.
findFirstByCode
(
code
).
orElseGet
(
PointsAvailable:
:
new
))
return
StringUtils
.
isNotEmpty
(
code
)
?
this
.
pointsAvailableMapper
.
toDto
(
this
.
p
ointsAvailableRepository
.
findFirstByCode
(
code
).
orElseGet
(
PointsAvailable:
:
new
))
:
new
PointsAvailableDTO
();
}
@Override
public
List
<
PointsAvailableDTO
>
findByMemberIdAndExpireTimeBefore
(
Long
memberId
,
LocalDateTime
timestamp
)
{
return
Objects
.
nonNull
(
memberId
)?
PointsAvailableMapper
.
toDto
(
P
ointsAvailableRepository
.
findByMemberIdAndExpireTimeBefore
(
memberId
,
timestamp
))
this
.
pointsAvailableMapper
.
toDto
(
this
.
p
ointsAvailableRepository
.
findByMemberIdAndExpireTimeBefore
(
memberId
,
timestamp
))
:
null
;
}
@Override
public
Long
findSoonExpireTime
(
Long
memberId
,
Integer
factor
)
{
return
P
ointsAvailableRepository
.
findSoonExpireTime
(
memberId
,
factor
);
return
this
.
p
ointsAvailableRepository
.
findSoonExpireTime
(
memberId
,
factor
);
}
@Override
public
long
findAvailablePointsByMemberId
(
long
memberId
)
{
Long
availablePoints
=
this
.
P
ointsAvailableRepository
.
findAvailablePointsByMemberId
(
memberId
);
Long
availablePoints
=
this
.
p
ointsAvailableRepository
.
findAvailablePointsByMemberId
(
memberId
);
return
availablePoints
==
null
?
0L
:
availablePoints
;
}
@Override
public
long
findTotalPointsByMemberId
(
Long
memberId
)
{
return
this
.
P
ointsAvailableRepository
.
findTotalCountByMemberId
(
memberId
);
return
this
.
p
ointsAvailableRepository
.
findTotalCountByMemberId
(
memberId
);
}
@Override
...
...
@@ -144,9 +147,9 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
Assert
.
notNull
(
id
,
"The given id must not be null!"
);
this
.
redisUtils
.
doLock
(
"PointsAvailable::delete::id"
+
id
);
try
{
PointsAvailable
PointsAvailable
=
P
ointsAvailableRepository
.
findById
(
id
).
orElseThrow
(
PointsAvailable
PointsAvailable
=
this
.
p
ointsAvailableRepository
.
findById
(
id
).
orElseThrow
(
()
->
new
EmptyResultDataAccessException
(
String
.
format
(
"No %s entity "
+
"with id %s "
+
"exists!"
,
PointsAvailable
.
class
,
id
),
1
));
P
ointsAvailableRepository
.
delete
(
PointsAvailable
);
this
.
p
ointsAvailableRepository
.
delete
(
PointsAvailable
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
...
...
@@ -156,10 +159,11 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
}
@Override
public
void
create4Custom
(
PointsAvailable
resources
)
{
public
PointsAvailableDTO
create4Custom
(
PointsAvailable
resources
)
{
this
.
redisUtils
.
doLock
(
"PointsAvailable::create::id"
+
resources
.
getMemberId
().
toString
());
try
{
PointsAvailableRepository
.
save
(
resources
);
PointsAvailable
pointsAvailable
=
this
.
pointsAvailableRepository
.
save
(
resources
);
return
this
.
pointsAvailableMapper
.
toDto
(
pointsAvailable
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
...
...
member-service-impl/src/main/java/com/topdraw/business/module/points/detail/service/PointsDetailService.java
View file @
8741023
...
...
@@ -2,10 +2,7 @@ package com.topdraw.business.module.points.detail.service;
import
com.topdraw.business.module.points.detail.domain.PointsDetail
;
import
com.topdraw.business.module.points.detail.service.dto.PointsDetailDTO
;
import
com.topdraw.business.module.points.detail.service.dto.PointsDetailQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
import
java.util.Map
;
import
java.util.List
;
/**
...
...
@@ -15,31 +12,30 @@ import java.util.List;
public
interface
PointsDetailService
{
/**
* 查询数据分页
* @param criteria 条件参数
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map
<
String
,
Object
>
queryAll
(
PointsDetailQueryCriteria
criteria
,
Pageable
pageable
);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<PointsDetailDTO>
*/
List
<
PointsDetailDTO
>
queryAll
(
PointsDetailQueryCriteria
criteria
);
/**
* 根据ID查询
* @param id ID
* @return PointsDetailDTO
*/
PointsDetailDTO
findById
(
Long
id
);
void
create
(
PointsDetail
resources
);
/**
*
* @param resources
* @return
*/
PointsDetailDTO
create
(
PointsDetail
resources
);
void
update
(
PointsDetail
resources
);
/**
*
* @param resources
* @return
*/
PointsDetailDTO
update
(
PointsDetail
resources
);
/**
*
* @param id
*/
void
delete
(
Long
id
);
/**
...
...
@@ -49,9 +45,13 @@ public interface PointsDetailService {
*/
PointsDetailDTO
getByCode
(
String
code
);
/**
*
* @param memberId
* @return
*/
List
<
PointsDetailDTO
>
loadListExpirePointsByMemberId
(
Long
memberId
);
/**
* 已过期的积分
* @param memberId
...
...
@@ -59,5 +59,9 @@ public interface PointsDetailService {
*/
List
<
PointsDetailDTO
>
findByMemberId
(
Long
memberId
);
/**
*
* @param pointsDetail
*/
void
create4Custom
(
PointsDetail
pointsDetail
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/points/detail/service/impl/PointsDetailServiceImpl.java
View file @
8741023
package
com
.
topdraw
.
business
.
module
.
points
.
detail
.
service
.
impl
;
import
com.topdraw.aspect.AsyncMqSend
;
import
com.topdraw.business.module.points.detail.domain.PointsDetail
;
import
com.topdraw.utils.ValidationUtil
;
import
com.topdraw.business.module.points.detail.repository.PointsDetailRepository
;
import
com.topdraw.business.module.points.detail.service.PointsDetailService
;
import
com.topdraw.business.module.points.detail.service.dto.PointsDetailDTO
;
import
com.topdraw.business.module.points.detail.service.dto.PointsDetailQueryCriteria
;
import
com.topdraw.business.module.points.detail.service.mapper.PointsDetailMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.dao.EmptyResultDataAccessException
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.util.Assert
;
import
com.topdraw.utils.PageUtil
;
import
com.topdraw.utils.QueryHelp
;
import
com.topdraw.utils.StringUtils
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
/**
...
...
@@ -33,57 +26,47 @@ import java.util.Objects;
public
class
PointsDetailServiceImpl
implements
PointsDetailService
{
@Autowired
private
PointsDetailRepository
PointsDetailRepository
;
private
PointsDetailRepository
pointsDetailRepository
;
@Autowired
private
PointsDetailMapper
PointsDetailMapper
;
@Override
public
Map
<
String
,
Object
>
queryAll
(
PointsDetailQueryCriteria
criteria
,
Pageable
pageable
)
{
Page
<
PointsDetail
>
page
=
PointsDetailRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
return
PageUtil
.
toPage
(
page
.
map
(
PointsDetailMapper:
:
toDto
));
}
@Override
public
List
<
PointsDetailDTO
>
queryAll
(
PointsDetailQueryCriteria
criteria
)
{
return
PointsDetailMapper
.
toDto
(
PointsDetailRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
)));
}
private
PointsDetailMapper
pointsDetailMapper
;
@Override
public
PointsDetailDTO
findById
(
Long
id
)
{
PointsDetail
PointsDetail
=
P
ointsDetailRepository
.
findById
(
id
).
orElseGet
(
PointsDetail:
:
new
);
ValidationUtil
.
isNull
(
P
ointsDetail
.
getId
(),
"PointsDetail"
,
"id"
,
id
);
return
PointsDetailMapper
.
toDto
(
P
ointsDetail
);
PointsDetail
pointsDetail
=
this
.
p
ointsDetailRepository
.
findById
(
id
).
orElseGet
(
PointsDetail:
:
new
);
ValidationUtil
.
isNull
(
p
ointsDetail
.
getId
(),
"PointsDetail"
,
"id"
,
id
);
return
this
.
pointsDetailMapper
.
toDto
(
p
ointsDetail
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
create
(
PointsDetail
resources
)
{
PointsDetailRepository
.
save
(
resources
);
public
PointsDetailDTO
create
(
PointsDetail
resources
)
{
PointsDetail
pointsDetail
=
this
.
pointsDetailRepository
.
save
(
resources
);
return
this
.
pointsDetailMapper
.
toDto
(
pointsDetail
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
PointsDetail
resources
)
{
PointsDetail
PointsDetail
=
PointsDetailRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
PointsDetail:
:
new
);
ValidationUtil
.
isNull
(
PointsDetail
.
getId
(),
"PointsDetail"
,
"id"
,
resources
.
getId
());
PointsDetail
.
copy
(
resources
);
PointsDetailRepository
.
save
(
PointsDetail
);
public
PointsDetailDTO
update
(
PointsDetail
resources
)
{
PointsDetail
pointsDetail
=
this
.
pointsDetailRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
PointsDetail:
:
new
);
ValidationUtil
.
isNull
(
pointsDetail
.
getId
(),
"PointsDetail"
,
"id"
,
resources
.
getId
());
pointsDetail
.
copy
(
resources
);
PointsDetail
_pointsDetail
=
this
.
pointsDetailRepository
.
save
(
pointsDetail
);
return
this
.
pointsDetailMapper
.
toDto
(
_pointsDetail
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Long
id
)
{
Assert
.
notNull
(
id
,
"The given id must not be null!"
);
PointsDetail
PointsDetail
=
P
ointsDetailRepository
.
findById
(
id
).
orElseThrow
(
PointsDetail
pointsDetail
=
this
.
p
ointsDetailRepository
.
findById
(
id
).
orElseThrow
(
()
->
new
EmptyResultDataAccessException
(
String
.
format
(
"No %s entity "
+
"with id %s "
+
"exists!"
,
PointsDetail
.
class
,
id
),
1
));
PointsDetailRepository
.
delete
(
P
ointsDetail
);
this
.
pointsDetailRepository
.
delete
(
p
ointsDetail
);
}
@Override
public
PointsDetailDTO
getByCode
(
String
code
)
{
return
StringUtils
.
isNotEmpty
(
code
)
?
PointsDetailMapper
.
toDto
(
P
ointsDetailRepository
.
findFirstByCode
(
code
).
orElseGet
(
PointsDetail:
:
new
))
return
StringUtils
.
isNotEmpty
(
code
)
?
this
.
pointsDetailMapper
.
toDto
(
this
.
p
ointsDetailRepository
.
findFirstByCode
(
code
).
orElseGet
(
PointsDetail:
:
new
))
:
new
PointsDetailDTO
();
}
...
...
@@ -95,12 +78,12 @@ public class PointsDetailServiceImpl implements PointsDetailService {
@Override
public
List
<
PointsDetailDTO
>
findByMemberId
(
Long
memberId
)
{
return
Objects
.
nonNull
(
memberId
)?
PointsDetailMapper
.
toDto
(
P
ointsDetailRepository
.
findByMemberId
(
memberId
))
this
.
pointsDetailMapper
.
toDto
(
this
.
p
ointsDetailRepository
.
findByMemberId
(
memberId
))
:
null
;
}
@Override
public
void
create4Custom
(
PointsDetail
pointsDetail
)
{
P
ointsDetailRepository
.
save
(
pointsDetail
);
this
.
p
ointsDetailRepository
.
save
(
pointsDetail
);
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/points/domain/Points.java
View file @
8741023
...
...
@@ -27,35 +27,37 @@ public class Points implements Serializable {
@Column
(
name
=
"id"
)
private
Long
id
;
/** 账号id */
@Column
(
name
=
"user_id"
)
private
Long
userId
;
// 积分类型,通用,绑定, 区分大小屏
/** 积分类型:10:通用积分(跨屏) 11:定向积分(跨屏,绑定用途)20:通用积分(大屏)
21:定向积分(大屏,绑定用途)30:通用积分(小屏) 31:定向积分(小屏,绑定用途)*/
@Column
(
name
=
"point_type"
)
private
Integer
pointType
;
/
/ 绑定对应的实体, 如何描述?
/
** 绑定对应的实体, 如何描述? */
@Column
(
name
=
"target_no"
)
private
String
targetNo
;
/
/ 本月期初积分值
/
** 本月期初积分值 */
@Column
(
name
=
"begin_points"
)
private
Integer
beginPoints
;
/
/ 当前积分余额
/
** 当前积分余额 */
@Column
(
name
=
"current_points"
)
private
Integer
currentPoints
;
/
/ 本月到期积分
/
** 本月到期积分 */
@Column
(
name
=
"expire_points"
)
private
Integer
expirePoints
;
/
/ 积分类型:10:通用积分(跨屏) 11:定向积分(跨屏,绑定用途)20:通用积分(大屏) 21:定向积分(大屏,绑定用途)30:通用积分(小屏) 31:定向积分(小屏,绑定用途)
/
** 创建时间 */
@CreatedDate
@Column
(
name
=
"create_time"
)
private
Timestamp
createTime
;
/
/ 最后修改时间
/
** 最后修改时间 */
@LastModifiedDate
@Column
(
name
=
"update_time"
)
private
Timestamp
updateTime
;
...
...
member-service-impl/src/main/java/com/topdraw/business/module/points/service/PointsService.java
View file @
8741023
...
...
@@ -2,10 +2,6 @@ package com.topdraw.business.module.points.service;
import
com.topdraw.business.module.points.domain.Points
;
import
com.topdraw.business.module.points.service.dto.PointsDTO
;
import
com.topdraw.business.module.points.service.dto.PointsQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
import
java.util.Map
;
import
java.util.List
;
/**
* @author XiangHan
...
...
@@ -14,31 +10,28 @@ import java.util.List;
public
interface
PointsService
{
/**
* 查询数据分页
* @param criteria 条件参数
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map
<
String
,
Object
>
queryAll
(
PointsQueryCriteria
criteria
,
Pageable
pageable
);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<PointsDTO>
*/
List
<
PointsDTO
>
queryAll
(
PointsQueryCriteria
criteria
);
/**
* 根据ID查询
* @param id ID
* @return PointsDTO
*/
PointsDTO
findById
(
Long
id
);
void
create
(
Points
resources
);
/**
*
* @param resources
*/
PointsDTO
create
(
Points
resources
);
void
update
(
Points
resources
);
/**
*
* @param resources
*/
PointsDTO
update
(
Points
resources
);
/**
*
* @param id
*/
void
delete
(
Long
id
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/points/service/dto/PointsDTO.java
View file @
8741023
...
...
@@ -18,26 +18,30 @@ public class PointsDTO implements Serializable {
@JsonSerialize
(
using
=
ToStringSerializer
.
class
)
private
Long
id
;
/** 账号id */
private
Long
userId
;
// 积分类型,通用,绑定, 区分大小屏 todo
/** 积分类型:10:通用积分(跨屏) 11:定向积分(跨屏,绑定用途)20:通用积分(大屏)
21:定向积分(大屏,绑定用途)30:通用积分(小屏) 31:定向积分(小屏,绑定用途)*/
private
Integer
pointType
;
/
/ 绑定对应的实体, 如何描述?
/
** 绑定对应的实体, 如何描述? */
private
String
targetNo
;
/
/ 本月期初积分值
/
** 本月期初积分值 */
private
Integer
beginPoints
;
/
/ 当前积分余额
/
** 当前积分余额 */
private
Integer
currentPoints
;
/
/ 本月到期积分
/
** 本月到期积分 */
private
Integer
expirePoints
;
// 积分类型:10:通用积分(跨屏) 11:定向积分(跨屏,绑定用途)20:通用积分(大屏) 21:定向积分(大屏,绑定用途)30:通用积分(小屏) 31:定向积分(小屏,绑定用途)
/** 积分类型:10:通用积分(跨屏) 11:定向积分(跨屏,绑定用途)20:通用积分(大屏)
* 21:定向积分(大屏,绑定用途)30:通用积分(小屏) 31:定向积分(小屏,绑定用途)
*/
private
Timestamp
createTime
;
/
/ 最后修改时间
/
** 最后修改时间 */
private
Timestamp
updateTime
;
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/points/service/dto/PointsQueryCriteria.java
deleted
100644 → 0
View file @
5f7c828
package
com
.
topdraw
.
business
.
module
.
points
.
service
.
dto
;
import
lombok.Data
;
/**
* @author XiangHan
* @date 2021-10-22
*/
@Data
public
class
PointsQueryCriteria
{
}
member-service-impl/src/main/java/com/topdraw/business/module/points/service/impl/PointsServiceImpl.java
View file @
8741023
...
...
@@ -6,23 +6,14 @@ import com.topdraw.utils.ValidationUtil;
import
com.topdraw.business.module.points.repository.PointsRepository
;
import
com.topdraw.business.module.points.service.PointsService
;
import
com.topdraw.business.module.points.service.dto.PointsDTO
;
import
com.topdraw.business.module.points.service.dto.PointsQueryCriteria
;
import
com.topdraw.business.module.points.service.mapper.PointsMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.dao.EmptyResultDataAccessException
;
import
cn.hutool.core.lang.Snowflake
;
import
cn.hutool.core.util.IdUtil
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.util.Assert
;
import
com.topdraw.utils.PageUtil
;
import
com.topdraw.utils.QueryHelp
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author XiangHan
...
...
@@ -33,49 +24,39 @@ import java.util.Map;
public
class
PointsServiceImpl
implements
PointsService
{
@Autowired
private
PointsRepository
PointsRepository
;
private
PointsRepository
pointsRepository
;
@Autowired
private
PointsMapper
PointsMapper
;
private
PointsMapper
pointsMapper
;
@Autowired
private
RedisUtils
redisUtils
;
@Override
public
Map
<
String
,
Object
>
queryAll
(
PointsQueryCriteria
criteria
,
Pageable
pageable
)
{
Page
<
Points
>
page
=
PointsRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
return
PageUtil
.
toPage
(
page
.
map
(
PointsMapper:
:
toDto
));
}
@Override
public
List
<
PointsDTO
>
queryAll
(
PointsQueryCriteria
criteria
)
{
return
PointsMapper
.
toDto
(
PointsRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
)));
}
@Override
public
PointsDTO
findById
(
Long
id
)
{
Points
Points
=
P
ointsRepository
.
findById
(
id
).
orElseGet
(
Points:
:
new
);
Points
Points
=
this
.
p
ointsRepository
.
findById
(
id
).
orElseGet
(
Points:
:
new
);
ValidationUtil
.
isNull
(
Points
.
getId
(),
"Points"
,
"id"
,
id
);
return
P
ointsMapper
.
toDto
(
Points
);
return
this
.
p
ointsMapper
.
toDto
(
Points
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
create
(
Points
resources
)
{
Snowflake
snowflake
=
IdUtil
.
createSnowflake
(
1
,
1
);
resources
.
setId
(
snowflake
.
nextId
());
PointsRepository
.
save
(
resources
);
public
PointsDTO
create
(
Points
resources
)
{
Points
points
=
this
.
pointsRepository
.
save
(
resources
);
return
this
.
pointsMapper
.
toDto
(
points
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
Points
resources
)
{
public
PointsDTO
update
(
Points
resources
)
{
this
.
redisUtils
.
doLock
(
"Points::update::userId"
+
resources
.
getUserId
().
toString
());
try
{
Points
Points
=
PointsRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
Points:
:
new
);
ValidationUtil
.
isNull
(
Points
.
getId
(),
"Points"
,
"id"
,
resources
.
getId
());
Points
.
copy
(
resources
);
PointsRepository
.
save
(
Points
);
Points
points
=
this
.
pointsRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
Points:
:
new
);
ValidationUtil
.
isNull
(
points
.
getId
(),
"Points"
,
"id"
,
resources
.
getId
());
points
.
copy
(
resources
);
this
.
pointsRepository
.
save
(
points
);
return
this
.
pointsMapper
.
toDto
(
points
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
...
...
@@ -88,9 +69,9 @@ public class PointsServiceImpl implements PointsService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Long
id
)
{
Assert
.
notNull
(
id
,
"The given id must not be null!"
);
Points
Points
=
P
ointsRepository
.
findById
(
id
).
orElseThrow
(
Points
Points
=
this
.
p
ointsRepository
.
findById
(
id
).
orElseThrow
(
()
->
new
EmptyResultDataAccessException
(
String
.
format
(
"No %s entity "
+
"with id %s "
+
"exists!"
,
Points
.
class
,
id
),
1
));
P
ointsRepository
.
delete
(
Points
);
this
.
p
ointsRepository
.
delete
(
Points
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/rights/domain/Rights.java
View file @
8741023
...
...
@@ -23,63 +23,63 @@ import java.io.Serializable;
@Table
(
name
=
"tr_rights"
)
public
class
Rights
implements
Serializable
{
/
/ 主键
/
** 主键 */
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
private
Long
id
;
/
/ 标识
/
** 标识 */
@Column
(
name
=
"code"
,
nullable
=
false
)
private
String
code
;
/
/ 权益名称
//
@Column(name = "name")
//
private String name;
/
** 权益名称 */
@Column
(
name
=
"name"
)
private
String
name
;
/
/ 类型 1:实体类 (预留字段)
/
** 类型 1:实体类 (预留字段) */
@Column
(
name
=
"type"
,
nullable
=
false
)
private
Integer
type
;
/
/ 终端类型 0:大屏;1:微信小程序/公众号;2:App
/
** 终端类型 0:大屏;1:微信小程序/公众号;2:App */
@Column
(
name
=
"device_type"
,
nullable
=
false
)
private
Integer
deviceType
;
/
/ 权益的实体类型 1:积分;2成长值;3优惠券
/
** 权益的实体类型 1:积分;2成长值;3优惠券 */
@Column
(
name
=
"entity_type"
,
nullable
=
false
)
private
String
entityType
;
/
/ 实体id
/
** 实体id */
@Column
(
name
=
"entity_id"
,
nullable
=
false
)
private
Long
entityId
;
/
/ 生效时间,为null表示获取后立即生效,不为空时,表示特定的生效时间
/
** 生效时间,为null表示获取后立即生效,不为空时,表示特定的生效时间 */
@Column
(
name
=
"valid_time"
)
private
Timestamp
validTime
;
/
/ 失效时间,空为不失效,否则为获得权益后直到失效的毫秒数
/
** 失效时间,空为不失效,否则为获得权益后直到失效的毫秒数 */
@Column
(
name
=
"expire_time"
)
private
Long
expireTime
;
/
/ 创建时间
/
** 创建时间 */
@CreatedDate
@Column
(
name
=
"create_time"
)
private
Timestamp
createTime
;
/
/ 更新时间
/
** 更新时间 */
@LastModifiedDate
@Column
(
name
=
"update_time"
)
private
Timestamp
updateTime
;
/
/ 图片
/
** 图片 */
@Column
(
name
=
"image"
)
private
String
image
;
/
/ 图片
/
** 图片 */
@Column
(
name
=
"images"
)
private
String
images
;
/
/ 描述
/
** 描述 */
@Column
(
name
=
"description"
)
private
String
description
;
...
...
member-service-impl/src/main/java/com/topdraw/business/module/rights/service/dto/RightsDTO.java
View file @
8741023
...
...
@@ -12,44 +12,45 @@ import java.io.Serializable;
@Data
public
class
RightsDTO
implements
Serializable
{
/
/ 主键
/
** 主键 */
private
Long
id
;
/
/ 标识
/
** 标识 */
private
String
code
;
// 权益名称
// private String name;
// 终端类型 0:大屏;1:微信小程序/公众号;2:App
/** 权益名称 */
private
String
name
;
/** 终端类型 0:大屏;1:微信小程序/公众号;2:App */
private
Integer
deviceType
;
/
/ 类型 1:实体类 (预留字段)
/
** 类型 1:实体类 (预留字段) */
private
Integer
type
;
/
/ 权益的实体类型 1:积分;2成长值;3优惠券
/
** 权益的实体类型 1:积分;2成长值;3优惠券 */
private
String
entityType
;
/
/ 实体id
/
** 实体id */
private
Long
entityId
;
/
/ 生效时间,为null表示获取后立即生效,不为空时,表示特定的生效时间
/
** 生效时间,为null表示获取后立即生效,不为空时,表示特定的生效时间 */
private
Timestamp
validTime
;
/
/ 失效时间,空为不失效,否则为获得权益后直到失效的毫秒数
/
** 失效时间,空为不失效,否则为获得权益后直到失效的毫秒数 */
private
Long
expireTime
;
/
/ 创建时间
/
** 创建时间 */
private
Timestamp
createTime
;
/
/ 更新时间
/
** 更新时间 */
private
Timestamp
updateTime
;
/
/ 图片
/
** 图片 */
private
String
image
;
/
/ 图片
/
** 图片 */
private
String
images
;
/
/ 描述
/
** 描述 */
private
String
description
;
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/rights/service/dto/RightsQueryCriteria.java
deleted
100644 → 0
View file @
5f7c828
package
com
.
topdraw
.
business
.
module
.
rights
.
service
.
dto
;
import
com.topdraw.annotation.Query
;
import
lombok.Data
;
/**
* @author XiangHan
* @date 2021-10-22
*/
@Data
public
class
RightsQueryCriteria
{
@Query
private
Long
memberId
;
private
RightsQueryType
queryType
;
}
member-service-impl/src/main/java/com/topdraw/business/module/rights/service/dto/RightsQueryType.java
deleted
100644 → 0
View file @
5f7c828
package
com
.
topdraw
.
business
.
module
.
rights
.
service
.
dto
;
public
enum
RightsQueryType
{
// 全部
ALL
,
// 可用
AVAILABLE_ONLY
}
member-service-impl/src/main/java/com/topdraw/business/module/rights/service/impl/RightsServiceImpl.java
View file @
8741023
...
...
@@ -20,24 +20,20 @@ import org.springframework.transaction.annotation.Transactional;
public
class
RightsServiceImpl
implements
RightsService
{
@Autowired
private
RightsRepository
RightsRepository
;
@Autowired
private
RightsMapper
RightsMapper
;
private
RightsRepository
rightsRepository
;
@Autowired
private
R
edisUtils
redisUtils
;
private
R
ightsMapper
rightsMapper
;
@Override
public
RightsDTO
findById
(
Long
id
)
{
Rights
Rights
=
R
ightsRepository
.
findById
(
id
).
orElseGet
(
Rights:
:
new
);
Rights
Rights
=
this
.
r
ightsRepository
.
findById
(
id
).
orElseGet
(
Rights:
:
new
);
ValidationUtil
.
isNull
(
Rights
.
getId
(),
"Rights"
,
"id"
,
id
);
return
R
ightsMapper
.
toDto
(
Rights
);
return
this
.
r
ightsMapper
.
toDto
(
Rights
);
}
@Override
public
RightsDTO
getByCode
(
String
code
)
{
return
StringUtils
.
isNotEmpty
(
code
)
?
RightsMapper
.
toDto
(
R
ightsRepository
.
findFirstByCode
(
code
).
orElseGet
(
Rights:
:
new
))
return
StringUtils
.
isNotEmpty
(
code
)
?
this
.
rightsMapper
.
toDto
(
this
.
r
ightsRepository
.
findFirstByCode
(
code
).
orElseGet
(
Rights:
:
new
))
:
new
RightsDTO
();
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/iptv/service/UserTvService.java
View file @
8741023
...
...
@@ -22,13 +22,13 @@ public interface UserTvService {
* @param resources
* @return
*/
UserTv
create
(
UserTv
resources
);
UserTv
DTO
create
(
UserTv
resources
);
/**
*
* @param resources
*/
void
update
(
UserTv
resources
);
UserTvDTO
update
(
UserTv
resources
);
/**
*
...
...
member-service-impl/src/main/java/com/topdraw/business/module/user/iptv/service/impl/UserTvServiceImpl.java
View file @
8741023
...
...
@@ -81,24 +81,25 @@ public class UserTvServiceImpl implements UserTvService {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
UserTv
create
(
UserTv
resources
)
{
public
UserTv
DTO
create
(
UserTv
resources
)
{
MemberDTO
memberDTO
=
memberService
.
findByCode
(
resources
.
getMemberCode
());
if
(
Objects
.
nonNull
(
memberDTO
))
{
Long
id
=
memberDTO
.
getId
();
resources
.
setMemberId
(
id
);
this
.
userTvRepository
.
save
(
resources
);
return
resources
;
UserTv
userTv
=
this
.
userTvRepository
.
save
(
resources
);
return
this
.
userTvMapper
.
toDto
(
userTv
)
;
}
return
null
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
UserTv
resources
)
{
UserTv
UserTv
=
this
.
userTvRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
UserTv:
:
new
);
ValidationUtil
.
isNull
(
UserTv
.
getId
(),
"UserTv"
,
"id"
,
resources
.
getId
());
UserTv
.
copy
(
resources
);
this
.
userTvRepository
.
save
(
UserTv
);
public
UserTvDTO
update
(
UserTv
resources
)
{
UserTv
userTv
=
this
.
userTvRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
UserTv:
:
new
);
ValidationUtil
.
isNull
(
userTv
.
getId
(),
"UserTv"
,
"id"
,
resources
.
getId
());
userTv
.
copy
(
resources
);
UserTv
_userTv
=
this
.
userTvRepository
.
save
(
userTv
);
return
this
.
userTvMapper
.
toDto
(
_userTv
);
}
@Override
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/CouponOperationController.java
View file @
8741023
package
com
.
topdraw
.
business
.
process
.
rest
;
import
com.topdraw.aop.log.Log
;
import
com.topdraw.business.process.domian.TempCoupon
;
import
com.topdraw.business.process.service.CouponOperationService
;
import
com.topdraw.common.ResultInfo
;
...
...
@@ -14,14 +15,15 @@ import java.util.List;
* @author XiangHan
* @date 2021-10-22
*/
@Api
(
tags
=
"
CouponOperation
管理"
)
@Api
(
tags
=
"
优惠券
管理"
)
@RestController
@RequestMapping
(
"/ucEngine/
api/
couponOperation"
)
@RequestMapping
(
"/ucEngine/couponOperation"
)
public
class
CouponOperationController
{
@Autowired
private
CouponOperationService
couponOperationService
;
@Log
(
"手动发放优惠券"
)
@PostMapping
(
value
=
"/grantCouponByManual"
)
@ApiOperation
(
"手动发放优惠券"
)
public
ResultInfo
grantCouponByManual
(
List
<
TempCoupon
>
tempCouponList
)
{
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/ExpOperationController.java
View file @
8741023
package
com
.
topdraw
.
business
.
process
.
rest
;
import
com.topdraw.
business.process.domian.TempCoupon
;
import
com.topdraw.
aop.log.Log
;
import
com.topdraw.business.process.domian.TempExp
;
import
com.topdraw.business.process.service.CouponOperationService
;
import
com.topdraw.business.process.service.ExpOperationService
;
import
com.topdraw.common.ResultInfo
;
import
io.swagger.annotations.Api
;
...
...
@@ -21,14 +20,15 @@ import java.util.List;
* @author XiangHan
* @date 2021-10-22
*/
@Api
(
tags
=
"
ExpOperation
管理"
)
@Api
(
tags
=
"
成长值
管理"
)
@RestController
@RequestMapping
(
"/ucEngine/
api/
expOperation"
)
@RequestMapping
(
"/ucEngine/expOperation"
)
public
class
ExpOperationController
{
@Autowired
private
ExpOperationService
expOperationService
;
@Log
(
"手动发放成长值"
)
@PostMapping
(
value
=
"/grantExpByManual"
)
@ApiOperation
(
"手动发放成长值"
)
public
ResultInfo
grantExpByManual
(
@Validated
@RequestBody
TempExp
tempExp
)
{
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/PointsOperationController.java
View file @
8741023
...
...
@@ -46,14 +46,6 @@ public class PointsOperationController {
@Autowired
private
PointsOperationService
pointsOperationService
;
@GetMapping
(
value
=
"/pagePointsDetails"
)
@ApiOperation
(
"查询PointsDetail"
)
@AnonymousAccess
public
ResultInfo
pagePointsDetails
(
PointsDetailQueryCriteria
criteria
,
Pageable
pageable
)
{
return
ResultInfo
.
successPage
(
pointsDetailService
.
queryAll
(
criteria
,
pageable
));
}
@GetMapping
(
value
=
"/cleanInvalidPointsAndCalculateCurrentPoints/{id}"
)
@ApiOperation
(
"清除过期积分并计算总积分,供客户端会员查询积分时调用"
)
@AnonymousAccess
...
...
member-service-impl/src/main/java/com/topdraw/business/process/rest/RightsOperationController.java
View file @
8741023
package
com
.
topdraw
.
business
.
process
.
rest
;
import
com.topdraw.aop.log.Log
;
import
com.topdraw.business.module.rights.history.domain.RightsHistory
;
import
com.topdraw.business.module.rights.history.service.RightsHistoryService
;
import
com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryCriteria
;
import
com.topdraw.business.module.rights.history.service.dto.RightsHistoryQueryType
;
import
com.topdraw.business.process.service.RightsOperationService
;
import
com.topdraw.common.ResultInfo
;
import
com.topdraw.util.TimestampUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.*
;
...
...
@@ -23,32 +19,20 @@ import java.util.List;
*/
@Api
(
tags
=
"Rights管理"
)
@RestController
@RequestMapping
(
"/ucEngine/
api/
rightsOperation"
)
@RequestMapping
(
"/ucEngine/rightsOperation"
)
public
class
RightsOperationController
{
@Autowired
private
RightsOperationService
rightsOperationService
;
@Autowired
private
RightsHistoryService
rightsHistoryService
;
/**
*
* @param id
* @return
*/
@GetMapping
(
value
=
"/findRightsHistoryById/{id}"
)
@ApiOperation
(
"查询RightsHistory"
)
public
ResultInfo
findRightsHistoryById
(
@PathVariable
Long
id
)
{
return
ResultInfo
.
success
(
rightsHistoryService
.
findById
(
id
));
}
/**
*
* @param rightsHistory
* @return
*/
@Log
(
"手动发放优惠券"
)
@PostMapping
(
value
=
"/grantRightsByManual"
)
@ApiOperation
(
"
查询RightsHistory
"
)
@ApiOperation
(
"
手动发放优惠券
"
)
public
ResultInfo
grantRightsByManual
(
@Validated
@RequestBody
RightsHistory
rightsHistory
)
{
List
<
RightsHistory
>
rightsHistories
=
Arrays
.
asList
(
rightsHistory
);
this
.
rightsOperationService
.
grantRightsByManual
(
rightsHistories
);
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/ExpOperationService.java
View file @
8741023
package
com
.
topdraw
.
business
.
process
.
service
;
import
com.topdraw.business.process.domian.TempCoupon
;
import
com.topdraw.business.process.domian.TempExp
;
import
com.topdraw.business.process.domian.TempRights
;
import
java.util.List
;
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/ExpOperationServiceImpl.java
View file @
8741023
...
...
@@ -52,11 +52,9 @@ public class ExpOperationServiceImpl implements ExpOperationService {
@Override
@AsyncMqSend
public
void
grantPointsThroughTempExp
(
List
<
TempExp
>
tempExpList
)
{
for
(
TempExp
tempExp
:
tempExpList
)
{
this
.
refresh
(
tempExp
);
}
}
@Override
...
...
@@ -73,7 +71,6 @@ public class ExpOperationServiceImpl implements ExpOperationService {
}
}
/**
*
* @param tempExp
...
...
@@ -105,6 +102,11 @@ public class ExpOperationServiceImpl implements ExpOperationService {
return
rewardExp
+
originalExp
;
}
/**
*
* @param tempExp
* @return
*/
private
long
getExpByMemberId
(
TempExp
tempExp
)
{
Long
memberId
=
tempExp
.
getMemberId
();
MemberDTO
memberDTO
=
this
.
memberOperationService
.
findById
(
memberId
);
...
...
@@ -115,7 +117,6 @@ public class ExpOperationServiceImpl implements ExpOperationService {
return
0L
;
}
/**
* 更新成长值与等级
*
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/PointsOperationServiceImpl.java
View file @
8741023
...
...
@@ -43,8 +43,6 @@ import java.util.stream.Collectors;
@Slf4j
public
class
PointsOperationServiceImpl
implements
PointsOperationService
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
PointsOperationServiceImpl
.
class
);
@Autowired
PointsService
pointsService
;
@Autowired
...
...
@@ -69,8 +67,6 @@ public class PointsOperationServiceImpl implements PointsOperationService {
private
static
final
String
DELETE_AVAILABLE_POINTS
=
"delete"
;
private
static
final
String
INSERT_AVAILABLE_POINTS
=
"insert"
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
grantPointsByManual
(
Long
memberId
,
TempPoints
tempPoints
){
...
...
@@ -361,15 +357,6 @@ public class PointsOperationServiceImpl implements PointsOperationService {
/**
*
* @param pointsAvailableDTOS
*/
private
void
doDeleteBatchInvalidAvailablePoints
(
List
<
PointsAvailableDTO
>
pointsAvailableDTOS
)
{
List
<
Long
>
collect
=
pointsAvailableDTOS
.
stream
().
map
(
pointsAvailableDTO
->
pointsAvailableDTO
.
getId
()).
collect
(
Collectors
.
toList
());
this
.
pointsAvailableService
.
deleteBatchByIds
(
collect
);
}
/**
*
* @param pointsAvailableDTO
*/
private
void
doDeleteInvalidAvailablePoints
(
PointsAvailableDTO
pointsAvailableDTO
)
{
...
...
@@ -515,16 +502,6 @@ public class PointsOperationServiceImpl implements PointsOperationService {
}
/**
* 计算当前总积分
* @param memberId 会员id
* @return
*/
private
Long
findAvailablePointsByMemberId
(
long
memberId
){
Long
availablePoints
=
this
.
pointsAvailableService
.
findAvailablePointsByMemberId
(
memberId
);
return
Objects
.
nonNull
(
availablePoints
)
?
availablePoints
:
0L
;
}
/**
* 更新可用积分表
* @param tempPoints
*/
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
View file @
8741023
...
...
@@ -1087,10 +1087,7 @@ public class UserOperationServiceImpl implements UserOperationService {
resources
.
setMemberId
(
memberId
);
resources
.
setMemberCode
(
memberCode
);
UserTv
userTv
=
this
.
userTvService
.
create
(
resources
);
UserTvDTO
userTvDTO
=
new
UserTvDTO
();
BeanUtils
.
copyProperties
(
userTv
,
userTvDTO
);
UserTvDTO
userTvDTO
=
this
.
userTvService
.
create
(
resources
);
return
userTvDTO
;
}
...
...
Please
register
or
sign in
to post a comment