|
|
@@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.poteviohealth.cgp.common.filter.TokenContext;
|
|
|
import com.poteviohealth.cgp.common.model.VaultsResponse;
|
|
|
+import com.poteviohealth.cgp.common.utils.CgpTool;
|
|
|
import com.poteviohealth.ym.ipos.model.back.BaseBack;
|
|
|
import com.poteviohealth.ym.ipos.model.payment.PayRefundQuery;
|
|
|
import com.poteviohealth.ym.ipos.model.split.*;
|
|
|
@@ -15,11 +17,13 @@ import com.poteviohealth.ym.ipos.model.split.dto.WithdrawDto;
|
|
|
import com.poteviohealth.ym.ipos.service.ISplitRecordsDetailService;
|
|
|
import com.poteviohealth.ym.ipos.service.ISplitRecordsService;
|
|
|
import com.poteviohealth.ym.ipos.service.ISplitService;
|
|
|
+import com.poteviohealth.ym.ipos.service.ISplitWithdrawService;
|
|
|
import com.poteviohealth.ym.ipos.utils.YmUtil;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -37,6 +41,8 @@ public class SplitServiceImpl implements ISplitService {
|
|
|
private ISplitRecordsService splitRecordsService;
|
|
|
@Resource
|
|
|
private ISplitRecordsDetailService splitRecordsDetailService;
|
|
|
+ @Resource
|
|
|
+ private ISplitWithdrawService splitWithdrawService;
|
|
|
|
|
|
@Override
|
|
|
public VaultsResponse delayConfirm(SplitRecords records, List<SplitRecordsDetail> details) {
|
|
|
@@ -210,7 +216,9 @@ public class SplitServiceImpl implements ISplitService {
|
|
|
|
|
|
@Override
|
|
|
public VaultsResponse<WithdrawBack> withdraw(WithdrawDto dto) {
|
|
|
+ Long withdrawId = CgpTool.generateKey();
|
|
|
Withdraw withdraw = new Withdraw();
|
|
|
+ withdraw.setPos_seq(withdrawId.toString());
|
|
|
WithdrawDetail detail = new WithdrawDetail();
|
|
|
detail.setMerchant_id(dto.getMerchantId());
|
|
|
detail.setAmount(dto.getAmount());
|
|
|
@@ -223,6 +231,18 @@ public class SplitServiceImpl implements ISplitService {
|
|
|
return VaultsResponse.failed(e.getMessage());
|
|
|
}
|
|
|
|
|
|
+ SplitWithdraw splitWithdraw = new SplitWithdraw();
|
|
|
+ splitWithdraw.setOperatorId(TokenContext.cureOperatorId());
|
|
|
+ splitWithdraw.setWithdrawId(withdrawId);
|
|
|
+ splitWithdraw.setWithdrawSeq(back.getWithdraw_seq());
|
|
|
+ splitWithdraw.setMerchantId(dto.getMerchantId());
|
|
|
+ splitWithdraw.setAmount(dto.getAmount());
|
|
|
+ splitWithdraw.setTransDate(new Date());
|
|
|
+ splitWithdraw.setTransStatus(back.getTrans_status());
|
|
|
+ splitWithdraw.setAcctStatus(back.getAcct_status());
|
|
|
+ splitWithdraw.setErrorMsg(back.getError_msg());
|
|
|
+ splitWithdrawService.save(splitWithdraw);
|
|
|
+
|
|
|
if(YmUtil.SUCCESS.equals(back.getResult().getId())){
|
|
|
return VaultsResponse.success(back);
|
|
|
}
|
|
|
@@ -245,11 +265,17 @@ public class SplitServiceImpl implements ISplitService {
|
|
|
return VaultsResponse.failed(e.getMessage());
|
|
|
}
|
|
|
|
|
|
+ QueryWrapper<SplitWithdraw> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("withdraw_seq",withdrawSeq);
|
|
|
+ SplitWithdraw splitWithdraw = new SplitWithdraw();
|
|
|
+ splitWithdraw.setTransStatus(back.getTrans_status());
|
|
|
+ splitWithdraw.setAcctStatus(back.getAcct_status());
|
|
|
+ splitWithdrawService.update(splitWithdraw,queryWrapper);
|
|
|
+
|
|
|
if(YmUtil.SUCCESS.equals(back.getResult().getId())){
|
|
|
return VaultsResponse.success(back);
|
|
|
}
|
|
|
|
|
|
return VaultsResponse.failed(back.getResult().getComment());
|
|
|
-
|
|
|
}
|
|
|
}
|