Commit 94147e9f authored by libin's avatar libin

Merge branch 'master-auto-pay'

parents 6b602776 444afa6f
......@@ -55,4 +55,7 @@ public class WalletCathListDTO {
private String accountNumber;
private String accountName;
@ApiModelProperty(value = "线下提现方式 1:自动 2:手动")
private Integer offlineWay;
}
......@@ -130,4 +130,8 @@ public class MyWalletCath implements Serializable {
@Column(name = "account_name")
private String accountName;
@Column(name = "offline_way")
@ApiModelProperty(value = "线下提现方式 1:自动 2:手动")
private Integer offlineWay;
}
......@@ -51,4 +51,7 @@ public class WalletCathAdminVo {
private String accountNumber;
private String accountName;
@ApiModelProperty(value = "线下提现方式 1:自动 2:手动")
private Integer offlineWay;
}
package com.github.wxiaoqi.security.admin.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
......@@ -12,6 +14,8 @@ import java.math.BigDecimal;
* @data 2019/7/12 9:20
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WalletPageVo {
private Integer id;
......
......@@ -17,10 +17,12 @@ import com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant;
import com.github.wxiaoqi.security.common.constant.UserConstant;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.ClientUtil;
import com.github.wxiaoqi.security.common.util.OrderUtil;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.app.entity.vo.WithDrawRuleVo;
import com.xxfc.platform.app.feign.ConfigFeign;
import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.vo.FundPayVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
......@@ -91,6 +93,9 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
@Autowired
RabbitTemplate rabbitTemplate;
@Autowired
private ThirdFeign thirdFeign;
private Snowflake snowflake;
private DateTimeFormatter dateTimeFormatter;
......@@ -148,7 +153,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
walletpg.setWithdrawaling(withDrawaling);
walletpg.setWithdrawals(walletpg.getWithdrawals() == null ? new BigDecimal(0) : walletpg.getWithdrawals());
walletpg.setUnbooked(walletpg.getUnbooked() == null ? new BigDecimal(0) : walletpg.getUnbooked());
walletpg.setTotalAmount(walletpg.getTodayAmount() == null ? new BigDecimal(0) : walletpg.getTotalAmount());
walletpg.setTotalAmount(walletpg.getTotalAmount() == null ? new BigDecimal(0) : walletpg.getTotalAmount());
walletpg.setTotalConsumption(totalConsumpution);
AppUserDetail appUserDetail = userdetailMap.get(wallet.getUserId());
if (Objects.nonNull(appUserDetail)){
......@@ -379,17 +384,20 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
/**
* 提现审核
*/
public ObjectRestResponse verifyCath(Integer cathId, String reason, Integer status) {
public ObjectRestResponse verifyCath(Integer cathId,String payMentNo,String reason, Integer status) {
boolean isvalid = status == WithDrawStatusEnum.REJECT.getCode() && StringUtils.isBlank(reason) || cathId == null || cathId == 0;
if (isvalid) {
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数不能为空");
}
MyWalletCath cath = myWalletCathBiz.selectById(cathId);
cath.getUserId();
if (cath == null) {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "提现记录不存在");
}
if (cath.getStauts() == WithDrawStatusEnum.SUCCESS.getCode()){
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "提现记录已审核");
}
Integer userId = cath.getUserId();
MyWallet wallet = new MyWallet();
wallet.setUserId(userId);
......@@ -399,20 +407,31 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
BigDecimal realAmount = cath.getRealAmount();
BigDecimal commission = cath.getCommission();
if (status == WithDrawStatusEnum.AGREE.getCode()) {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String host = StringUtils.defaultIfBlank(request.getHeader("userHost"), ClientUtil.getClientIp(request));
FundPayVo fundPayVo = FundPayVo.builder()
.amount(cath.getCathType() == 0 ? String.valueOf(cath.getRealAmount().multiply(new BigDecimal(100)).doubleValue()) : String.format("%.2f", cath.getRealAmount().doubleValue()))
.payeeAccount(cath.getAccountNumber())
.orderNo(cath.getOrderNo())
.payerShowName("欣新房车网络科技(广东)股份有限公司")
.remark("提现转账")
.type(cath.getCathType())
.creatIp(host)
.build();
sendPayMessage(fundPayVo);
log.info("发送提现消息成功:【{}】", fundPayVo);
if(org.springframework.util.StringUtils.hasText(payMentNo)){
withDrawProcess(cath.getOrderNo(),payMentNo,null,true);
}else {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String host = StringUtils.defaultIfBlank(request.getHeader("userHost"), ClientUtil.getClientIp(request));
String cono = OrderUtil.GetOrderNumber("");
FundPayVo fundPayVo = FundPayVo.builder()
.amount(cath.getCathType() == 0 ? String.valueOf(cath.getRealAmount().multiply(new BigDecimal(100)).doubleValue()) : String.format("%.2f", cath.getRealAmount().doubleValue()))
.payeeAccount(cath.getAccountNumber())
.orderNo(cono)
.payerShowName("欣新房车网络科技(广东)股份有限公司")
.remark("提现转账")
.type(cath.getCathType())
.creatIp(host)
.build();
ObjectRestResponse<String> response = thirdFeign.transferAccount(fundPayVo);
if (response.getStatus() == 200){
withDrawProcess(cath.getOrderNo(),response.getData(),"",true);
}else {
withDrawProcess(cath.getOrderNo(),response.getData(),response.getMessage(),false);
}
log.info("发送提现消息成功:【{}】", fundPayVo);
}
} else {
cath.setStauts(status);
cath.setReason(reason);
......@@ -475,7 +494,7 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> implements In
detail.setUserId(myWalletCath.getUserId());
detail.setItype(1);
//设置提现单号
detail.setWithDrawOrderNo(orderNo);
detail.setWithDrawOrderNo(myWalletCath.getOrderNo());
detail.setCono(myWalletCath.getId().intValue());
detail.setBalance(myWalletCath.getBalance());
detail.setAmount(myWalletCath.getAmount());
......
......@@ -49,6 +49,8 @@ public class UserBusinessBiz {
if (CollectionUtils.isEmpty(data)) {
userTeamMemberVo.setPageNum(pageNo);
userTeamMemberVo.setPageSize(pageSize);
userTeamMemberVo.setTotalCount(0);
userTeamMemberVo.setTotalPage(0);
userTeamMemberVo.setTotalIncome(new BigDecimal(0));
userTeamMemberVo.setUserTeamMemberBos(Collections.EMPTY_LIST);
return userTeamMemberVo;
......
......@@ -38,9 +38,10 @@ public class WalletCathAdminController {
public ObjectRestResponse verifyCath(
@RequestParam(value = "cathId",defaultValue = "0") Integer cathId,
@RequestParam(value = "reason",defaultValue = "") String reason,
@RequestParam(value = "status",defaultValue = "1") Integer status){
@RequestParam(value = "status",defaultValue = "1") Integer status,
@RequestParam(value = "payMentNo",required = false) String payMentNo){
try {
return myWalletBiz.verifyCath(cathId,reason,status);
return myWalletBiz.verifyCath(cathId,payMentNo,reason,status);
}catch (Exception e) {
throw new BaseException(e);
}
......
......@@ -96,8 +96,26 @@ FROM
SELECT
ausw.*,
aul.username AS `phone`,
IFNULL(aud.realname,aud.nickname) AS `sourceName`,
IFNULL(audd.realname,audd.nickname) AS `userName`
(
CASE
WHEN aud.realname = "" THEN
aull.username
WHEN aud.realname IS NULL THEN
aull.username
ELSE
aud.realname
END
)AS `sourceName`,
(
CASE
WHEN audd.realname = "" THEN
aul.username
WHEN audd.realname IS NULL THEN
aul.username
ELSE
audd.realname
END
) AS `userName`
FROM
( SELECT * FROM `app_user_selling_water` WHERE 1 = 1
<if test="status !=null">
......@@ -124,10 +142,12 @@ FROM
WHERE `username` = #{phone}
</if>
) AS aul ON aul.id = ausw.user_id
INNER JOIN `app_user_login` AS `aull` ON aull.id=ausw.source_id
INNER JOIN `app_user_detail` AS aud ON aud.userid = ausw.source_id
INNER JOIN ( SELECT * FROM `app_user_detail`
<if test="userName!=null and userName!=' '">
WHERE `realname` LIKE CONCAT('%',#{userName},'%') OR `nickname` LIKE CONCAT('%',#{userName},'%')
</if>) AS audd ON audd.userid = ausw.user_id
ORDER BY ausw.crt_time DESC
</select>
</mapper>
\ No newline at end of file
......@@ -18,14 +18,15 @@
wc.cono,
wc.order_no AS `orderNo`,
wc.account_number AS `accountNumber`,
wc.account_name AS `accountName`
wc.account_name AS `accountName`,
wc.offline_way AS `offlineWay`
FROM
(SELECT * FROM `my_wallet_cath` WHERE 1 = 1
<if test="state != null">
AND `stauts`=#{state}
i
</if>
<if test="orderNo">
<if test="orderNo !=null and orderNo !=''">
AND `order_no` = #{orderNo}
</if>
<if test="startTime !=null and endTime !=null">
......
......@@ -95,7 +95,12 @@ public class WithDrawMqHandler implements InitializingBean {
Long count = valueOperations.increment(orderNo);
if (count <= MAX_RETRY) {
//重新把消息放回队列
basicNack(channel, message.getMessageProperties().getDeliveryTag(), false, true, pay_way);
// basicNack(channel, message.getMessageProperties().getDeliveryTag(), false, true, pay_way);
try {
channel.basicRecover();
}catch (IOException ex){
}
return;
}
redisTemplate.delete(orderNo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment