Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
point-project
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
point-project
Commits
63ebf7e0
Commit
63ebf7e0
authored
Jan 08, 2025
by
阳浪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
积分任务
parent
c62f3499
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
514 additions
and
0 deletions
+514
-0
cloud-point-api/src/main/java/com/yizhi/point/application/feign/PointListenerClients.java
+17
-0
cloud-point/src/main/java/com/yizhi/application/controller/PointListenerController.java
+497
-0
No files found.
cloud-point-api/src/main/java/com/yizhi/point/application/feign/PointListenerClients.java
0 → 100644
View file @
63ebf7e0
package
com
.
yizhi
.
point
.
application
.
feign
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
* com.yizhi.point.application.feign
*
* @author yanglang
* @create 2025-01-08 10:03:51
*/
@FeignClient
(
name
=
"point"
,
contextId
=
"PointListenerClients"
)
public
interface
PointListenerClients
{
@GetMapping
(
"/manage/point/hadPointList"
)
void
hadPointList
();
}
cloud-point/src/main/java/com/yizhi/application/controller/PointListenerController.java
0 → 100644
View file @
63ebf7e0
package
com
.
yizhi
.
application
.
controller
;
import
cn.hutool.core.collection.CollUtil
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.yizhi.application.constant.PointEventEnum
;
import
com.yizhi.application.domain.*
;
import
com.yizhi.application.orm.id.IdGenerator
;
import
com.yizhi.application.redis.RedisUtils
;
import
com.yizhi.application.service.*
;
import
com.yizhi.application.util.PointEvenSendMessage
;
import
com.yizhi.core.application.context.RequestContext
;
import
com.yizhi.core.application.task.AbstractTaskHandler
;
import
com.yizhi.core.application.task.TaskExecutor
;
import
com.yizhi.message.application.enums.EvenType
;
import
com.yizhi.message.application.vo.TaskVo
;
import
io.swagger.annotations.Api
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Api
(
tags
=
"积分等级 管理端"
,
description
=
"积分等级 管理端"
)
@RestController
@RequestMapping
(
"/manage/point"
)
public
class
PointListenerController
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
PointListenerController
.
class
);
@Autowired
private
RedisUtils
redisUtils
;
@Autowired
private
IdGenerator
idGenerator
;
@Autowired
private
PointService
pointService
;
@Autowired
private
PointDetailsService
pointDetailsService
;
@Autowired
private
PointUserService
pointUserService
;
@Autowired
private
PointActivityService
pointActivityService
;
@Autowired
private
MqPointParamService
mqPointParamService
;
@Autowired
private
TaskExecutor
taskExecutor
;
@Autowired
private
PointEvenSendMessage
pointEvenSendMessage
;
// 处理积分
@GetMapping
(
"hadPointList"
)
public
void
hadPointList
(){
MqPointParam
pointParam
=
new
MqPointParam
();
pointParam
.
setState
(
1
);
EntityWrapper
wrapper
=
new
EntityWrapper
(
pointParam
);
List
<
MqPointParam
>
pointParamList
=
mqPointParamService
.
selectList
(
wrapper
);
if
(
CollUtil
.
isNotEmpty
(
pointParamList
))
{
for
(
MqPointParam
param
:
pointParamList
)
{
handPoint
(
param
);
}
}
}
public
boolean
handPoint
(
MqPointParam
vo
)
{
if
(
vo
==
null
)
{
LOGGER
.
info
(
"消息ID{}获取不到缓存信息"
);
return
false
;
}
String
pointId
=
vo
.
getId
();
try
{
if
(
null
==
pointId
)
{
LOGGER
.
info
(
"积分MQId为空"
);
return
false
;
}
LOGGER
.
info
(
"开始处理消息ID{},业务ID{} 的积分"
,
pointId
,
vo
.
getSourceId
());
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"learn_source_id"
,
vo
.
getSourceId
());
map
.
put
(
"account_id"
,
vo
.
getAccountId
());
List
<
PointDetails
>
selectByMap
=
pointDetailsService
.
selectByMap
(
map
);
String
eventName
=
vo
.
getEventName
();
if
(
vo
.
getOperatingPoint
()
==
null
&&
vo
.
getOperatingPoint
()
==
0
)
{
LOGGER
.
info
(
"不产生0或空的积分,学员ID{},业务单据{}"
,
vo
.
getAccountId
(),
vo
.
getSourceId
());
return
false
;
}
if
(
eventName
.
equals
(
PointEventEnum
.
POINTCOURSE
.
getKey
()))
{
// 课程
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
POINTEXAM
.
getKey
()))
{
// 考试
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
else
{
addExamPoint
(
pointId
,
vo
,
selectByMap
);
}
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
POINTRESEARCH
.
getKey
()))
{
// 调研
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
POINTVOTE
.
getKey
()))
{
// 投票
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
POINTASSIGNMENT
.
getKey
()))
{
// 作业
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
POINTCOURSETEST
.
getKey
()))
{
// 测验
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
POINTOFFLINECOURSE
.
getKey
()))
{
// 线下课程
// 获得对应的记录以及积分,多则补总积分,少则减积分,并删除这条记录,添加导入的记录
addCoursePoint
(
pointId
,
vo
,
selectByMap
);
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
POINTTRAININGPROJECT
.
getKey
()))
{
// 培训项目
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
/**
* 案例活动
*/
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
POINTCASELIBRARY
.
getKey
()))
{
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
/**
* 签到打卡
*/
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
POINTSIGN
.
getKey
()))
{
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
/**
* 论坛发贴/评论
*/
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
POINTFORUM
.
getKey
()))
{
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
/**
* 项目签到
*/
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
POINTPROJECTSIGN
.
getKey
()))
{
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
/**
* 智能演练
*/
}
else
if
(
eventName
.
equals
(
PointEventEnum
.
CHAPPRACTICE
.
getKey
()))
{
if
(
selectByMap
.
size
()
==
0
||
selectByMap
==
null
)
{
addHandPoint
(
pointId
,
vo
);
}
}
try
{
vo
.
setState
(
0
);
mqPointParamService
.
updateById
(
vo
);
redisUtils
.
remove
(
pointId
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"删除积分缓存失败{}"
,
pointId
);
e
.
printStackTrace
();
}
LOGGER
.
info
(
"完成处理消息ID{},业务ID{} 的积分"
,
pointId
,
vo
.
getSourceId
());
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"添加积分异常消息ID{}, 业务单据ID{},异常信息{}"
,
pointId
,
vo
.
getSourceId
(),
e
);
// e.printStackTrace();
}
return
true
;
}
// 线下课程
public
boolean
addCoursePoint
(
String
pointId
,
MqPointParam
vo
,
List
<
PointDetails
>
selectByMap
)
{
PointDetails
pd
=
new
PointDetails
();
Integer
point
=
vo
.
getOperatingPoint
();
if
(!
CollectionUtils
.
isEmpty
(
selectByMap
))
{
PointDetails
pointDetail
=
selectByMap
.
get
(
0
);
vo
.
setOperatingPoint
(
vo
.
getOperatingPoint
()
-
pointDetail
.
getPoint
());
// 删除旧的记录
pointDetailsService
.
deleteById
(
pointDetail
.
getId
());
}
Integer
pointCount
=
pointDetailsService
.
getPointCountByAccountId
(
vo
.
getAccountId
(),
vo
.
getCompanyId
(),
vo
.
getSiteId
());
//导入用户在point_detail的总积分
// 添加新的记录
pd
.
setId
(
idGenerator
.
generate
());
pd
.
setChangeBefore
(
pointCount
);
pd
.
setPoint
(
point
);
pd
.
setChangeAfter
(
pointCount
+
point
);
pd
.
setActivityId
(
null
);
pd
.
setTime
(
vo
.
getCreatePointTime
());
pd
.
setMultiple
(
1
);
pd
.
setAccountId
(
vo
.
getAccountId
());
pd
.
setLearnName
(
vo
.
getActivityName
());
pd
.
setLearnSource
(
"线下课程学习记录"
);
pd
.
setLearnSourceId
(
vo
.
getSourceId
());
pd
.
setLearnType
(
vo
.
getActivityType
());
pd
.
setState
(
1
);
pd
.
setCreateById
(
vo
.
getAccountId
());
pd
.
setCreateByName
(
vo
.
getAccountName
());
pd
.
setCreateTime
(
vo
.
getCreatePointTime
());
pd
.
setOrgId
(
vo
.
getOrgId
());
pd
.
setCompanyId
(
vo
.
getCompanyId
());
pd
.
setSiteId
(
vo
.
getSiteId
());
pointDetailsService
.
insert
(
pd
);
// 计算个人总积分
addPoint
(
pointId
,
vo
.
getAccountId
(),
vo
.
getOperatingPoint
(),
vo
.
getAccountName
(),
vo
.
getOrgId
(),
vo
.
getCompanyId
(),
vo
.
getSiteId
(),
vo
.
getCreatePointTime
(),
vo
.
getActivityType
());
return
true
;
}
// 考试
@SuppressWarnings
(
"unchecked"
)
public
boolean
addExamPoint
(
String
pointId
,
MqPointParam
vo
,
List
<
PointDetails
>
selectByMap
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"site_id"
,
vo
.
getSiteId
());
map
.
put
(
"company_id"
,
vo
.
getCompanyId
());
List
<
Point
>
selectByMap1
=
pointService
.
selectByMap
(
map
);
if
(
selectByMap1
==
null
||
selectByMap1
.
size
()
==
0
)
{
return
true
;
}
Integer
state
=
selectByMap1
.
get
(
0
).
getState
();
if
(
state
==
0
)
{
return
true
;
}
selectByMap
.
sort
((
PointDetails
p1
,
PointDetails
p2
)
->
p1
.
getTime
().
compareTo
(
p2
.
getTime
()));
Integer
point
=
0
;
Integer
activityPoint
=
0
;
// 某个活动对应的获取的总积分
Integer
totalActivityPoint
=
0
;
Map
<
Long
,
Integer
>
pointDetailsMap
=
new
HashMap
<
Long
,
Integer
>(
6
);
List
<
PointDetails
>
list
=
selectByMap
.
stream
()
.
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
PointDetails:
:
getTime
))),
ArrayList:
:
new
));
List
<
PointActivity
>
activities
=
pointActivityService
.
getPointActivity
(
vo
.
getCreatePointTime
(),
vo
.
getCompanyId
(),
vo
.
getSiteId
());
for
(
PointDetails
pd
:
list
)
{
if
(
pointDetailsMap
.
get
(
pd
.
getActivityId
())
==
null
)
{
totalActivityPoint
=
pd
.
getPoint
();
}
else
{
totalActivityPoint
=
pointDetailsMap
.
get
(
pd
.
getActivityId
())
+
pd
.
getPoint
();
}
pointDetailsMap
.
put
(
pd
.
getActivityId
(),
totalActivityPoint
);
if
(
pd
.
getPoint
()
==
null
)
{
pd
.
setPoint
(
0
);
}
point
+=
pd
.
getPoint
();
}
if
(
vo
.
getOperatingPoint
()
==
null
)
{
LOGGER
.
info
(
"积分消息ID{},业务ID{} 积分为空"
,
pointId
,
vo
.
getSourceId
());
vo
.
setOperatingPoint
(
0
);
}
// 将要新增的获取积分明细
PointDetails
pd
;
// 将要新增的获取积分明细列表
List
<
PointDetails
>
pdList
=
new
ArrayList
<
PointDetails
>(
10
);
Integer
pointCount
=
pointDetailsService
.
getPointCountByAccountId
(
vo
.
getAccountId
(),
vo
.
getCompanyId
(),
vo
.
getSiteId
());
//导入用户在point_detail的总积分
// 没有翻倍
if
(
CollectionUtils
.
isEmpty
(
activities
))
{
if
(
vo
.
getOperatingPoint
()
>
point
)
{
pd
=
new
PointDetails
();
pd
.
setId
(
idGenerator
.
generate
());
pd
.
setTime
(
vo
.
getCreatePointTime
());
pd
.
setChangeBefore
(
pointCount
);
pd
.
setPoint
(
vo
.
getOperatingPoint
()
-
point
);
pd
.
setChangeAfter
(
pointCount
+
vo
.
getOperatingPoint
()
-
point
);
pd
.
setMultiple
(
1
);
pd
.
setAccountId
(
vo
.
getAccountId
());
pd
.
setLearnName
(
vo
.
getActivityName
());
pd
.
setLearnSource
(
vo
.
getActivitySource
());
pd
.
setLearnSourceId
(
vo
.
getSourceId
());
pd
.
setLearnType
(
vo
.
getActivityType
());
pd
.
setState
(
1
);
pd
.
setCreateById
(
vo
.
getAccountId
());
pd
.
setCreateByName
(
vo
.
getAccountName
());
pd
.
setCreateTime
(
vo
.
getCreatePointTime
());
pd
.
setOrgId
(
vo
.
getOrgId
());
pd
.
setCompanyId
(
vo
.
getCompanyId
());
pd
.
setSiteId
(
vo
.
getSiteId
());
pointDetailsService
.
insert
(
pd
);
}
}
else
{
for
(
PointActivity
pointActivity
:
activities
)
{
boolean
add
=
false
;
pd
=
new
PointDetails
();
if
(
pointDetailsMap
.
get
(
pointActivity
.
getId
())
==
null
)
{
// 1.新增的活动,将新增的积分添加进pointDetails
activityPoint
=
vo
.
getOperatingPoint
()
*
pointActivity
.
getMultiple
();
pd
.
setChangeBefore
(
pointCount
);
pd
.
setPoint
(
activityPoint
);
pd
.
setChangeAfter
(
pointCount
+
activityPoint
);
add
=
true
;
}
else
{
totalActivityPoint
=
pointDetailsMap
.
get
(
pointActivity
.
getId
());
activityPoint
=
vo
.
getOperatingPoint
()
*
pointActivity
.
getMultiple
();
if
(
activityPoint
>
totalActivityPoint
)
{
add
=
true
;
pd
.
setChangeBefore
(
pointCount
);
pd
.
setPoint
(
activityPoint
-
totalActivityPoint
);
pd
.
setChangeAfter
(
pointCount
+
activityPoint
-
totalActivityPoint
);
}
}
if
(
add
)
{
pd
.
setId
(
idGenerator
.
generate
());
pd
.
setMultiple
(
pointActivity
.
getMultiple
());
pd
.
setActivityId
(
pointActivity
.
getId
());
pd
.
setTime
(
vo
.
getCreatePointTime
());
pd
.
setAccountId
(
vo
.
getAccountId
());
pd
.
setLearnName
(
vo
.
getActivityName
());
pd
.
setLearnSource
(
vo
.
getActivitySource
());
pd
.
setLearnSourceId
(
vo
.
getSourceId
());
pd
.
setLearnType
(
vo
.
getActivityType
());
pd
.
setState
(
1
);
pd
.
setCreateById
(
vo
.
getAccountId
());
pd
.
setCreateByName
(
vo
.
getAccountName
());
pd
.
setCreateTime
(
vo
.
getCreatePointTime
());
pd
.
setOrgId
(
vo
.
getOrgId
());
pd
.
setCompanyId
(
vo
.
getCompanyId
());
pd
.
setSiteId
(
vo
.
getSiteId
());
pdList
.
add
(
pd
);
}
}
if
(
pdList
.
size
()
>
0
)
{
pointDetailsService
.
insertBatch
(
pdList
);
}
}
addPoint
(
pointId
,
vo
.
getAccountId
(),
point
,
vo
.
getAccountName
(),
vo
.
getOrgId
(),
vo
.
getCompanyId
(),
vo
.
getSiteId
(),
vo
.
getCreatePointTime
(),
vo
.
getActivityType
());
return
true
;
}
// 处理服务积分
public
boolean
addHandPoint
(
String
pointId
,
MqPointParam
vo
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"site_id"
,
vo
.
getSiteId
());
map
.
put
(
"company_id"
,
vo
.
getCompanyId
());
List
<
Point
>
selectByMap
=
pointService
.
selectByMap
(
map
);
if
(
selectByMap
==
null
||
selectByMap
.
size
()
==
0
)
{
return
true
;
}
Integer
state
=
selectByMap
.
get
(
0
).
getState
();
if
(
state
==
0
)
{
return
true
;
}
if
(
vo
.
getOperatingPoint
()
==
null
||
vo
.
getOperatingPoint
()
==
0
)
{
return
true
;
}
Integer
pointCount
=
pointDetailsService
.
getPointCountByAccountId
(
vo
.
getAccountId
(),
vo
.
getCompanyId
(),
vo
.
getSiteId
());
//传入用户的金币总数
List
<
PointActivity
>
list
=
pointActivityService
.
getPointActivity
(
vo
.
getCreatePointTime
(),
vo
.
getCompanyId
(),
vo
.
getSiteId
());
Integer
point
=
0
;
Integer
operatingPoint
=
0
;
Long
accountId
=
vo
.
getAccountId
();
PointDetails
pd
=
null
;
if
(
list
.
size
()
>
0
)
{
List
<
PointDetails
>
pdList
=
new
ArrayList
<
PointDetails
>();
for
(
PointActivity
pa
:
list
)
{
operatingPoint
=
vo
.
getOperatingPoint
();
if
(
operatingPoint
==
null
)
{
LOGGER
.
info
(
"积分消息ID{},业务ID{} 积分为空"
,
pointId
,
vo
.
getSourceId
());
operatingPoint
=
0
;
}
operatingPoint
=
operatingPoint
*
pa
.
getMultiple
();
point
+=
operatingPoint
;
pd
=
new
PointDetails
();
pd
.
setId
(
idGenerator
.
generate
());
pd
.
setActivityId
(
pa
.
getId
());
pd
.
setTime
(
vo
.
getCreatePointTime
());
pd
.
setChangeBefore
(
pointCount
);
pd
.
setPoint
(
operatingPoint
);
pd
.
setChangeAfter
(
pointCount
+
operatingPoint
);
pd
.
setAccountId
(
accountId
);
pd
.
setLearnName
(
vo
.
getActivityName
());
pd
.
setLearnSource
(
vo
.
getActivitySource
());
pd
.
setLearnSourceId
(
vo
.
getSourceId
());
if
(
null
!=
vo
.
getCourseId
())
{
pd
.
setCourseId
(
vo
.
getCourseId
());
}
pd
.
setLearnType
(
vo
.
getActivityType
());
pd
.
setState
(
1
);
pd
.
setCreateById
(
vo
.
getAccountId
());
pd
.
setCreateByName
(
vo
.
getAccountName
());
pd
.
setCreateTime
(
vo
.
getCreatePointTime
());
pd
.
setOrgId
(
vo
.
getOrgId
());
pd
.
setCompanyId
(
vo
.
getCompanyId
());
pd
.
setSiteId
(
vo
.
getSiteId
());
pd
.
setMultiple
(
pa
.
getMultiple
());
pdList
.
add
(
pd
);
}
if
(
pdList
.
size
()
>
0
)
{
pointDetailsService
.
insertBatch
(
pdList
);
}
}
else
{
point
=
vo
.
getOperatingPoint
();
pd
=
new
PointDetails
();
pd
.
setId
(
idGenerator
.
generate
());
pd
.
setTime
(
vo
.
getCreatePointTime
());
pd
.
setChangeBefore
(
pointCount
);
pd
.
setPoint
(
point
);
pd
.
setChangeAfter
(
pointCount
+
point
);
pd
.
setMultiple
(
1
);
pd
.
setAccountId
(
accountId
);
pd
.
setLearnName
(
vo
.
getActivityName
());
pd
.
setLearnSource
(
vo
.
getActivitySource
());
pd
.
setLearnSourceId
(
vo
.
getSourceId
());
if
(
null
!=
vo
.
getCourseId
())
{
pd
.
setCourseId
(
vo
.
getCourseId
());
}
pd
.
setLearnType
(
vo
.
getActivityType
());
pd
.
setState
(
1
);
pd
.
setCreateById
(
vo
.
getAccountId
());
pd
.
setCreateByName
(
vo
.
getAccountName
());
pd
.
setCreateTime
(
vo
.
getCreatePointTime
());
pd
.
setOrgId
(
vo
.
getOrgId
());
pd
.
setCompanyId
(
vo
.
getCompanyId
());
pd
.
setSiteId
(
vo
.
getSiteId
());
pointDetailsService
.
insert
(
pd
);
}
try
{
addPoint
(
pointId
,
accountId
,
point
,
vo
.
getAccountName
(),
vo
.
getOrgId
(),
vo
.
getCompanyId
(),
vo
.
getSiteId
(),
vo
.
getCreatePointTime
(),
vo
.
getActivityType
());
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"userPoint插入过程中出现异常"
);
e
.
printStackTrace
();
}
return
true
;
}
// 个人积分统计
private
void
addPoint
(
String
pointId
,
Long
accountId
,
Integer
operatingPoint
,
String
accountName
,
Long
orgId
,
Long
companyId
,
Long
siteId
,
Date
date
,
String
learnType
)
{
PointUser
pu
=
null
;
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"user_id"
,
accountId
);
List
<
PointUser
>
selectByMap
=
pointUserService
.
selectByMap
(
map
);
Long
id
=
idGenerator
.
generate
();
if
(
selectByMap
==
null
||
selectByMap
.
size
()
==
0
)
{
pu
=
new
PointUser
();
pu
.
setId
(
id
);
pu
.
setUserId
(
accountId
);
pu
.
setTotalPoint
(
operatingPoint
);
pu
.
setState
(
1
);
pu
.
setCreateById
(
accountId
);
pu
.
setCreateByName
(
accountName
);
pu
.
setCreateTime
(
date
);
}
else
{
pu
=
selectByMap
.
get
(
0
);
pu
.
setTotalPoint
(
pu
.
getTotalPoint
()
+
operatingPoint
);
pu
.
setUpdateById
(
accountId
);
pu
.
setUpdateByName
(
accountName
);
pu
.
setUpdateTime
(
date
);
}
pu
.
setOrgId
(
orgId
);
pu
.
setSiteId
(
siteId
);
pu
.
setCompanyId
(
companyId
);
boolean
b
=
pointUserService
.
insertOrUpdate
(
pu
);
// 个人积分变动发消息
if
(
b
&&
accountId
!=
null
)
{
TaskVo
taskVo
=
new
TaskVo
();
taskVo
.
setReason
(
learnType
);
taskVo
.
setTaskEndTime
(
pu
.
getUpdateTime
());
taskVo
.
setTaskScore
(
operatingPoint
.
doubleValue
());
RequestContext
context
=
new
RequestContext
();
context
.
setCompanyId
(
companyId
);
context
.
setSiteId
(
siteId
);
context
.
setAccountId
(
accountId
);
context
.
setAccountName
(
accountName
);
taskExecutor
.
asynExecute
(
new
AbstractTaskHandler
()
{
@Override
public
void
handle
()
{
pointEvenSendMessage
.
evenSendMessage
(
id
,
taskVo
,
accountId
,
EvenType
.
POINT_CHANGE
,
context
);
}
});
}
MqPointParam
selectById
=
mqPointParamService
.
selectById
(
pointId
);
selectById
.
setState
(
0
);
mqPointParamService
.
updateById
(
selectById
);
String
key
=
accountId
.
toString
();
Integer
userPoint
=
(
Integer
)
redisUtils
.
get
(
key
);
if
(
userPoint
==
null
)
{
redisUtils
.
set
(
key
,
operatingPoint
);
}
else
{
redisUtils
.
set
(
key
,
userPoint
+
operatingPoint
);
}
redisUtils
.
remove
(
pointId
);
}
}
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