Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李丛阳
education
Commits
510b6667
Commit
510b6667
authored
Nov 19, 2019
by
zhangqingle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加报名课程培训增加积分,学习报名课程培训扣除积分
parent
faa6b78e
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
168 additions
and
31 deletions
+168
-31
BDiscussController.java
...soft/business/bdiscuss/controller/BDiscussController.java
+1
-1
BLessonController.java
...cisoft/business/blesson/controller/BLessonController.java
+1
-1
AddLessonDTO.java
...n/java/org/rcisoft/business/blesson/dto/AddLessonDTO.java
+15
-2
BLesson.java
...ain/java/org/rcisoft/business/blesson/entity/BLesson.java
+14
-2
BLessonService.java
.../org/rcisoft/business/blesson/service/BLessonService.java
+1
-1
BLessonPersonServiceImpl.java
...siness/blesson/service/impl/BLessonPersonServiceImpl.java
+35
-5
BLessonServiceImpl.java
...oft/business/blesson/service/impl/BLessonServiceImpl.java
+74
-11
BPersonValueRepository.java
...oft/business/bpersonvalue/dao/BPersonValueRepository.java
+4
-4
BPersonValue.java
...rg/rcisoft/business/bpersonvalue/entity/BPersonValue.java
+7
-0
BReleaseValueRepository.java
...t/business/breleasevalue/dao/BReleaseValueRepository.java
+14
-3
ResultServiceEnums.java
...main/java/org/rcisoft/core/result/ResultServiceEnums.java
+1
-0
SysUserMapper.java
src/main/java/org/rcisoft/sys/user/dao/SysUserMapper.java
+1
-1
No files found.
src/main/java/org/rcisoft/business/bdiscuss/controller/BDiscussController.java
View file @
510b6667
...
@@ -68,7 +68,7 @@ public class BDiscussController extends PaginationController<BDiscuss> {
...
@@ -68,7 +68,7 @@ public class BDiscussController extends PaginationController<BDiscuss> {
@ApiOperation
(
value
=
"逻辑删除"
,
notes
=
"逻辑删除"
)
@ApiOperation
(
value
=
"逻辑删除"
,
notes
=
"逻辑删除"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"id"
,
required
=
false
,
dataType
=
"varchar"
)})
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"id"
,
required
=
false
,
dataType
=
"varchar"
)})
@
Delete
Mapping
(
"/delete/{id:\\w+}"
)
@
Post
Mapping
(
"/delete/{id:\\w+}"
)
public
Result
delete
(
@PathVariable
String
id
)
{
public
Result
delete
(
@PathVariable
String
id
)
{
BDiscuss
bDiscuss
=
new
BDiscuss
();
BDiscuss
bDiscuss
=
new
BDiscuss
();
bDiscuss
.
setBusinessId
(
id
);
bDiscuss
.
setBusinessId
(
id
);
...
...
src/main/java/org/rcisoft/business/blesson/controller/BLessonController.java
View file @
510b6667
...
@@ -353,7 +353,7 @@ public class BLessonController extends PaginationController<BLesson> {
...
@@ -353,7 +353,7 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
)
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
true
,
dataType
=
"varchar"
)
@PostMapping
(
value
=
"/release"
)
@PostMapping
(
value
=
"/release"
)
public
Result
release
(
CurUser
curUser
,
String
businessId
,
BindingResult
bindingResult
)
{
public
Result
release
(
CurUser
curUser
,
String
businessId
,
BindingResult
bindingResult
)
{
PersistModel
data
=
bLessonService
.
releaseBLesson
(
businessId
);
PersistModel
data
=
bLessonService
.
releaseBLesson
(
businessId
,
curUser
);
return
Result
.
builder
(
data
,
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
...
...
src/main/java/org/rcisoft/business/blesson/dto/AddLessonDTO.java
View file @
510b6667
...
@@ -43,8 +43,21 @@ public class AddLessonDTO {
...
@@ -43,8 +43,21 @@ public class AddLessonDTO {
@ApiModelProperty
(
value
=
"课程类型(0:课程 1:培训)"
,
required
=
true
)
@ApiModelProperty
(
value
=
"课程类型(0:课程 1:培训)"
,
required
=
true
)
private
String
lessonType
;
private
String
lessonType
;
@ApiModelProperty
(
value
=
"积分"
)
@ApiModelProperty
(
value
=
"消耗积分"
)
private
String
value
;
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
Integer
valueConsume
;
@ApiModelProperty
(
value
=
"获得积分"
)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
Integer
valueGain
;
@ApiModelProperty
(
value
=
"更新积分日期"
)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
Date
valueUpdateDate
;
// @ApiModelProperty(value = "积分")
// private String value;
@ApiModelProperty
(
value
=
"标签集合,使用','分隔"
)
@ApiModelProperty
(
value
=
"标签集合,使用','分隔"
)
private
String
labels
;
private
String
labels
;
...
...
src/main/java/org/rcisoft/business/blesson/entity/BLesson.java
View file @
510b6667
...
@@ -110,9 +110,21 @@ public class BLesson extends IdEntity<BLesson> {
...
@@ -110,9 +110,21 @@ public class BLesson extends IdEntity<BLesson> {
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
hotNumber
;
private
String
hotNumber
;
@ApiModelProperty
(
value
=
"积分"
)
@ApiModelProperty
(
value
=
"
消耗
积分"
)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
String
value
;
private
Integer
valueConsume
;
@ApiModelProperty
(
value
=
"获得积分"
)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
Integer
valueGain
;
@ApiModelProperty
(
value
=
"更新积分日期"
)
@Length
(
min
=
1
,
max
=
64
,
message
=
"长度最小为1,最大为50"
)
private
Date
valueUpdateDate
;
// @ApiModelProperty(value = "积分")
// @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
// private String value;
//---------------培训------------------
//---------------培训------------------
@DateTimeFormat
(
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
@DateTimeFormat
(
pattern
=
"yyyy/MM/dd HH:mm:ss"
)
...
...
src/main/java/org/rcisoft/business/blesson/service/BLessonService.java
View file @
510b6667
...
@@ -125,7 +125,7 @@ public interface BLessonService{
...
@@ -125,7 +125,7 @@ public interface BLessonService{
* @param id
* @param id
* @return
* @return
*/
*/
PersistModel
releaseBLesson
(
String
id
);
PersistModel
releaseBLesson
(
String
id
,
CurUser
curUser
);
/**
/**
* 推荐课程
* 推荐课程
...
...
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonPersonServiceImpl.java
View file @
510b6667
...
@@ -11,6 +11,9 @@ import org.rcisoft.business.blesson.entity.BLesson;
...
@@ -11,6 +11,9 @@ import org.rcisoft.business.blesson.entity.BLesson;
import
org.rcisoft.business.blesson.dao.BLessonPersonRepository
;
import
org.rcisoft.business.blesson.dao.BLessonPersonRepository
;
import
org.rcisoft.business.blesson.entity.BLessonPerson
;
import
org.rcisoft.business.blesson.entity.BLessonPerson
;
import
org.rcisoft.business.blesson.service.BLessonPersonService
;
import
org.rcisoft.business.blesson.service.BLessonPersonService
;
import
org.rcisoft.business.blesson.service.BLessonService
;
import
org.rcisoft.business.bpersonvalue.dao.BPersonValueRepository
;
import
org.rcisoft.business.bpersonvalue.entity.BPersonValue
;
import
org.rcisoft.common.util.feignDto.*
;
import
org.rcisoft.common.util.feignDto.*
;
import
org.rcisoft.common.util.outClient.MTCotactApiRequestClient
;
import
org.rcisoft.common.util.outClient.MTCotactApiRequestClient
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.aop.PageUtil
;
...
@@ -22,6 +25,8 @@ import org.rcisoft.core.result.ResultServiceEnums;
...
@@ -22,6 +25,8 @@ import org.rcisoft.core.result.ResultServiceEnums;
import
org.rcisoft.core.util.IdGen
;
import
org.rcisoft.core.util.IdGen
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.rcisoft.sys.user.dao.SysUserMapper
;
import
org.rcisoft.sys.user.dto.MyInfoDTO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
...
@@ -53,6 +58,15 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
...
@@ -53,6 +58,15 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
@Autowired
@Autowired
MTCotactApiRequestClient
mtCotactApiRequestClient
;
MTCotactApiRequestClient
mtCotactApiRequestClient
;
@Autowired
SysUserMapper
sysUserMapper
;
@Autowired
BPersonValueRepository
bPersonValueRepository
;
@Autowired
BLessonServiceImpl
bLessonServiceImpl
;
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Override
@Override
...
@@ -231,8 +245,14 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
...
@@ -231,8 +245,14 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
return
new
PersistModel
(
line
);
return
new
PersistModel
(
line
);
}
}
if
(
bLessonPersons
==
null
||
bLessonPersons
.
size
()
<
1
){
//未指派
if
(
bLessonPersons
==
null
||
bLessonPersons
.
size
()
<
1
){
//未指派
//TODO 判断用户是否有足够积分
//判断用户是否有足够积分
MyInfoDTO
userInfo
=
sysUserMapper
.
getNameById
(
curUser
.
getUserId
());
if
(
userInfo
==
null
){
throw
new
ServiceException
(
ResultServiceEnums
.
COMPANY_NOT_EXISTS
);
}
if
(
Long
.
valueOf
(
userInfo
.
getValue
())
<
Long
.
valueOf
(
bLesson
.
getValueConsume
())){
throw
new
ServiceException
(
ResultServiceEnums
.
VALUE_NOT_ENOUGH
);
}
//查询是否已有已删除
//查询是否已有已删除
List
<
BLessonPerson
>
bLessonPersonReals
=
bLessonPersonRepository
.
selectRealByPersonAndLesson
(
addMyLearnLessonDTO
);
List
<
BLessonPerson
>
bLessonPersonReals
=
bLessonPersonRepository
.
selectRealByPersonAndLesson
(
addMyLearnLessonDTO
);
if
(
bLessonPersonReals
!=
null
&&
bLessonPersonReals
.
size
()>
0
){
if
(
bLessonPersonReals
!=
null
&&
bLessonPersonReals
.
size
()>
0
){
...
@@ -244,6 +264,12 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
...
@@ -244,6 +264,12 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
UserUtil
.
setCurrentMergeOperation
(
bLessonPersonReal
);
UserUtil
.
setCurrentMergeOperation
(
bLessonPersonReal
);
line
=
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
bLessonPersonReal
);
line
=
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
bLessonPersonReal
);
//扣除对应积分 添加用户积分详情 更新用户积分
//增加用户积分详情
if
(
bLesson
.
getValueConsume
()
!=
null
&&
bLesson
.
getValueConsume
()
!=
0
){
BPersonValue
bPersonValue
=
new
BPersonValue
(
curUser
.
getUserId
(),
"学习课程"
,
bLesson
.
getValueConsume
(),
"1"
);
bLessonServiceImpl
.
addValueEvent
(
curUser
,
bPersonValue
,
bLesson
);
}
return
new
PersistModel
(
line
);
return
new
PersistModel
(
line
);
}
}
bLessonPerson
=
new
BLessonPerson
();
bLessonPerson
=
new
BLessonPerson
();
...
@@ -254,9 +280,13 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
...
@@ -254,9 +280,13 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
bLessonPerson
.
setLessonId
(
addMyLearnLessonDTO
.
getLessonId
());
bLessonPerson
.
setLessonId
(
addMyLearnLessonDTO
.
getLessonId
());
bLessonPerson
.
setPersonId
(
addMyLearnLessonDTO
.
getUserId
());
bLessonPerson
.
setPersonId
(
addMyLearnLessonDTO
.
getUserId
());
line
=
bLessonPersonRepository
.
insertBLessonPerson
(
bLessonPerson
);
line
=
bLessonPersonRepository
.
insertBLessonPerson
(
bLessonPerson
);
//TODO 扣除对应积分 添加用户积分详情 更新用户积分
//扣除对应积分 添加用户积分详情 更新用户积分
//增加用户积分详情
//积分变化后 s_user表中value字段重新统计
if
(
bLesson
.
getValueConsume
()
!=
null
&&
bLesson
.
getValueConsume
()
!=
0
){
BPersonValue
bPersonValue
=
new
BPersonValue
(
curUser
.
getUserId
(),
"学习课程"
,
bLesson
.
getValueConsume
(),
"1"
);
bLessonServiceImpl
.
addValueEvent
(
curUser
,
bPersonValue
,
bLesson
);
}
//重新统计在学人数
//重新统计在学人数
bLessonRepository
.
personNumberReCount
(
addMyLearnLessonDTO
.
getLessonId
(),
"0"
);
bLessonRepository
.
personNumberReCount
(
addMyLearnLessonDTO
.
getLessonId
(),
"0"
);
return
new
PersistModel
(
line
);
return
new
PersistModel
(
line
);
...
...
src/main/java/org/rcisoft/business/blesson/service/impl/BLessonServiceImpl.java
View file @
510b6667
...
@@ -18,6 +18,10 @@ import org.rcisoft.business.blesson.util.Recursion;
...
@@ -18,6 +18,10 @@ import org.rcisoft.business.blesson.util.Recursion;
import
org.rcisoft.business.blesson.dao.BViewrangeRepository
;
import
org.rcisoft.business.blesson.dao.BViewrangeRepository
;
import
org.rcisoft.business.bmaterial.dao.BMaterialRepository
;
import
org.rcisoft.business.bmaterial.dao.BMaterialRepository
;
import
org.rcisoft.business.bmaterial.entity.BMaterial
;
import
org.rcisoft.business.bmaterial.entity.BMaterial
;
import
org.rcisoft.business.bpersonvalue.dao.BPersonValueRepository
;
import
org.rcisoft.business.bpersonvalue.entity.BPersonValue
;
import
org.rcisoft.business.breleasevalue.dao.BReleaseValueRepository
;
import
org.rcisoft.business.breleasevalue.entity.BReleaseValue
;
import
org.rcisoft.common.util.feignDto.*
;
import
org.rcisoft.common.util.feignDto.*
;
import
org.rcisoft.common.util.outClient.MTCotactApiRequestClient
;
import
org.rcisoft.common.util.outClient.MTCotactApiRequestClient
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.aop.PageUtil
;
...
@@ -29,6 +33,7 @@ import org.rcisoft.core.util.IdGen;
...
@@ -29,6 +33,7 @@ import org.rcisoft.core.util.IdGen;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.core.util.UserUtil
;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.rcisoft.sys.user.bean.CurUser
;
import
org.rcisoft.sys.user.dao.SysUserMapper
;
import
org.rcisoft.sys.user.dao.SysUserMapper
;
import
org.rcisoft.sys.user.dto.MyInfoDTO
;
import
org.rcisoft.sys.user.entity.SysUser
;
import
org.rcisoft.sys.user.entity.SysUser
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -90,6 +95,12 @@ public class BLessonServiceImpl implements BLessonService {
...
@@ -90,6 +95,12 @@ public class BLessonServiceImpl implements BLessonService {
@Autowired
@Autowired
MTCotactApiRequestClient
cotactApiRequestClient
;
MTCotactApiRequestClient
cotactApiRequestClient
;
@Autowired
BReleaseValueRepository
bReleaseValueRepository
;
@Autowired
BPersonValueRepository
bPersonValueRepository
;
@Override
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
BLesson
selectOne
(
CurUser
curUser
,
String
lessonId
)
{
public
BLesson
selectOne
(
CurUser
curUser
,
String
lessonId
)
{
...
@@ -503,18 +514,19 @@ public class BLessonServiceImpl implements BLessonService {
...
@@ -503,18 +514,19 @@ public class BLessonServiceImpl implements BLessonService {
@Override
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
public
PersistModel
releaseBLesson
(
String
id
)
{
public
PersistModel
releaseBLesson
(
String
id
,
CurUser
curUser
)
{
BLesson
bLesson
=
new
BLesson
();
BLesson
bLesson
=
new
BLesson
();
bLesson
.
setBusinessId
(
id
);
bLesson
.
setBusinessId
(
id
);
bLesson
=
bLessonRepository
.
selectByPrimaryKey
(
bLesson
);
bLesson
=
bLessonRepository
.
selectByPrimaryKey
(
bLesson
);
if
(
"0"
.
equals
(
bLesson
.
getLessonType
())
&&
bChapterRepository
.
getlessonHours
(
id
)
==
0
){
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_NO_CHAPTER
);
}
if
(
bLesson
==
null
){
if
(
bLesson
==
null
){
throw
new
ServiceException
(
ResultServiceEnums
.
NOT_LESSON_ERROR
);
throw
new
ServiceException
(
ResultServiceEnums
.
NOT_LESSON_ERROR
);
}
}
if
(
"0"
.
equals
(
bLesson
.
getLessonType
())
&&
bChapterRepository
.
getlessonHours
(
id
)
==
0
){
throw
new
ServiceException
(
ResultServiceEnums
.
LESSON_NO_CHAPTER
);
}
if
(!
"0"
.
equals
(
bLesson
.
getReleaseState
()))
{
if
(!
"0"
.
equals
(
bLesson
.
getReleaseState
()))
{
throw
new
ServiceException
(
ResultServiceEnums
.
STATE_NOT_RELEASE
);
throw
new
ServiceException
(
ResultServiceEnums
.
STATE_NOT_RELEASE
);
}
}
...
@@ -526,8 +538,26 @@ public class BLessonServiceImpl implements BLessonService {
...
@@ -526,8 +538,26 @@ public class BLessonServiceImpl implements BLessonService {
bLesson
.
setReleaseDate
(
new
Date
());
bLesson
.
setReleaseDate
(
new
Date
());
UserUtil
.
setCurrentMergeOperation
(
bLesson
);
UserUtil
.
setCurrentMergeOperation
(
bLesson
);
int
line
=
bLessonRepository
.
releaseLesson
(
bLesson
);
int
line
=
bLessonRepository
.
releaseLesson
(
bLesson
);
//TODO:查询该讲师发布课程获得积分数并
//查询该讲师发布课程获得积分数
//TODO:增加用户积分详情,更新用户积分表,重新统计用户积分
List
<
BReleaseValue
>
bReleaseValueList
=
bReleaseValueRepository
.
selectReleaseValueByPersonId
(
curUser
);
if
(
bReleaseValueList
!=
null
&&
bReleaseValueList
.
size
()
>
0
&&
bReleaseValueList
.
get
(
0
)
!=
null
){
//增加用户积分详情
BPersonValue
bPersonValue
=
new
BPersonValue
();
UserUtil
.
setCurrentPersistOperation
(
bPersonValue
);
bPersonValue
.
setPersonId
(
bLesson
.
getLecturerId
());
bPersonValue
.
setType
(
"0"
);
if
(
"0"
.
equals
(
bLesson
.
getLessonType
()))
{
bPersonValue
.
setEvent
(
"发布课程"
);
bPersonValue
.
setValue
(
bReleaseValueList
.
get
(
0
).
getLessonValue
());
}
if
(
"1"
.
equals
(
bLesson
.
getLessonType
())){
bPersonValue
.
setEvent
(
"发布培训"
);
bPersonValue
.
setValue
(
bReleaseValueList
.
get
(
0
).
getTrainValue
());
}
bPersonValueRepository
.
add
(
bPersonValue
);
//积分变化后 s_user表中value字段重新统计
bPersonValueRepository
.
updateUserValue
(
bLesson
.
getLecturerId
(),
curUser
.
getCorpId
());
}
//int line = bLessonRepository.deleteByPrimaryKey(id);
//int line = bLessonRepository.deleteByPrimaryKey(id);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
return
new
PersistModel
(
line
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
);
}
}
...
@@ -1074,9 +1104,7 @@ public class BLessonServiceImpl implements BLessonService {
...
@@ -1074,9 +1104,7 @@ public class BLessonServiceImpl implements BLessonService {
person
.
setTrainIsSign
(
"0"
);
person
.
setTrainIsSign
(
"0"
);
person
.
setApplyDate
(
new
Date
());
person
.
setApplyDate
(
new
Date
());
person
.
setIsApply
(
"1"
);
person
.
setIsApply
(
"1"
);
//TODO 判断积分是否够用
int
line
=
bLessonPersonRepository
.
updateLessonPersonByUserId
(
person
);
int
line
=
bLessonPersonRepository
.
updateLessonPersonByUserId
(
person
);
//TODO 更新用户积分明细表 重进计算积分
bLessonRepository
.
personNumberReCount
(
lessonId
,
"1"
);
bLessonRepository
.
personNumberReCount
(
lessonId
,
"1"
);
return
line
;
return
line
;
}
}
...
@@ -1086,9 +1114,21 @@ public class BLessonServiceImpl implements BLessonService {
...
@@ -1086,9 +1114,21 @@ public class BLessonServiceImpl implements BLessonService {
person
.
setIsApply
(
"1"
);
person
.
setIsApply
(
"1"
);
person
.
setApplyDate
(
new
Date
());
person
.
setApplyDate
(
new
Date
());
//TODO 判断积分是否够用
//TODO 判断积分是否够用
MyInfoDTO
userInfo
=
sysUserMapper
.
getNameById
(
curUser
.
getUserId
());
if
(
userInfo
==
null
){
throw
new
ServiceException
(
ResultServiceEnums
.
COMPANY_NOT_EXISTS
);
}
if
(
bLesson
.
getValueConsume
()
!=
null
&&
bLesson
.
getValueConsume
()
!=
0
&&
Integer
.
parseInt
(
userInfo
.
getValue
())
<
bLesson
.
getValueConsume
()){
throw
new
ServiceException
(
ResultServiceEnums
.
VALUE_NOT_ENOUGH
);
}
int
line
=
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
person
);
int
line
=
bLessonPersonRepository
.
updateByPrimaryKeySelective
(
person
);
//TODO 更新用户积分明细表 重进计算积分
//TODO 更新用户积分明细表 重进计算积分
bLessonRepository
.
personNumberReCount
(
lessonId
,
"1"
);
//扣除对应积分 添加用户积分详情 更新用户积分
//增加用户积分详情
if
(
bLesson
.
getValueConsume
()
!=
null
&&
bLesson
.
getValueConsume
()
!=
0
){
BPersonValue
bPersonValue
=
new
BPersonValue
(
curUser
.
getUserId
(),
"报名培训"
,
bLesson
.
getValueConsume
(),
"1"
);
addValueEvent
(
curUser
,
bPersonValue
,
bLesson
);
}
return
line
;
return
line
;
}
}
List
<
BLessonPerson
>
bLessonPersons
=
new
ArrayList
<>();
List
<
BLessonPerson
>
bLessonPersons
=
new
ArrayList
<>();
...
@@ -1104,9 +1144,21 @@ public class BLessonServiceImpl implements BLessonService {
...
@@ -1104,9 +1144,21 @@ public class BLessonServiceImpl implements BLessonService {
//插入 用户id 、培训id、指派状态、报名状态、培训状态、报名时间 、通用字段
//插入 用户id 、培训id、指派状态、报名状态、培训状态、报名时间 、通用字段
// int line = bLessonPersonRepository.insert(bLessonPerson);
// int line = bLessonPersonRepository.insert(bLessonPerson);
//TODO 判断积分是否够用
//TODO 判断积分是否够用
MyInfoDTO
userInfo
=
sysUserMapper
.
getNameById
(
curUser
.
getUserId
());
if
(
userInfo
==
null
){
throw
new
ServiceException
(
ResultServiceEnums
.
COMPANY_NOT_EXISTS
);
}
if
(
bLesson
.
getValueConsume
()
!=
null
&&
bLesson
.
getValueConsume
()
!=
0
&&
Integer
.
parseInt
(
userInfo
.
getValue
())
<
bLesson
.
getValueConsume
()){
throw
new
ServiceException
(
ResultServiceEnums
.
VALUE_NOT_ENOUGH
);
}
int
line
=
this
.
trainInsert
(
"0"
,
bLesson
,
bLessonPersons
);
int
line
=
this
.
trainInsert
(
"0"
,
bLesson
,
bLessonPersons
);
//TODO 更新用户积分明细表 重进计算积分
//TODO 更新用户积分明细表 重进计算积分
bLessonRepository
.
personNumberReCount
(
lessonId
,
"1"
);
//扣除对应积分 添加用户积分详情 更新用户积分
//增加用户积分详情
if
(
bLesson
.
getValueConsume
()
!=
null
&&
bLesson
.
getValueConsume
()
!=
0
){
BPersonValue
bPersonValue
=
new
BPersonValue
(
curUser
.
getUserId
(),
"报名培训"
,
bLesson
.
getValueConsume
(),
"1"
);
addValueEvent
(
curUser
,
bPersonValue
,
bLesson
);
}
return
line
;
return
line
;
}
}
...
@@ -1407,7 +1459,7 @@ public class BLessonServiceImpl implements BLessonService {
...
@@ -1407,7 +1459,7 @@ public class BLessonServiceImpl implements BLessonService {
}
}
}
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
)
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
,
rollbackFor
=
Exception
.
class
)
//type: 0报名 1指派
//type: 0报名 1指派
synchronized
int
trainInsert
(
String
type
,
BLesson
bLesson
,
List
<
BLessonPerson
>
bLessonPersons
){
synchronized
int
trainInsert
(
String
type
,
BLesson
bLesson
,
List
<
BLessonPerson
>
bLessonPersons
){
int
line
=
0
;
int
line
=
0
;
...
@@ -1439,4 +1491,15 @@ public class BLessonServiceImpl implements BLessonService {
...
@@ -1439,4 +1491,15 @@ public class BLessonServiceImpl implements BLessonService {
return
line
;
return
line
;
}
}
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
readOnly
=
false
,
rollbackFor
=
Exception
.
class
)
public
void
addValueEvent
(
CurUser
curUser
,
BPersonValue
bPersonValue
,
BLesson
bLesson
){
if
(
curUser
!=
null
&&
bPersonValue
!=
null
&&
bLesson
!=
null
){
UserUtil
.
setCurrentPersistOperation
(
bPersonValue
);
bPersonValueRepository
.
add
(
bPersonValue
);
//积分变化后 s_user表中value字段重新统计
bPersonValueRepository
.
updateUserValue
(
curUser
.
getUserId
(),
curUser
.
getCorpId
());
bLessonRepository
.
personNumberReCount
(
bLesson
.
getBusinessId
(),
"1"
);
}
}
}
}
src/main/java/org/rcisoft/business/bpersonvalue/dao/BPersonValueRepository.java
View file @
510b6667
...
@@ -25,12 +25,12 @@ public interface BPersonValueRepository extends BaseMapper<BPersonValue> {
...
@@ -25,12 +25,12 @@ public interface BPersonValueRepository extends BaseMapper<BPersonValue> {
"and person_id = #{businessId} "
+
"and person_id = #{businessId} "
+
"<if test=\"startTime !=null and startTime != '' \"> and create_date <= #{startTime} </if> "
+
"<if test=\"startTime !=null and startTime != '' \"> and create_date <= #{startTime} </if> "
+
"<if test=\"endTime !=null and endTime != '' \"> and create_date >= #{endTime} </if> "
+
"<if test=\"endTime !=null and endTime != '' \"> and create_date >= #{endTime} </if> "
+
"<if test=\"event !=null and event != '' \"> and
event
like concat('%',#{event},'%') </if> "
+
"<if test=\"event !=null and event != '' \"> and
`event`
like concat('%',#{event},'%') </if> "
+
// "<if test=\"type !=null and type != '' \"> and event like concat('%',#{event},'%') </if> "+
// "<if test=\"type !=null and type != '' \"> and event like concat('%',#{event},'%') </if> "+
" ORDER BY person_id "
+
" ORDER BY person_id "
+
"<if test=\" valueSort !=null and valueSort != '' and valueSort == '0'.toString() \"> ,type asc,
value
desc </if> "
+
"<if test=\" valueSort !=null and valueSort != '' and valueSort == '0'.toString() \"> ,type asc,
`value`
desc </if> "
+
"<if test=\" valueSort !=null and valueSort != '' and valueSort == '1'.toString() \"> ,type desc,
value
asc </if> "
+
"<if test=\" valueSort !=null and valueSort != '' and valueSort == '1'.toString() \"> ,type desc,
`value`
asc </if> "
+
"<if test=\" dateSort !=null and dateSort != '' and dateSort == '0'.toString() \"> ,create_date asc</if> "
+
"<if test=\" dateSort !=null and dateSort != '' and dateSort == '0'.toString() \"> ,create_date asc</if> "
+
"<if test=\" dateSort !=null and dateSort != '' and dateSort == '1'.toString() \"> ,create_date desc</if> "
+
"<if test=\" dateSort !=null and dateSort != '' and dateSort == '1'.toString() \"> ,create_date desc</if> "
+
"</script>"
)
"</script>"
)
...
@@ -68,7 +68,7 @@ public interface BPersonValueRepository extends BaseMapper<BPersonValue> {
...
@@ -68,7 +68,7 @@ public interface BPersonValueRepository extends BaseMapper<BPersonValue> {
* @return
* @return
*/
*/
@Insert
(
"INSERT INTO b_person_value "
+
@Insert
(
"INSERT INTO b_person_value "
+
"( remarks,create_by,create_date,update_by,update_date,del_flag,flag,business_id,person_id,
event,value
,type )"
+
"( remarks,create_by,create_date,update_by,update_date,del_flag,flag,business_id,person_id,
`event`,`value`
,type )"
+
" VALUES( #{remarks},#{createBy},#{createDate},#{updateBy},#{updateDate},#{delFlag},#{flag},#{businessId},#{personId},#{event},#{value},#{type} )"
)
" VALUES( #{remarks},#{createBy},#{createDate},#{updateBy},#{updateDate},#{delFlag},#{flag},#{businessId},#{personId},#{event},#{value},#{type} )"
)
int
add
(
BPersonValue
bPersonValue
);
int
add
(
BPersonValue
bPersonValue
);
}
}
...
...
src/main/java/org/rcisoft/business/bpersonvalue/entity/BPersonValue.java
View file @
510b6667
...
@@ -29,5 +29,12 @@ public class BPersonValue extends IdEntity<BPersonValue> {
...
@@ -29,5 +29,12 @@ public class BPersonValue extends IdEntity<BPersonValue> {
private
String
type
;
private
String
type
;
// public BPersonValue(String personId, String event, Integer value, String type) {
// this.personId = personId;
// this.event = event;
// this.value = value;
// this.type = type;
// }
}
}
src/main/java/org/rcisoft/business/breleasevalue/dao/BReleaseValueRepository.java
View file @
510b6667
...
@@ -125,7 +125,7 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> {
...
@@ -125,7 +125,7 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> {
* @return
* @return
*/
*/
@Select
(
"<script>select business_id, name , `value` ,"
+
@Select
(
"<script>select business_id, name , `value` ,"
+
"(select sum(
value
) from b_person_value where person_id = s_user.business_id and type = 0) valueGain "
+
"(select sum(
`value`
) from b_person_value where person_id = s_user.business_id and type = 0) valueGain "
+
" from s_user "
+
" from s_user "
+
" where 1=1 and del_flag !=1 and flag = 1 "
+
" where 1=1 and del_flag !=1 and flag = 1 "
+
" and corp_id = #{dto.corpId} "
+
" and corp_id = #{dto.corpId} "
+
...
@@ -140,8 +140,8 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> {
...
@@ -140,8 +140,8 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> {
"<if test=\"dto.gainValueEnd!=null and dto.gainValueEnd != ''\"> "
+
"<if test=\"dto.gainValueEnd!=null and dto.gainValueEnd != ''\"> "
+
" and (select sum(value) from b_person_value where person_id = s_user.business_id and type = 0) <= #{dto.gainValueEnd} </if> "
+
" and (select sum(value) from b_person_value where person_id = s_user.business_id and type = 0) <= #{dto.gainValueEnd} </if> "
+
"ORDER BY corp_id "
+
"ORDER BY corp_id "
+
"<if test=\"dto.nowValueSort!=null and dto.nowValueSort != '' and dto.nowValueSort == '0'.toString()\"> ,
value
asc </if> "
+
"<if test=\"dto.nowValueSort!=null and dto.nowValueSort != '' and dto.nowValueSort == '0'.toString()\"> ,
`value`
asc </if> "
+
"<if test=\"dto.nowValueSort!=null and dto.nowValueSort != '' and dto.nowValueSort == '1'.toString()\"> ,
value
desc </if> "
+
"<if test=\"dto.nowValueSort!=null and dto.nowValueSort != '' and dto.nowValueSort == '1'.toString()\"> ,
`value`
desc </if> "
+
"<if test=\"dto.gainValueSort!=null and dto.gainValueSort != '' and dto.gainValueSort == '0'.toString()\"> ,valueGain asc </if> "
+
"<if test=\"dto.gainValueSort!=null and dto.gainValueSort != '' and dto.gainValueSort == '0'.toString()\"> ,valueGain asc </if> "
+
"<if test=\"dto.gainValueSort!=null and dto.gainValueSort != '' and dto.gainValueSort == '1'.toString()\"> ,valueGain desc </if> "
+
"<if test=\"dto.gainValueSort!=null and dto.gainValueSort != '' and dto.gainValueSort == '1'.toString()\"> ,valueGain desc </if> "
+
" </script>"
)
" </script>"
)
...
@@ -165,5 +165,16 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> {
...
@@ -165,5 +165,16 @@ public interface BReleaseValueRepository extends BaseMapper<BReleaseValue> {
"and rv.corp_id = #{corpId}"
+
"and rv.corp_id = #{corpId}"
+
"</script>"
)
"</script>"
)
String
getReleaseId
(
@Param
(
"name"
)
String
name
,
@Param
(
"corpId"
)
String
corpId
);
String
getReleaseId
(
@Param
(
"name"
)
String
name
,
@Param
(
"corpId"
)
String
corpId
);
@Select
(
"<script>"
+
"select rv.lesson_value lessonValue, rv.train_value trainValue "
+
"from b_release_value rv "
+
"left join b_release_value_son rvs on rv.business_id = rvs.release_id "
+
// "left join s_user su on su.business_id = rvs.user_id " +
"where rv.del_flag != 1 and rv.flag = 1 "
+
"and rvs.user_id = #{curUser.userId} "
+
"and rv.corp_id = #{curUser.corpId} "
+
"</script>"
)
List
<
BReleaseValue
>
selectReleaseValueByPersonId
(
@Param
(
"curUser"
)
CurUser
curUser
);
}
}
src/main/java/org/rcisoft/core/result/ResultServiceEnums.java
View file @
510b6667
...
@@ -241,6 +241,7 @@ public enum ResultServiceEnums {
...
@@ -241,6 +241,7 @@ public enum ResultServiceEnums {
VALUE_IS_ERROR
(
141
,
"扣除积分大于当前积分"
),
VALUE_IS_ERROR
(
141
,
"扣除积分大于当前积分"
),
USER_IS_NULL
(
142
,
"请选择用户"
),
USER_IS_NULL
(
142
,
"请选择用户"
),
NUM_IS_ERROR
(
143
,
"积分输入格式错误"
),
NUM_IS_ERROR
(
143
,
"积分输入格式错误"
),
VALUE_NOT_ENOUGH
(
144
,
"积分输入格式错误"
),
;
;
private
Integer
code
;
private
Integer
code
;
...
...
src/main/java/org/rcisoft/sys/user/dao/SysUserMapper.java
View file @
510b6667
...
@@ -273,7 +273,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
...
@@ -273,7 +273,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
* @return
* @return
*/
*/
@Insert
(
"<script> INSERT INTO b_dictionary "
+
@Insert
(
"<script> INSERT INTO b_dictionary "
+
"(BUSINESS_ID,PID,TYPE,NAME,
VALUE
,CREATE_BY,CREATE_DATE,UPDATE_BY,UPDATE_DATE,DEL_FLAG,FLAG,REMARKS,corp_id,sort) VALUES"
+
"(BUSINESS_ID,PID,TYPE,NAME,
`VALUE`
,CREATE_BY,CREATE_DATE,UPDATE_BY,UPDATE_DATE,DEL_FLAG,FLAG,REMARKS,corp_id,sort) VALUES"
+
"<foreach collection=\"list\" item=\"item\" separator=\",\">"
+
"<foreach collection=\"list\" item=\"item\" separator=\",\">"
+
"(#{item.businessId},#{item.pid},#{item.type},#{item.name},#{item.value},#{item.createBy},#{item.createDate},#{item.updateBy},#{item.updateDate},#{item.delFlag},#{item.flag},#{item.remarks},#{item.corpId},#{item.sort})"
+
"(#{item.businessId},#{item.pid},#{item.type},#{item.name},#{item.value},#{item.createBy},#{item.createDate},#{item.updateBy},#{item.updateDate},#{item.delFlag},#{item.flag},#{item.remarks},#{item.corpId},#{item.sort})"
+
"</foreach> </script>"
)
"</foreach> </script>"
)
...
...
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