Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
5292fa19
Commit
5292fa19
authored
Nov 07, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
保证金缴纳2
parent
a48a9b6b
Changes
20
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
318 additions
and
3043 deletions
+318
-3043
ch-core/src/main/java/com/wwdz/ch/core/api/lianpay/security/LianLianPaySecurity.java
...wdz/ch/core/api/lianpay/security/LianLianPaySecurity.java
+33
-0
ch-core/src/main/java/com/wwdz/ch/core/consts/EarnestEnum.java
...re/src/main/java/com/wwdz/ch/core/consts/EarnestEnum.java
+4
-4
ch-core/src/main/java/com/wwdz/ch/core/entity/openShop/EarnestRecordVo.java
...ava/com/wwdz/ch/core/entity/openShop/EarnestRecordVo.java
+72
-0
ch-dao/src/main/java/com/wwdz/ch/db/dao/dts/DtsAccountDao.java
...o/src/main/java/com/wwdz/ch/db/dao/dts/DtsAccountDao.java
+0
-71
ch-dao/src/main/java/com/wwdz/ch/db/dao/openShop/EarnestRecordDao.java
...in/java/com/wwdz/ch/db/dao/openShop/EarnestRecordDao.java
+7
-0
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserAccountObsolete.java
.../main/java/com/wwdz/ch/db/domain/UserAccountObsolete.java
+0
-564
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserAccountObsoleteExample.java
...ava/com/wwdz/ch/db/domain/UserAccountObsoleteExample.java
+0
-1604
ch-dao/src/main/java/com/wwdz/ch/db/impl/dts/DtsAccountDaoImpl.java
.../main/java/com/wwdz/ch/db/impl/dts/DtsAccountDaoImpl.java
+0
-229
ch-dao/src/main/java/com/wwdz/ch/db/impl/dts/DtsUserDaoImpl.java
...src/main/java/com/wwdz/ch/db/impl/dts/DtsUserDaoImpl.java
+2
-5
ch-dao/src/main/java/com/wwdz/ch/db/impl/openShop/EarnestRecordDaoImpl.java
...va/com/wwdz/ch/db/impl/openShop/EarnestRecordDaoImpl.java
+11
-0
ch-dao/src/main/java/com/wwdz/ch/db/impl/openShop/UserAccountDaoImpl.java
...java/com/wwdz/ch/db/impl/openShop/UserAccountDaoImpl.java
+0
-2
ch-dao/src/main/java/com/wwdz/ch/db/mapper/UserAccountObsoleteMapper.java
...java/com/wwdz/ch/db/mapper/UserAccountObsoleteMapper.java
+0
-134
ch-dao/src/main/java/com/wwdz/ch/db/mapper/openShop/EarnestRecordMapper.java
...a/com/wwdz/ch/db/mapper/openShop/EarnestRecordMapper.java
+11
-0
ch-dao/src/main/java/com/wwdz/ch/db/mapper/openShop/UserAccountMapper.java
...ava/com/wwdz/ch/db/mapper/openShop/UserAccountMapper.java
+0
-1
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/UserAccountObsoleteMapper.xml
...urces/com/wwdz/ch/db/mapper/UserAccountObsoleteMapper.xml
+0
-428
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/openShop/EarnestRecordMapper.xml
...es/com/wwdz/ch/db/mapper/openShop/EarnestRecordMapper.xml
+7
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
...m/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/openShop/EarnestRecordServiceImpl.java
...om/wwdz/ch/wx/impl/openShop/EarnestRecordServiceImpl.java
+102
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/openShop/EarnestRecordService.java
...com/wwdz/ch/wx/service/openShop/EarnestRecordService.java
+12
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/openShop/EarnestRecordController.java
.../com/wwdz/ch/wx/web/openShop/EarnestRecordController.java
+56
-0
No files found.
ch-core/src/main/java/com/wwdz/ch/core/api/lianpay/security/LianLianPaySecurity.java
0 → 100644
View file @
5292fa19
package
com.wwdz.ch.core.api.lianpay.security
;
import
java.security.KeyFactory
;
import
java.security.PrivateKey
;
import
java.security.spec.PKCS8EncodedKeySpec
;
public
class
LianLianPaySecurity
{
/**
* 签名处理
* @param signStr:签名源内容
* @param prikeyValue:私钥
* @return
*/
public
static
String
encrypt
(
String
signStr
,
String
prikeyValue
)
{
try
{
PKCS8EncodedKeySpec
priPKCS8
=
new
PKCS8EncodedKeySpec
(
Base64Utils
.
getBytesBASE64
(
prikeyValue
));
KeyFactory
keyf
=
KeyFactory
.
getInstance
(
"RSA"
);
PrivateKey
myprikey
=
keyf
.
generatePrivate
(
priPKCS8
);
// 用私钥对信息生成数字签名
java
.
security
.
Signature
signet
=
java
.
security
.
Signature
.
getInstance
(
"MD5withRSA"
);
signet
.
initSign
(
myprikey
);
signet
.
update
(
signStr
.
getBytes
(
"UTF-8"
));
byte
[]
signed
=
signet
.
sign
();
// 对信息的数字签名
return
new
String
(
org
.
apache
.
commons
.
codec
.
binary
.
Base64
.
encodeBase64
(
signed
));
}
catch
(
java
.
lang
.
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
}
ch-core/src/main/java/com/wwdz/ch/core/consts/EarnestEnum.java
View file @
5292fa19
...
...
@@ -83,7 +83,7 @@ public class EarnestEnum {
public
enum
StateEnum
{
VALID
(
1
,
"初始有效状态"
),
RELEASE
(
5
,
"已释放"
),
DEDUCT
(-
1
,
"已扣除"
),
DEDUCT
(-
1
,
"
中拍超时未支付,
已扣除"
),
;
private
int
code
;
...
...
@@ -95,9 +95,9 @@ public class EarnestEnum {
}
public
static
String
getNameByCode
(
int
code
)
{
for
(
EarnestEnum
.
TypeEnum
typeEnum
:
EarnestEnum
.
Typ
eEnum
.
values
())
{
if
(
code
==
typ
eEnum
.
getCode
())
{
return
typ
eEnum
.
getDes
();
for
(
EarnestEnum
.
StateEnum
stateEnum
:
EarnestEnum
.
Stat
eEnum
.
values
())
{
if
(
code
==
stat
eEnum
.
getCode
())
{
return
stat
eEnum
.
getDes
();
}
}
return
null
;
...
...
ch-core/src/main/java/com/wwdz/ch/core/entity/openShop/EarnestRecordVo.java
0 → 100644
View file @
5292fa19
package
com.wwdz.ch.core.entity.openShop
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.Map
;
@Data
public
class
EarnestRecordVo
implements
Entity
{
/**
* 用户ID
*/
private
Long
userId
;
/**
* 商品id
*/
private
Long
itemId
;
/**
* 商品名称
*/
private
String
itemName
;
/**
* 用于列表展示的图片对象
*/
private
Map
<
String
,
Object
>
homePageImage
;
/**
* 保证金金额
*/
private
String
amount
;
/**
* -1扣除1新增
*/
private
Integer
entryType
;
private
String
entryTypeName
;
/**
* 记录类型
*/
private
Integer
type
;
private
String
typeName
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 状态
*/
private
Integer
state
;
/**
* 状态
*/
private
String
stateName
;
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/dts/DtsAccountDao.java
deleted
100644 → 0
View file @
a48a9b6b
package
com.wwdz.ch.db.dao.dts
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Random
;
import
javax.annotation.Resource
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
com.github.pagehelper.PageHelper
;
import
com.wwdz.ch.db.mapper.AccountTraceObsoleteMapper
;
import
com.wwdz.ch.db.mapper.UserAccountObsoleteMapper
;
import
com.wwdz.ch.db.mapper.UserMapper
;
import
com.wwdz.ch.db.domain.AccountTraceObsolete
;
import
com.wwdz.ch.db.domain.AccountTraceObsoleteExample
;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.UserAccountObsolete
;
import
com.wwdz.ch.db.domain.UserAccountObsoleteExample
;
public
interface
DtsAccountDao
{
UserAccountObsolete
findShareUserAccountByUserId
(
Integer
shareUserId
);
void
settleApplyTrace
(
Integer
sharedUserId
,
String
startTime
,
String
endTime
,
Integer
type
,
BigDecimal
toSettleMoney
,
String
mobile
);
List
<
AccountTraceObsolete
>
queryAccountTraceList
(
Integer
userId
,
Integer
page
,
Integer
size
);
/**
* 新增申请提现记录
*
* @param userId
* @param applyAmt
*/
void
addExtractRecord
(
Integer
userId
,
BigDecimal
applyAmt
,
String
mobile
,
String
smsCode
,
BigDecimal
hasAmount
);
void
add
(
UserAccountObsolete
userAccount
);
/**
* 根据账号和状态,查询提现记录
* @param userId
* @param types
* @return
*/
List
<
AccountTraceObsolete
>
getAccountTraceList
(
Integer
userId
,
Byte
...
types
);
List
<
AccountTraceObsolete
>
querySelectiveTrace
(
List
<
User
>
userList
,
List
<
Byte
>
status
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
);
/**
* 为资金账户的安全,建议做线下销账处理,处理后执行该逻辑
* 这里只根据记录做状态调整和审批意见记录
* @param traceId
* @param status
* @param traceMsg
* @return
*/
boolean
approveAccountTrace
(
Integer
traceId
,
Byte
status
,
String
traceMsg
);
}
ch-dao/src/main/java/com/wwdz/ch/db/dao/openShop/EarnestRecordDao.java
View file @
5292fa19
...
...
@@ -29,4 +29,11 @@ public interface EarnestRecordDao {
* @return
*/
List
<
EarnestRecord
>
findList
(
EarnestRecordRequestDto
dto
);
/**
* 查询用户当前被占用的保证金
* @param userId
* @return
*/
long
sumForOccupy
(
EarnestRecordRequestDto
dto
);
}
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserAccountObsolete.java
deleted
100644 → 0
View file @
a48a9b6b
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/domain/UserAccountObsoleteExample.java
deleted
100644 → 0
View file @
a48a9b6b
This diff is collapsed.
Click to expand it.
ch-dao/src/main/java/com/wwdz/ch/db/impl/dts/DtsAccountDaoImpl.java
deleted
100644 → 0
View file @
a48a9b6b
package
com.wwdz.ch.db.impl.dts
;
import
com.github.pagehelper.PageHelper
;
import
com.wwdz.ch.db.dao.dts.DtsAccountDao
;
import
com.wwdz.ch.db.domain.*
;
import
com.wwdz.ch.db.mapper.AccountTraceObsoleteMapper
;
import
com.wwdz.ch.db.mapper.UserAccountObsoleteMapper
;
import
com.wwdz.ch.db.mapper.UserMapper
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Random
;
@Repository
public
class
DtsAccountDaoImpl
implements
DtsAccountDao
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DtsAccountDaoImpl
.
class
);
public
static
final
long
TWO_MONTH_DAYS
=
60
;
//近两个月,60天
public
static
final
long
ONE_WEEK_DAYS
=
7
;
//近一周
@Resource
private
UserAccountObsoleteMapper
userAccountMapper
;
@Resource
private
AccountTraceObsoleteMapper
accountTraceMapper
;
@Resource
private
UserMapper
userMapper
;
@Override
public
UserAccountObsolete
findShareUserAccountByUserId
(
Integer
shareUserId
)
{
UserAccountObsoleteExample
example
=
new
UserAccountObsoleteExample
();
example
.
or
().
andUserIdEqualTo
(
shareUserId
);
List
<
UserAccountObsolete
>
accounts
=
userAccountMapper
.
selectByExample
(
example
);
// Assert.state(accounts.size() < 2, "同一个用户存在两个账户");
if
(
accounts
.
size
()
==
1
)
{
return
accounts
.
get
(
0
);
}
else
{
logger
.
error
(
"根据代理用户id:{},获取账号信息出错!!!"
,
shareUserId
);
return
null
;
}
}
private
String
getRandomNum
(
Integer
num
)
{
String
base
=
"0123456789"
;
Random
random
=
new
Random
();
StringBuffer
sb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
num
;
i
++)
{
int
number
=
random
.
nextInt
(
base
.
length
());
sb
.
append
(
base
.
charAt
(
number
));
}
return
sb
.
toString
();
}
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
{
Exception
.
class
})
public
void
settleApplyTrace
(
Integer
sharedUserId
,
String
startTime
,
String
endTime
,
Integer
type
,
BigDecimal
toSettleMoney
,
String
mobile
)
{
Integer
settlementRate
=
5
;
// 获取用户账户信息并更新记录
UserAccountObsolete
account
=
this
.
findShareUserAccountByUserId
(
sharedUserId
);
if
(
account
!=
null
&&
toSettleMoney
.
compareTo
(
new
BigDecimal
(
"0"
))
==
0
)
{
// 如果该用户未产生推荐单,则降低结算比例
settlementRate
=
account
.
getSettlementRate
()
>
8
?
8
:
account
.
getSettlementRate
();
}
//更新代理用户账号信息
account
.
setRemainAmount
(
account
.
getRemainAmount
().
add
(
toSettleMoney
));
//剩余结算,尚未结算给用户
account
.
setTotalAmount
(
account
.
getTotalAmount
().
add
(
toSettleMoney
));
account
.
setModifyTime
(
LocalDateTime
.
now
());
account
.
setSettlementRate
(
settlementRate
);
userAccountMapper
.
updateByPrimaryKeySelective
(
account
);
// 新增账户跟踪表,添加结算跟踪记录
AccountTraceObsolete
trace
=
new
AccountTraceObsolete
();
trace
.
setAmount
(
account
.
getRemainAmount
());
//当前申请金额,直接将未结算的进行申请
trace
.
setTotalAmount
(
account
.
getTotalAmount
());
//已提现总金额
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMdd"
);
String
now
=
df
.
format
(
LocalDate
.
now
());
String
traceSn
=
now
+
getRandomNum
(
6
);
trace
.
setTraceSn
(
traceSn
);
trace
.
setAddTime
(
LocalDateTime
.
now
());
trace
.
setType
(
type
);
trace
.
setUserId
(
sharedUserId
);
trace
.
setStatus
((
byte
)
0
);
//申请状态
trace
.
setMobile
(
mobile
);
accountTraceMapper
.
insert
(
trace
);
}
@Override
public
List
<
AccountTraceObsolete
>
queryAccountTraceList
(
Integer
userId
,
Integer
page
,
Integer
size
)
{
AccountTraceObsoleteExample
example
=
new
AccountTraceObsoleteExample
();
example
.
setOrderByClause
(
AccountTraceObsolete
.
Column
.
addTime
.
desc
());
AccountTraceObsoleteExample
.
Criteria
criteria
=
example
.
or
();
criteria
.
andUserIdEqualTo
(
userId
);
PageHelper
.
startPage
(
page
,
size
);
return
accountTraceMapper
.
selectByExample
(
example
);
}
/**
* 新增申请提现记录
*
* @param userId
* @param applyAmt
*/
@Override
public
void
addExtractRecord
(
Integer
userId
,
BigDecimal
applyAmt
,
String
mobile
,
String
smsCode
,
BigDecimal
hasAmount
)
{
AccountTraceObsolete
record
=
new
AccountTraceObsolete
();
record
.
setAmount
(
applyAmt
);
record
.
setMobile
(
mobile
);
record
.
setTotalAmount
(
applyAmt
.
add
(
hasAmount
));
record
.
setSmsCode
(
smsCode
);
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMdd"
);
String
now
=
df
.
format
(
LocalDate
.
now
());
String
traceSn
=
now
+
getRandomNum
(
6
);
record
.
setTraceSn
(
traceSn
);
record
.
setAddTime
(
LocalDateTime
.
now
());
record
.
setType
(
1
);
// 申请中..
record
.
setUserId
(
userId
);
accountTraceMapper
.
insert
(
record
);
}
@Override
public
void
add
(
UserAccountObsolete
userAccount
)
{
userAccount
.
setCreateTime
(
LocalDateTime
.
now
());
userAccount
.
setModifyTime
(
LocalDateTime
.
now
());
userAccountMapper
.
insert
(
userAccount
);
}
/**
* 根据账号和状态,查询提现记录
* @param userId
* @param types
* @return
*/
@Override
public
List
<
AccountTraceObsolete
>
getAccountTraceList
(
Integer
userId
,
Byte
...
types
)
{
if
(
userId
==
null
||
types
==
null
||
types
.
length
<
1
)
{
return
null
;
}
AccountTraceObsoleteExample
example
=
new
AccountTraceObsoleteExample
();
List
<
Byte
>
statusList
=
new
ArrayList
<
Byte
>();
for
(
Byte
type
:
types
)
{
statusList
.
add
(
type
);
}
example
.
or
().
andUserIdEqualTo
(
userId
).
andStatusIn
(
statusList
);
return
accountTraceMapper
.
selectByExample
(
example
);
}
@Override
public
List
<
AccountTraceObsolete
>
querySelectiveTrace
(
List
<
User
>
userList
,
List
<
Byte
>
status
,
Integer
page
,
Integer
size
,
String
sort
,
String
order
)
{
//是否有匹配到的用户,转用户id集合
List
<
Integer
>
userIdArray
=
null
;
if
(
userList
!=
null
&&
userList
.
size
()
>
0
)
{
userIdArray
=
new
ArrayList
<
Integer
>();
for
(
User
dtsUser
:
userList
)
{
userIdArray
.
add
(
dtsUser
.
getId
().
intValue
())
;
}
}
AccountTraceObsoleteExample
example
=
new
AccountTraceObsoleteExample
();
AccountTraceObsoleteExample
.
Criteria
criteria
=
example
.
or
();
if
(
userIdArray
!=
null
&&
userIdArray
.
size
()
!=
0
)
{
criteria
.
andUserIdIn
(
userIdArray
);
}
if
(
status
!=
null
&&
status
.
size
()
!=
0
)
{
criteria
.
andStatusIn
(
status
);
}
if
(!
StringUtils
.
isEmpty
(
sort
)
&&
!
StringUtils
.
isEmpty
(
order
))
{
example
.
setOrderByClause
(
sort
+
" "
+
order
);
}
PageHelper
.
startPage
(
page
,
size
);
return
accountTraceMapper
.
selectByExample
(
example
);
}
/**
* 为资金账户的安全,建议做线下销账处理,处理后执行该逻辑
* 这里只根据记录做状态调整和审批意见记录
* @param traceId
* @param status
* @param traceMsg
* @return
*/
@Override
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
rollbackFor
=
{
Exception
.
class
})
public
boolean
approveAccountTrace
(
Integer
traceId
,
Byte
status
,
String
traceMsg
)
{
AccountTraceObsolete
trace
=
accountTraceMapper
.
selectByPrimaryKey
(
traceId
);
trace
.
setStatus
(
status
);
trace
.
setTraceMsg
(
traceMsg
);
if
(
status
.
intValue
()
==
1
)
{
//如果是审批通过,需要消除账户中的可提现余额
UserAccountObsolete
userAccount
=
findShareUserAccountByUserId
(
trace
.
getUserId
());
if
(
userAccount
!=
null
)
{
userAccount
.
setRemainAmount
(
userAccount
.
getRemainAmount
().
subtract
(
trace
.
getAmount
()));
logger
.
info
(
"提现审批通过,调整账户可提现余额为{} - {} = {}"
,
userAccount
.
getRemainAmount
(),
trace
.
getAmount
(),
userAccount
.
getRemainAmount
().
subtract
(
trace
.
getAmount
()));
if
(
userAccountMapper
.
updateByPrimaryKeySelective
(
userAccount
)
==
0
)
{
return
false
;
}
}
else
{
logger
.
error
(
"审批提现,获取账号出错!请检查对应用户 userId:{} 的账户"
,
trace
.
getUserId
());
return
false
;
}
}
if
(
accountTraceMapper
.
updateByPrimaryKeySelective
(
trace
)
==
0
)
{
return
false
;
}
return
true
;
}
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/dts/DtsUserDaoImpl.java
View file @
5292fa19
...
...
@@ -7,19 +7,16 @@ import com.wwdz.ch.db.dao.dts.DtsUserDao;
import
com.wwdz.ch.db.domain.User
;
import
com.wwdz.ch.db.domain.UserExample
;
import
com.wwdz.ch.db.domain.UserVo
;
import
com.wwdz.ch.db.mapper.UserAccountObsoleteMapper
;
import
com.wwdz.ch.db.mapper.UserMapper
;
import
com.wwdz.ch.db.mapper.ex.StatMapper
;
import
com.wwdz.mall.common.vo.response.CloudServerResponse
;
import
com.wwdz.user.api.service.user.UserReadService
;
import
com.wwdz.user.api.service.user.UserWriteService
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@Repository
...
...
@@ -28,8 +25,8 @@ public class DtsUserDaoImpl implements DtsUserDao {
@Resource
private
UserMapper
userMapper
;
@Resource
private
UserAccountObsoleteMapper
userAccount
Mapper
;
/*
@Resource
private UserAccountObsoleteMapper userAccount
ObsoleteMapper;*/
@Resource
private
StatMapper
statMapper
;
...
...
ch-dao/src/main/java/com/wwdz/ch/db/impl/openShop/EarnestRecordDaoImpl.java
View file @
5292fa19
...
...
@@ -43,4 +43,15 @@ public class EarnestRecordDaoImpl implements EarnestRecordDao {
example
.
setOrderByClause
(
"create_time desc"
);
return
earnestRecordMapper
.
selectByExample
(
example
);
}
@Override
public
long
sumForOccupy
(
EarnestRecordRequestDto
dto
)
{
EarnestRecordExample
example
=
new
EarnestRecordExample
();
EarnestRecordExample
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andUserIdEqualTo
(
dto
.
getUserId
());
JdbcHelper
.
ifPresent
(
dto
.
getType
(),
criteria
::
andTypeEqualTo
);
JdbcHelper
.
ifPresent
(
dto
.
getTypeList
(),
criteria
::
andTypeIn
);
JdbcHelper
.
ifPresent
(
dto
.
getState
(),
criteria
::
andStateEqualTo
);
return
earnestRecordMapper
.
sumForOccupy
(
example
);
}
}
ch-dao/src/main/java/com/wwdz/ch/db/impl/openShop/UserAccountDaoImpl.java
View file @
5292fa19
...
...
@@ -3,11 +3,9 @@ package com.wwdz.ch.db.impl.openShop;
import
com.wwdz.ch.db.dao.openShop.UserAccountDao
;
import
com.wwdz.ch.db.domain.openShop.UserAccount
;
import
com.wwdz.ch.db.domain.openShop.UserAccountExample
;
import
com.wwdz.ch.db.mapper.UserMapper
;
import
com.wwdz.ch.db.mapper.openShop.UserAccountMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.Date
;
@Repository
...
...
ch-dao/src/main/java/com/wwdz/ch/db/mapper/UserAccountObsoleteMapper.java
deleted
100644 → 0
View file @
a48a9b6b
package
com.wwdz.ch.db.mapper
;
import
com.wwdz.ch.db.domain.UserAccountObsolete
;
import
com.wwdz.ch.db.domain.UserAccountObsoleteExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
UserAccountObsoleteMapper
{
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
long
countByExample
(
UserAccountObsoleteExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int
deleteByExample
(
UserAccountObsoleteExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int
deleteByPrimaryKey
(
Integer
id
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int
insert
(
UserAccountObsolete
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int
insertSelective
(
UserAccountObsolete
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserAccountObsolete
selectOneByExample
(
UserAccountObsoleteExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserAccountObsolete
selectOneByExampleSelective
(
@Param
(
"example"
)
UserAccountObsoleteExample
example
,
@Param
(
"selective"
)
UserAccountObsolete
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List
<
UserAccountObsolete
>
selectByExampleSelective
(
@Param
(
"example"
)
UserAccountObsoleteExample
example
,
@Param
(
"selective"
)
UserAccountObsolete
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
List
<
UserAccountObsolete
>
selectByExample
(
UserAccountObsoleteExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
UserAccountObsolete
selectByPrimaryKeySelective
(
@Param
(
"id"
)
Integer
id
,
@Param
(
"selective"
)
UserAccountObsolete
.
Column
...
selective
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
UserAccountObsolete
selectByPrimaryKey
(
Integer
id
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int
updateByExampleSelective
(
@Param
(
"record"
)
UserAccountObsolete
record
,
@Param
(
"example"
)
UserAccountObsoleteExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int
updateByExample
(
@Param
(
"record"
)
UserAccountObsolete
record
,
@Param
(
"example"
)
UserAccountObsoleteExample
example
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int
updateByPrimaryKeySelective
(
UserAccountObsolete
record
);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dts_user_account
*
* @mbg.generated
*/
int
updateByPrimaryKey
(
UserAccountObsolete
record
);
}
\ No newline at end of file
ch-dao/src/main/java/com/wwdz/ch/db/mapper/openShop/EarnestRecordMapper.java
View file @
5292fa19
package
com.wwdz.ch.db.mapper.openShop
;
import
com.wwdz.ch.db.bean.OrderDataStat
;
import
com.wwdz.ch.db.domain.distribution.DistributorProfitExample
;
import
com.wwdz.ch.db.domain.openShop.EarnestRecord
;
import
com.wwdz.ch.db.domain.openShop.EarnestRecordExample
;
import
java.util.List
;
...
...
@@ -66,4 +68,13 @@ public interface EarnestRecordMapper {
int
updateByPrimaryKeySelective
(
EarnestRecord
record
);
int
updateByPrimaryKey
(
EarnestRecord
record
);
/**
* 统计用户被占用的保证金
* @param example
* @return
*/
long
sumForOccupy
(
EarnestRecordExample
example
);
}
\ No newline at end of file
ch-dao/src/main/java/com/wwdz/ch/db/mapper/openShop/UserAccountMapper.java
View file @
5292fa19
...
...
@@ -3,7 +3,6 @@ package com.wwdz.ch.db.mapper.openShop;
import
com.wwdz.ch.db.domain.openShop.UserAccount
;
import
com.wwdz.ch.db.domain.openShop.UserAccountExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/UserAccountObsoleteMapper.xml
deleted
100644 → 0
View file @
a48a9b6b
This diff is collapsed.
Click to expand it.
ch-dao/src/main/resources/com/wwdz/ch/db/mapper/openShop/EarnestRecordMapper.xml
View file @
5292fa19
...
...
@@ -386,4 +386,11 @@
</if>
limit 1
</select>
<select
id=
"sumForOccupy"
parameterType=
"com.wwdz.ch.db.domain.openShop.EarnestRecordExample"
resultType=
"java.lang.Long"
>
select IFNULL(sum(amount), 0) as amount from earnest_order
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
</mapper>
\ No newline at end of file
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/openShop/AuctionEarnestServiceImpl.java
View file @
5292fa19
...
...
@@ -118,7 +118,7 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
//换算成对应占用的保证金
long
occupyAmount
=
earnestAmount
.
longValue
();
earnestRecord
.
setUserId
(
dto
.
getUserId
());
earnestRecord
.
setAmount
(
earnestAmount
.
longValue
());
earnestRecord
.
setAmount
(
-
earnestAmount
.
longValue
());
earnestRecord
.
setItemId
(
dto
.
getItemId
());
earnestRecord
.
setSpecialPerformanceId
(
dto
.
getSpecialPerformanceId
());
earnestRecord
.
setEntryType
(
EarnestEnum
.
EntryEnum
.
DEDUCT
.
getCode
());
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/openShop/EarnestRecordServiceImpl.java
0 → 100644
View file @
5292fa19
package
com.wwdz.ch.wx.impl.openShop
;
import
com.github.pagehelper.PageInfo
;
import
com.wwdz.ch.core.consts.EarnestEnum
;
import
com.wwdz.ch.core.entity.openShop.EarnestRecordVo
;
import
com.wwdz.ch.core.type.PageSearchResult
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.MediaUtil
;
import
com.wwdz.ch.core.util.PriceUtil
;
import
com.wwdz.ch.db.dao.distribution.SupplierItemDao
;
import
com.wwdz.ch.db.dao.openShop.EarnestRecordDao
;
import
com.wwdz.ch.db.dao.openShop.UserAccountDao
;
import
com.wwdz.ch.db.domain.distribution.SupplierItem
;
import
com.wwdz.ch.db.domain.openShop.EarnestRecord
;
import
com.wwdz.ch.db.domain.openShop.UserAccount
;
import
com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto
;
import
com.wwdz.ch.wx.service.openShop.EarnestRecordService
;
import
com.xxdxxs.utils.EntityMapper
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
java.util.*
;
@Service
public
class
EarnestRecordServiceImpl
implements
EarnestRecordService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EarnestRecordServiceImpl
.
class
);
@Autowired
EarnestRecordDao
earnestRecordDao
;
@Autowired
SupplierItemDao
supplierItemDao
;
@Autowired
UserAccountDao
userAccountDao
;
@Override
public
Result
findList
(
EarnestRecordRequestDto
dto
)
{
try
{
List
<
EarnestRecordVo
>
earnestRecordVos
=
new
ArrayList
<>();
dto
.
setTypeList
(
Arrays
.
asList
(
EarnestEnum
.
TypeEnum
.
PAY
.
getCode
(),
EarnestEnum
.
TypeEnum
.
DEDUCT
.
getCode
(),
EarnestEnum
.
TypeEnum
.
WITHDRAW
.
getCode
()));
List
<
EarnestRecord
>
earnestRecordList
=
earnestRecordDao
.
findList
(
dto
);
PageInfo
pageInfo
=
new
PageInfo
<>(
earnestRecordList
);
for
(
EarnestRecord
earnestRecord
:
earnestRecordList
)
{
EarnestRecordVo
earnestRecordVo
=
new
EarnestRecordVo
();
EntityMapper
.
copyAttribute
(
earnestRecord
,
earnestRecordVo
);
earnestRecordVo
.
setTypeName
(
EarnestEnum
.
TypeEnum
.
getNameByCode
(
earnestRecord
.
getType
()));
earnestRecordVo
.
setAmount
(
PriceUtil
.
convertPriceFenToYuan
(
earnestRecord
.
getAmount
()));
earnestRecordVos
.
add
(
earnestRecordVo
);
}
return
Result
.
success
(
PageSearchResult
.
of
(
pageInfo
,
earnestRecordVos
));
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询保证金明细失败 error : {}"
,
e
);
}
return
Result
.
failed
();
}
@Override
public
Result
findUseDetails
(
EarnestRecordRequestDto
dto
)
{
try
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
List
<
EarnestRecordVo
>
earnestRecordVos
=
new
ArrayList
<>();
dto
.
setTypeList
(
Arrays
.
asList
(
EarnestEnum
.
TypeEnum
.
OCCUPY
.
getCode
()));
List
<
EarnestRecord
>
earnestRecordList
=
earnestRecordDao
.
findList
(
dto
);
PageInfo
pageInfo
=
new
PageInfo
<>(
earnestRecordList
);
for
(
EarnestRecord
earnestRecord
:
earnestRecordList
)
{
EarnestRecordVo
earnestRecordVo
=
new
EarnestRecordVo
();
EntityMapper
.
copyAttribute
(
earnestRecord
,
earnestRecordVo
);
earnestRecordVo
.
setTypeName
(
EarnestEnum
.
TypeEnum
.
getNameByCode
(
earnestRecord
.
getType
()));
earnestRecordVo
.
setAmount
(
PriceUtil
.
convertPriceFenToYuan
(
earnestRecord
.
getAmount
()));
if
(
earnestRecord
.
getState
()
!=
EarnestEnum
.
StateEnum
.
VALID
.
getCode
())
{
earnestRecordVo
.
setStateName
(
EarnestEnum
.
StateEnum
.
getNameByCode
(
earnestRecord
.
getState
()));
}
SupplierItem
supplierItem
=
supplierItemDao
.
findById
(
earnestRecord
.
getItemId
());
earnestRecordVo
.
setItemName
(
supplierItem
.
getName
());
earnestRecordVo
.
setHomePageImage
(
MediaUtil
.
getHomePageImage
(
supplierItem
.
getImages
(),
supplierItem
.
getVideos
()));
earnestRecordVos
.
add
(
earnestRecordVo
);
}
map
.
put
(
"details"
,
PageSearchResult
.
of
(
pageInfo
,
earnestRecordVos
));
//查询用户被占用的保证金
EarnestRecordRequestDto
earnestRecordRequestDto
=
new
EarnestRecordRequestDto
();
earnestRecordRequestDto
.
setUserId
(
dto
.
getUserId
());
earnestRecordRequestDto
.
setType
(
EarnestEnum
.
TypeEnum
.
OCCUPY
.
getCode
());
earnestRecordRequestDto
.
setState
(
EarnestEnum
.
StateEnum
.
VALID
.
getCode
());
long
occupyAmount
=
earnestRecordDao
.
sumForOccupy
(
earnestRecordRequestDto
);
map
.
put
(
"usedAmount"
,
PriceUtil
.
convertPriceFenToYuan
(
occupyAmount
));
//查询用户的保证金账户
UserAccount
userAccount
=
userAccountDao
.
findByUserId
(
dto
.
getUserId
());
return
Result
.
success
(
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询保证金使用明细失败 error : {}"
,
e
);
}
return
Result
.
failed
();
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/openShop/EarnestRecordService.java
View file @
5292fa19
...
...
@@ -5,5 +5,17 @@ import com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto;
public
interface
EarnestRecordService
{
/**
* 查询保证金明细
* @param dto
* @return
*/
Result
findList
(
EarnestRecordRequestDto
dto
);
/**
* 查询保证金使用明细
* @param dto
* @return
*/
Result
findUseDetails
(
EarnestRecordRequestDto
dto
);
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/openShop/EarnestRecordController.java
0 → 100644
View file @
5292fa19
package
com.wwdz.ch.wx.web.openShop
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.core.consts.ResultCode
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.db.dto.request.openShop.EarnestRecordRequestDto
;
import
com.wwdz.ch.wx.service.openShop.EarnestRecordService
;
import
com.xxdxxs.service.FormHandler
;
import
com.xxdxxs.validation.Validator
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/wx/earnestRecord"
)
public
class
EarnestRecordController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
OpenShopController
.
class
);
@Autowired
EarnestRecordService
earnestRecordService
;
@ApiOperation
(
value
=
"查询保证金明细"
)
@PostMapping
(
"/findList"
)
public
Result
findList
(
@RequestBody
EarnestRecordRequestDto
dto
)
{
logger
.
info
(
"【请求开始】查询保证金明细,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"userId"
,
"用户id"
).
must
().
number
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
ResultCode
.
PARAM_ERROR
);
}
return
earnestRecordService
.
findList
(
dto
);
}
@ApiOperation
(
value
=
"查询保证金使用明细"
)
@PostMapping
(
"/findUseDetails"
)
public
Result
findUseDetails
(
@RequestBody
EarnestRecordRequestDto
dto
)
{
logger
.
info
(
"【请求开始】查询保证金使用明细,请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
Validator
validator
=
new
Validator
(
FormHandler
.
ofEntity
(
dto
));
validator
.
set
(
"userId"
,
"用户id"
).
must
().
number
()
.
end
();
if
(!
validator
.
isValid
())
{
return
Result
.
failed
(
ResultCode
.
PARAM_ERROR
);
}
return
earnestRecordService
.
findUseDetails
(
dto
);
}
}
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