| | |
| | | import com.dsh.communityWorldCup.model.*; |
| | | import com.dsh.communityWorldCup.service.*; |
| | | import com.dsh.communityWorldCup.util.*; |
| | | import com.dsh.communityWorldCup.util.wx.WxV3PayConfig; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | |
| | | return payment; |
| | | } |
| | | |
| | | private String smidVx = "2088330203191220";//平台微信商户号 |
| | | |
| | | /** |
| | | * 支付逻辑 |
| | |
| | | worldCupPayment.setAmount(new BigDecimal(num).multiply(worldCup.getCash())); |
| | | worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); |
| | | worldCupPaymentService.save(worldCupPayment); |
| | | return payMoneyUtil.weixinpay("社区世界杯报名", "", worldCupPayment.getCode(), |
| | | List<WorldCupStore> list = worldCupStoreService.lambdaQuery().eq(WorldCupStore::getWorldCupId, worldCup.getId()).list(); |
| | | if (list.isEmpty()){ |
| | | return payMoneyUtil.weixinpay("社区世界杯报名", "", worldCupPayment.getCode(), |
| | | worldCupPayment.getAmount().toString(), "/base/worldCup/wxPayWorldCupCallback", "APP", ""); |
| | | }else{ |
| | | Integer storeId = list.get(0).getStoreId(); |
| | | Store store = storeClient.queryStoreById(storeId); |
| | | if (store.getOperatorId()==null||store.getOperatorId()==0){ |
| | | // 平台 |
| | | return payMoneyUtil.weixinpay("社区世界杯报名", "", worldCupPayment.getCode(), |
| | | worldCupPayment.getAmount().toString(), "/base/worldCup/wxPayWorldCupCallback", "APP", ""); |
| | | }else{ |
| | | String s2 = storeClient.getmerchantNumberByOperatorId(store.getOperatorId()); |
| | | System.err.println("微信商户号"+s2); |
| | | if(!StringUtils.hasLength(s2)){ |
| | | return ResultUtil.error("运营商未配置微信商户号,获取支付失败!"); |
| | | } |
| | | return payMoneyUtil.weixinpayV3(s2,"社区世界杯报名",worldCupPayment.getCode() |
| | | ,"/base/worldCup/wxPayWorldCupCallback1",worldCupPayment.getAmount().toString()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | //支付宝 |
| | | if(payType == 2){ |
| | | worldCupPayment.setAmount(new BigDecimal(num).multiply(worldCup.getCash())); |
| | | worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); |
| | | worldCupPaymentService.save(worldCupPayment); |
| | | return payMoneyUtil.alipay("2088330203191220", "社区世界杯报名", "世界杯报名", "", worldCupPayment.getCode(), |
| | | List<WorldCupStore> list = worldCupStoreService.lambdaQuery().eq(WorldCupStore::getWorldCupId, worldCup.getId()).list(); |
| | | |
| | | if (list.isEmpty()){ |
| | | return payMoneyUtil.alipay("2088330203191220", "社区世界杯报名", "世界杯报名", "", worldCupPayment.getCode(), |
| | | worldCupPayment.getAmount().toString(), "/base/worldCup/aliPayWorldCupCallback"); |
| | | } |
| | | }else{ |
| | | Integer storeId = list.get(0).getStoreId(); |
| | | Store store = storeClient.queryStoreById(storeId); |
| | | if (store.getOperatorId()==null||store.getOperatorId()==0){ |
| | | return payMoneyUtil.alipay("2088330203191220", "社区世界杯报名", "世界杯报名", "", worldCupPayment.getCode(), |
| | | worldCupPayment.getAmount().toString(), "/base/worldCup/aliPayWorldCupCallback"); |
| | | }else{ |
| | | String s2 = storeClient.getmerchantNumberAliByOperatorId(store.getOperatorId()); |
| | | System.err.println("支付宝商户号"+s2); |
| | | if(!StringUtils.hasLength(s2)){ |
| | | return ResultUtil.error("运营商未配置支付宝商户号,获取支付失败!"); |
| | | } |
| | | return payMoneyUtil.alipay(s2, "社区世界杯报名", "世界杯报名", "", worldCupPayment.getCode(), |
| | | worldCupPayment.getAmount().toString(), "/base/worldCup/aliPayWorldCupCallback"); |
| | | } |
| | | } |
| | | } |
| | | //玩湃币 |
| | | if(payType == 3){ |
| | | AppUser appUser = appUserClient.getAppUser(paymentWorldCup.getUid()); |