Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
dbabcfe1
Commit
dbabcfe1
authored
Jul 26, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
点赞评论排序
parent
0b4aee0c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
142 additions
and
32 deletions
+142
-32
IntegralRulePeriod.java
...m/xxfc/platform/activity/constant/IntegralRulePeriod.java
+33
-0
IntegralRuleDto.java
...n/java/com/xxfc/platform/activity/vo/IntegralRuleDto.java
+3
-2
IntegralRuleBiz.java
.../java/com/xxfc/platform/activity/biz/IntegralRuleBiz.java
+0
-3
IntegralUserRecordBiz.java
...com/xxfc/platform/activity/biz/IntegralUserRecordBiz.java
+44
-7
IntegralUserStatusBiz.java
...com/xxfc/platform/activity/biz/IntegralUserStatusBiz.java
+39
-0
IntegralUserRecordMapper.java
...fc/platform/activity/mapper/IntegralUserRecordMapper.java
+2
-0
generatorConfig.xml
...ity-server/src/main/resources/builder/generatorConfig.xml
+3
-15
IntegralRuleMapper.xml
...y-server/src/main/resources/mapper/IntegralRuleMapper.xml
+9
-5
IntegralUserRecordMapper.xml
...er/src/main/resources/mapper/IntegralUserRecordMapper.xml
+9
-0
No files found.
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/constant/IntegralRulePeriod.java
0 → 100644
View file @
dbabcfe1
package
com
.
xxfc
.
platform
.
activity
.
constant
;
public
enum
IntegralRulePeriod
{
DAY
(
0
,
"天"
),
WEEK
(
1
,
"周"
),
MONTH
(
2
,
"月"
),
QUARTER
(
3
,
"季度"
),
YEAR
(
4
,
"年"
);
Integer
code
;
String
msg
;
IntegralRulePeriod
(
Integer
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/vo/IntegralRuleDto.java
View file @
dbabcfe1
...
@@ -3,8 +3,6 @@ package com.xxfc.platform.activity.vo;
...
@@ -3,8 +3,6 @@ package com.xxfc.platform.activity.vo;
import
com.github.wxiaoqi.security.common.vo.PageParam
;
import
com.github.wxiaoqi.security.common.vo.PageParam
;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
@Data
@Data
public
class
IntegralRuleDto
extends
PageParam
{
public
class
IntegralRuleDto
extends
PageParam
{
/**
/**
...
@@ -13,4 +11,7 @@ public class IntegralRuleDto extends PageParam {
...
@@ -13,4 +11,7 @@ public class IntegralRuleDto extends PageParam {
Integer
id
;
Integer
id
;
String
code
;
String
code
;
Integer
userId
;
}
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/IntegralRuleBiz.java
View file @
dbabcfe1
...
@@ -97,9 +97,6 @@ public class IntegralRuleBiz extends BaseBiz<IntegralRuleMapper, IntegralRule> {
...
@@ -97,9 +97,6 @@ public class IntegralRuleBiz extends BaseBiz<IntegralRuleMapper, IntegralRule> {
Query
query
=
new
Query
(
integralRule
);
Query
query
=
new
Query
(
integralRule
);
PageDataVO
<
IntegralRule
>
pageDataVO
=
PageDataVO
.
pageInfo
(
query
,
()
->
mapper
.
selectAllByParam
(
integralRule
));
PageDataVO
<
IntegralRule
>
pageDataVO
=
PageDataVO
.
pageInfo
(
query
,
()
->
mapper
.
selectAllByParam
(
integralRule
));
//添加个人积分状态
//添加个人积分状态
for
(
IntegralRule
value
:
pageDataVO
.
getData
())
{
value
.
setIntegralStatus
(
getIntegralStatus
(
appUserDTO
,
value
));
}
return
ObjectRestResponse
.
succ
(
pageDataVO
);
return
ObjectRestResponse
.
succ
(
pageDataVO
);
}
}
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/IntegralUserRecordBiz.java
View file @
dbabcfe1
...
@@ -7,11 +7,14 @@ import com.github.wxiaoqi.security.common.constant.RestCode;
...
@@ -7,11 +7,14 @@ import com.github.wxiaoqi.security.common.constant.RestCode;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.activity.constant.IntegralRulePeriod
;
import
com.xxfc.platform.activity.entity.IntegralRule
;
import
com.xxfc.platform.activity.entity.IntegralRule
;
import
com.xxfc.platform.activity.entity.IntegralUserRecord
;
import
com.xxfc.platform.activity.entity.IntegralUserRecord
;
import
com.xxfc.platform.activity.entity.IntegralUserStatus
;
import
com.xxfc.platform.activity.entity.IntegralUserTotal
;
import
com.xxfc.platform.activity.entity.IntegralUserTotal
;
import
com.xxfc.platform.activity.mapper.IntegralUserRecordMapper
;
import
com.xxfc.platform.activity.mapper.IntegralUserRecordMapper
;
import
com.xxfc.platform.activity.user.UserInfoBiz
;
import
com.xxfc.platform.activity.user.UserInfoBiz
;
import
com.xxfc.platform.activity.util.IntegralToolsUtils
;
import
com.xxfc.platform.activity.vo.IntegralRuleDto
;
import
com.xxfc.platform.activity.vo.IntegralRuleDto
;
import
com.xxfc.platform.activity.vo.IntegralUserRecordDto
;
import
com.xxfc.platform.activity.vo.IntegralUserRecordDto
;
import
com.xxfc.platform.activity.vo.IntegralUserTotalDto
;
import
com.xxfc.platform.activity.vo.IntegralUserTotalDto
;
...
@@ -37,6 +40,9 @@ public class IntegralUserRecordBiz extends BaseBiz<IntegralUserRecordMapper, Int
...
@@ -37,6 +40,9 @@ public class IntegralUserRecordBiz extends BaseBiz<IntegralUserRecordMapper, Int
@Autowired
@Autowired
IntegralRuleBiz
integralRuleBiz
;
IntegralRuleBiz
integralRuleBiz
;
@Autowired
IntegralUserStatusBiz
integralUserStatusBiz
;
/**
/**
* 添加用户积分记录
* 添加用户积分记录
*
*
...
@@ -49,15 +55,15 @@ public class IntegralUserRecordBiz extends BaseBiz<IntegralUserRecordMapper, Int
...
@@ -49,15 +55,15 @@ public class IntegralUserRecordBiz extends BaseBiz<IntegralUserRecordMapper, Int
return
ObjectRestResponse
.
paramIsEmpty
();
return
ObjectRestResponse
.
paramIsEmpty
();
}
}
//如果参数没有积分,说明是消息队列过来的参数,需要查询规则表获取积分数
//如果参数没有积分,说明是消息队列过来的参数,需要查询规则表获取积分数
IntegralRuleDto
integralRule
=
new
IntegralRuleDto
();
integralRule
.
setCode
(
integralUserRecord
.
getIntegralRuleCode
());
ObjectRestResponse
<
IntegralRule
>
ruleObjectRestResponse
=
integralRuleBiz
.
getOne
(
integralRule
);
if
(
ruleObjectRestResponse
.
getData
()
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
1202
,
"积分规则不存在"
);
}
IntegralRule
oldValue
=
ruleObjectRestResponse
.
getData
();
if
(
integralUserRecord
.
getPoint
()
==
null
)
{
if
(
integralUserRecord
.
getPoint
()
==
null
)
{
IntegralRuleDto
integralRule
=
new
IntegralRuleDto
();
integralRule
.
setCode
(
integralUserRecord
.
getIntegralRuleCode
());
ObjectRestResponse
<
IntegralRule
>
ruleObjectRestResponse
=
integralRuleBiz
.
getOne
(
integralRule
);
if
(
ruleObjectRestResponse
.
getData
()
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
1202
,
"积分规则不存在"
);
}
Integer
point
=
0
;
Integer
point
=
0
;
IntegralRule
oldValue
=
ruleObjectRestResponse
.
getData
();
if
(
oldValue
.
getPoint
()
==
0
)
{
//没有基础分需要计算分数
if
(
oldValue
.
getPoint
()
==
0
)
{
//没有基础分需要计算分数
//Integer amount = Integer.parseInt(new BigDecimal(integralUserRecord.getAmount()).divide(new BigDecimal("100"), 0, BigDecimal.ROUND_DOWN).toString());
//Integer amount = Integer.parseInt(new BigDecimal(integralUserRecord.getAmount()).divide(new BigDecimal("100"), 0, BigDecimal.ROUND_DOWN).toString());
Integer
amount
=
Integer
.
parseInt
(
integralUserRecord
.
getAmount
());
Integer
amount
=
Integer
.
parseInt
(
integralUserRecord
.
getAmount
());
...
@@ -95,6 +101,9 @@ public class IntegralUserRecordBiz extends BaseBiz<IntegralUserRecordMapper, Int
...
@@ -95,6 +101,9 @@ public class IntegralUserRecordBiz extends BaseBiz<IntegralUserRecordMapper, Int
}
}
}
}
insertSelective
(
integralUserRecord
.
getIntegralUserRecord
());
insertSelective
(
integralUserRecord
.
getIntegralUserRecord
());
if
(
oldValue
!=
null
)
{
getUserRecordStatus
(
integralUserRecord
,
oldValue
.
getPeriod
(),
oldValue
.
getNumber
());
}
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
...
@@ -149,4 +158,32 @@ public class IntegralUserRecordBiz extends BaseBiz<IntegralUserRecordMapper, Int
...
@@ -149,4 +158,32 @@ public class IntegralUserRecordBiz extends BaseBiz<IntegralUserRecordMapper, Int
List
<
IntegralUserRecord
>
integralUserRecordList
=
mapper
.
selectByUserAndTime
(
integralUserRecordDto
);
List
<
IntegralUserRecord
>
integralUserRecordList
=
mapper
.
selectByUserAndTime
(
integralUserRecordDto
);
return
ObjectRestResponse
.
succ
(
integralUserRecordList
);
return
ObjectRestResponse
.
succ
(
integralUserRecordList
);
}
}
/**
* //判断用户获取积分是否达标
* @param integralUserRecordDto 积分记录实体
* @param period 周期
* number 周期内可获得积分的次数
*/
public
void
getUserRecordStatus
(
IntegralUserRecordDto
integralUserRecordDto
,
Integer
period
,
Integer
number
)
{
IntegralUserStatus
integralUserStatus
=
new
IntegralUserStatus
();
integralUserStatus
.
setUserId
(
integralUserRecordDto
.
getUserId
());
integralUserStatus
.
setIntegralRuleCode
(
integralUserRecordDto
.
getIntegralRuleCode
());
if
(
period
==
IntegralRulePeriod
.
DAY
.
getCode
())
{
//按天
integralUserRecordDto
.
setStartTime
(
IntegralToolsUtils
.
getDayStart
());
integralUserRecordDto
.
setEndTime
(
IntegralToolsUtils
.
getDayStart
()
+
24
*
60
*
60
*
1000
);
Integer
count
=
mapper
.
countByUserAndCode
(
integralUserRecordDto
);
integralUserStatus
.
setIntegralStatus
(
count
==
number
);
}
else
{
integralUserRecordDto
.
setStartTime
(
null
);
Integer
count
=
mapper
.
countByUserAndCode
(
integralUserRecordDto
);
integralUserStatus
.
setIntegralStatus
(
count
==
number
);
}
integralUserStatusBiz
.
save
(
integralUserStatus
);
}
}
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/IntegralUserStatusBiz.java
0 → 100644
View file @
dbabcfe1
package
com
.
xxfc
.
platform
.
activity
.
biz
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.activity.entity.IntegralUserStatus
;
import
com.xxfc.platform.activity.mapper.IntegralUserStatusMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
@Service
@Transactional
public
class
IntegralUserStatusBiz
extends
BaseBiz
<
IntegralUserStatusMapper
,
IntegralUserStatus
>
{
public
ObjectRestResponse
save
(
IntegralUserStatus
integralUserStatus
)
{
if
(
integralUserStatus
!=
null
)
{
IntegralUserStatus
oldValue
=
mapper
.
selectByUserAndCode
(
integralUserStatus
);
if
(
oldValue
!=
null
)
{
BeanUtil
.
copyProperties
(
integralUserStatus
,
oldValue
,
CopyOptions
.
create
().
setIgnoreNullValue
(
true
).
setIgnoreError
(
true
));
updateSelectiveById
(
oldValue
);
}
insertSelective
(
integralUserStatus
);
}
return
ObjectRestResponse
.
succ
();
}
public
IntegralUserStatus
selectByUserAndCode
(
String
code
,
Integer
userId
)
{
if
(!
StringUtils
.
isAllBlank
(
code
,
userId
+
""
))
{
IntegralUserStatus
integralUserStatus
=
new
IntegralUserStatus
();
integralUserStatus
.
setIntegralRuleCode
(
code
);
integralUserStatus
.
setUserId
(
userId
);
return
mapper
.
selectByUserAndCode
(
integralUserStatus
);
}
return
null
;
}
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/mapper/IntegralUserRecordMapper.java
View file @
dbabcfe1
...
@@ -12,4 +12,6 @@ public interface IntegralUserRecordMapper extends Mapper<IntegralUserRecord> {
...
@@ -12,4 +12,6 @@ public interface IntegralUserRecordMapper extends Mapper<IntegralUserRecord> {
List
<
IntegralUserRecord
>
selectByUserAndTime
(
IntegralUserRecordDto
integralUserRecordDto
);
List
<
IntegralUserRecord
>
selectByUserAndTime
(
IntegralUserRecordDto
integralUserRecordDto
);
Integer
countByUserAndCode
(
IntegralUserRecordDto
integralUserRecordDto
);
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/resources/builder/generatorConfig.xml
View file @
dbabcfe1
...
@@ -15,9 +15,9 @@
...
@@ -15,9 +15,9 @@
</plugin>
</plugin>
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
<jdbcConnection
driverClass=
"com.mysql.jdbc.Driver"
connectionURL=
"jdbc:mysql://
localhost:3306/vehicle
?useUnicode=true&characterEncoding=UTF8"
connectionURL=
"jdbc:mysql://
10.5.52.4:3307/xxfc_activity
?useUnicode=true&characterEncoding=UTF8"
userId=
"root"
userId=
"root"
password=
"
xx2019fc
"
>
password=
"
sslcloud123*()
"
>
</jdbcConnection>
</jdbcConnection>
<javaModelGenerator
targetPackage=
"${targetModelPackage}"
targetProject=
"${targetJavaProject}"
/>
<javaModelGenerator
targetPackage=
"${targetModelPackage}"
targetProject=
"${targetJavaProject}"
/>
...
@@ -26,18 +26,6 @@
...
@@ -26,18 +26,6 @@
<javaClientGenerator
targetPackage=
"${targetMapperPackage}"
targetProject=
"${targetJavaProject}"
<javaClientGenerator
targetPackage=
"${targetMapperPackage}"
targetProject=
"${targetJavaProject}"
type=
"XMLMAPPER"
/>
type=
"XMLMAPPER"
/>
<table
tableName=
"integral_user_status"
domainObjectName=
"IntegralUserStatus"
></table>
<!-- <table tableName="vehicle" domainObjectName="Vehicle">-->
<!-- </table>-->
<!-- <table tableName="vehicle_book_info" domainObjectName="VehicleBookInfo">-->
<!-- </table>-->
<!-- <table tableName="vehicle_book_record" domainObjectName="VehicleBookRecord">-->
<!-- </table>-->
<!-- <table tableName="branch_company" domainObjectName="BranchCompany">-->
<!-- </table>-->
<!-- <table tableName="branch_company_stock_info" domainObjectName="BranchCompanyStockInfo"></table>-->
<!-- <table tableName="branch_company_stock_apply_info" domainObjectName="BranchCompanyStockApplyInfo"></table>-->
<table
tableName=
"vehicle_upkeep_item"
domainObjectName=
"VehicleUpkeepItem"
></table>
<table
tableName=
"vehicle_upkeep_log"
domainObjectName=
"VehicleUpkeepLog"
></table>
</context>
</context>
</generatorConfiguration>
</generatorConfiguration>
\ No newline at end of file
xx-activity/xx-activity-server/src/main/resources/mapper/IntegralRuleMapper.xml
View file @
dbabcfe1
...
@@ -31,17 +31,21 @@
...
@@ -31,17 +31,21 @@
<select
id=
"selectAllByParam"
resultType=
"com.xxfc.platform.activity.entity.IntegralRule"
parameterType=
"com.xxfc.platform.activity.vo.IntegralRuleDto"
>
<select
id=
"selectAllByParam"
resultType=
"com.xxfc.platform.activity.entity.IntegralRule"
parameterType=
"com.xxfc.platform.activity.vo.IntegralRuleDto"
>
select * from integral_rule
select i1.*, i2.integral_status from integral_rule i1
left join integral_user_status i2 on i1.code = i2.integral_rule_code
<where>
<where>
<if
test=
"id != null"
>
<if
test=
"id != null"
>
and id = #{id}
and i1.id = #{id}
</if>
<if
test=
"userId != null"
>
and i2.user_id = #{userId}
</if>
</if>
<if
test=
"code != null"
>
<if
test=
"code != null"
>
and code = #{code}
and
i1.
code = #{code}
</if>
</if>
and isdel = 0 and status = 1
and i
1.i
sdel = 0 and status = 1
</where>
</where>
order by
order_id DESC ,
crt_time DESC
order by
i1.order_id DESC ,i1.
crt_time DESC
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
xx-activity/xx-activity-server/src/main/resources/mapper/IntegralUserRecordMapper.xml
View file @
dbabcfe1
...
@@ -29,4 +29,13 @@
...
@@ -29,4 +29,13 @@
select * from integral_user_record
select * from integral_user_record
where user_id = #{userId} and crt_time between #{startTime} and #{endTime} and integral_rule_code = #{integralRuleCode}
where user_id = #{userId} and crt_time between #{startTime} and #{endTime} and integral_rule_code = #{integralRuleCode}
</select>
</select>
<select
id=
"countByUserAndCode"
resultType=
"java.lang.Integer"
parameterType=
"com.xxfc.platform.activity.vo.IntegralUserRecordDto"
>
select count(*) from integral_user_record
where user_id = #{userId} and integral_rule_code = #{integralRuleCode}
<if
test=
"startTime != null"
>
and crt_time between #{startTime} and #{endTime}
</if>
</select>
</mapper>
</mapper>
\ No newline at end of file
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