|
|
@@ -23,7 +23,7 @@ import org.springblade.pay.tonglianPayment.service.IWechatMarkService;
|
|
|
import org.springblade.pay.tonglianPayment.utils.AnalysisMapUtils;
|
|
|
import org.springblade.pay.tonglianPayment.utils.SybPayService;
|
|
|
import org.springblade.purchase.sales.entity.Order;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springblade.system.feign.ISysClient;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
@@ -48,6 +48,8 @@ public class PaymentClient implements IPaymentClient {
|
|
|
*/
|
|
|
private final ICorpsDescClient corpsDescClient;
|
|
|
|
|
|
+ private final ISysClient sysClient;
|
|
|
+
|
|
|
@Override
|
|
|
public R getWeChatPayment(Order order) {
|
|
|
return paymentService.getWeChatPayment(order);
|
|
|
@@ -61,45 +63,64 @@ public class PaymentClient implements IPaymentClient {
|
|
|
//"https://test.allinpaygd.com/JWeb/NotifyServlet"
|
|
|
try {
|
|
|
System.out.println("支付函数数据======》" + paymentDTO.toString());
|
|
|
- Map<String, String> map = service.pay(paymentDTO.getTrxamt(), paymentDTO.getReqsn(), paymentDTO.getPaytype(),
|
|
|
- paymentDTO.getBody(), paymentDTO.getRemark(), paymentDTO.getAcct(), paymentDTO.getValidtime(), paymentDTO.getNotify_url(),
|
|
|
- paymentDTO.getLimit_pay(), paymentDTO.getIdno(), paymentDTO.getTruename(), paymentDTO.getAsinfo(),
|
|
|
- paymentDTO.getSub_appid(), paymentDTO.getGoods_tag(), paymentDTO.getBenefitdetail(), paymentDTO.getChnlstoreid(),
|
|
|
- paymentDTO.getSubbranch(), paymentDTO.getExtendparams(), paymentDTO.getCusip(), paymentDTO.getFqnum(), paymentDTO.getCusId(),
|
|
|
- paymentDTO.getAppId(), paymentDTO.getOrgid(), paymentDTO.getTransactionType(), paymentDTO.getSybMdAppkey(), paymentDTO.getSybRsacusprikey(),
|
|
|
- paymentDTO.getSybRsatlpubkey(), paymentDTO.getSybSmpprivatekey(), paymentDTO.getSybSmtlpubkey());
|
|
|
- print(map);
|
|
|
-
|
|
|
- Map<String, String> mapType = null;
|
|
|
- if (map != null) {
|
|
|
- for (Object key : map.keySet()) {
|
|
|
- if (key.equals("payinfo")) {
|
|
|
- mapType = JSON.parseObject((String) map.get(key), Map.class);
|
|
|
+ String status = sysClient.getParamServiceNew("cashier.payment");
|
|
|
+ if ("1".equals(status)) {
|
|
|
+ Map<String, String> map = service.pay(paymentDTO.getTrxamt(), paymentDTO.getReqsn(), paymentDTO.getPaytype(),
|
|
|
+ paymentDTO.getBody(), paymentDTO.getRemark(), paymentDTO.getAcct(), paymentDTO.getValidtime(), paymentDTO.getNotify_url(),
|
|
|
+ paymentDTO.getLimit_pay(), paymentDTO.getIdno(), paymentDTO.getTruename(), paymentDTO.getAsinfo(),
|
|
|
+ paymentDTO.getSub_appid(), paymentDTO.getGoods_tag(), paymentDTO.getBenefitdetail(), paymentDTO.getChnlstoreid(),
|
|
|
+ paymentDTO.getSubbranch(), paymentDTO.getExtendparams(), paymentDTO.getCusip(), paymentDTO.getFqnum(), paymentDTO.getCusId(),
|
|
|
+ paymentDTO.getAppId(), paymentDTO.getOrgid(), paymentDTO.getTransactionType(), paymentDTO.getSybMdAppkey(), paymentDTO.getSybRsacusprikey(),
|
|
|
+ paymentDTO.getSybRsatlpubkey(), paymentDTO.getSybSmpprivatekey(), paymentDTO.getSybSmtlpubkey());
|
|
|
+ print(map);
|
|
|
+ for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
|
+ Object key = entry.getKey();
|
|
|
+ Object value = entry.getValue();
|
|
|
+ resultObj.put(key, value);
|
|
|
+ }
|
|
|
+ Map<Object, Object> map1 = new TreeMap<>(resultObj);
|
|
|
+ return R.data(map1);
|
|
|
+ } else {
|
|
|
+ Map<String, String> map = service.pay(paymentDTO.getTrxamt(), paymentDTO.getReqsn(), paymentDTO.getPaytype(),
|
|
|
+ paymentDTO.getBody(), paymentDTO.getRemark(), paymentDTO.getAcct(), paymentDTO.getValidtime(), paymentDTO.getNotify_url(),
|
|
|
+ paymentDTO.getLimit_pay(), paymentDTO.getIdno(), paymentDTO.getTruename(), paymentDTO.getAsinfo(),
|
|
|
+ paymentDTO.getSub_appid(), paymentDTO.getGoods_tag(), paymentDTO.getBenefitdetail(), paymentDTO.getChnlstoreid(),
|
|
|
+ paymentDTO.getSubbranch(), paymentDTO.getExtendparams(), paymentDTO.getCusip(), paymentDTO.getFqnum(), paymentDTO.getCusId(),
|
|
|
+ paymentDTO.getAppId(), paymentDTO.getOrgid(), paymentDTO.getTransactionType(), paymentDTO.getSybMdAppkey(), paymentDTO.getSybRsacusprikey(),
|
|
|
+ paymentDTO.getSybRsatlpubkey(), paymentDTO.getSybSmpprivatekey(), paymentDTO.getSybSmtlpubkey());
|
|
|
+ print(map);
|
|
|
+
|
|
|
+ Map<String, String> mapType = null;
|
|
|
+ if (map != null) {
|
|
|
+ for (Object key : map.keySet()) {
|
|
|
+ if (key.equals("payinfo")) {
|
|
|
+ mapType = JSON.parseObject((String) map.get(key), Map.class);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- // print(map);
|
|
|
- if (map == null) {
|
|
|
- throw new Exception("返回数据错误");
|
|
|
- }
|
|
|
- String return_code = AnalysisMapUtils.getString("retcode", map);
|
|
|
- String return_msg = AnalysisMapUtils.getString("retmsg", map);
|
|
|
- if (return_code.equalsIgnoreCase("FAIL")) {
|
|
|
- throw new RuntimeException("支付失败," + return_msg);
|
|
|
- } else if (return_code.equalsIgnoreCase("SUCCESS")) {
|
|
|
- // 返回数据
|
|
|
- // 先生成paySign 参考https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=5
|
|
|
- resultObj.put("appId", AnalysisMapUtils.getString("appId", mapType));
|
|
|
- resultObj.put("timeStamp", AnalysisMapUtils.getString("timeStamp", mapType));
|
|
|
- resultObj.put("nonceStr", AnalysisMapUtils.getString("nonceStr", mapType));
|
|
|
- resultObj.put("package", AnalysisMapUtils.getString("package", mapType));
|
|
|
- resultObj.put("signType", AnalysisMapUtils.getString("signType", mapType));
|
|
|
- resultObj.put("partnerid", AnalysisMapUtils.getString("cusid", map));
|
|
|
- resultObj.put("prepayId", AnalysisMapUtils.getString("reqsn", map));
|
|
|
- String paySign = AnalysisMapUtils.getString("paySign", mapType);
|
|
|
- resultObj.put("paySign", paySign);
|
|
|
- resultObj.put("trxid", AnalysisMapUtils.getString("trxid", map));
|
|
|
- return R.data(resultObj);
|
|
|
+ // print(map);
|
|
|
+ if (map == null) {
|
|
|
+ throw new Exception("返回数据错误");
|
|
|
+ }
|
|
|
+ String return_code = AnalysisMapUtils.getString("retcode", map);
|
|
|
+ String return_msg = AnalysisMapUtils.getString("retmsg", map);
|
|
|
+ if (return_code.equalsIgnoreCase("FAIL")) {
|
|
|
+ throw new RuntimeException("支付失败," + return_msg);
|
|
|
+ } else if (return_code.equalsIgnoreCase("SUCCESS")) {
|
|
|
+ // 返回数据
|
|
|
+ // 先生成paySign 参考https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=5
|
|
|
+ resultObj.put("appId", AnalysisMapUtils.getString("appId", mapType));
|
|
|
+ resultObj.put("timeStamp", AnalysisMapUtils.getString("timeStamp", mapType));
|
|
|
+ resultObj.put("nonceStr", AnalysisMapUtils.getString("nonceStr", mapType));
|
|
|
+ resultObj.put("package", AnalysisMapUtils.getString("package", mapType));
|
|
|
+ resultObj.put("signType", AnalysisMapUtils.getString("signType", mapType));
|
|
|
+ resultObj.put("partnerid", AnalysisMapUtils.getString("cusid", map));
|
|
|
+ resultObj.put("prepayId", AnalysisMapUtils.getString("reqsn", map));
|
|
|
+ String paySign = AnalysisMapUtils.getString("paySign", mapType);
|
|
|
+ resultObj.put("paySign", paySign);
|
|
|
+ resultObj.put("trxid", AnalysisMapUtils.getString("trxid", map));
|
|
|
+ return R.data(resultObj);
|
|
|
+ }
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -113,8 +134,8 @@ public class PaymentClient implements IPaymentClient {
|
|
|
SybPayService service = new SybPayService();
|
|
|
Map<String, String> resultObj = new TreeMap();
|
|
|
try {
|
|
|
- resultObj = service.scanPay(paymentDTO.getTrxamt(),paymentDTO.getReqsn(),paymentDTO.getBody(),paymentDTO.getRemark(),
|
|
|
- paymentDTO.getAuthcode(),paymentDTO.getLimit_pay(),paymentDTO.getIdno(),paymentDTO.getTruename(),paymentDTO.getAsinfo());
|
|
|
+ resultObj = service.scanPay(paymentDTO.getTrxamt(), paymentDTO.getReqsn(), paymentDTO.getBody(), paymentDTO.getRemark(),
|
|
|
+ paymentDTO.getAuthcode(), paymentDTO.getLimit_pay(), paymentDTO.getIdno(), paymentDTO.getTruename(), paymentDTO.getAsinfo());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -174,22 +195,22 @@ public class PaymentClient implements IPaymentClient {
|
|
|
String corpName = "";
|
|
|
String corpAddress = "";
|
|
|
if (ObjectUtils.isNotNull(userId)) {
|
|
|
- CorpsAttn corpsAttn = corpsAttnClient.getUser(userId,tenantId);
|
|
|
+ CorpsAttn corpsAttn = corpsAttnClient.getUser(userId, tenantId);
|
|
|
if (ObjectUtils.isNotNull(corpsAttn)) {
|
|
|
CorpsDesc corpsDesc = corpsDescClient.getCorpId(corpsAttn.getPid());
|
|
|
if (ObjectUtils.isNotNull(corpsDesc)) {
|
|
|
- corpId = corpsDesc.getId()+"";
|
|
|
+ corpId = corpsDesc.getId() + "";
|
|
|
corpName = corpsDesc.getCname();
|
|
|
if (ObjectUtils.isNotNull(corpsDesc.getCorpsAddrList()) && corpsDesc.getCorpsAddrList().size() > 0) {
|
|
|
- corpAddress = corpsDesc.getCorpsAddrList().stream().filter(e-> "0".equals(e.getDefaultAddres()))
|
|
|
+ corpAddress = corpsDesc.getCorpsAddrList().stream().filter(e -> "0".equals(e.getDefaultAddres()))
|
|
|
.findFirst().orElse(new CorpsAddr()).getDetailedAddress();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- map.put("corpId",corpId);
|
|
|
- map.put("corpName",corpName);
|
|
|
- map.put("corpAddress",corpAddress);
|
|
|
+ map.put("corpId", corpId);
|
|
|
+ map.put("corpName", corpName);
|
|
|
+ map.put("corpAddress", corpAddress);
|
|
|
return R.data(map);
|
|
|
}
|
|
|
|
|
|
@@ -204,8 +225,8 @@ public class PaymentClient implements IPaymentClient {
|
|
|
LambdaQueryWrapper<WechatMark> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
lambdaQueryWrapper.eq(WechatMark::getIsDeleted, 0)
|
|
|
.eq(WechatMark::getTenantId, AuthUtil.getTenantId());
|
|
|
- lambdaQueryWrapper.and(ObjectUtils.isNotNull(srcBillNo) && ObjectUtils.isNotNull(billNo),i -> i.apply( "find_in_set(src_bill_no,'" + srcBillNo + "," + billNo + "')")
|
|
|
- .or().apply( "find_in_set(bill_no,'" + srcBillNo + "," + billNo + "')"));
|
|
|
+ lambdaQueryWrapper.and(ObjectUtils.isNotNull(srcBillNo) && ObjectUtils.isNotNull(billNo), i -> i.apply("find_in_set(src_bill_no,'" + srcBillNo + "," + billNo + "')")
|
|
|
+ .or().apply("find_in_set(bill_no,'" + srcBillNo + "," + billNo + "')"));
|
|
|
lambdaQueryWrapper.orderByDesc(WechatMark::getCreateTime);
|
|
|
List<WechatMark> pages = wechatMarkService.list(lambdaQueryWrapper);
|
|
|
return R.data(pages);
|
|
|
@@ -220,5 +241,14 @@ public class PaymentClient implements IPaymentClient {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static void printNew(Map<Object, Object> map) {
|
|
|
+ System.out.println("返回数据如下:");
|
|
|
+ if (map != null) {
|
|
|
+ for (Object key : map.keySet()) {
|
|
|
+ System.out.println(key + ";" + map.get(key));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|