|
|
@@ -6,6 +6,7 @@ import com.alipay.api.CertAlipayRequest;
|
|
|
import com.alipay.api.DefaultAlipayClient;
|
|
|
import com.alipay.api.request.AlipayTradeRefundRequest;
|
|
|
import com.alipay.api.response.AlipayTradeRefundResponse;
|
|
|
+import com.travel.mapper.SupplierMapper;
|
|
|
import com.travel.mapper.ZFBPayMapper;
|
|
|
import com.travel.model.*;
|
|
|
import com.travel.service.ZFBPayService;
|
|
|
@@ -25,13 +26,18 @@ public class ZFBPayServiceImpl extends ZfbPayUtils implements ZFBPayService {
|
|
|
@Autowired
|
|
|
private ZFBPayMapper zfbPayMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SupplierMapper supplierMapper;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateBuySupplier(ZFBPay buySupplier) {
|
|
|
try{
|
|
|
+ buySupplier.setCode(getSuppileUtil(buySupplier.getCode()));
|
|
|
zfbPayMapper.updateBuySupplier(buySupplier); //完善充值记录
|
|
|
//供应商余额增加
|
|
|
zfbPayMapper.updateBalance(Double.parseDouble(buySupplier.getTotalFee()), buySupplier.getCode());//金额充值
|
|
|
+ zfbPayMapper.updateBalanceChild(Double.parseDouble(buySupplier.getTotalFee()), buySupplier.getCode());//子账号金额同步
|
|
|
} catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -41,9 +47,11 @@ public class ZFBPayServiceImpl extends ZfbPayUtils implements ZFBPayService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updateBuyOfferNum(BuyOfferNum buyOfferNum) {
|
|
|
try{
|
|
|
+ buyOfferNum.setCode(getSuppileUtil(buyOfferNum.getCode()));
|
|
|
zfbPayMapper.updateBuyOfferNum(buyOfferNum);//完善购买记录
|
|
|
//供应商报价单次数增加
|
|
|
zfbPayMapper.addOfferNum(buyOfferNum.getOfferNum(), buyOfferNum.getCode());//增加次数
|
|
|
+ zfbPayMapper.addOfferNumChild(buyOfferNum.getOfferNum(), buyOfferNum.getCode());//子账号次数同步
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -73,7 +81,9 @@ public class ZFBPayServiceImpl extends ZfbPayUtils implements ZFBPayService {
|
|
|
|
|
|
@Override
|
|
|
public void updateSupplierOffer(SupplierRelease supplierRelease2) {
|
|
|
+ supplierRelease2.setCode(getSuppileUtil(supplierRelease2.getCode()));
|
|
|
zfbPayMapper.updateSupplierOffer(supplierRelease2);
|
|
|
+ zfbPayMapper.updateSupplierOfferChild(supplierRelease2);//返回子账号次数
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -100,6 +110,13 @@ public class ZFBPayServiceImpl extends ZfbPayUtils implements ZFBPayService {
|
|
|
}
|
|
|
if(zfbRefund.getRefundState().equals("1")){
|
|
|
ZFBPay wxPay = zfbPayMapper.getRefundVal(zfbRefund.getReleaseUuid());//获取付该报价单付款的信息
|
|
|
+ Supplier supplier = supplierMapper.getSuppierPhone(wxPay.getCode());//查询供应商信息
|
|
|
+ //如果操作人不是父级账号 则查询父级账号的信息 将父级余额放入对象中
|
|
|
+ if(!supplier.getAccountAssociated().equals("0")){
|
|
|
+ Supplier supplier1 = supplierMapper.getSuppierPhone(supplier.getAccountAssociated());//查询父级信息
|
|
|
+ wxPay.setBalanceOf(supplier1.getBalanceOf());
|
|
|
+ wxPay.setCode(supplier1.getCode());
|
|
|
+ }
|
|
|
if(null == wxPay){
|
|
|
map.put("msg", "500");
|
|
|
map.put("errMsg", "未查询到该报价单的支付信息");
|
|
|
@@ -119,6 +136,7 @@ public class ZFBPayServiceImpl extends ZfbPayUtils implements ZFBPayService {
|
|
|
if(map1.get("msg").equals("200")){
|
|
|
String bigDecimal2 = AmountUtil.moneySub(wxPay.getBalanceOf(), refund.getRefundFee());//退款后的账户余额
|
|
|
zfbPayMapper.subtractBalance(bigDecimal2, wxPay.getCode());//供应商余额变更
|
|
|
+ zfbPayMapper.updateBalanceChild(Double.parseDouble(bigDecimal2), wxPay.getCode());//子账号余同步
|
|
|
zfbPayMapper.updateRefundType(zfbRefund.getReleaseUuid(), zfbRefund.getRefundState());
|
|
|
return map1;
|
|
|
} else {
|
|
|
@@ -186,7 +204,9 @@ public class ZFBPayServiceImpl extends ZfbPayUtils implements ZFBPayService {
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void addSupplierBalanceOf(Supplier supplier) {
|
|
|
+ supplier.setCode(getSuppileUtil(supplier.getCode()));
|
|
|
zfbPayMapper.addSupplierBalanceOf(supplier);
|
|
|
+ zfbPayMapper.addSupplierBalanceOfChild(supplier);//子账号同步
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -244,4 +264,21 @@ public class ZFBPayServiceImpl extends ZfbPayUtils implements ZFBPayService {
|
|
|
}
|
|
|
return mapReturn;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 判断当前账号是否是主账号 如果不是主账号则将编号改成主账号操作
|
|
|
+ * @param code 参数
|
|
|
+ * @return 返回结果
|
|
|
+ */
|
|
|
+ public String getSuppileUtil(String code){
|
|
|
+ String result = "";
|
|
|
+ Supplier supplier = supplierMapper.getSuppierPhone(code);//查询供应商信息
|
|
|
+ //如果操作人不是父级账号 则查询父级账号的信息 将父级余额放入对象中
|
|
|
+ if(!supplier.getAccountAssociated().equals("0")){
|
|
|
+ result = supplier.getAccountAssociated();
|
|
|
+ } else {
|
|
|
+ result = code;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|