|
|
@@ -52,13 +52,14 @@ 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.purchase.sales.entity.*;
|
|
|
import org.springblade.purchase.sales.enums.OrderStatusEnum;
|
|
|
import org.springblade.purchase.sales.excel.*;
|
|
|
import org.springblade.purchase.sales.mapper.*;
|
|
|
import org.springblade.purchase.sales.service.IOrderFilesService;
|
|
|
import org.springblade.purchase.sales.service.IOrderService;
|
|
|
+import org.springblade.purchase.sales.tonglianPayment.utils.AnalysisMapUtils;
|
|
|
+import org.springblade.purchase.sales.tonglianPayment.utils.SybPayService;
|
|
|
import org.springblade.purchase.sales.vo.*;
|
|
|
import org.springblade.stock.entity.StockGoods;
|
|
|
import org.springblade.stock.feign.IStockGoodsClient;
|
|
|
@@ -75,6 +76,7 @@ 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;
|
|
|
@@ -82,7 +84,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.*;
|
|
|
|
|
|
@@ -148,7 +149,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
private final IRedisClient redisClient;//redis缓存处理
|
|
|
|
|
|
- private final IPaymentClient paymentClient;//支付
|
|
|
+
|
|
|
+ private final ITongLianPaymentClient tongLianPaymentClient;//支付
|
|
|
|
|
|
/**
|
|
|
* 库区信息
|
|
|
@@ -277,7 +279,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);
|
|
|
}
|
|
|
@@ -1131,6 +1133,122 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
+ public void checkChargeBack(Order order) {
|
|
|
+ Order salesOrder = baseMapper.selectById(order.getId());
|
|
|
+
|
|
|
+ if (ObjectUtil.isEmpty(salesOrder)){//判断单据是否存在
|
|
|
+ throw new SecurityException("单据信息异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (salesOrder.getChargebackStatus() == 1){
|
|
|
+ throw new SecurityException("订单已开启审核,请勿重复提交");
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据销售订单id获得采购订单
|
|
|
+ Order orderPurchase = baseMapper.selectOne(new LambdaQueryWrapper<Order>()
|
|
|
+ .eq(Order::getIsDeleted, 0)
|
|
|
+ .eq(Order::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Order::getSrcId, salesOrder.getId()));
|
|
|
+ if (ObjectUtil.isNotEmpty(orderPurchase)){//判断采购订单是否存在
|
|
|
+ throw new SecurityException("采购订单已存在,禁止撤销");
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据订单号获得收发货
|
|
|
+ List<Delivery> deliveryList = deliveryClient.getOrgMessage(salesOrder.getOrderNo(), OrderTypeEnum.DOMESTIC.getType());
|
|
|
+ if (CollectionUtils.isNotEmpty(deliveryList)) {//判断收发货是否存在
|
|
|
+ throw new SecurityException("收发货单据已存在,禁止撤销");
|
|
|
+ }
|
|
|
+
|
|
|
+ //获得财务收款信息
|
|
|
+ List<Settlement> settlementList = financeClient.selectSrcOrderNo(salesOrder.getOrderNo());
|
|
|
+ if (CollectionUtils.isNotEmpty(settlementList)) {//判断收款是否存在
|
|
|
+ throw new SecurityException("收款单据已存在,禁止撤销");
|
|
|
+ }
|
|
|
+
|
|
|
+ //审批数据
|
|
|
+ AuditProecessDTO auditProecessDTO = new AuditProecessDTO();
|
|
|
+ //获取审批级次
|
|
|
+ List<AuditPathsLevels> auditPathsLevels = null;
|
|
|
+ // 判断是否有审批流,如果审批流已开启就进入审批流,否则直接走申请通过
|
|
|
+ AuditPathsActs pathsActs = null;
|
|
|
+ //是否开启流程
|
|
|
+ pathsActs = iCheckClient.getActsByActId(21, "status");
|
|
|
+ //获取审批信息
|
|
|
+ auditPathsLevels = iCheckClient.listLevelsByActId(21, "status");
|
|
|
+ auditProecessDTO.setTimes(1);
|
|
|
+
|
|
|
+ // 没开启审批流直接走 通过流程
|
|
|
+ if (pathsActs == null || pathsActs.getIsEnable() == 2) {
|
|
|
+ throw new SecurityException("当前租户未查询到审批流配置");
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(auditPathsLevels)) {
|
|
|
+ throw new SecurityException("开启审批失败:未查询到审批信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ //增加审批类型
|
|
|
+ auditProecessDTO.setProcessType("退单审批");
|
|
|
+
|
|
|
+ LambdaQueryWrapper<OrderItems> orderItemsLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ orderItemsLambdaQueryWrapper
|
|
|
+ .eq(OrderItems::getGoodType, 0)
|
|
|
+ .eq(OrderItems::getPid, salesOrder.getId())
|
|
|
+ .eq(OrderItems::getIsDeleted, 0);
|
|
|
+ List<OrderItems> orderItems = orderItemsMapper.selectList(orderItemsLambdaQueryWrapper);
|
|
|
+ if (CollectionUtils.isNotEmpty(orderItems)) {
|
|
|
+ auditProecessDTO.setOrderQuantity(orderItems.stream().map(OrderItems::getOrderQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ auditProecessDTO.setAmount(orderItems.stream().map(OrderItems::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ } else {
|
|
|
+ auditProecessDTO.setOrderQuantity(BigDecimal.ZERO);
|
|
|
+ auditProecessDTO.setAmount(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 绑定审核类型
|
|
|
+ auditProecessDTO.setCheckType("XSTD");//代理订单
|
|
|
+ // 追加跳转路由url
|
|
|
+ auditProecessDTO.setUrl(salesOrder.getUrl());
|
|
|
+ auditProecessDTO.setPageStatus(salesOrder.getPageStatus());
|
|
|
+ auditProecessDTO.setPageLabel(salesOrder.getPageLabel());
|
|
|
+ auditProecessDTO.setOrderRemark(salesOrder.getOrderRemark());//订单备注
|
|
|
+ auditProecessDTO.setPathsLevelsList(auditPathsLevels);
|
|
|
+ auditProecessDTO.setActId(1);
|
|
|
+ auditProecessDTO.setSrcBillId(salesOrder.getId());//申请表id
|
|
|
+ auditProecessDTO.setBillId(salesOrder.getId());//业务id
|
|
|
+ auditProecessDTO.setBillNo(salesOrder.getOrderNo());//业务编号
|
|
|
+ auditProecessDTO.setSendUserId(AuthUtil.getUserId());//请核人id
|
|
|
+ auditProecessDTO.setSendName(AuthUtil.getUserName());//请核人名称
|
|
|
+ auditProecessDTO.setSendTime(new Date());//请核时间
|
|
|
+ auditProecessDTO.setBillTime(salesOrder.getCreateTime());//业务日期
|
|
|
+ auditProecessDTO.setTenantId(AuthUtil.getTenantId());//租户id
|
|
|
+ R financeProcess = iCheckClient.createFinanceProcess(auditProecessDTO);
|
|
|
+ if (!financeProcess.isSuccess()) {
|
|
|
+ throw new SecurityException("操作失败,请联系管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ salesOrder.setChargebackStatus(1);
|
|
|
+ salesOrder.setChargebackUser(AuthUtil.getUserName());
|
|
|
+ salesOrder.setChargebackTime(new Date());
|
|
|
+ baseMapper.updateById(salesOrder);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 申请退单审批中
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void underChargeBackReview(Long id) {
|
|
|
+ Order order = baseMapper.selectById(id);
|
|
|
+ if (order == null) {
|
|
|
+ throw new SecurityException("审批失败");
|
|
|
+ }
|
|
|
+ order.setChargebackStatus(2);
|
|
|
+ baseMapper.updateById(order);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public void passCheck(Long id) {
|
|
|
|
|
|
// ===========================start 审核通过修改销售订单信息==========================
|
|
|
@@ -1365,31 +1483,10 @@ 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("撤销失败");
|
|
|
}
|
|
|
|
|
|
- //根据销售订单id获得采购订单
|
|
|
- Order orderPurchase = baseMapper.selectOne(new LambdaQueryWrapper<Order>()
|
|
|
- .eq(Order::getIsDeleted, 0)
|
|
|
- .eq(Order::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(Order::getSrcId, orderMessage.getId()));
|
|
|
- if (ObjectUtil.isNotEmpty(orderPurchase)) {//判断采购订单是否存在
|
|
|
- throw new SecurityException("采购订单已存在,禁止撤销");
|
|
|
- }
|
|
|
-
|
|
|
- //根据订单号获得工厂发货
|
|
|
- List<Delivery> deliveryList = deliveryClient.getOrderMessage(orderMessage.getOrderNo(), OrderTypeEnum.DOMESTIC.getType());
|
|
|
- if (CollectionUtils.isNotEmpty(deliveryList)) {//判断收发货是否存在
|
|
|
- throw new SecurityException("收发货单据已存在,禁止撤销");
|
|
|
- }
|
|
|
-
|
|
|
- //获得财务收款信息
|
|
|
- List<Settlement> settlementList = financeClient.selectSrcOrderNo(orderMessage.getOrderNo());
|
|
|
- if (CollectionUtils.isNotEmpty(settlementList)) {//判断收款是否存在
|
|
|
- throw new SecurityException("收款单据已存在,禁止撤销");
|
|
|
- }
|
|
|
-
|
|
|
// 销售释放库存
|
|
|
if ("XS".equals(orderMessage.getBillType()) && orderMessage.getTradeType().equals(OrderTypeEnum.DOMESTIC.getType())) {
|
|
|
// ===========================Start 审核撤销释放库存=============================
|
|
|
@@ -1438,7 +1535,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
//删除明细
|
|
|
int res = orderItemsMapper.deleteById(e.getId());
|
|
|
- if (res != 1) {
|
|
|
+ if (res != 1){
|
|
|
throw new SecurityException("撤销失败,明细错误");
|
|
|
}
|
|
|
});
|
|
|
@@ -1513,6 +1610,23 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 申请退单审批不通过
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void passChargeBackCancel(Long id) {
|
|
|
+ Order order = baseMapper.selectById(id);
|
|
|
+ if (order == null) {
|
|
|
+ throw new SecurityException("审批失败");
|
|
|
+ }
|
|
|
+ baseMapper.update(null, new LambdaUpdateWrapper<Order>()
|
|
|
+ .set(Order::getChargebackStatus, 0)
|
|
|
+ .set(Order::getChargebackUser, null)
|
|
|
+ .set(Order::getChargebackTime, null)
|
|
|
+ .eq(Order::getId, id)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void passSpecialCheck(Long id) {
|
|
|
Order order = baseMapper.selectById(id);
|
|
|
@@ -1903,6 +2017,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 发货客户明细导出
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<OrderStatisticsVo> corpStatisticsItemExport(OrderStatisticsVo statisticsVo) {
|
|
|
+ return baseMapper.corpStatisticsItem(null, statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 发货业务员统计
|
|
|
*/
|
|
|
@Override
|
|
|
@@ -1927,6 +2049,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 发货业务员明细导出
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<OrderStatisticsVo> salesmanStatisticsItemExport(OrderStatisticsVo statisticsVo) {
|
|
|
+ return baseMapper.salesmanStatisticsItem(null, statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 业务员利润统计
|
|
|
*/
|
|
|
@Override
|
|
|
@@ -1951,6 +2081,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 业务员利润明细导出
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<OrderStatisticsVo> salesmanProfitItemExport(OrderStatisticsVo statisticsVo) {
|
|
|
+ return baseMapper.salesmanProfitItem(null, statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 客户利润统计
|
|
|
*/
|
|
|
@Override
|
|
|
@@ -1975,6 +2113,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 客户利润明细导出
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<OrderStatisticsVo> customerProfitItemExport(OrderStatisticsVo statisticsVo) {
|
|
|
+ return baseMapper.customerProfitItem(null, statisticsVo, statisticsVo.getBrand());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 品牌利润对比统计
|
|
|
*/
|
|
|
@Override
|
|
|
@@ -1999,6 +2145,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 品牌利润对比明细导出
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<OrderStatisticsVo> brandProfitItemExport(OrderStatisticsVo statisticsVo) {
|
|
|
+ return baseMapper.brandProfitItem(null, statisticsVo, statisticsVo.getBrand());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 发货规格统计
|
|
|
*/
|
|
|
@Override
|
|
|
@@ -2023,6 +2177,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 发货规格明细导出
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<OrderStatisticsVo> specificationsProfitItemExport(OrderStatisticsVo statisticsVo) {
|
|
|
+ return baseMapper.specificationsProfitItem(null, statisticsVo, statisticsVo.getBrand(), statisticsVo.getChargeMember());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 数量金额汇总对比统计
|
|
|
*/
|
|
|
@Override
|
|
|
@@ -2047,6 +2209,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 数量金额汇总对比统计导出
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<OrderStatisticsVo> totalSummaryItemExport(OrderStatisticsVo statisticsVo) {
|
|
|
+ return baseMapper.totalSummaryItem(null, statisticsVo, statisticsVo.getBrand());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 计算国内费用
|
|
|
*
|
|
|
* @param order
|
|
|
@@ -2412,15 +2582,12 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
@Override
|
|
|
public R collectPayment(Order order) {
|
|
|
if ("线上".equals(order.getOrderSource())) {
|
|
|
+ R r = this.payPrepay(order.getId());
|
|
|
+ if (!r.isSuccess() || r.getCode() != 200) {
|
|
|
+ throw new RuntimeException("支付失败!原因:" + r.getData());
|
|
|
+ }
|
|
|
order.setStatus(2);
|
|
|
Order selectOrder = baseMapper.selectById(order.getId());
|
|
|
-
|
|
|
- if (null == selectOrder) {
|
|
|
- throw new RuntimeException("未找到订单信息,订单已取消");
|
|
|
- }
|
|
|
- if (selectOrder.getActualPaymentStatus() > 0) {
|
|
|
- throw new RuntimeException("订单已支付,请不要重复操作");
|
|
|
- }
|
|
|
if (ObjectUtils.isNotNull(selectOrder) && ObjectUtils.isNotNull(selectOrder.getDebitAmount())) {
|
|
|
List<Settlement> settlementList = new ArrayList<>();
|
|
|
Settlement settlement = new Settlement();
|
|
|
@@ -3939,10 +4106,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //箱号拼接字符串
|
|
|
- List<Long> itemList = order.getOrderItemsList().stream().map(OrderItems::getItemId).distinct().collect(Collectors.toList());
|
|
|
- order.setItemList(itemList);
|
|
|
- return paymentClient.getWeChatPayment(order);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -4108,6 +4271,117 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public R payPrepay(Long orderId) {
|
|
|
+ //查询订单及物流信息
|
|
|
+ Order orderInfo = baseMapper.selectById(orderId);
|
|
|
+
|
|
|
+ if (null == orderInfo) {
|
|
|
+ throw new RuntimeException("未找到订单信息,订单已取消");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (orderInfo.getActualPaymentStatus() > 0) {
|
|
|
+ throw new RuntimeException("订单已支付,请不要重复操作");
|
|
|
+ }
|
|
|
+
|
|
|
+ Parameters parameters = tongLianPaymentClient.getParametersOne();
|
|
|
+
|
|
|
+ if (ObjectUtils.isNull(parameters)) {
|
|
|
+ throw new RuntimeException("未找到支付信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ R<User> r = userClient.userInfoById(AuthUtil.getUserId());
|
|
|
+ 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<>();
|
|
|
+ lambdaQueryWrapper.eq(OrderItems::getIsDeleted, 0).eq(OrderItems::getTenantId, AuthUtil.getTenantId()).eq(OrderItems::getPid, orderId);
|
|
|
+ //订单的商品nideshop_order_goods表
|
|
|
+ List<OrderItems> orderGoods = orderItemsMapper.selectList(lambdaQueryWrapper);
|
|
|
+ String body = "商品-";
|
|
|
+ if (null != orderGoods) {
|
|
|
+ for (OrderItems goodsVo : orderGoods) {
|
|
|
+ GoodsDesc goodsDesc = goodsDescClient.getGoodsDescDetail(goodsVo.getItemId());
|
|
|
+ if (ObjectUtils.isNotNull(goodsDesc)) {
|
|
|
+ body = body + goodsDesc.getCname() + "、";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (body.length() > 0) {
|
|
|
+ body = body.substring(0, body.length() - 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String, String> map = service.pay(orderInfo.getDebitAmount().multiply(new BigDecimal(100)).intValue(),
|
|
|
+ orderInfo.getSysNo(),
|
|
|
+ parameters.getPayType(),
|
|
|
+ body,
|
|
|
+ "",
|
|
|
+ r.getData().getOpenId(),
|
|
|
+ parameters.getValidtime(),
|
|
|
+ parameters.getNotifyUrl() + "/api/blade-purchase-sales/tongLianPayment/notify",
|
|
|
+ "",
|
|
|
+ "",
|
|
|
+ "",
|
|
|
+ "",
|
|
|
+ parameters.getSubAppid(),
|
|
|
+ "",
|
|
|
+ "",
|
|
|
+ "",
|
|
|
+ "",
|
|
|
+ "",
|
|
|
+ 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);
|
|
|
+ // 业务处理
|
|
|
+ orderInfo.setPrepayId(prepay_id);
|
|
|
+ // 付款中
|
|
|
+ orderInfo.setActualPaymentStatus(1);
|
|
|
+ //更新订单表
|
|
|
+ baseMapper.updateById(orderInfo);
|
|
|
+ return R.data(resultObj);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new RuntimeException("下单失败,error=" + e.getMessage());
|
|
|
+ }
|
|
|
+ return R.data("下单失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public R personalInformation(String tenantId) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if (StringUtils.isBlank(tenantId)) {
|