|
|
@@ -16,7 +16,6 @@
|
|
|
*/
|
|
|
package org.springblade.purchase.sales.service.impl;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
@@ -52,9 +51,7 @@ import org.springblade.finance.vojo.Items;
|
|
|
import org.springblade.finance.vojo.Settlement;
|
|
|
import org.springblade.land.entity.LandOrder;
|
|
|
import org.springblade.land.feign.ILandClient;
|
|
|
-import org.springblade.payment.tonglianPayment.fegin.IPaymentClient;
|
|
|
-import org.springblade.payment.tonglianPayment.utils.AnalysisMapUtils;
|
|
|
-import org.springblade.payment.tonglianPayment.utils.SybPayService;
|
|
|
+import org.springblade.pay.tonglianPayment.fegin.IPaymentClient;
|
|
|
import org.springblade.purchase.sales.entity.*;
|
|
|
import org.springblade.purchase.sales.enums.OrderStatusEnum;
|
|
|
import org.springblade.purchase.sales.excel.*;
|
|
|
@@ -77,7 +74,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
-import javax.sql.rowset.serial.SerialException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.BigInteger;
|
|
|
import java.math.MathContext;
|
|
|
@@ -85,7 +81,6 @@ import java.math.RoundingMode;
|
|
|
import java.text.DateFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
import static org.springblade.common.constant.TenantConstant.*;
|
|
|
|
|
|
@@ -154,6 +149,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
private final ITongLianPaymentClient tongLianPaymentClient;//支付
|
|
|
|
|
|
+ private final IPaymentClient paymentClient;//支付
|
|
|
+
|
|
|
/**
|
|
|
* 库区信息
|
|
|
*/
|
|
|
@@ -281,7 +278,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
String[] arrs = order.getSrcOrderNo().split(",");
|
|
|
for (String arr : arrs) {
|
|
|
Order order1 = baseMapper.selectOne(new LambdaQueryWrapper<Order>().eq(Order::getSysNo, arr));
|
|
|
- if (ObjectUtils.isNotNull(order1)){
|
|
|
+ if (ObjectUtils.isNotNull(order1)) {
|
|
|
order1.setSrcOrderNo(order.getSysNo());
|
|
|
baseMapper.updateById(order1);
|
|
|
}
|
|
|
@@ -1140,11 +1137,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
public void checkChargeBack(Order order) {
|
|
|
Order salesOrder = baseMapper.selectById(order.getId());
|
|
|
|
|
|
- if (ObjectUtil.isEmpty(salesOrder)){//判断单据是否存在
|
|
|
+ if (ObjectUtil.isEmpty(salesOrder)) {//判断单据是否存在
|
|
|
throw new SecurityException("单据信息异常");
|
|
|
}
|
|
|
|
|
|
- if (salesOrder.getChargebackStatus() == 1){
|
|
|
+ if (salesOrder.getChargebackStatus() == 1) {
|
|
|
throw new SecurityException("订单已开启审核,请勿重复提交");
|
|
|
}
|
|
|
|
|
|
@@ -1153,7 +1150,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
.eq(Order::getIsDeleted, 0)
|
|
|
.eq(Order::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Order::getSrcId, salesOrder.getId()));
|
|
|
- if (ObjectUtil.isNotEmpty(orderPurchase)){//判断采购订单是否存在
|
|
|
+ if (ObjectUtil.isNotEmpty(orderPurchase)) {//判断采购订单是否存在
|
|
|
throw new SecurityException("采购订单已存在,禁止撤销");
|
|
|
}
|
|
|
|
|
|
@@ -1485,7 +1482,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
public void checkPassCancel(Long id) {
|
|
|
//获得当前销售订单信息
|
|
|
Order orderMessage = baseMapper.selectById(id);
|
|
|
- if (orderMessage == null){//判断销售订单是否为null
|
|
|
+ if (orderMessage == null) {//判断销售订单是否为null
|
|
|
throw new SecurityException("撤销失败");
|
|
|
}
|
|
|
|
|
|
@@ -1537,7 +1534,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
//删除明细
|
|
|
int res = orderItemsMapper.deleteById(e.getId());
|
|
|
- if (res != 1){
|
|
|
+ if (res != 1) {
|
|
|
throw new SecurityException("撤销失败,明细错误");
|
|
|
}
|
|
|
});
|
|
|
@@ -4793,12 +4790,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
if (r.isSuccess() && ObjectUtils.isNull(r.getData())) {
|
|
|
throw new RuntimeException("未找到用户信息");
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- SybPayService service = new SybPayService();
|
|
|
- //https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3
|
|
|
Map<Object, Object> resultObj = new TreeMap();
|
|
|
- //"https://test.allinpaygd.com/JWeb/NotifyServlet"
|
|
|
try {
|
|
|
// body 订单标题
|
|
|
LambdaQueryWrapper<OrderItems> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -4817,7 +4809,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
body = body.substring(0, body.length() - 1);
|
|
|
}
|
|
|
}
|
|
|
- Map<String, String> map = service.pay(orderInfo.getDebitAmount().multiply(new BigDecimal(100)).intValue(),
|
|
|
+ R<Map<Object, Object>> res = paymentClient.payPrepay(orderInfo.getDebitAmount().multiply(new BigDecimal(100)).intValue(),
|
|
|
orderInfo.getSysNo(),
|
|
|
parameters.getPayType(),
|
|
|
body,
|
|
|
@@ -4837,57 +4829,23 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
"",
|
|
|
parameters.getCusIp(),
|
|
|
"");
|
|
|
- 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")) {
|
|
|
- // 返回数据
|
|
|
- String prepay_id = AnalysisMapUtils.getString("prepay_id", mapType);
|
|
|
- // 先生成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));
|
|
|
- String paySign = AnalysisMapUtils.getString("paySign", mapType);
|
|
|
- resultObj.put("paySign", paySign);
|
|
|
+ if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
|
|
|
+ String prepay_id = res.getData().get("prepay_id").toString();
|
|
|
// 业务处理
|
|
|
orderInfo.setPrepayId(prepay_id);
|
|
|
// 付款中
|
|
|
orderInfo.setActualPaymentStatus(1);
|
|
|
//更新订单表
|
|
|
baseMapper.updateById(orderInfo);
|
|
|
- return R.data(resultObj);
|
|
|
+ return R.data(res.getData());
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("下单失败");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new RuntimeException("下单失败,error=" + e.getMessage());
|
|
|
}
|
|
|
- return R.data("下单失败");
|
|
|
- }
|
|
|
-
|
|
|
- public static void print(Map<String, String> map) {
|
|
|
- System.out.println("返回数据如下:");
|
|
|
- if (map != null) {
|
|
|
- for (String key : map.keySet()) {
|
|
|
- System.out.println(key + ";" + map.get(key));
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
@Override
|