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
9db5a924
...
9db5a924fe17d2da9fa53110a3290ae50a730e1f
authored
2021-11-12 21:15:43 +0800
by
xianghan@topdraw.cn
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'release/1.0.1'
2 parents
11227f2b
b2cf3020
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
291 additions
and
134 deletions
member-service-impl/src/main/java/com/topdraw/MemberServiceApplication.java
member-service-impl/src/main/java/com/topdraw/aspect/AsyncMqProducer.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/coupon/history/rest/CouponHistoryController.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/coupon/rest/CouponController.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/exp/detail/rest/ExpDetailController.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/exp/history/rest/ExpHistoryController.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/domain/Member.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/level/rest/MemberLevelController.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/profile/domain/MemberProfile.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/profile/rest/MemberProfileController.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/profile/service/dto/MemberProfileDTO.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/relatedinfo/rest/MemberRelatedInfoController.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/rest/MemberController.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/service/dto/MemberDTO.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/service/impl/MemberServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/points/domain/Points.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/task/template/repository/TaskTemplateRepository.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/task/template/service/TaskTemplateService.java
member-service-impl/src/main/java/com/topdraw/business/basicdata/task/template/service/impl/TaskTemplateServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/service/PointsOperationService.java
member-service-impl/src/main/java/com/topdraw/business/process/service/builder/TempCouponBuilder.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/CouponOperationServiceImpl.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/RightsOperationServiceImpl.java
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/TaskOperationServiceImpl.java
member-service-impl/src/main/resources/config/application-dev.yml
member-service-impl/src/main/resources/config/application-test.yml
member-service-impl/src/main/resources/config/application.yml
member-service-impl/src/test/java/com/topdraw/test/business/basicdata/member/rest/MemberProfileControllerTest.java
member-service-impl/src/test/java/com/topdraw/test/business/process/rest/TaskOperationControllerTest.java
member-service-impl/src/main/java/com/topdraw/MemberServiceApplication.java
View file @
9db5a92
...
...
@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
import
org.springframework.retry.annotation.EnableRetry
;
...
...
@@ -21,6 +22,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication
(
exclude
=
{
SecurityAutoConfiguration
.
class
})
@EnableTransactionManagement
@EnableRetry
@EnableCaching
public
class
MemberServiceApplication
extends
SpringBootServletInitializer
{
public
static
void
main
(
String
[]
args
)
{
...
...
member-service-impl/src/main/java/com/topdraw/aspect/AsyncMqProducer.java
View file @
9db5a92
...
...
@@ -73,7 +73,7 @@ public class AsyncMqProducer {
boolean
async
=
asyncMqSend
.
async
();
if
(
async
)
{
// 异步
this
.
sendMqMessage
(
tableOperationMsg
);
this
.
threadPoolTaskExecutor
.
execute
(()->
this
.
sendMqMessage
(
tableOperationMsg
)
);
}
else
{
// 同步
this
.
sendMqMessage
(
tableOperationMsg
);
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/coupon/history/rest/CouponHistoryController.java
View file @
9db5a92
...
...
@@ -40,7 +40,7 @@ public class CouponHistoryController {
}
@Log
@PostMapping
@PostMapping
(
value
=
"/create"
)
@ApiOperation
(
"新增CouponHistory"
)
public
ResultInfo
create
(
@Validated
@RequestBody
CouponHistory
resources
)
{
CouponHistoryService
.
create
(
resources
);
...
...
@@ -48,7 +48,7 @@ public class CouponHistoryController {
}
@Log
@PutMapping
@PutMapping
(
value
=
"/update"
)
@ApiOperation
(
"修改CouponHistory"
)
public
ResultInfo
update
(
@Validated
@RequestBody
CouponHistory
resources
)
{
CouponHistoryService
.
update
(
resources
);
...
...
@@ -57,7 +57,7 @@ public class CouponHistoryController {
@Log
@DeleteMapping
(
value
=
"/{id}"
)
@DeleteMapping
(
value
=
"/
delete/
{id}"
)
@ApiOperation
(
"删除CouponHistory"
)
public
ResultInfo
delete
(
@PathVariable
Long
id
)
{
CouponHistoryService
.
delete
(
id
);
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/coupon/rest/CouponController.java
View file @
9db5a92
...
...
@@ -36,7 +36,7 @@ public class CouponController {
}
@Log
@PostMapping
@PostMapping
(
value
=
"/create"
)
@ApiOperation
(
"新增Coupon"
)
public
ResultInfo
create
(
@Validated
@RequestBody
Coupon
resources
)
{
CouponService
.
create
(
resources
);
...
...
@@ -44,7 +44,7 @@ public class CouponController {
}
@Log
@PutMapping
@PutMapping
(
value
=
"/update"
)
@ApiOperation
(
"修改Coupon"
)
public
ResultInfo
update
(
@Validated
@RequestBody
Coupon
resources
)
{
CouponService
.
update
(
resources
);
...
...
@@ -53,7 +53,7 @@ public class CouponController {
@Log
@DeleteMapping
(
value
=
"/{id}"
)
@DeleteMapping
(
value
=
"/
delete/
{id}"
)
@ApiOperation
(
"删除Coupon"
)
public
ResultInfo
delete
(
@PathVariable
Long
id
)
{
CouponService
.
delete
(
id
);
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/exp/detail/rest/ExpDetailController.java
View file @
9db5a92
...
...
@@ -36,7 +36,7 @@ public class ExpDetailController {
}
@Log
@PostMapping
@PostMapping
(
value
=
"/create"
)
@ApiOperation
(
"新增ExpDetail"
)
public
ResultInfo
create
(
@Validated
@RequestBody
ExpDetail
resources
)
{
ExpDetailService
.
create
(
resources
);
...
...
@@ -44,7 +44,7 @@ public class ExpDetailController {
}
@Log
@PutMapping
@PutMapping
(
value
=
"/update"
)
@ApiOperation
(
"修改ExpDetail"
)
public
ResultInfo
update
(
@Validated
@RequestBody
ExpDetail
resources
)
{
ExpDetailService
.
update
(
resources
);
...
...
@@ -53,7 +53,7 @@ public class ExpDetailController {
@Log
@DeleteMapping
(
value
=
"/{id}"
)
@DeleteMapping
(
value
=
"/
delete/
{id}"
)
@ApiOperation
(
"删除ExpDetail"
)
public
ResultInfo
delete
(
@PathVariable
Long
id
)
{
ExpDetailService
.
delete
(
id
);
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/exp/history/rest/ExpHistoryController.java
View file @
9db5a92
...
...
@@ -35,31 +35,6 @@ public class ExpHistoryController {
return
ResultInfo
.
success
(
ExpHistoryService
.
queryAll
(
criteria
));
}
@Log
@PostMapping
@ApiOperation
(
"新增ExpHistory"
)
public
ResultInfo
create
(
@Validated
@RequestBody
ExpHistory
resources
)
{
ExpHistoryService
.
create
(
resources
);
return
ResultInfo
.
success
();
}
@Log
@PutMapping
@ApiOperation
(
"修改ExpHistory"
)
public
ResultInfo
update
(
@Validated
@RequestBody
ExpHistory
resources
)
{
ExpHistoryService
.
update
(
resources
);
return
ResultInfo
.
success
();
}
@Log
@DeleteMapping
(
value
=
"/{id}"
)
@ApiOperation
(
"删除ExpHistory"
)
public
ResultInfo
delete
(
@PathVariable
Long
id
)
{
ExpHistoryService
.
delete
(
id
);
return
ResultInfo
.
success
();
}
@GetMapping
(
value
=
"/getByCode/{code}"
)
@ApiOperation
(
value
=
"根据标识查询"
)
public
ResultInfo
getByCode
(
@PathVariable
String
code
)
{
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/domain/Member.java
View file @
9db5a92
...
...
@@ -120,8 +120,8 @@ public class Member implements Serializable {
private
Timestamp
updateTime
;
// 是否在黑名单 1:是;0否
//
@Column(name = "black_status")
//
private Integer blackStatus;
@Column
(
name
=
"black_status"
)
private
Integer
blackStatus
;
public
void
copy
(
Member
source
){
BeanUtil
.
copyProperties
(
source
,
this
,
CopyOptions
.
create
().
setIgnoreNullValue
(
true
));
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/level/rest/MemberLevelController.java
View file @
9db5a92
...
...
@@ -35,8 +35,8 @@ public class MemberLevelController {
return
ResultInfo
.
success
(
MemberLevelService
.
queryAll
(
criteria
));
}
@Log
@PostMapping
/*
@Log
@PostMapping
(value = "/create")
@ApiOperation("新增MemberLevel")
public ResultInfo create(@Validated @RequestBody MemberLevel resources) {
MemberLevelService.create(resources);
...
...
@@ -44,7 +44,7 @@ public class MemberLevelController {
}
@Log
@PutMapping
@PutMapping
(value = "/update")
@ApiOperation("修改MemberLevel")
public ResultInfo update(@Validated @RequestBody MemberLevel resources) {
MemberLevelService.update(resources);
...
...
@@ -53,12 +53,12 @@ public class MemberLevelController {
@Log
@DeleteMapping
(
value
=
"/{id}"
)
@DeleteMapping(value = "/
delete/
{id}")
@ApiOperation("删除MemberLevel")
public ResultInfo delete(@PathVariable Long id) {
MemberLevelService.delete(id);
return ResultInfo.success();
}
}
*/
@GetMapping
(
value
=
"/getByCode/{code}"
)
@ApiOperation
(
value
=
"根据标识查询"
)
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/profile/domain/MemberProfile.java
View file @
9db5a92
...
...
@@ -53,6 +53,10 @@ public class MemberProfile implements Serializable {
@Column
(
name
=
"birthday"
,
nullable
=
false
)
private
Timestamp
birthday
;
// 手机号
@Column
(
name
=
"phone"
)
private
String
phone
;
// 星座
@Column
(
name
=
"constellation"
)
private
String
constellation
;
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/profile/rest/MemberProfileController.java
View file @
9db5a92
...
...
@@ -36,7 +36,7 @@ public class MemberProfileController {
}*/
@Log
@PostMapping
@PostMapping
(
value
=
"/create"
)
@ApiOperation
(
"新增MemberProfile"
)
public
ResultInfo
create
(
@Validated
@RequestBody
MemberProfile
resources
)
{
MemberProfileService
.
create
(
resources
);
...
...
@@ -44,7 +44,7 @@ public class MemberProfileController {
}
@Log
@PutMapping
@PutMapping
(
value
=
"/update"
)
@ApiOperation
(
"修改MemberProfile"
)
public
ResultInfo
update
(
@Validated
@RequestBody
MemberProfile
resources
)
{
MemberProfileService
.
update
(
resources
);
...
...
@@ -53,7 +53,7 @@ public class MemberProfileController {
@Log
@DeleteMapping
(
value
=
"/{id}"
)
@DeleteMapping
(
value
=
"/
delete/
{id}"
)
@ApiOperation
(
"删除MemberProfile"
)
public
ResultInfo
delete
(
@PathVariable
Long
id
)
{
MemberProfileService
.
delete
(
id
);
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/profile/service/dto/MemberProfileDTO.java
View file @
9db5a92
...
...
@@ -33,6 +33,9 @@ public class MemberProfileDTO implements Serializable {
// 身份证
private
String
idCard
;
// 电话
private
String
phone
;
// 电子邮件
private
String
email
;
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/relatedinfo/rest/MemberRelatedInfoController.java
View file @
9db5a92
...
...
@@ -53,7 +53,7 @@ public class MemberRelatedInfoController {
}
@Log
@DeleteMapping
(
value
=
"/delete/
/
{id}"
)
@DeleteMapping
(
value
=
"/delete/{id}"
)
@ApiOperation
(
"删除MemberRelatedInfo"
)
public
ResultInfo
delete
(
@PathVariable
Long
id
)
{
MemberRelatedInfoService
.
delete
(
id
);
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/rest/MemberController.java
View file @
9db5a92
...
...
@@ -50,7 +50,7 @@ public class MemberController {
@ApiOperation
(
"修改Member等级"
)
public
ResultInfo
doUpdateVip
(
Long
memberId
,
Integer
vip
)
{
Assert
.
isNull
(
memberId
,
"MemberController -->> doUpdateVip -->>【memberId】 not be null!!"
);
Assert
.
isNull
(
vip
,
"MemberController -->> doUpdateVip -->>【
memberId
】 not be null!!"
);
Assert
.
isNull
(
vip
,
"MemberController -->> doUpdateVip -->>【
vip
】 not be null!!"
);
Member
member
=
new
Member
();
member
.
setId
(
memberId
);
member
.
setVip
(
vip
);
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/service/dto/MemberDTO.java
View file @
9db5a92
...
...
@@ -83,5 +83,5 @@ public class MemberDTO implements Serializable {
private
Timestamp
updateTime
;
// 是否在黑名单 1:是;0否
//
private Integer blackStatus;
private
Integer
blackStatus
;
}
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/member/service/impl/MemberServiceImpl.java
View file @
9db5a92
...
...
@@ -19,6 +19,7 @@ import org.redisson.api.RLock;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.dao.EmptyResultDataAccessException
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
...
...
@@ -60,6 +61,7 @@ public class MemberServiceImpl implements MemberService {
return
memberMapper
.
toDto
(
memberRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
)));
}
// @Cacheable(cacheNames = "",key = "")
@Override
public
MemberDTO
findById
(
Long
id
)
{
Member
member
=
memberRepository
.
findById
(
id
).
orElseGet
(
Member:
:
new
);
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/points/domain/Points.java
View file @
9db5a92
...
...
@@ -30,7 +30,7 @@ public class Points implements Serializable {
@Column
(
name
=
"user_id"
)
private
Long
userId
;
// 积分类型,通用,绑定, 区分大小屏
todo
// 积分类型,通用,绑定, 区分大小屏
@Column
(
name
=
"point_type"
)
private
Integer
pointType
;
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/task/template/repository/TaskTemplateRepository.java
View file @
9db5a92
...
...
@@ -15,4 +15,6 @@ public interface TaskTemplateRepository extends JpaRepository<TaskTemplate, Long
Optional
<
TaskTemplate
>
findFirstByCode
(
String
code
);
TaskTemplate
findByEvent
(
String
event
);
TaskTemplate
findByType
(
Integer
event
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/task/template/service/TaskTemplateService.java
View file @
9db5a92
...
...
@@ -49,4 +49,6 @@ public interface TaskTemplateService {
TaskTemplateDTO
getByCode
(
String
code
);
TaskTemplate
findByEvent
(
String
event
);
TaskTemplate
findByType
(
Integer
event
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/basicdata/task/template/service/impl/TaskTemplateServiceImpl.java
View file @
9db5a92
...
...
@@ -8,6 +8,7 @@ import com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateDTO;
import
com.topdraw.business.basicdata.task.template.service.dto.TaskTemplateQueryCriteria
;
import
com.topdraw.business.basicdata.task.template.service.mapper.TaskTemplateMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -21,6 +22,7 @@ import com.topdraw.utils.StringUtils;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
/**
* @author XiangHan
...
...
@@ -85,8 +87,14 @@ public class TaskTemplateServiceImpl implements TaskTemplateService {
:
new
TaskTemplateDTO
();
}
// @Cacheable(cacheNames = "uc.taskTemplate" , key = "event")
@Override
public
TaskTemplate
findByEvent
(
String
event
)
{
public
TaskTemplate
findByEvent
(
String
event
)
{
return
StringUtils
.
isNotEmpty
(
event
)
?
this
.
TaskTemplateRepository
.
findByEvent
(
event
)
:
null
;
}
@Override
public
TaskTemplate
findByType
(
Integer
event
)
{
return
Objects
.
nonNull
(
event
)
?
this
.
TaskTemplateRepository
.
findByType
(
event
)
:
null
;
}
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/PointsOperationService.java
View file @
9db5a92
...
...
@@ -38,4 +38,9 @@ public interface PointsOperationService {
* 清理过期的积分
*/
void
cleanInvalidAvailablePoints
();
/**
* 清理过期的积分
*/
void
cleanInvalidAvailablePointsByMemberId
(
Long
memberId
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/builder/TempCouponBuilder.java
0 → 100644
View file @
9db5a92
package
com
.
topdraw
.
business
.
process
.
service
.
builder
;
import
com.topdraw.business.process.domian.TempCoupon
;
public
class
TempCouponBuilder
{
public
TempCoupon
build
(){
TempCoupon
tempCoupon
=
new
TempCoupon
();
return
tempCoupon
;
}
}
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/CouponOperationServiceImpl.java
View file @
9db5a92
...
...
@@ -16,6 +16,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
import
java.sql.Timestamp
;
...
...
@@ -40,11 +41,13 @@ public class CouponOperationServiceImpl implements CouponOperationService {
RightsOperationService
rightsOperationService
;
@Autowired
RedissonClient
redissonClient
;
@Autowired
ThreadPoolTaskExecutor
threadPoolTaskExecutor
;
// 过期阀值(默认一个月)
private
static
final
Integer
EXPIRE_FACTOR_MONTH
=
1
;
private
ReentrantLock
reentrantLock
=
new
ReentrantLock
(
true
);
@Override
public
void
grantCouponThroughTempCoupon
(
List
<
TempCoupon
>
tempCouponList
)
{
...
...
@@ -78,7 +81,7 @@ public class CouponOperationServiceImpl implements CouponOperationService {
*/
private
void
refresh
(
TempCoupon
tempCoupon
)
{
// 1.保存优惠券领取、使用历史记录表
this
.
doInsertCouponHistory
(
tempCoupon
);
this
.
threadPoolTaskExecutor
.
execute
(()->
this
.
doInsertCouponHistory
(
tempCoupon
)
);
// 2.更新会员优惠券数量
this
.
refreshMemberCoupon
(
tempCoupon
);
}
...
...
@@ -91,7 +94,7 @@ public class CouponOperationServiceImpl implements CouponOperationService {
private
void
refreshMemberCoupon
(
TempCoupon
tempCoupon
)
{
Long
userId
=
tempCoupon
.
getUserId
();
Long
memberId
=
tempCoupon
.
getMemberId
();
RLock
rLock
=
this
.
redissonClient
.
getLock
(
"refreshMemberCoupon"
+
memberId
.
toString
());
RLock
rLock
=
this
.
redissonClient
.
getLock
(
"refreshMemberCoupon
:
"
+
memberId
.
toString
());
try
{
RedissonUtil
.
lock
(
rLock
);
// 1.获取用户领取的总优惠券
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/ExpOperationServiceImpl.java
View file @
9db5a92
...
...
@@ -19,9 +19,11 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Objects
;
...
...
@@ -41,6 +43,8 @@ public class ExpOperationServiceImpl implements ExpOperationService {
MemberLevelService
memberLevelService
;
@Autowired
RedissonClient
redissonClient
;
@Resource
(
name
=
"executorTask"
)
ThreadPoolTaskExecutor
threadPoolTaskExecutor
;
@Override
public
void
grantPointsThroughTempExp
(
List
<
TempExp
>
tempExpList
)
{
...
...
@@ -71,11 +75,35 @@ public class ExpOperationServiceImpl implements ExpOperationService {
* @param tempExp
*/
private
void
refresh
(
TempExp
tempExp
)
{
// 1.添加成长值记录
this
.
doInsertExpDetail
(
tempExp
);
RLock
lock
=
this
.
redissonClient
.
getLock
(
"refresh_exp:"
+
tempExp
.
getMemberId
());
try
{
RedissonUtil
.
lock
(
lock
);
// 原始积分
long
originExp
=
this
.
getExpByMemberId
(
tempExp
);
// 总积分
long
totalExp
=
this
.
calculateTotalExp
(
originExp
,
tempExp
);
// 1.添加成长值记录
this
.
threadPoolTaskExecutor
.
execute
(()->
this
.
doInsertExpDetail
(
tempExp
,
originExp
,
totalExp
));
// 2.更新成长值与等级
this
.
refreshMemberExpAndLevel
(
tempExp
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
finally
{
RedissonUtil
.
unlock
(
lock
);
}
}
private
long
calculateTotalExp
(
long
originalExp
,
TempExp
tempExp
)
{
Long
rewardExp
=
tempExp
.
getRewardExp
();
return
(
Objects
.
nonNull
(
rewardExp
)
?
rewardExp
:
0L
)
+
(
Objects
.
nonNull
(
originalExp
)
?
originalExp
:
0L
);
}
// 2.更新成长值与等级
this
.
refreshMemberExpAndLevel
(
tempExp
);
private
long
getExpByMemberId
(
TempExp
tempExp
)
{
Long
memberId
=
tempExp
.
getMemberId
();
MemberDTO
memberDTO
=
this
.
memberOperationService
.
findById
(
memberId
);
Long
exp
=
memberDTO
.
getExp
();
return
exp
;
}
...
...
@@ -156,26 +184,24 @@ public class ExpOperationServiceImpl implements ExpOperationService {
return
memberDTO
;
}
/**
* 添加成长值记录
*
* @param tempExp 成长值列表
*/
private
void
doInsertExpDetail
(
TempExp
tempExp
)
{
private
void
doInsertExpDetail
(
TempExp
tempExp
,
long
originalExp
,
long
totalExp
)
{
// 获得的积分
Long
rewardExp
=
tempExp
.
getRewardExp
();
ExpDetail
expDetail
=
new
ExpDetail
();
BeanUtils
.
copyProperties
(
tempExp
,
expDetail
);
MemberDTO
memberDTO
=
this
.
memberOperationService
.
findById
(
expDetail
.
getMemberId
());
Long
exp
=
memberDTO
.
getExp
();
Long
rewardExp
=
tempExp
.
getRewardExp
();
Long
originalExp
=
exp
;
expDetail
.
setCode
(
String
.
valueOf
(
IdWorker
.
generator
()));
// 原始积分
expDetail
.
setOriginalExp
(
Objects
.
nonNull
(
originalExp
)
?
originalExp
:
0L
);
expDetail
.
setResultExp
((
Objects
.
nonNull
(
rewardExp
)
?
rewardExp
:
0L
)
+
(
Objects
.
nonNull
(
originalExp
)
?
originalExp
:
0L
));
// 总积分
expDetail
.
setResultExp
(
totalExp
);
// 获得的积分
expDetail
.
setExp
(
rewardExp
);
if
(
StringUtils
.
isEmpty
(
expDetail
.
getDescription
()))
{
expDetail
.
setDescription
(
"#"
);
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/PointsOperationServiceImpl.java
View file @
9db5a92
package
com
.
topdraw
.
business
.
process
.
service
.
impl
;
import
cn.hutool.core.map.MapUtil
;
import
com.topdraw.business.basicdata.member.domain.Member
;
import
com.topdraw.business.basicdata.member.service.dto.MemberDTO
;
import
com.topdraw.business.basicdata.points.available.domain.PointsAvailable
;
import
com.topdraw.business.basicdata.points.available.service.PointsAvailableService
;
import
com.topdraw.business.basicdata.points.available.service.dto.PointsAvailableDTO
;
...
...
@@ -17,25 +16,22 @@ import com.topdraw.util.IdWorker;
import
com.topdraw.util.RedissonUtil
;
import
com.topdraw.util.TimestampUtil
;
import
com.topdraw.utils.StringUtils
;
import
io.swagger.models.auth.In
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
java
.sql.Tim
e
;
import
java
x.annotation.Resourc
e
;
import
java.sql.Timestamp
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.concurrent.ForkJoinPool
;
import
java.util.concurrent.ForkJoinTask
;
import
java.util.concurrent.RecursiveTask
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -65,7 +61,9 @@ public class PointsOperationServiceImpl implements PointsOperationService {
private
static
final
String
INSERT_AVAILABLE_POINTS
=
"insert"
;
@Autowired
private
RedissonClient
redissonClient
;
RedissonClient
redissonClient
;
@Resource
(
name
=
"executorTask"
)
ThreadPoolTaskExecutor
threadPoolTaskExecutor
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -89,11 +87,11 @@ public class PointsOperationServiceImpl implements PointsOperationService {
// 1.判断可用积分是否够用
boolean
b
=
this
.
checkAvailablePoints
(
tempPoints
);
if
(
b
)
{
// 1.可用积分表,按照过期时间进行升序排列
// TODO 删除过期的积分
//1.删除过期的积分
this
.
cleanInvalidAvailablePointsByMemberId
(
memberId
);
// 2.可用积分表,按照过期时间进行升序排列
List
<
PointsAvailableDTO
>
pointsAvailableDTOS
=
this
.
findByMemberIdOrderByExpireTime
(
tempPoints
);
// 当前可用总积分
// 3.当前可用总积分
long
currentPoints
=
this
.
findAvailablePointsByMemberId
(
memberId
);
// 2.优先使用即将过期的积分,累加到超过需兑换积分时,需要进行拆分
Map
<
String
,
List
<
PointsAvailableDTO
>>
customAvailablePointsMap
=
this
.
customAvailablePoints
(
tempPoints
,
pointsAvailableDTOS
);
...
...
@@ -101,11 +99,8 @@ public class PointsOperationServiceImpl implements PointsOperationService {
this
.
doInsertTrPointsDetailByAvailablePointsMap
(
tempPoints
,
customAvailablePointsMap
,
currentPoints
);
// 4.更新可用积分表,超过的删除,剩余的新增
long
totalPoints
=
this
.
doFreshTrPointsAvailableByAvailablePointsMap
(
customAvailablePointsMap
,
currentPoints
);
// 4.获取即将过期的积分
// TODO 不用在这里查询
long
soonExpireTime
=
this
.
getSoonExpirePoints
(
memberId
,
tempPoints
);
// 6.更新会员积分信息
this
.
freshMemberCurrentPoints
(
memberId
,
totalPoints
,
soonExpireTime
);
this
.
freshMemberCurrentPoints
(
memberId
,
totalPoints
);
return
true
;
}
...
...
@@ -290,6 +285,17 @@ public class PointsOperationServiceImpl implements PointsOperationService {
}
}
@Override
public
void
cleanInvalidAvailablePointsByMemberId
(
Long
memberId
)
{
List
<
PointsAvailableDTO
>
pointsAvailableDTOS
=
pointsAvailableService
.
findByMemberIdAndExpireTimeBefore
(
memberId
,
TimestampUtil
.
now
());
if
(!
CollectionUtils
.
isEmpty
(
pointsAvailableDTOS
))
{
// 添加积分明细 uc_points_detail
this
.
doCreatePointsDetail
(
pointsAvailableDTOS
);
// 删除已过期的积分
this
.
doDeleteInvalidAvailablePoints
(
pointsAvailableDTOS
);
}
}
/**
*
* @param pointsAvailableDTOS
...
...
@@ -325,9 +331,8 @@ public class PointsOperationServiceImpl implements PointsOperationService {
pointsDetail
.
setEvtType
(
99
);
this
.
doInsertPointsDetail
(
pointsDetail
);
long
soonExpireTime
=
this
.
getSoonExpirePoints
(
memberId
,
null
);
// 更新会员积分
this
.
freshMemberCurrentPoints
(
memberId
,
resultPoints
,
soonExpireTime
);
this
.
freshMemberCurrentPoints
(
memberId
,
resultPoints
);
}
}
...
...
@@ -339,7 +344,7 @@ public class PointsOperationServiceImpl implements PointsOperationService {
*/
private
void
refresh
(
TempPoints
tempPoints
)
{
Long
memberId
=
tempPoints
.
getMemberId
();
RLock
rLock
=
this
.
redissonClient
.
getLock
(
"refresh"
+
memberId
.
toString
());
RLock
rLock
=
this
.
redissonClient
.
getLock
(
"refresh
_point:
"
+
memberId
.
toString
());
try
{
RedissonUtil
.
lock
(
rLock
);
// 1.可用总积分
...
...
@@ -347,13 +352,9 @@ public class PointsOperationServiceImpl implements PointsOperationService {
// 2.计算总积分
long
totalPoints
=
this
.
calculateTotalPoints
(
tempPoints
,
currentPoints
);
// 2.添加积分明细,并计算总积分
// TODO 把计算总积分的过程单独提取出来,保存积分流水的时候可以异步
this
.
doInsertTrPointsDetail
(
memberId
,
tempPoints
,
currentPoints
,
totalPoints
);
// 3.获取即将过期的积分
// TODO 不需要在这里查询过期积分,用的时候再去查看
long
soonExpireTime
=
this
.
getSoonExpirePoints
(
memberId
,
tempPoints
);
this
.
threadPoolTaskExecutor
.
execute
(()->
this
.
doInsertTrPointsDetail
(
memberId
,
tempPoints
,
currentPoints
,
totalPoints
));
// 4.更新会员的总积分
this
.
freshMemberCurrentPoints
(
memberId
,
totalPoints
,
soonExpireTime
);
this
.
freshMemberCurrentPoints
(
memberId
,
totalPoints
);
// 5.添加可用积分
this
.
doInsertTrPointsAvailable
(
tempPoints
);
}
catch
(
Exception
e
)
{
...
...
@@ -408,13 +409,12 @@ public class PointsOperationServiceImpl implements PointsOperationService {
* 更新会员总积分
* @param memberId 会员Id
* @param currentPoints 当前总积分
* @param duePoints 即将过期的积分
*/
private
void
freshMemberCurrentPoints
(
Long
memberId
,
Long
currentPoints
,
long
duePoints
)
{
private
void
freshMemberCurrentPoints
(
Long
memberId
,
Long
currentPoints
)
{
Member
member
=
new
Member
();
member
.
setId
(
memberId
);
member
.
setPoints
(
Objects
.
nonNull
(
currentPoints
)?
currentPoints:
0
);
member
.
setDuePoints
(
duePoints
);
//
member.setDuePoints(duePoints);
member
.
setUpdateTime
(
Timestamp
.
valueOf
(
LocalDateTime
.
now
()));
try
{
this
.
memberOperationService
.
doUpdateMemberPoints
(
member
);
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/RightsOperationServiceImpl.java
View file @
9db5a92
...
...
@@ -10,9 +10,9 @@ import com.topdraw.business.process.service.PointsOperationService;
import
com.topdraw.business.process.service.RightsOperationService
;
import
com.topdraw.business.process.domian.*
;
import
com.topdraw.util.TimestampUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
...
...
@@ -29,6 +29,7 @@ import java.util.*;
* @date 2021.10.23
*/
@Service
@Slf4j
public
class
RightsOperationServiceImpl
implements
RightsOperationService
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
RightsOperationServiceImpl
.
class
);
...
...
@@ -69,12 +70,17 @@ public class RightsOperationServiceImpl implements RightsOperationService {
*/
@Override
public
void
grantRights
(
Map
<
RightType
,
Object
>
tempRightsMap
)
{
this
.
threadPoolTaskExecutor
.
execute
(()->
{
// 2.创建权益历史对象
List
<
RightsHistory
>
rightsList
=
this
.
getRightHistory
(
tempRightsMap
);
// 3.保存权益历史
this
.
doInsertTrRightHistory
(
rightsList
);
});
// 1.权益下发
this
.
refresh
(
tempRightsMap
);
// 2.创建权益历史对象
List
<
RightsHistory
>
rightsList
=
this
.
getRightHistory
(
tempRightsMap
);
// 3.保存权益历史
this
.
doInsertTrRightHistory
(
rightsList
);
}
/**
...
...
@@ -138,24 +144,24 @@ public class RightsOperationServiceImpl implements RightsOperationService {
*/
private
void
refresh
(
Map
<
RightType
,
Object
>
tempRightsMap
)
{
/*
threadPoolTaskExecutor.execute(()->{
this
.
threadPoolTaskExecutor
.
execute
(()->{
// 积分
this
.
grantPoint
((
List
<
TempPoints
>)
tempRightsMap
.
get
(
RightType
.
POINTS
));
});
threadPoolTaskExecutor.execute(()->{
th
is
.
th
readPoolTaskExecutor
.
execute
(()->{
// 成长值
this
.
grantExp
((
List
<
TempExp
>)
tempRightsMap
.
get
(
RightType
.
EXP
));
});
threadPoolTaskExecutor.execute(()->{
th
is
.
th
readPoolTaskExecutor
.
execute
(()->{
// 优惠券
this
.
grantCoupon
((
List
<
TempCoupon
>)
tempRightsMap
.
get
(
RightType
.
COUPON
));
});
*/
});
this
.
grantPoint
((
List
<
TempPoints
>)
tempRightsMap
.
get
(
RightType
.
POINTS
));
/*
this.grantPoint((List<TempPoints>)tempRightsMap.get(RightType.POINTS));
this.grantExp((List<TempExp>)tempRightsMap.get(RightType.EXP));
this
.
grantCoupon
((
List
<
TempCoupon
>)
tempRightsMap
.
get
(
RightType
.
COUPON
));
this.grantCoupon((List<TempCoupon>)tempRightsMap.get(RightType.COUPON));
*/
}
/**
...
...
@@ -255,6 +261,7 @@ public class RightsOperationServiceImpl implements RightsOperationService {
for
(
RightsHistory
rightsHistory
:
rightsHistories
)
{
rightsHistory
.
setSendTime
(
TimestampUtil
.
now
());
this
.
rightsHistoryService
.
create
(
rightsHistory
);
}
...
...
member-service-impl/src/main/java/com/topdraw/business/process/service/impl/TaskOperationServiceImpl.java
View file @
9db5a92
...
...
@@ -18,11 +18,15 @@ import com.topdraw.business.basicdata.task.service.TaskService;
import
com.topdraw.business.basicdata.task.template.domain.TaskTemplate
;
import
com.topdraw.business.basicdata.task.template.service.TaskTemplateService
;
import
com.topdraw.business.process.domian.*
;
import
com.topdraw.exception.BadRequestException
;
import
com.topdraw.module.mq.DataSyncMsg
;
import
com.topdraw.util.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.CacheEvict
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
...
...
@@ -46,6 +50,7 @@ import java.util.stream.Collectors;
* @date 2021.10.23
*/
@Service
@Slf4j
public
class
TaskOperationServiceImpl
implements
TaskOperationService
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
PointsOperationServiceImpl
.
class
);
...
...
@@ -75,30 +80,52 @@ public class TaskOperationServiceImpl implements TaskOperationService {
@Override
public
void
dealTask
(
String
content
)
{
long
l
=
System
.
currentTimeMillis
();
DataSyncMsg
dataSyncMsg
=
JSONUtil
.
parseMsg2Object
(
content
,
DataSyncMsg
.
class
);
String
eventType
=
dataSyncMsg
.
getEventType
();
DataSyncMsg
.
MsgData
msgData
=
dataSyncMsg
.
getMsg
();
Integer
event
=
msgData
.
getEvent
();
Long
memberId
=
msgData
.
getMemberId
();
long
l
=
System
.
currentTimeMillis
();
// 验证会员信息
boolean
b
=
this
.
validatedMember
(
memberId
);
if
(
b
)
{
throw
new
BadRequestException
(
"【member status exception!!】"
);
}
// 1.通过任务标识获取任务模板,通过模板参数获取具体的模板
TaskTemplate
taskTemplate
=
this
.
getTaskTemplate
(
eventType
);
// 2.解析模板参数
Map
<
String
,
Object
>
paramMap
=
this
.
parseTaskTemplateParam
(
taskTemplate
);
// 3.通过任务模板获取对应的任务列表
List
<
Task
>
taskList
=
this
.
loadListTaskByTaskTemplate
(
taskTemplate
,
paramMap
);
TaskTemplate
taskTemplate
=
this
.
getTaskTemplate
(
event
);
// 2.通过任务模板获取对应的任务列表
List
<
Task
>
taskList
=
this
.
loadListTaskByTaskTemplate
(
taskTemplate
);
// 4.判断当前用户是否满足任务完成条件
boolean
checkResult
=
this
.
checkTaskCompletion
(
memberId
,
taskList
);
if
(
checkResult
)
{
// 5.权益区分(积分、权益、成长值)
Map
<
RightType
,
Object
>
tempRightsMap
=
this
.
distinguishRight
(
memberId
,
taskList
,
msgData
);
// 6.权益发放
this
.
grantRight
(
tempRightsMap
);
}
long
r
=
System
.
currentTimeMillis
();
LOG
.
info
(
"总耗时======>>>>>"
+
(
r
-
l
));
}
/**
* 验证会员信息
* @param memberId
* @return
*/
private
boolean
validatedMember
(
Long
memberId
)
{
log
.
info
(
"validatedMember -->>【memberId】 -->> "
+
memberId
);
MemberDTO
memberDTO
=
this
.
memberService
.
findById
(
memberId
);
Integer
blackStatus
=
memberDTO
.
getBlackStatus
();
if
(
Objects
.
nonNull
(
blackStatus
)
&&
blackStatus
==
1
)
{
log
.
error
(
"validatedMember -->> 会员已被加入黑名单 【blackStatus】 -->> "
+
blackStatus
);
return
false
;
}
return
Objects
.
nonNull
(
memberDTO
)
?
true
:
false
;
}
/**
...
...
@@ -674,11 +701,27 @@ public class TaskOperationServiceImpl implements TaskOperationService {
}
/**
* 获取任务模板对应的任务列表
*
* @param taskTemplate 任务模板
* @return List<task> 任务列表
*/
private
List
<
Task
>
loadListTaskByTaskTemplate
(
TaskTemplate
taskTemplate
)
{
if
(
Objects
.
nonNull
(
taskTemplate
))
{
Long
taskTemplateId
=
taskTemplate
.
getId
();
return
this
.
taskService
.
findByTemplateId
(
taskTemplateId
);
}
return
null
;
}
/**
* 获取任务模板
* @param event 任务
* @return TaskTemplate 任务模板
*/
private
TaskTemplate
getTaskTemplate
(
String
event
)
{
return
this
.
taskTemplateService
.
findBy
Event
(
event
);
private
TaskTemplate
getTaskTemplate
(
Integer
event
)
{
return
this
.
taskTemplateService
.
findBy
Type
(
event
);
}
}
...
...
member-service-impl/src/main/resources/config/application-dev.yml
View file @
9db5a92
...
...
@@ -53,7 +53,7 @@ spring:
max-request-size
:
200MB
redis
:
#数据库索引
database
:
16
database
:
0
host
:
122.112.214.149
# host: 139.196.4.234
port
:
6379
...
...
@@ -61,17 +61,23 @@ spring:
# password:
#连接超时时间
timeout
:
5000
# rabbitmq:
# host: 47.100.212.170 # rabbitmq的连接地址
## host: 122.112.214.149 # rabbitmq的连接地址
# #host: 139.196.192.242 # rabbitmq的连接地址
# port: 5672 # rabbitmq的连接端口号
# #virtual-host: /member_center # rabbitmq的虚拟host
# #username: member_center # rabbitmq的用户名
# #password: Tjlh@2021 # rabbitmq的密码
# virtual-host: test # rabbitmq的虚拟host
# username: omo_test # rabbitmq的用户名
# password: omo_test # rabbitmq的密码
rabbitmq
:
host
:
47.100.212.170
# rabbitmq的连接地址
# host: 122.112.214.149 # rabbitmq的连接地址
#host: 139.196.192.242 # rabbitmq的连接地址
host
:
139.196.145.150
# rabbitmq的连接地址
port
:
5672
# rabbitmq的连接端口号
#virtual-host: /member_center # rabbitmq的虚拟host
#username: member_center # rabbitmq的用户名
#password: Tjlh@2021 # rabbitmq的密码
virtual-host
:
test
# rabbitmq的虚拟host
username
:
omo_test
# rabbitmq的用户名
password
:
omo_test
# rabbitmq的密码
virtual-host
:
member_center
# rabbitmq的虚拟host
username
:
admin
# rabbitmq的用户名
password
:
Topdraw1qaz
# rabbitmq的密码
publisher-confirms
:
true
#如果对异步消息需要回调必须设置为true
#jwt。依赖的common中有需要jwt的部分属性。
...
...
member-service-impl/src/main/resources/config/application-test.yml
View file @
9db5a92
...
...
@@ -62,15 +62,11 @@ spring:
#连接超时时间
timeout
:
5000
rabbitmq
:
host
:
122.112.214.149
# rabbitmq的连接地址
#host: 139.196.192.242 # rabbitmq的连接地址
host
:
139.196.145.150
# rabbitmq的连接地址
port
:
5672
# rabbitmq的连接端口号
#virtual-host: /member_center # rabbitmq的虚拟host
#username: member_center # rabbitmq的用户名
#password: Tjlh@2021 # rabbitmq的密码
virtual-host
:
/
# rabbitmq的虚拟host
username
:
guest
# rabbitmq的用户名
password
:
guest
# rabbitmq的密码
virtual-host
:
member_center
# rabbitmq的虚拟host
username
:
admin
# rabbitmq的用户名
password
:
Topdraw1qaz
# rabbitmq的密码
publisher-confirms
:
true
#如果对异步消息需要回调必须设置为true
#jwt。依赖的common中有需要jwt的部分属性。
...
...
member-service-impl/src/main/resources/config/application.yml
View file @
9db5a92
...
...
@@ -7,7 +7,7 @@ spring:
freemarker
:
check-template-location
:
false
profiles
:
active
:
test
active
:
dev
jackson
:
time-zone
:
GMT+8
data
:
...
...
member-service-impl/src/test/java/com/topdraw/test/business/basicdata/member/rest/MemberProfileControllerTest.java
0 → 100644
View file @
9db5a92
package
com
.
topdraw
.
test
.
business
.
basicdata
.
member
.
rest
;
import
com.alibaba.fastjson.JSON
;
import
com.topdraw.BaseTest
;
import
com.topdraw.business.basicdata.member.profile.domain.MemberProfile
;
import
com.topdraw.business.basicdata.member.profile.rest.MemberProfileController
;
import
com.topdraw.business.basicdata.member.profile.service.MemberProfileService
;
import
com.topdraw.util.TimestampUtil
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
public
class
MemberProfileControllerTest
extends
BaseTest
{
@Autowired
private
MemberProfileController
memberProfileController
;
@Test
public
void
create
(){
Long
memberId
=
1L
;
MemberProfile
resources
=
new
MemberProfile
();
resources
.
setMemberId
(
memberId
);
resources
.
setIdCard
(
"422827199208010713"
);
resources
.
setBirthday
(
TimestampUtil
.
now
());
resources
.
setGender
(
1
);
resources
.
setDescription
(
""
);
resources
.
setRealname
(
""
);
resources
.
setConstellation
(
""
);
resources
.
setProvince
(
""
);
resources
.
setCity
(
""
);
resources
.
setEmail
(
""
);
resources
.
setDistrict
(
""
);
String
s
=
JSON
.
toJSONString
(
resources
);
this
.
memberProfileController
.
create
(
resources
);
LOG
.
info
(
"=====>>>"
+
s
);
}
@Test
public
void
update
(){
Long
memberId
=
1L
;
MemberProfile
resources
=
new
MemberProfile
();
resources
.
setId
(
1L
);
resources
.
setMemberId
(
memberId
);
resources
.
setCity
(
"sh"
);
String
s
=
JSON
.
toJSONString
(
resources
);
this
.
memberProfileController
.
update
(
resources
);
LOG
.
info
(
"=====>>>s=====>>>"
+
s
);
}
@Test
public
void
delete
(){
Long
memberId
=
1L
;
this
.
memberProfileController
.
delete
(
memberId
);
LOG
.
info
(
"=====>>>s=====>>>"
);
}
}
member-service-impl/src/test/java/com/topdraw/test/business/process/rest/TaskOperationControllerTest.java
View file @
9db5a92
...
...
@@ -31,6 +31,8 @@ public class TaskOperationControllerTest extends BaseTest {
String
s
=
JSON
.
toJSONString
(
dataSyncMsg
);
TaskOperationQueryCriteria
pointsQueryCriteria
=
new
TaskOperationQueryCriteria
();
pointsQueryCriteria
.
setContent
(
s
);
String
s1
=
JSON
.
toJSONString
(
pointsQueryCriteria
);
System
.
out
.
println
(
s1
);
this
.
taskOperationController
.
dealTask
(
pointsQueryCriteria
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
Please
register
or
sign in
to post a comment