|
|
@@ -1,19 +1,20 @@
|
|
|
package com.poteviohealth.ym.ipos.controller.app;
|
|
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.poteviohealth.cgp.common.controller.BaseWebController;
|
|
|
import com.poteviohealth.cgp.common.facade.log.OperateType;
|
|
|
import com.poteviohealth.cgp.common.facade.log.OperationLog;
|
|
|
import com.poteviohealth.cgp.common.filter.TokenContext;
|
|
|
import com.poteviohealth.cgp.common.integrated.StringParams;
|
|
|
import com.poteviohealth.cgp.common.integrated.customer.CustomerFeignClient;
|
|
|
-import com.poteviohealth.cgp.common.integrated.customer.model.GroupLeaderDTO;
|
|
|
-import com.poteviohealth.cgp.common.integrated.customer.model.GroupLeaderParams;
|
|
|
import com.poteviohealth.cgp.common.model.CommonPage;
|
|
|
import com.poteviohealth.cgp.common.model.VaultsResponse;
|
|
|
+import com.poteviohealth.cgp.common.utils.CgpTool;
|
|
|
import com.poteviohealth.ym.ipos.model.split.SplitWithdraw;
|
|
|
import com.poteviohealth.ym.ipos.model.split.back.AccountBalanceBack;
|
|
|
import com.poteviohealth.ym.ipos.model.split.back.SettlementQueryBack;
|
|
|
import com.poteviohealth.ym.ipos.model.split.back.WithdrawBack;
|
|
|
+import com.poteviohealth.ym.ipos.model.split.detail.AccountBalanceList;
|
|
|
import com.poteviohealth.ym.ipos.model.split.detail.SettlementQueryDetail;
|
|
|
import com.poteviohealth.ym.ipos.model.split.dto.SplitWithdrawDto;
|
|
|
import com.poteviohealth.ym.ipos.model.split.dto.WithdrawDto;
|
|
|
@@ -22,12 +23,15 @@ import com.poteviohealth.ym.ipos.service.ISplitWithdrawService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
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;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 结算管理app
|
|
|
@@ -44,7 +48,8 @@ public class SettlementAppController extends BaseWebController {
|
|
|
private ISplitWithdrawService splitWithdrawService;
|
|
|
@Resource
|
|
|
private CustomerFeignClient customerFeignClient;
|
|
|
-
|
|
|
+ @Value("${sync.dbName}")
|
|
|
+ private String dbName;
|
|
|
|
|
|
@PostMapping("/merchantQuery")
|
|
|
@ApiOperation(value = "结算查询")
|
|
|
@@ -62,7 +67,8 @@ public class SettlementAppController extends BaseWebController {
|
|
|
@OperationLog(type = OperateType.SELECT, description ="单账户查询")
|
|
|
public VaultsResponse<AccountBalanceBack> accountBalanceQuery(@RequestBody StringParams params) {
|
|
|
|
|
|
- if(StringUtils.isEmpty(params.getId())){
|
|
|
+ //TODO 暂时去掉三方支付
|
|
|
+ /* if(StringUtils.isEmpty(params.getId())){
|
|
|
String ipos = TokenContext.cureMiniUser().getIposMerchantId();
|
|
|
if(StringUtils.isEmpty(ipos)){
|
|
|
return VaultsResponse.failed("账户未激活,请联系管理员");
|
|
|
@@ -70,7 +76,16 @@ public class SettlementAppController extends BaseWebController {
|
|
|
params.setId(TokenContext.cureMiniUser().getIposMerchantId());
|
|
|
}
|
|
|
|
|
|
- return splitService.accountBalanceQuery(params.getId());
|
|
|
+ return splitService.accountBalanceQuery(params.getId());*/
|
|
|
+
|
|
|
+ Integer money = splitWithdrawService.getGroupLeaderWithdrawSumPrice(TokenContext.cureOperatorId(),dbName, TokenContext.cureMiniUser().getGroupLeaderId());
|
|
|
+ AccountBalanceBack balanceBack = new AccountBalanceBack();
|
|
|
+ List<AccountBalanceList> list = Lists.newArrayList();
|
|
|
+ AccountBalanceList abList = new AccountBalanceList();
|
|
|
+ abList.setBalance_amt(money);
|
|
|
+ list.add(abList);
|
|
|
+ balanceBack.setList(list);
|
|
|
+ return VaultsResponse.success(balanceBack);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -79,7 +94,10 @@ public class SettlementAppController extends BaseWebController {
|
|
|
@OperationLog(type = OperateType.SELECT, description ="可提现金额查询")
|
|
|
public VaultsResponse<Long> accountBalanceUse() {
|
|
|
|
|
|
- if(StringUtils.isEmpty(TokenContext.cureMiniUser().getIposMerchantId())){
|
|
|
+ //TODO 暂时去掉三方支付
|
|
|
+ Long money = splitWithdrawService.getGroupLeaderWithdrawPrice(TokenContext.cureOperatorId(),dbName, TokenContext.cureMiniUser().getGroupLeaderId());
|
|
|
+ return VaultsResponse.success(money<0L?0L:money);
|
|
|
+ /*if(StringUtils.isEmpty(TokenContext.cureMiniUser().getIposMerchantId())){
|
|
|
return VaultsResponse.success(0L);
|
|
|
}
|
|
|
GroupLeaderParams groupLeaderParams = new GroupLeaderParams();
|
|
|
@@ -98,14 +116,15 @@ public class SettlementAppController extends BaseWebController {
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
return VaultsResponse.success(0L);
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
@PostMapping("/withdraw")
|
|
|
@ApiOperation(value = "取现")
|
|
|
@OperationLog(type = OperateType.SELECT, description ="取现")
|
|
|
public VaultsResponse<WithdrawBack> withdraw(@RequestBody WithdrawDto dto) {
|
|
|
- if(StringUtils.isEmpty(dto.getMerchantId())){
|
|
|
+ //TODO 暂时去掉三方支付
|
|
|
+ /* if(StringUtils.isEmpty(dto.getMerchantId())){
|
|
|
String ipos = TokenContext.cureMiniUser().getIposMerchantId();
|
|
|
if(StringUtils.isEmpty(ipos)){
|
|
|
return VaultsResponse.failed("账户未激活,请联系管理员");
|
|
|
@@ -118,12 +137,24 @@ public class SettlementAppController extends BaseWebController {
|
|
|
VaultsResponse<GroupLeaderDTO> vaultsResponse = customerFeignClient.getGroupLeaderById(groupLeaderParams);
|
|
|
GroupLeaderDTO groupLeaderDTO = vaultsResponse.getData();
|
|
|
|
|
|
- /* if(groupLeaderDTO.getRemainedAmt()>=dto.getAmount()){
|
|
|
+ *//* if(groupLeaderDTO.getRemainedAmt()>=dto.getAmount()){
|
|
|
DecimalFormat df = new DecimalFormat("#0.00");
|
|
|
return VaultsResponse.failed("留存保证金为:"+new BigDecimal(df.format(groupLeaderDTO.getRemainedAmt() / 100.0))+"元,可提现金额不足");
|
|
|
- }*/
|
|
|
+ }*//*
|
|
|
dto.setAmount(dto.getAmount());
|
|
|
- return splitService.withdraw(dto);
|
|
|
+ return splitService.withdraw(dto);*/
|
|
|
+
|
|
|
+ SplitWithdraw splitWithdraw = new SplitWithdraw();
|
|
|
+ splitWithdraw.setOperatorId(TokenContext.cureOperatorId());
|
|
|
+ splitWithdraw.setWithdrawId(CgpTool.generateKey());
|
|
|
+ splitWithdraw.setWithdrawSeq(CgpTool.generateKey().toString());
|
|
|
+ splitWithdraw.setMerchantId("TZ"+TokenContext.cureMiniUser().getGroupLeaderId());
|
|
|
+ splitWithdraw.setAmount(dto.getAmount());
|
|
|
+ splitWithdraw.setTransDate(new Date());
|
|
|
+ splitWithdraw.setTransStatus("p");
|
|
|
+ splitWithdraw.setAcctStatus("p");
|
|
|
+ splitWithdrawService.save(splitWithdraw);
|
|
|
+ return VaultsResponse.success();
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -141,13 +172,16 @@ public class SettlementAppController extends BaseWebController {
|
|
|
@PostMapping("/list")
|
|
|
@ApiOperation(value = "取现记录",notes = "list")
|
|
|
public VaultsResponse<CommonPage<SplitWithdraw>> list(@RequestBody SplitWithdrawDto dto){
|
|
|
- if(StringUtils.isEmpty(dto.getIposMerchantId())){
|
|
|
+ //TODO 暂时去掉三方支付
|
|
|
+ /*if(StringUtils.isEmpty(dto.getIposMerchantId())){
|
|
|
String ipos = TokenContext.cureMiniUser().getIposMerchantId();
|
|
|
if(StringUtils.isEmpty(ipos)){
|
|
|
return VaultsResponse.failed("账户未激活,请联系管理员");
|
|
|
}
|
|
|
dto.setIposMerchantId(TokenContext.cureMiniUser().getIposMerchantId());
|
|
|
- }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ dto.setIposMerchantId("TZ"+TokenContext.cureMiniUser().getGroupLeaderId());
|
|
|
return VaultsResponse.success(splitWithdrawService.pageList(dto));
|
|
|
}
|
|
|
}
|