|
@@ -22,8 +22,10 @@ import com.cyksj.mapper.market.task.UserBindDetailMapper;
|
|
|
import com.cyksj.model.dto.AliPayParams;
|
|
import com.cyksj.model.dto.AliPayParams;
|
|
|
import com.cyksj.model.dto.H5JsPayParams;
|
|
import com.cyksj.model.dto.H5JsPayParams;
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
-import com.cyksj.model.manage.views.OrderDonSearchView;
|
|
|
|
|
import com.cyksj.model.manage.views.OrderDonView;
|
|
import com.cyksj.model.manage.views.OrderDonView;
|
|
|
|
|
+import com.cyksj.model.manage.views.OrderMasterDetailView;
|
|
|
|
|
+import com.cyksj.model.manage.views.OrderMasterDonView;
|
|
|
|
|
+import com.cyksj.model.manage.views.OrderMasterSearchView;
|
|
|
import com.cyksj.model.request.AlipayOrderDonReq;
|
|
import com.cyksj.model.request.AlipayOrderDonReq;
|
|
|
import com.cyksj.model.request.OrderPayRequest;
|
|
import com.cyksj.model.request.OrderPayRequest;
|
|
|
import com.cyksj.model.response.AliPayTradeStatus;
|
|
import com.cyksj.model.response.AliPayTradeStatus;
|
|
@@ -60,7 +62,6 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
import java.io.OutputStream;
|
|
|
-import java.math.BigDecimal;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -138,9 +139,9 @@ public class OrderController {
|
|
|
/**
|
|
/**
|
|
|
* 0元订单确认
|
|
* 0元订单确认
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("/post/order/status/{orderId}")
|
|
|
|
|
- public Result<String> zeroOrderConfirm(@PathVariable Long orderId) {
|
|
|
|
|
- orderDonService.zeroOrderConfirm(orderId);
|
|
|
|
|
|
|
+ @PostMapping("/post/order/status/{mOid}")
|
|
|
|
|
+ public Result<String> zeroOrderConfirm(@PathVariable Long mOid) {
|
|
|
|
|
+ orderDonService.zeroOrderConfirm(mOid);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -150,12 +151,12 @@ public class OrderController {
|
|
|
* @author chan
|
|
* @author chan
|
|
|
* @date 2021-10-11 下午4:56
|
|
* @date 2021-10-11 下午4:56
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("/post/pay/{orderId}")
|
|
|
|
|
- public Result<H5JsPayParams> pay(@PathVariable Long orderId) throws Exception {
|
|
|
|
|
|
|
+ @PostMapping("/post/pay/{mOid}")
|
|
|
|
|
+ public Result<H5JsPayParams> pay(@PathVariable Long mOid) throws Exception {
|
|
|
final String methodName = "吊起微信支付";
|
|
final String methodName = "吊起微信支付";
|
|
|
- log.info("{}[start] orderId:{}",methodName,orderId);
|
|
|
|
|
|
|
+ log.info("{}[start] orderId:{}",methodName,mOid);
|
|
|
|
|
|
|
|
- H5JsPayParams payParams = orderDonService.pay(orderId, "JSAPI");
|
|
|
|
|
|
|
+ H5JsPayParams payParams = orderDonService.pay(mOid, "JSAPI");
|
|
|
|
|
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(payParams);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(payParams);
|
|
|
}
|
|
}
|
|
@@ -164,10 +165,10 @@ public class OrderController {
|
|
|
* 调用生成订单之后
|
|
* 调用生成订单之后
|
|
|
* 微信网页预下单获取交易链接生成二维码
|
|
* 微信网页预下单获取交易链接生成二维码
|
|
|
*/
|
|
*/
|
|
|
- @PostMapping("/get/wx/orderQrCode/{orderId}")
|
|
|
|
|
- public Result<String> createUnifiedOrderQr(@PathVariable Long orderId) throws Exception {
|
|
|
|
|
|
|
+ @PostMapping("/get/wx/orderQrCode/{mOid}")
|
|
|
|
|
+ public Result<String> createUnifiedOrderQr(@PathVariable Long mOid) throws Exception {
|
|
|
//预下单
|
|
//预下单
|
|
|
- H5JsPayParams payParams = orderDonService.wxPcWebPay(orderId, "NATIVE");
|
|
|
|
|
|
|
+ H5JsPayParams payParams = orderDonService.wxPcWebPay(mOid, "NATIVE");
|
|
|
//获取二维码链接code_url
|
|
//获取二维码链接code_url
|
|
|
String codeUrl = payParams.getCodeUrl();
|
|
String codeUrl = payParams.getCodeUrl();
|
|
|
QrConfig qrConfig = new QrConfig(300, 300);
|
|
QrConfig qrConfig = new QrConfig(300, 300);
|
|
@@ -249,9 +250,9 @@ public class OrderController {
|
|
|
@PostMapping("/post/pay/zfb")
|
|
@PostMapping("/post/pay/zfb")
|
|
|
@Deprecated
|
|
@Deprecated
|
|
|
public Result<String> aliPay(@RequestBody @Validated AlipayOrderDonReq re) throws Exception {
|
|
public Result<String> aliPay(@RequestBody @Validated AlipayOrderDonReq re) throws Exception {
|
|
|
- Long orderId = re.getOrderId();
|
|
|
|
|
|
|
+ Long mOid = re.getOrderId();
|
|
|
String returnUrl = re.getReturnUrl();
|
|
String returnUrl = re.getReturnUrl();
|
|
|
- AliPayParams aliPayParams = orderDonService.aliPay(orderId, returnUrl, ZfbProductCode.MOBILE_WEB.getProductCode(), null);
|
|
|
|
|
|
|
+ AliPayParams aliPayParams = orderDonService.aliPay(mOid, returnUrl, ZfbProductCode.MOBILE_WEB.getProductCode(), null);
|
|
|
// response.setContentType("text/html;charset=" + BaseZfbConfig.charset);
|
|
// response.setContentType("text/html;charset=" + BaseZfbConfig.charset);
|
|
|
//直接将完整的表单html输出到页面
|
|
//直接将完整的表单html输出到页面
|
|
|
// response.getWriter().write(aliPayParams.getBody());
|
|
// response.getWriter().write(aliPayParams.getBody());
|
|
@@ -266,9 +267,9 @@ public class OrderController {
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/get/zfb/orderQrCode")
|
|
@PostMapping("/get/zfb/orderQrCode")
|
|
|
public Result<String> zfbWebQrCode(@RequestBody @Validated AlipayOrderDonReq re) throws Exception {
|
|
public Result<String> zfbWebQrCode(@RequestBody @Validated AlipayOrderDonReq re) throws Exception {
|
|
|
- Long orderId = re.getOrderId();
|
|
|
|
|
|
|
+ Long mOid = re.getOrderId();
|
|
|
String returnUrl = re.getReturnUrl();
|
|
String returnUrl = re.getReturnUrl();
|
|
|
- AliPayParams aliPayParams = orderDonService.aliPay(orderId, returnUrl, ZfbProductCode.PC_WEB.getProductCode(), BaseZfbConfig.qrPayMode_orderCode);
|
|
|
|
|
|
|
+ AliPayParams aliPayParams = orderDonService.aliPay(mOid, returnUrl, ZfbProductCode.PC_WEB.getProductCode(), BaseZfbConfig.qrPayMode_orderCode);
|
|
|
// response.setContentType("text/html;charset=" + BaseZfbConfig.charset);
|
|
// response.setContentType("text/html;charset=" + BaseZfbConfig.charset);
|
|
|
//直接将完整的表单html输出到页面
|
|
//直接将完整的表单html输出到页面
|
|
|
// response.getWriter().write(aliPayParams.getBody());
|
|
// response.getWriter().write(aliPayParams.getBody());
|
|
@@ -283,9 +284,9 @@ public class OrderController {
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("/get/zfb/orderRedirect")
|
|
@PostMapping("/get/zfb/orderRedirect")
|
|
|
public Result<String> zfbWebRedirectQrCode(@RequestBody @Validated AlipayOrderDonReq re) throws Exception {
|
|
public Result<String> zfbWebRedirectQrCode(@RequestBody @Validated AlipayOrderDonReq re) throws Exception {
|
|
|
- Long orderId = re.getOrderId();
|
|
|
|
|
|
|
+ Long mOid = re.getOrderId();
|
|
|
String returnUrl = re.getReturnUrl();
|
|
String returnUrl = re.getReturnUrl();
|
|
|
- AliPayParams aliPayParams = orderDonService.aliPay(orderId, returnUrl, ZfbProductCode.PC_WEB.getProductCode(), BaseZfbConfig.qrPayMode_redirect);
|
|
|
|
|
|
|
+ AliPayParams aliPayParams = orderDonService.aliPay(mOid, returnUrl, ZfbProductCode.PC_WEB.getProductCode(), BaseZfbConfig.qrPayMode_redirect);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(aliPayParams.getBody());
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(aliPayParams.getBody());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -339,33 +340,51 @@ public class OrderController {
|
|
|
* 获取订单列表
|
|
* 获取订单列表
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/get")
|
|
@GetMapping("/get")
|
|
|
- public Result<SearchResult<OrderDonView>> list(String customId){
|
|
|
|
|
|
|
+ public Result<SearchResult<OrderMasterDonView>> list(String customId, String status) {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
Long yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
|
|
Long yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
|
|
|
List<Long> userIds = UserBindRelationService.getRelationUserIdList(userId, null);
|
|
List<Long> userIds = UserBindRelationService.getRelationUserIdList(userId, null);
|
|
|
- SearchResult<OrderDonView> search = beanSearcher.search(OrderDonView.class, builder
|
|
|
|
|
- .field(OrderDonView::getYhsId, yhsId)
|
|
|
|
|
- .field(OrderDonView::getUserId, userIds).op(Operator.InList)
|
|
|
|
|
- .orderBy(OrderDonView::getId).desc()
|
|
|
|
|
- .build());
|
|
|
|
|
- search.getDataList().forEach(data->{
|
|
|
|
|
- Integer count = availableBenefitsMapper.selectCount(Wrappers.lambdaQuery(UserPayEquipmentAvailableBenefits.class)
|
|
|
|
|
- .eq(UserPayEquipmentAvailableBenefits::getRealOrderId, data.getId())
|
|
|
|
|
- .eq(UserPayEquipmentAvailableBenefits::getDeleted, true));
|
|
|
|
|
- data.setIsHasBenefits(count > 0 ? true : false);
|
|
|
|
|
- if (data.getIsBenefits() != null && data.getIsBenefits()) {
|
|
|
|
|
- String benefitsList = data.getBenefitsList();
|
|
|
|
|
- if (StrUtil.isNotBlank(benefitsList)) {
|
|
|
|
|
- try {
|
|
|
|
|
- List<Long> skuIds = Jsons.parseList(benefitsList, GoodsDonSku.class).stream().map(GoodsDonSku::getId).collect(Collectors.toList());
|
|
|
|
|
- data.setBenefitsViews(beanSearcher.searchAll(GoodsDonSkuView.class, MapUtils.builder().field(GoodsDonSkuView::getSkuId, skuIds).op(Operator.InList).build()));
|
|
|
|
|
- } catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
|
|
+ String conditionSql = null;
|
|
|
|
|
+ if (StrUtil.isNotBlank(status)) {
|
|
|
|
|
+ StringBuilder conditionSb = new StringBuilder();
|
|
|
|
|
+ conditionSb.append(String.format(" and os.status = %s", status));
|
|
|
|
|
+ conditionSql = String.format(" exists (select count(*) from order_don os where os.m_oid = o.id %s) > 0", conditionSb.toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StrUtil.isNotBlank(conditionSql)) {
|
|
|
|
|
+ builder.put("condition", conditionSql);
|
|
|
|
|
+ }
|
|
|
|
|
+ SearchResult<OrderMasterDonView> search = beanSearcher.search(OrderMasterDonView.class, builder
|
|
|
|
|
+ .field(OrderMasterDonView::getYhsId, yhsId)
|
|
|
|
|
+ .field(OrderMasterDonView::getUserId, userIds).op(Operator.InList)
|
|
|
|
|
+ .orderBy(OrderMasterDonView::getMOid).desc()
|
|
|
|
|
+ .build());
|
|
|
|
|
+ search.getDataList().forEach(mData -> {
|
|
|
|
|
+ List<OrderDonView> orderDonViews = beanSearcher.searchAll(OrderDonView.class, MapUtils.builder()
|
|
|
|
|
+ .field(OrderDonView::getMOid, mData.getMOid())
|
|
|
|
|
+ .orderBy(OrderDonView::getId).desc().build());
|
|
|
|
|
+ mData.setOrderDonViews(orderDonViews);
|
|
|
|
|
+ mData.getOrderDonViews().forEach(data -> {
|
|
|
|
|
+ if (data.getIsBenefits() != null && data.getIsBenefits()) {
|
|
|
|
|
+ String benefitsList = data.getBenefitsList();
|
|
|
|
|
+ if (StrUtil.isNotBlank(benefitsList)) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<Long> skuIds = Jsons.parseList(benefitsList, GoodsDonSku.class).stream().map(GoodsDonSku::getId).collect(Collectors.toList());
|
|
|
|
|
+ data.setBenefitsViews(beanSearcher.searchAll(GoodsDonSkuView.class, MapUtils.builder().field(GoodsDonSkuView::getSkuId, skuIds).op(Operator.InList).build()));
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- data.setWaybill(waybillMapper.selectOne(Wrappers.lambdaQuery(OrderDonWaybill.class).eq(OrderDonWaybill::getOrderId, data.getId()).last("limit 1")));
|
|
|
|
|
|
|
+ if (data.getRelationId() == 0) {
|
|
|
|
|
+ Integer count = availableBenefitsMapper.selectCount(Wrappers.lambdaQuery(UserPayEquipmentAvailableBenefits.class)
|
|
|
|
|
+ .eq(UserPayEquipmentAvailableBenefits::getRealOrderId, data.getId())
|
|
|
|
|
+ .eq(UserPayEquipmentAvailableBenefits::getDeleted, true));
|
|
|
|
|
+ data.setIsHasBenefits(count > 0 ? true : false);
|
|
|
|
|
+ data.setWaybill(waybillMapper.selectOne(Wrappers.lambdaQuery(OrderDonWaybill.class).eq(OrderDonWaybill::getOrderId, data.getId()).last("limit 1")));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
}
|
|
}
|
|
@@ -374,35 +393,36 @@ public class OrderController {
|
|
|
/**
|
|
/**
|
|
|
* 获取订单详情
|
|
* 获取订单详情
|
|
|
*/
|
|
*/
|
|
|
- @GetMapping("/get/{orderId}")
|
|
|
|
|
- public Result<OrderDetailView> detail(@PathVariable Long orderId, Boolean isNoLogin) {
|
|
|
|
|
|
|
+ @GetMapping("/get/{mOid}")
|
|
|
|
|
+ public Result<OrderMasterDetailView> detail(@PathVariable Long mOid, Boolean isNoLogin) {
|
|
|
Long userId = null;
|
|
Long userId = null;
|
|
|
if (isNoLogin == null || !isNoLogin) {
|
|
if (isNoLogin == null || !isNoLogin) {
|
|
|
userId = StpUserUtil.getLoginIdAsLong();
|
|
userId = StpUserUtil.getLoginIdAsLong();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- OrderDetailView detail = orderDonService.getDetail(orderId, userId);
|
|
|
|
|
|
|
+ OrderMasterDetailView detail = orderDonService.getDetail(mOid, userId);
|
|
|
|
|
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(detail);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(detail);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 取消订单
|
|
* 取消订单
|
|
|
|
|
+ * 主订单id
|
|
|
*/
|
|
*/
|
|
|
- @GetMapping("/get/close/{orderId}")
|
|
|
|
|
- public Result<String> closeOrder(@PathVariable Long orderId) {
|
|
|
|
|
|
|
+ @GetMapping("/get/close/{mOid}")
|
|
|
|
|
+ public Result<String> closeOrder(@PathVariable Long mOid) {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
- orderDonService.closeOrder(orderId, userId);
|
|
|
|
|
|
|
+ orderDonService.closeOrder(mOid, userId);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @GetMapping("/get/order/status/{orderId}")
|
|
|
|
|
- public Result<OrderDonSearchView> getOrderStatusById(@PathVariable Long orderId) {
|
|
|
|
|
- if (orderId < 1) {
|
|
|
|
|
|
|
+ @GetMapping("/get/order/status/{mOid}")
|
|
|
|
|
+ public Result<OrderMasterSearchView> getMasterOrderStatusById(@PathVariable Long mOid) {
|
|
|
|
|
+ if (mOid < 1) {
|
|
|
throw BusinessRuntimeException.getInstance("订单不存在");
|
|
throw BusinessRuntimeException.getInstance("订单不存在");
|
|
|
}
|
|
}
|
|
|
- OrderDonSearchView orderDonView = beanSearcher.searchFirst(OrderDonSearchView.class, MapUtils.builder()
|
|
|
|
|
- .put("orderId", String.format("where id = %s", orderId))
|
|
|
|
|
|
|
+ OrderMasterSearchView orderDonView = beanSearcher.searchFirst(OrderMasterSearchView.class, MapUtils.builder()
|
|
|
|
|
+ .field(OrderMasterSearchView::getMOid, mOid)
|
|
|
.build());
|
|
.build());
|
|
|
if (orderDonView == null) {
|
|
if (orderDonView == null) {
|
|
|
throw BusinessRuntimeException.getInstance("订单不存在");
|
|
throw BusinessRuntimeException.getInstance("订单不存在");
|
|
@@ -411,11 +431,17 @@ public class OrderController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/get/noLogin/order")
|
|
@PostMapping("/get/noLogin/order")
|
|
|
- public Result<List<OrderDonView>> getSearchResult(@RequestBody List<Long> orderIds) {
|
|
|
|
|
- List<OrderDonView> orderDonViews = beanSearcher.searchAll(OrderDonView.class, MapUtils.builder()
|
|
|
|
|
- .field(OrderDonView::getId, orderIds).op(Operator.InList)
|
|
|
|
|
- .orderBy(OrderDonView::getId).desc().build());
|
|
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(orderDonViews);
|
|
|
|
|
|
|
+ public Result<List<OrderMasterDonView>> getSearchResult(@RequestBody List<Long> orderIds) {
|
|
|
|
|
+ List<OrderMasterDonView> orderMasterDonViews = beanSearcher.searchAll(OrderMasterDonView.class, MapUtils.builder()
|
|
|
|
|
+ .field(OrderMasterDonView::getMOid, orderIds).op(Operator.InList)
|
|
|
|
|
+ .orderBy(OrderMasterDonView::getMOid).desc().build());
|
|
|
|
|
+ orderMasterDonViews.forEach(mData->{
|
|
|
|
|
+ List<OrderDonView> orderDonViews = beanSearcher.searchAll(OrderDonView.class, MapUtils.builder()
|
|
|
|
|
+ .field(OrderDonView::getMOid, mData.getMOid())
|
|
|
|
|
+ .orderBy(OrderDonView::getId).desc().build());
|
|
|
|
|
+ mData.setOrderDonViews(orderDonViews);
|
|
|
|
|
+ });
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(orderMasterDonViews);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|