付款二维码接口参数改为String,以便后续支持多个订单ID传参
This commit is contained in:
parent
36aa346c2a
commit
842793a74e
|
|
@ -121,7 +121,7 @@ public class OrderMasterController extends BaseController {
|
|||
* 修改详细订单
|
||||
*/
|
||||
@GetMapping("/payQrcode/{orderId}")
|
||||
public String payQrcode(@PathVariable("orderId") Long orderId, ModelMap mmap) {
|
||||
public String payQrcode(@PathVariable("orderId") String orderId, ModelMap mmap) {
|
||||
mmap.put("orderId", orderId);
|
||||
return "/order/master-qrcode";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.ghy.common.core.controller.BaseController;
|
|||
import com.ghy.common.core.domain.AjaxResult;
|
||||
import com.ghy.common.enums.PayStatus;
|
||||
import com.ghy.common.enums.PayTypeEnum;
|
||||
import com.ghy.common.utils.MoneyUtil;
|
||||
import com.ghy.order.domain.OrderDetail;
|
||||
import com.ghy.order.domain.OrderMaster;
|
||||
import com.ghy.order.service.OrderDetailService;
|
||||
|
|
@ -24,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -76,9 +78,11 @@ public class AlipayController extends BaseController {
|
|||
}
|
||||
|
||||
@PostMapping("/addMasterQr")
|
||||
public AjaxResult addMasterQrPay(@RequestBody Long orderId) {
|
||||
public AjaxResult addMasterQrPay(@RequestBody String orderId) {
|
||||
// 不知道为啥参数可能会带上双引号 这里去掉再转Long
|
||||
Long orderMasterId = Long.valueOf(orderId.replace("\"", ""));
|
||||
BigDecimal payMoney = BigDecimal.ZERO;
|
||||
OrderMaster orderMaster = orderMasterService.selectById(orderId);
|
||||
OrderMaster orderMaster = orderMasterService.selectById(orderMasterId);
|
||||
if (orderMaster == null) {
|
||||
return AjaxResult.error("主订单不存在!");
|
||||
}
|
||||
|
|
@ -93,28 +97,13 @@ public class AlipayController extends BaseController {
|
|||
payMoney = payMoney.add(fm.getPayMoney());
|
||||
}
|
||||
|
||||
// 查询关联的加价单
|
||||
FinancialChangeRecord financialChangeRecord = null;
|
||||
// FinancialChangeRecord financialChangeRecord = financialChangeRecordService.selectNotPayRecordByDetailId(orderDetailId);
|
||||
// if (financialChangeRecord != null) {
|
||||
// payMoney = payMoney.add(financialChangeRecord.getChangeMoney());
|
||||
// }
|
||||
//
|
||||
// if (BigDecimal.ZERO.compareTo(payMoney) > -1) {
|
||||
// return AjaxResult.error("不需要支付");
|
||||
// }
|
||||
if (MoneyUtil.lte0(payMoney)) {
|
||||
return AjaxResult.error("不需要支付");
|
||||
}
|
||||
|
||||
// 付款
|
||||
PayParam payParam;
|
||||
if (financialChangeRecord == null) {
|
||||
payParam = PayParam.delayPayParam(orderMaster.getCode() + "_" + System.currentTimeMillis(),
|
||||
payMoney.setScale(2, BigDecimal.ROUND_UNNECESSARY).toString(),
|
||||
"订单支付", "叮咚到家服务");
|
||||
} else {
|
||||
payParam = PayParam.delayPayParam(orderMaster.getCode() + "_" + financialChangeRecord.getId() + "_" + System.currentTimeMillis(),
|
||||
payMoney.setScale(2, BigDecimal.ROUND_UNNECESSARY).toString(),
|
||||
"加价付款", "叮咚到家服务");
|
||||
}
|
||||
PayParam payParam = PayParam.delayPayParam(orderMaster.getCode() + "_" + System.currentTimeMillis(),
|
||||
payMoney.setScale(2, RoundingMode.UNNECESSARY).toString(), "订单支付", "叮咚到家服务");
|
||||
|
||||
JSONObject response;
|
||||
try {
|
||||
|
|
@ -137,12 +126,6 @@ public class AlipayController extends BaseController {
|
|||
fm2update.setPayType(PayTypeEnum.ALIPAY_QR.getCode());
|
||||
financialMasterService.updateFinancialMaster(fm2update);
|
||||
}
|
||||
if (financialChangeRecord != null) {
|
||||
FinancialChangeRecord fcr2update = new FinancialChangeRecord();
|
||||
fcr2update.setId(financialChangeRecord.getId());
|
||||
fcr2update.setPaymentId(paymentId);
|
||||
financialChangeRecordService.update(fcr2update);
|
||||
}
|
||||
return AjaxResult.success(response);
|
||||
}
|
||||
|
||||
|
|
@ -174,7 +157,7 @@ public class AlipayController extends BaseController {
|
|||
payMoney = payMoney.add(financialChangeRecord.getChangeMoney());
|
||||
}
|
||||
|
||||
if (BigDecimal.ZERO.compareTo(payMoney) > -1) {
|
||||
if (MoneyUtil.lte0(payMoney)) {
|
||||
return AjaxResult.error("不需要支付");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -278,6 +278,10 @@
|
|||
shiro:hasPermission="order:order:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
|
||||
<a class="btn btn-default" onclick="mergePay()">
|
||||
<i class="fa fa-money"></i> 付款
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -561,6 +565,16 @@
|
|||
});
|
||||
}
|
||||
|
||||
function mergePay() {
|
||||
table.set();
|
||||
var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
|
||||
if (rows.length === 0) {
|
||||
$.modal.alertWarning("请至少选择一条记录");
|
||||
return;
|
||||
}
|
||||
showPayQrcode(rows.join());
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue