Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
D
data-server
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
licc
data-server
Commits
080b4735
Commit
080b4735
authored
Mar 09, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增月度奖金接口
parent
c7438ca0
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
179 additions
and
86 deletions
+179
-86
MonthAwardMapper.java
...r/src/main/java/cn/wisenergy/mapper/MonthAwardMapper.java
+5
-0
TradeRecordMapper.java
.../src/main/java/cn/wisenergy/mapper/TradeRecordMapper.java
+20
-11
MonthAwardMapper.xml
...rgy-mapper/src/main/resources/mapper/MonthAwardMapper.xml
+16
-0
TradeRecordMapper.xml
...gy-mapper/src/main/resources/mapper/TradeRecordMapper.xml
+7
-6
MonthAwardVo.java
...del/src/main/java/cn/wisenergy/model/vo/MonthAwardVo.java
+43
-20
MonthAwardService.java
...main/java/cn/wisenergy/service/app/MonthAwardService.java
+19
-0
TradeRecordService.java
...ain/java/cn/wisenergy/service/app/TradeRecordService.java
+0
-17
MonthAwardServiceImpl.java
.../cn/wisenergy/service/app/impl/MonthAwardServiceImpl.java
+55
-0
TradeRecordServiceImpl.java
...cn/wisenergy/service/app/impl/TradeRecordServiceImpl.java
+0
-25
AccountController.java
...wisenergy/web/admin/controller/app/AccountController.java
+2
-1
MonthAwardController.java
...energy/web/admin/controller/app/MonthAwardController.java
+12
-6
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/MonthAwardMapper.java
View file @
080b4735
...
...
@@ -2,6 +2,9 @@ package cn.wisenergy.mapper;
import
cn.wisenergy.model.app.MonthAward
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Date
;
/**
* @author 86187
...
...
@@ -31,4 +34,6 @@ public interface MonthAwardMapper extends BaseMapper<MonthAward> {
* @return 1
*/
int
delById
(
Integer
id
);
MonthAward
getByTime
(
@Param
(
"yearMonth"
)
Date
yearMonth
);
}
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/TradeRecordMapper.java
View file @
080b4735
...
...
@@ -16,6 +16,7 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> {
/**
* 添加交易记录
*
* @param tradeRecord 记录信息
* @return 1
*/
...
...
@@ -23,6 +24,7 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> {
/**
* 编辑交易记录
*
* @param tradeRecord 记录信息
* @return 1
*/
...
...
@@ -30,6 +32,7 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> {
/**
* 删除
*
* @param id 主键
* @return 1
*/
...
...
@@ -37,6 +40,7 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> {
/**
* 根据用户id,获取用户交易列表
*
* @param userId 用户id
* @return 用户交易列表
*/
...
...
@@ -44,13 +48,15 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> {
/**
* 根据用户id、年月 ,获取用户本月交易列表
*
* @param userId 用户id
* @return 用户交易列表
*/
List
<
TradeRecord
>
getByUserIdAndTime
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"yearMonth"
)
Date
yearMonth
);
List
<
TradeRecord
>
getByUserIdAndTime
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"yearMonth"
)
Date
yearMonth
);
/**
* 获取不包括本月的六个月的累计收益
*
* @param userId 用户id
* @return 累计收益
*/
...
...
@@ -58,6 +64,7 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> {
/**
* 根据用户id 或 年月 ,获取用户本月交易提现列表
*
* @param userId 用户id
* @param yearMonth 年月
* @return 交易列表
...
...
@@ -66,10 +73,12 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> {
/**
* 获取月 累计奖金
* 获取用户本月累计奖金
*
* @param userId 用户id
* @param yearMonth 年月
* @return
*/
Double
queryMonthAward
(
@Param
(
"yearMonth"
)
Date
yearMonth
);
Double
queryMonthAward
(
@Param
(
"
userId"
)
String
userId
,
@Param
(
"
yearMonth"
)
Date
yearMonth
);
}
wisenergy-mapper/src/main/resources/mapper/MonthAwardMapper.xml
View file @
080b4735
...
...
@@ -86,4 +86,20 @@
where id = #{id}
</delete>
<select
id=
"getByTime"
resultType=
"cn.wisenergy.model.app.MonthAward"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
<if
test=
"yearMonth != null"
>
AND(
YEAR(create_time) = YEAR(#{yearMonth})
AND MONTH(create_time) = MONTH(#{yearMonth}))
</if>
order by create_time desc
limit 1
</where>
</select>
</mapper>
\ No newline at end of file
wisenergy-mapper/src/main/resources/mapper/TradeRecordMapper.xml
View file @
080b4735
...
...
@@ -137,17 +137,18 @@
</select>
<select
id=
"queryMonthAward"
resultType=
"java.lang.Double"
>
select
sum(money)
select sum(money)
from
<include
refid=
"table"
/>
<where>
(type=2
or status=0)
(type=2 or status=0)
<if
test=
"userId"
>
and user_id=#{userId}
</if>
<if
test=
"yearMonth != null"
>
AND(
YEAR(
cre
ate_time) = YEAR(#{yearMonth})
AND MONTH(
cre
ate_time) = MONTH(#{yearMonth}))
YEAR(
upd
ate_time) = YEAR(#{yearMonth})
AND MONTH(
upd
ate_time) = MONTH(#{yearMonth}))
</if>
</where>
</select>
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/vo/MonthAwardVo.java
View file @
080b4735
...
...
@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* @author 86187
* @ Description: 月度奖金页面展示数据Vo
...
...
@@ -13,45 +16,65 @@ import lombok.Data;
@ApiModel
(
"MonthAwardVo"
)
@Data
public
class
MonthAwardVo
{
/**
* 与上一次比较的增长奖金
*/
@ApiModelProperty
(
name
=
"growthAward"
,
value
=
"与上一次比较的增长额度"
)
private
BigDecimal
growthAward
;
/**
* 历史
累计奖金
* 历史
奖金总额
*/
@ApiModelProperty
(
value
=
"历史累计奖金"
,
name
=
"totalAward"
)
private
Double
totalAward
;
@ApiModelProperty
(
value
=
"历史奖金总额"
,
name
=
"awardTotal"
)
private
BigDecimal
awardTotal
;
/**
* 本月累计奖金总额(本月新增+上月没有分出去的月度肥料奖金)
*/
@ApiModelProperty
(
value
=
"本月累计奖金总额"
,
name
=
"monthAwardTotal"
)
private
BigDecimal
monthAwardTotal
;
/**
* 本月新增
*/
@ApiModelProperty
(
value
=
"本月新增"
,
name
=
"monthIncreased"
)
private
Double
monthIncreased
;
@ApiModelProperty
(
value
=
"本月新增"
,
name
=
"monthIncreased"
)
private
BigDecimal
monthIncreased
;
/**
*
用户-份
额
*
黄金树月奖励总
额
*/
@ApiModelProperty
(
value
=
"用户-份额"
,
name
=
"userMonthAward"
)
private
Double
userMonthAward
;
@ApiModelProperty
(
value
=
"黄金树月奖励总额"
,
name
=
"goldAward"
)
private
BigDecimal
goldAward
;
/**
*
黄金树等级奖金
*
农场主月奖励总额
*/
@ApiModelProperty
(
value
=
"
黄金树等级奖金"
,
name
=
"gold
Award"
)
private
Double
gold
Award
;
@ApiModelProperty
(
value
=
"
农场主月奖励总额"
,
name
=
"farmer
Award"
)
private
BigDecimal
farmer
Award
;
/**
*
农场主等级 奖金
*
森林之星月奖励总额
*/
@ApiModelProperty
(
value
=
"
农场主等级 奖金"
,
name
=
"farmer
Award"
)
private
Double
farmer
Award
;
@ApiModelProperty
(
value
=
"
森林之星月奖励总额"
,
name
=
"forestStart
Award"
)
private
BigDecimal
forestStart
Award
;
/**
* 森
林之星等级奖金
* 森
田合伙人月奖励总额
*/
@ApiModelProperty
(
value
=
"森林之星等级奖金"
,
name
=
"forestStartAward"
)
private
Double
forestStartAward
;
@ApiModelProperty
(
value
=
"森田合伙人月奖励总额"
,
name
=
"partnerAward"
)
private
BigDecimal
partnerAward
;
/**
* 用户-份额
*/
@ApiModelProperty
(
value
=
"用户-份额"
,
name
=
"userMonthAward"
)
private
Double
userMonthAward
;
/**
*
西田森合伙人等级奖金
*
奖金入池时间
*/
@ApiModelProperty
(
value
=
"
西田森合伙人等级奖金"
,
name
=
"partnerAward
"
)
private
D
ouble
partnerAward
;
@ApiModelProperty
(
value
=
"
奖金入池时间"
,
name
=
"awardTime
"
)
private
D
ate
awardTime
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/MonthAwardService.java
0 → 100644
View file @
080b4735
package
cn
.
wisenergy
.
service
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.vo.MonthAwardVo
;
/**
* @author 86187
* @ Description:
* @ Author : 86187
* @ Date : 2021/3/9 15:25
*/
public
interface
MonthAwardService
{
/**
* 获取月度奖金
* @param userId 用户id
* @return 月度奖金
*/
R
<
MonthAwardVo
>
queryMonthAward
(
String
userId
);
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/TradeRecordService.java
View file @
080b4735
package
cn
.
wisenergy
.
service
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.vo.MonthAwardVo
;
/**
* @author 86187
*/
public
interface
TradeRecordService
{
/**
* 查询本月累计奖金
*
* @return 本月累计奖金
*/
R
<
Double
>
queryMonthAward
();
/**
* 查询各种月度奖金
*
* @param userId 用户id
* @return 各种月度奖金
*/
R
<
MonthAwardVo
>
queryAllAward
(
String
userId
);
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/MonthAwardServiceImpl.java
0 → 100644
View file @
080b4735
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.MonthAwardMapper
;
import
cn.wisenergy.mapper.TradeRecordMapper
;
import
cn.wisenergy.model.app.MonthAward
;
import
cn.wisenergy.model.vo.MonthAwardVo
;
import
cn.wisenergy.service.app.MonthAwardService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
/**
* @author 86187
*/
@Slf4j
@Service
public
class
MonthAwardServiceImpl
extends
ServiceImpl
<
MonthAwardMapper
,
MonthAward
>
implements
MonthAwardService
{
@Autowired
private
TradeRecordMapper
tradeRecordMapper
;
@Override
public
R
<
MonthAwardVo
>
queryMonthAward
(
String
userId
)
{
log
.
info
(
"shop-mall[]MonthAwardServiceImpl[]queryMonthAward[]input.param.userId:"
+
userId
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
R
.
error
(
"入参为空!"
);
}
//获取本月最新的一条数据
MonthAwardVo
monthAwardVo
=
new
MonthAwardVo
();
MonthAward
monthAward
=
baseMapper
.
getByTime
(
new
Date
());
if
(
null
==
monthAward
)
{
return
R
.
ok
(
monthAwardVo
);
}
monthAwardVo
.
setAwardTime
(
monthAward
.
getCreateTime
());
monthAwardVo
.
setAwardTotal
(
monthAward
.
getAwardTotal
());
monthAwardVo
.
setFarmerAward
(
monthAward
.
getFarmerAward
());
monthAwardVo
.
setForestStartAward
(
monthAward
.
getForestStartAward
());
monthAwardVo
.
setGoldAward
(
monthAward
.
getGoldAward
());
monthAwardVo
.
setGrowthAward
(
monthAward
.
getGrowthAward
());
monthAwardVo
.
setMonthAwardTotal
(
monthAward
.
getMonthAwardTotal
());
monthAwardVo
.
setMonthIncreased
(
monthAward
.
getMonthIncreased
());
monthAwardVo
.
setPartnerAward
(
monthAward
.
getPartnerAward
());
//获取用户本月奖金
Double
sum
=
tradeRecordMapper
.
queryMonthAward
(
userId
,
new
Date
());
monthAwardVo
.
setUserMonthAward
(
sum
);
return
R
.
ok
(
monthAwardVo
);
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/TradeRecordServiceImpl.java
View file @
080b4735
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.mapper.TradeRecordMapper
;
import
cn.wisenergy.model.app.TradeRecord
;
import
cn.wisenergy.model.vo.MonthAwardVo
;
import
cn.wisenergy.service.app.TradeRecordService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
/**
* @author 86187
*/
...
...
@@ -19,24 +14,4 @@ import java.util.Date;
@Slf4j
public
class
TradeRecordServiceImpl
extends
ServiceImpl
<
TradeRecordMapper
,
TradeRecord
>
implements
TradeRecordService
{
@Override
public
R
<
Double
>
queryMonthAward
()
{
log
.
info
(
"shop-mall[]TradeRecordServiceImpl[]queryMonthAward[]input.method"
);
//获取本月累计奖金
Double
award
=
baseMapper
.
queryMonthAward
(
new
Date
());
return
R
.
ok
(
award
);
}
@Override
public
R
<
MonthAwardVo
>
queryAllAward
(
String
userId
)
{
log
.
info
(
"shop-mall[]TradeRecordServiceImpl[]queryAllAward[]input.param.userId:"
+
userId
);
if
(
StringUtils
.
isBlank
(
userId
)){
return
R
.
error
(
"入参为空!"
);
}
return
null
;
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/AccountController.java
View file @
080b4735
...
...
@@ -4,6 +4,7 @@ import cn.wisenergy.common.utils.R;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.service.app.AccountService
;
import
cn.wisenergy.web.common.BaseController
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -22,7 +23,7 @@ import java.util.List;
@RestController
@RequestMapping
(
"/account"
)
@Slf4j
public
class
AccountController
{
public
class
AccountController
extends
BaseController
{
@Autowired
private
AccountService
accountService
;
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/
TradeReco
rdController.java
→
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/
MonthAwa
rdController.java
View file @
080b4735
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.service.app.TradeRecordService
;
import
cn.wisenergy.model.vo.MonthAwardVo
;
import
cn.wisenergy.service.app.MonthAwardService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -21,14 +23,18 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
(
"/award"
)
@Slf4j
public
class
TradeReco
rdController
{
public
class
MonthAwa
rdController
{
@Autowired
private
TradeRecordService
tradeReco
rdService
;
private
MonthAwardService
monthAwa
rdService
;
@ApiOperation
(
value
=
"本月累计奖金"
,
notes
=
"本月累计奖金"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户id"
,
dataType
=
"String"
)
@GetMapping
(
"/queryMonthAward"
)
public
R
<
Double
>
queryMonthAward
()
{
log
.
info
(
"shop-mall[]TradeRecordController[]queryMonthAward[]input.method"
);
return
tradeRecordService
.
queryMonthAward
();
public
R
<
MonthAwardVo
>
queryMonthAward
(
String
userId
)
{
log
.
info
(
"shop-mall[]MonthAwardController[]queryMonthAward[]input.param.userId:"
+
userId
);
if
(
StringUtils
.
isBlank
(
userId
))
{
return
R
.
error
(
"入参为空!"
);
}
return
monthAwardService
.
queryMonthAward
(
userId
);
}
}
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