|
@@ -1,32 +1,59 @@
|
|
|
package com.ruoyi.web.H5Api.api;
|
|
package com.ruoyi.web.H5Api.api;
|
|
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+
|
|
|
|
|
+import org.apache.commons.collections.map.HashedMap;
|
|
|
|
|
+import org.redisson.api.RLock;
|
|
|
|
|
+import org.redisson.api.RedissonClient;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
+
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
import com.ruoyi.common.enums.OperatorType;
|
|
import com.ruoyi.common.enums.OperatorType;
|
|
|
-import com.ruoyi.common.utils.DateUtils;
|
|
|
|
|
-import com.ruoyi.common.utils.SecurityUtils;
|
|
|
|
|
-import com.ruoyi.web.pcApi.domain.*;
|
|
|
|
|
|
|
+import com.ruoyi.web.line.LineCallBankParam;
|
|
|
|
|
+import com.ruoyi.web.line.LinePay;
|
|
|
|
|
+import com.ruoyi.web.line.LinePayAPOD;
|
|
|
|
|
+import com.ruoyi.web.line.LinePayConfirmAPOD;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TCommodityManage;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TCustomerCollectionOrFootprint;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TCustomerCoupon;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TCustomerDistributionRecord;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TCustomerDistributionSet;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TCustomerIntegralRecord;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TCustomerIntegralSet;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TCustomerManage;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TCustomerNotice;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TCustomerShoppingCart;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TOrderEvaluate;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TOrderManage;
|
|
|
|
|
+import com.ruoyi.web.pcApi.domain.TOrderManageTotal;
|
|
|
import com.ruoyi.web.pcApi.mapper.TCommodityManageMapper;
|
|
import com.ruoyi.web.pcApi.mapper.TCommodityManageMapper;
|
|
|
-import com.ruoyi.web.pcApi.service.*;
|
|
|
|
|
-import org.apache.commons.collections.map.HashedMap;
|
|
|
|
|
-import org.redisson.api.RLock;
|
|
|
|
|
-import org.redisson.api.RedissonClient;
|
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
-import org.springframework.http.HttpHeaders;
|
|
|
|
|
-import org.springframework.http.HttpRequest;
|
|
|
|
|
-import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
-import org.springframework.security.core.Authentication;
|
|
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
|
-
|
|
|
|
|
-import java.io.IOException;
|
|
|
|
|
-import java.io.Reader;
|
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITCommodityManageService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITCustomerCollectionOrFootprintService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITCustomerCouponService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITCustomerDistributionRecordService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITCustomerDistributionSetService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITCustomerIntegralRecordService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITCustomerIntegralSetService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITCustomerManageService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITCustomerNoticeService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITCustomerShoppingCartService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITOrderEvaluateService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITOrderManageService;
|
|
|
|
|
+import com.ruoyi.web.pcApi.service.ITOrderManageTotalService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* h5端-订单信息api
|
|
* h5端-订单信息api
|
|
@@ -68,7 +95,9 @@ public class H5OrderController extends BaseController {
|
|
|
private ITOrderManageTotalService orderManageTotalService;
|
|
private ITOrderManageTotalService orderManageTotalService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ITCustomerIntegralSetService customerIntegralSetService;
|
|
private ITCustomerIntegralSetService customerIntegralSetService;
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private LinePay linePay;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 增加收藏
|
|
* 增加收藏
|
|
|
*
|
|
*
|
|
@@ -262,86 +291,158 @@ public class H5OrderController extends BaseController {
|
|
|
@RepeatSubmit
|
|
@RepeatSubmit
|
|
|
@PostMapping("/aiPay")
|
|
@PostMapping("/aiPay")
|
|
|
public AjaxResult aiPay(@RequestBody TOrderManageTotal orderManageTotal) {
|
|
public AjaxResult aiPay(@RequestBody TOrderManageTotal orderManageTotal) {
|
|
|
- //TODO 接入支付接口
|
|
|
|
|
|
|
|
|
|
- TCustomerManage customer = customerManageService.selectTCustomerManageById(getLoginUser().getLoginCustomer().getId());
|
|
|
|
|
- // 多/单订单支付
|
|
|
|
|
- for (TOrderManage order : orderManageTotal.getOrderList()) {
|
|
|
|
|
- TOrderManage orderManage = orderManageService.selectTOrderManageById(order.getId());
|
|
|
|
|
- /** 通知待使用*/
|
|
|
|
|
- customerNoticeService.insertTCustomerNotice(TCustomerNotice.builder().customerId(customer.getId()).commodityId(order.getId())
|
|
|
|
|
- .content("您有一张" + orderManage.getCommodityName() + "商品待使用。").title("订单信息")
|
|
|
|
|
- .createBy(orderManage.getCreateBy()).status("0")
|
|
|
|
|
- .build());
|
|
|
|
|
- // 若使用积分 则订单金额减去积分金额
|
|
|
|
|
- if(orderManageTotal.getIntegralDeduction() != BigDecimal.ZERO && orderManageTotal.getIntegralDeduction() != null){
|
|
|
|
|
- order.setOrderMoney(orderManage.getOrderMoney().subtract(orderManageTotal.getIntegralDeduction()));
|
|
|
|
|
- order.setIntegralDeduction(orderManageTotal.getIntegralDeduction());
|
|
|
|
|
|
|
+ // 接入支付接口
|
|
|
|
|
+ LinePayAPOD resp = linePay.pay(orderManageTotal, orderManageTotalService.getDeptName(orderManageTotal.getId()));
|
|
|
|
|
+
|
|
|
|
|
+ //ok
|
|
|
|
|
+ if (resp != null && "0000".equals(resp.returnCode)) {
|
|
|
|
|
+ //set the transactionId to the db.
|
|
|
|
|
+ orderManageTotal.setTransactionId(resp.info.transactionId);
|
|
|
|
|
+
|
|
|
|
|
+ orderManageTotalService.updateTOrderManageTotal(orderManageTotal);
|
|
|
|
|
+
|
|
|
|
|
+ return AjaxResult.success(resp.info);
|
|
|
|
|
+ }
|
|
|
|
|
+ //line支付error
|
|
|
|
|
+ return AjaxResult.error("LINE PAY失敗しました。");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 支付回调接口,需接入支付接口后,填写该回调URL,进行订单支付
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param orderManageTotal
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Log(title = "キャンセルCallBack", operatorType = OperatorType.MOBILE, businessType = BusinessType.INSERT)
|
|
|
|
|
+ @RepeatSubmit
|
|
|
|
|
+ @PostMapping("/cancel")
|
|
|
|
|
+ public AjaxResult apayCancelCallBack(@RequestBody LineCallBankParam param) {
|
|
|
|
|
+ //
|
|
|
|
|
+ TOrderManageTotal select = new TOrderManageTotal();
|
|
|
|
|
+
|
|
|
|
|
+ select.setTransactionId(param.getTransactionId());
|
|
|
|
|
+ select.setId(param.getOrderId());
|
|
|
|
|
+ select.setDelFlag("1");
|
|
|
|
|
+
|
|
|
|
|
+ orderManageTotalService.updateTOrderManageTotal(select);
|
|
|
|
|
+
|
|
|
|
|
+ return AjaxResult.success("支払キャンセルしました。");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 支付回调接口,需接入支付接口后,填写该回调URL,进行订单支付
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param orderManageTotal
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Log(title = "用户支付CallBack", operatorType = OperatorType.MOBILE, businessType = BusinessType.INSERT)
|
|
|
|
|
+ @RepeatSubmit
|
|
|
|
|
+ @PostMapping("/confirm")
|
|
|
|
|
+ public AjaxResult aiPayCallBack(@RequestBody LineCallBankParam param) {
|
|
|
|
|
+ //
|
|
|
|
|
+ TOrderManageTotal select = new TOrderManageTotal();
|
|
|
|
|
+
|
|
|
|
|
+ select.setTransactionId(param.getTransactionId());
|
|
|
|
|
+ select.setId(param.getOrderId());
|
|
|
|
|
+
|
|
|
|
|
+ List<TOrderManageTotal> lst = orderManageTotalService.selectTOrderManageTotalList(select);
|
|
|
|
|
+
|
|
|
|
|
+ TOrderManageTotal orderManageTotal = lst.get(0);
|
|
|
|
|
+
|
|
|
|
|
+ // 接入支付接口
|
|
|
|
|
+ LinePayConfirmAPOD resp = linePay.payConfirm(orderManageTotal.getTransactionId(), orderManageTotal.getOrderMoney().longValue());
|
|
|
|
|
+
|
|
|
|
|
+ if ("0000".equals(resp.returnCode)) {
|
|
|
|
|
+ //set order list
|
|
|
|
|
+ TOrderManage orderPram = new TOrderManage();
|
|
|
|
|
+ orderPram.setOrderTotalId(param.getOrderId());
|
|
|
|
|
+
|
|
|
|
|
+ List<TOrderManage> orderList = orderManageService.selectTOrderManageList(orderPram);
|
|
|
|
|
+
|
|
|
|
|
+ orderManageTotal.setOrderList(orderList);
|
|
|
|
|
+ TCustomerManage customer = customerManageService.selectTCustomerManageById(getLoginUser().getLoginCustomer().getId());
|
|
|
|
|
+ // 多/单订单支付
|
|
|
|
|
+ for (TOrderManage order : orderManageTotal.getOrderList()) {
|
|
|
|
|
+ TOrderManage orderManage = orderManageService.selectTOrderManageById(order.getId());
|
|
|
|
|
+ /** 通知待使用*/
|
|
|
|
|
+ customerNoticeService.insertTCustomerNotice(TCustomerNotice.builder().customerId(customer.getId()).commodityId(order.getId())
|
|
|
|
|
+ .content("您有一张" + orderManage.getCommodityName() + "商品待使用。").title("订单信息")
|
|
|
|
|
+ .createBy(orderManage.getCreateBy()).status("0")
|
|
|
|
|
+ .build());
|
|
|
|
|
+ // 若使用积分 则订单金额减去积分金额
|
|
|
|
|
+ if(orderManageTotal.getIntegralDeduction() != BigDecimal.ZERO && orderManageTotal.getIntegralDeduction() != null){
|
|
|
|
|
+ order.setOrderMoney(orderManage.getOrderMoney().subtract(orderManageTotal.getIntegralDeduction()));
|
|
|
|
|
+ order.setIntegralDeduction(orderManageTotal.getIntegralDeduction());
|
|
|
|
|
+ }
|
|
|
|
|
+ order.setStatus("1");// 已支付 支付状态,若接入支付回调,则变更为支付中状态-9,支付回调成功后变更为1-已支付
|
|
|
|
|
+ order.setPayDate(new Date());
|
|
|
|
|
+ orderManageService.updateTOrderManage(order);
|
|
|
}
|
|
}
|
|
|
- order.setStatus("1");// 已支付 支付状态,若接入支付回调,则变更为支付中状态-9,支付回调成功后变更为1-已支付
|
|
|
|
|
- order.setPayDate(new Date());
|
|
|
|
|
- orderManageService.updateTOrderManage(order);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- // 获取场馆积分获取比例
|
|
|
|
|
- List<TCustomerIntegralSet> tCustomerIntegralSets = customerIntegralSetService.selectTCustomerIntegralSetList(TCustomerIntegralSet.builder().deptId(getLoginUser().getLoginCustomer().getDeptId()).build());
|
|
|
|
|
- BigDecimal orderIntegral = orderManageTotal.getOrderMoney();
|
|
|
|
|
- if (tCustomerIntegralSets.size() > 0) {
|
|
|
|
|
- // 计算分销人员奖励
|
|
|
|
|
- BigDecimal proportion = new BigDecimal(tCustomerIntegralSets.get(0).getProportion()).divide(new BigDecimal("100"));
|
|
|
|
|
- orderIntegral= (orderManageTotal.getOrderMoney().multiply(proportion)).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 获取场馆积分获取比例
|
|
|
|
|
+ List<TCustomerIntegralSet> tCustomerIntegralSets = customerIntegralSetService.selectTCustomerIntegralSetList(TCustomerIntegralSet.builder().deptId(getLoginUser().getLoginCustomer().getDeptId()).build());
|
|
|
|
|
+ BigDecimal orderIntegral = orderManageTotal.getOrderMoney();
|
|
|
|
|
+ if (tCustomerIntegralSets.size() > 0) {
|
|
|
|
|
+ // 计算分销人员奖励
|
|
|
|
|
+ BigDecimal proportion = new BigDecimal(tCustomerIntegralSets.get(0).getProportion()).divide(new BigDecimal("100"));
|
|
|
|
|
+ orderIntegral= (orderManageTotal.getOrderMoney().multiply(proportion)).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- // 记录用户积分
|
|
|
|
|
- customerIntegralRecordService.insertTCustomerIntegralRecord(TCustomerIntegralRecord.builder().
|
|
|
|
|
- supIntegral(customer.getIntegral()==null?"0":customer.getIntegral().toString()).integralNum(String.valueOf(orderIntegral.longValue())).integralType("1")
|
|
|
|
|
- .createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getId()).customerId(customer.getId()).deptId(getLoginUser().getDeptId())
|
|
|
|
|
- .build());
|
|
|
|
|
- /** 增加用户积分*/
|
|
|
|
|
- customer.setIntegral(customer.getIntegral()==null?0:customer.getIntegral() + orderIntegral.longValue());
|
|
|
|
|
- customerManageService.updateTCustomerManage(customer);
|
|
|
|
|
-
|
|
|
|
|
- // 会员减去积分
|
|
|
|
|
- if(orderManageTotal.getIntegralDeduction() != null && orderManageTotal.getIntegralDeduction() != BigDecimal.ZERO){
|
|
|
|
|
- customer.setIntegral(customer.getIntegral() - orderManageTotal.getIntegralDeduction().longValue());
|
|
|
|
|
- customerManageService.updateTCustomerManage(customer);
|
|
|
|
|
- // 记录减去用户积分
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ // 记录用户积分
|
|
|
customerIntegralRecordService.insertTCustomerIntegralRecord(TCustomerIntegralRecord.builder().
|
|
customerIntegralRecordService.insertTCustomerIntegralRecord(TCustomerIntegralRecord.builder().
|
|
|
- supIntegral(customer.getIntegral().toString()).integralNum(orderManageTotal.getIntegralDeduction().toString()).integralType("4")
|
|
|
|
|
- .createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getOrderList().get(0).getId()).customerId(customer.getId()).deptId(getLoginUser().getDeptId())
|
|
|
|
|
|
|
+ supIntegral(customer.getIntegral()==null?"0":customer.getIntegral().toString()).integralNum(String.valueOf(orderIntegral.longValue())).integralType("1")
|
|
|
|
|
+ .createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getId()).customerId(customer.getId()).deptId(getLoginUser().getDeptId())
|
|
|
.build());
|
|
.build());
|
|
|
- }
|
|
|
|
|
|
|
+ /** 增加用户积分*/
|
|
|
|
|
+ customer.setIntegral(customer.getIntegral()==null?0:customer.getIntegral() + orderIntegral.longValue());
|
|
|
|
|
+ customerManageService.updateTCustomerManage(customer);
|
|
|
|
|
|
|
|
- // 是否有分销
|
|
|
|
|
- if (orderManageTotal.getDistributionId() != null) {
|
|
|
|
|
- // 获取场馆分销比例
|
|
|
|
|
- List<TCustomerDistributionSet> tCustomerDistributionSets = customerDistributionSetService.selectTCustomerDistributionSetList(TCustomerDistributionSet.builder().deptId(getLoginUser().getLoginCustomer().getDeptId()).build());
|
|
|
|
|
- if (tCustomerDistributionSets.size() > 0) {
|
|
|
|
|
- // 计算分销人员奖励
|
|
|
|
|
- BigDecimal proportion = new BigDecimal(tCustomerDistributionSets.get(0).getProportion()).divide(new BigDecimal("100"));
|
|
|
|
|
- BigDecimal integral = (orderManageTotal.getOrderMoney().multiply(proportion)).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
|
-
|
|
|
|
|
- // 增加用户积分
|
|
|
|
|
- TCustomerManage customerManage = customerManageService.selectTCustomerManageById(orderManageTotal.getDistributionId());
|
|
|
|
|
- customerManage.setIntegral(customerManage.getIntegral() + integral.longValue());
|
|
|
|
|
- customerManageService.updateTCustomerManage(customerManage);
|
|
|
|
|
-
|
|
|
|
|
- // 记录分销
|
|
|
|
|
- customerDistributionRecordService.insertTCustomerDistributionRecord(
|
|
|
|
|
- TCustomerDistributionRecord.builder().customerId(orderManageTotal.getDistributionId()).deptId(getLoginUser().getLoginCustomer().getDeptId())
|
|
|
|
|
- .distributionIntegral(integral.toString()).createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getId()).build());
|
|
|
|
|
|
|
+ // 会员减去积分
|
|
|
|
|
+ if(orderManageTotal.getIntegralDeduction() != null && orderManageTotal.getIntegralDeduction() != BigDecimal.ZERO){
|
|
|
|
|
+ customer.setIntegral(customer.getIntegral() - orderManageTotal.getIntegralDeduction().longValue());
|
|
|
|
|
+ customerManageService.updateTCustomerManage(customer);
|
|
|
|
|
+ // 记录减去用户积分
|
|
|
|
|
+ customerIntegralRecordService.insertTCustomerIntegralRecord(TCustomerIntegralRecord.builder().
|
|
|
|
|
+ supIntegral(customer.getIntegral().toString()).integralNum(orderManageTotal.getIntegralDeduction().toString()).integralType("4")
|
|
|
|
|
+ .createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getOrderList().get(0).getId()).customerId(customer.getId()).deptId(getLoginUser().getDeptId())
|
|
|
|
|
+ .build());
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- // 查询总订单下-是否还有未支付的信息
|
|
|
|
|
- List<TOrderManage> orderManageList = orderManageService.selectTOrderManageList(TOrderManage.builder().
|
|
|
|
|
- orderTotalId(orderManageTotal.getId()).status("0").build());
|
|
|
|
|
- if(orderManageList.size() <= 0){
|
|
|
|
|
- orderManageTotal.setStatus("1");
|
|
|
|
|
- orderManageTotalService.updateTOrderManageTotal(orderManageTotal);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 是否有分销
|
|
|
|
|
+ if (orderManageTotal.getDistributionId() != null) {
|
|
|
|
|
+ // 获取场馆分销比例
|
|
|
|
|
+ List<TCustomerDistributionSet> tCustomerDistributionSets = customerDistributionSetService.selectTCustomerDistributionSetList(TCustomerDistributionSet.builder().deptId(getLoginUser().getLoginCustomer().getDeptId()).build());
|
|
|
|
|
+ if (tCustomerDistributionSets.size() > 0) {
|
|
|
|
|
+ // 计算分销人员奖励
|
|
|
|
|
+ BigDecimal proportion = new BigDecimal(tCustomerDistributionSets.get(0).getProportion()).divide(new BigDecimal("100"));
|
|
|
|
|
+ BigDecimal integral = (orderManageTotal.getOrderMoney().multiply(proportion)).setScale(0, BigDecimal.ROUND_DOWN);
|
|
|
|
|
+
|
|
|
|
|
+ // 增加用户积分
|
|
|
|
|
+ TCustomerManage customerManage = customerManageService.selectTCustomerManageById(orderManageTotal.getDistributionId());
|
|
|
|
|
+ customerManage.setIntegral(customerManage.getIntegral() + integral.longValue());
|
|
|
|
|
+ customerManageService.updateTCustomerManage(customerManage);
|
|
|
|
|
+
|
|
|
|
|
+ // 记录分销
|
|
|
|
|
+ customerDistributionRecordService.insertTCustomerDistributionRecord(
|
|
|
|
|
+ TCustomerDistributionRecord.builder().customerId(orderManageTotal.getDistributionId()).deptId(getLoginUser().getLoginCustomer().getDeptId())
|
|
|
|
|
+ .distributionIntegral(integral.toString()).createBy(getLoginUser().getLoginCustomer().getUsername()).orderId(orderManageTotal.getId()).build());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- return AjaxResult.success();
|
|
|
|
|
|
|
+ // 查询总订单下-是否还有未支付的信息
|
|
|
|
|
+ List<TOrderManage> orderManageList = orderManageService.selectTOrderManageList(TOrderManage.builder().
|
|
|
|
|
+ orderTotalId(orderManageTotal.getId()).status("0").build());
|
|
|
|
|
+ if(orderManageList.size() <= 0){
|
|
|
|
|
+ orderManageTotal.setStatus("1");
|
|
|
|
|
+ orderManageTotalService.updateTOrderManageTotal(orderManageTotal);
|
|
|
|
|
+ }
|
|
|
|
|
+ return AjaxResult.success("支払成功");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return AjaxResult.success("支払失敗した");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|