Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
shop-Mall
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
shop-Mall
Commits
045e014e
Commit
045e014e
authored
Mar 15, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新获取税率信息接口
parent
422ab246
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
249 additions
and
8 deletions
+249
-8
VariableMapper.java
...per/src/main/java/cn/wisenergy/mapper/VariableMapper.java
+44
-0
VariableMapper.xml
...nergy-mapper/src/main/resources/mapper/VariableMapper.xml
+83
-0
Variable.java
...-model/src/main/java/cn/wisenergy/model/app/Variable.java
+44
-0
TaxRateVo.java
...-model/src/main/java/cn/wisenergy/model/vo/TaxRateVo.java
+27
-0
BankService.java
...e/src/main/java/cn/wisenergy/service/app/BankService.java
+10
-0
BankServiceImpl.java
...n/java/cn/wisenergy/service/app/impl/BankServiceImpl.java
+32
-8
BankController.java
...cn/wisenergy/web/admin/controller/app/BankController.java
+9
-0
No files found.
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/VariableMapper.java
0 → 100644
View file @
045e014e
package
cn
.
wisenergy
.
mapper
;
import
cn.wisenergy.model.app.Variable
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* @author 86187
* @ Description: 变量表mapper
* @ Author : 86187
* @ Date : 2021/3/15 15:09
*/
public
interface
VariableMapper
extends
BaseMapper
<
Variable
>
{
/**
* 新增
*
* @param variable 变量信息
* @return 1
*/
int
add
(
Variable
variable
);
/**
* 编辑
*
* @param variable 变量信息
* @return 1
*/
int
edit
(
Variable
variable
);
/**
* 删除
*
* @param id 主键id
* @return 1
*/
int
delById
(
@Param
(
"id"
)
Integer
id
);
/**
* 根据key,获取变量信息
* @param key 变量唯一标识
* @return
*/
Variable
getByKey
(
@Param
(
"key"
)
String
key
);
}
wisenergy-mapper/src/main/resources/mapper/VariableMapper.xml
0 → 100644
View file @
045e014e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.wisenergy.mapper.VariableMapper"
>
<resultMap
id=
"variableMap"
type=
"cn.wisenergy.model.app.Variable"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"key"
property=
"key"
/>
<result
column=
"variable_value"
property=
"variableValue"
/>
<result
column=
"desc"
property=
"desc"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
</resultMap>
<sql
id=
"table"
>
variable
</sql>
<sql
id=
"cols_all"
>
id,
<include
refid=
"cols_exclude_id"
/>
</sql>
<sql
id=
"cols_exclude_id"
>
key,password,variable_value,desc,create_time,update_time
</sql>
<sql
id=
"vals"
>
#{key},#{variableValue},#{desc},now(),now()
</sql>
<sql
id=
"updateCondition"
>
<if
test=
"key != null"
>
key = #{key},
</if>
<if
test=
"variableValue != null"
>
variable_value =#{variableValue},
</if>
<if
test=
"desc != null"
>
desc =#{desc},
</if>
update_time =now()
</sql>
<sql
id=
"criteria"
>
<if
test=
"id != null"
>
id = #{id}
</if>
<if
test=
"key != null"
>
and key = #{key}
</if>
<if
test=
"variableValue != null"
>
and variable_value =#{variableValue}
</if>
<if
test=
"desc != null"
>
and desc =#{desc}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"updateTime != null"
>
and #{updateTime}
>
= update_time
</if>
</sql>
<insert
id=
"add"
parameterType=
"cn.wisenergy.model.app.Variable"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into
<include
refid=
"table"
/>
(
<include
refid=
"cols_exclude_id"
/>
)
value(
<include
refid=
"vals"
/>
)
</insert>
<update
id=
"edit"
parameterType=
"cn.wisenergy.model.app.Variable"
>
UPDATE
<include
refid=
"table"
/>
<set>
<include
refid=
"updateCondition"
/>
</set>
<where>
id = #{id}
</where>
</update>
<delete
id=
"delById"
parameterType=
"java.lang.Integer"
>
delete from
<include
refid=
"table"
/>
where id = #{id}
</delete>
<select
id=
"getByKey"
resultType=
"cn.wisenergy.model.app.Variable"
>
select
<include
refid=
"cols_all"
/>
from
<include
refid=
"table"
/>
<where>
key=#{key}
</where>
</select>
</mapper>
wisenergy-model/src/main/java/cn/wisenergy/model/app/Variable.java
0 → 100644
View file @
045e014e
package
cn
.
wisenergy
.
model
.
app
;
import
lombok.Data
;
import
java.util.Date
;
/**
*@ Description: 变量表实体类
*@ Author : 86187
*@ Date : 2021/3/15 15:04
* @author 86187
*/
@Data
public
class
Variable
{
/**
* 变量主键
*/
private
Integer
id
;
/**
* 变量唯一标识
*/
private
String
key
;
/**
* 变量值
*/
private
String
variableValue
;
/**
* 变量描述
*/
private
String
desc
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/vo/TaxRateVo.java
0 → 100644
View file @
045e014e
package
cn
.
wisenergy
.
model
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @author 86187
* @ Description: 提现税率Vo
* @ Author : 86187
* @ Date : 2021/3/15 15:24
*/
@Data
@ApiModel
(
"TaxRateVo"
)
public
class
TaxRateVo
{
/**
* 实际金额
*/
@ApiModelProperty
(
value
=
"实际金额"
,
name
=
"actualMoney"
)
private
Double
actualMoney
;
/**
* 税款金额
*/
@ApiModelProperty
(
value
=
"税款金额"
,
name
=
"taxMoney"
)
private
Double
taxMoney
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/BankService.java
View file @
045e014e
...
...
@@ -3,6 +3,7 @@ package cn.wisenergy.service.app;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.BankInfo
;
import
cn.wisenergy.model.dto.WithdrawBankDto
;
import
cn.wisenergy.model.vo.TaxRateVo
;
import
java.util.List
;
...
...
@@ -53,8 +54,17 @@ public interface BankService {
/**
* 获取银行卡名称列表
*
* @return
*/
R
<
List
<
String
>>
getBankNameList
();
/**
* 获取提现税率信息
*
* @param money 提现金额
* @return 提现税率信息
*/
R
<
TaxRateVo
>
getTaxRate
(
Double
money
);
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/BankServiceImpl.java
View file @
045e014e
package
cn
.
wisenergy
.
service
.
app
.
impl
;
import
cn.wisenergy.common.utils.*
;
import
cn.wisenergy.mapper.AccountMapper
;
import
cn.wisenergy.mapper.BankInfoMapper
;
import
cn.wisenergy.mapper.TradeRecordMapper
;
import
cn.wisenergy.mapper.UsersMapper
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.BankInfo
;
import
cn.wisenergy.model.app.TradeRecord
;
import
cn.wisenergy.model.app.User
;
import
cn.wisenergy.mapper.*
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.dto.WithdrawBankDto
;
import
cn.wisenergy.model.enums.TradeRecordEnum
;
import
cn.wisenergy.model.enums.TradeStatusEnum
;
import
cn.wisenergy.model.vo.TaxRateVo
;
import
cn.wisenergy.service.app.BankService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.Validate
;
import
org.apache.poi.ss.formula.functions.T
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -50,6 +47,11 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
@Autowired
private
TradeRecordMapper
recordMapper
;
@Autowired
private
VariableMapper
variableMapper
;
private
static
final
String
TAX_RATE_KEY
=
"TAX_RATE_CODE"
;
@Override
public
R
<
BankInfo
>
add
(
BankInfo
bankInfo
)
{
...
...
@@ -190,4 +192,26 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
list
.
add
(
"中信银行"
);
return
R
.
ok
(
list
);
}
@Override
public
R
<
TaxRateVo
>
getTaxRate
(
Double
money
)
{
log
.
info
(
"shop-mall[]BankServiceImpl[]getTaxRate[]input.param.money:"
+
money
);
if
(
null
==
money
)
{
return
R
.
error
(
"入参为空!"
);
}
//获取提现税率信息
Variable
validate
=
variableMapper
.
getByKey
(
TAX_RATE_KEY
);
if
(
null
==
validate
)
{
return
R
.
error
(
"未设置提现税率,请联系后台管理员设置!"
);
}
TaxRateVo
taxRateVo
=
new
TaxRateVo
();
Double
value
=
Double
.
valueOf
(
validate
.
getVariableValue
());
Double
taxMoney
=
Math
.
floor
(
money
*
value
/
100
);
Double
actualMoney
=
money
-
taxMoney
;
taxRateVo
.
setActualMoney
(
actualMoney
);
taxRateVo
.
setTaxMoney
(
taxMoney
);
return
R
.
ok
(
taxRateVo
);
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/BankController.java
View file @
045e014e
...
...
@@ -3,6 +3,7 @@ package cn.wisenergy.web.admin.controller.app;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.app.BankInfo
;
import
cn.wisenergy.model.dto.WithdrawBankDto
;
import
cn.wisenergy.model.vo.TaxRateVo
;
import
cn.wisenergy.service.app.BankService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -89,4 +90,12 @@ public class BankController {
log
.
info
(
"shop-mall[]BankController[]getBankNameList[]input.method"
);
return
bankService
.
getBankNameList
();
}
@ApiOperation
(
value
=
"获取提现税率信息"
,
notes
=
"获取提现税率信息"
,
httpMethod
=
"GET"
)
@ApiImplicitParam
(
name
=
"money"
,
value
=
"提现金额"
,
dataType
=
"double"
)
@GetMapping
(
"/getTaxRate"
)
public
R
<
TaxRateVo
>
getTaxRate
(
Double
money
)
{
log
.
info
(
"shop-mall[]BankController[]getTaxRate[]input.method"
);
return
bankService
.
getTaxRate
(
money
);
}
}
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