| @@ -23,6 +23,7 @@ import com.iformall.service.WxCouponChannelService; | |||
| import com.iformall.service.WxCouponService; | |||
| import com.iformall.service.WxOrderService; | |||
| import com.iformall.service.order.OrderFactory; | |||
| import com.iformall.service.order.entity.WxComposeOrder; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -62,6 +63,9 @@ public class WxOrderController extends BaseController { | |||
| @Autowired | |||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| @Autowired | |||
| OrderFactory orderFactory; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @@ -187,7 +191,8 @@ public class WxOrderController extends BaseController { | |||
| return new ResultData(ErrorCode.COUPON_IS_NOT_FREE); | |||
| } | |||
| // 免费券 | |||
| order = wxOrderService.saveFreeOrderForCoupon(false,null,user, coupon, 1, | |||
| WxComposeOrder composeOrder = orderFactory.getOrderAdapterService(EnumComposeOrder.SINGLE.getCode()).createDBMainOrder(coupon, user, 0, EnumPayWay.PAY_WAY_NOT_UNPAY_CREDIT); | |||
| order = wxOrderService.saveFreeOrderForCoupon(false,composeOrder,user, coupon, 1, | |||
| orderSaveDto.getCouponChannelId(), orderSaveDto.getFormId(), null,EnumPayWay.PAY_WAY_NOT_UNPAY_CREDIT, | |||
| EnumOrderShopingType.ONLINE_PURCHASE.getCode(),null); | |||
| return new ResultData(order); | |||
| @@ -8,6 +8,7 @@ import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.order.OrderFactory; | |||
| import com.iformall.service.order.entity.WxComposeOrder; | |||
| import com.iformall.utils.Constant; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @@ -38,6 +39,9 @@ public class WxCouponPasswordController extends BaseController { | |||
| @Autowired | |||
| private WxCUserBasicInfoService userService; | |||
| @Autowired | |||
| OrderFactory orderFactory; | |||
| @ApiOperation(value = "根据卡密领卡", notes = "{\"password\":\"String\",\"formId\":\"String\"}") | |||
| @PostMapping("getCouponOrderByPassword") | |||
| public ResultData getCouponOrderByPassword(@RequestBody Map<String, String> params) { | |||
| @@ -97,7 +101,8 @@ public class WxCouponPasswordController extends BaseController { | |||
| // 3. 领取free coupon | |||
| try { | |||
| WxOrder order = orderService.saveFreeOrderForCoupon(false,null,member, coupon, 1, | |||
| WxComposeOrder composeOrder = orderFactory.getOrderAdapterService(EnumComposeOrder.SINGLE.getCode()).createDBMainOrder(coupon, member, 0, payWay); | |||
| WxOrder order = orderService.saveFreeOrderForCoupon(false,composeOrder,member, coupon, 1, | |||
| null, formId, couponPassword.getId(),payWay, | |||
| EnumOrderShopingType.ONLINE_PURCHASE.getCode(),null); | |||
| } catch (MallinkException e) { | |||
| @@ -2619,22 +2619,10 @@ public class WxOrderServiceImpl implements WxOrderService { | |||
| if(EnumOrderShopingType.DISTRIBUTION.getCode().equals(shippingType)){ | |||
| record.setShippingAddress(JSON.toJSONString(address)); | |||
| } | |||
| if (null != composeOrder) { | |||
| record.setComposeOrderId(composeOrder.getMainOrderId()); | |||
| //if (EnumComposeOrder.childOrderIsSingle(composeOrder.getComposeOrderType())) { | |||
| // record.setComposeOrderType(EnumComposeOrder.SINGLE.getCode()); | |||
| //}else { | |||
| record.setComposeOrderType(composeOrder.getComposeOrderType()); | |||
| //} | |||
| }else { | |||
| record.setComposeOrderType(EnumComposeOrder.SINGLE.getCode()); | |||
| record.setComposeOrderId(0L); | |||
| } | |||
| record.setComposeOrderId(composeOrder.getMainOrderId()); | |||
| record.setComposeOrderType(composeOrder.getComposeOrderType()); | |||
| record.setCouponNumber(couponNumber); | |||
| try { | |||
| if(EnumComposeOrder.isSingle(composeOrder.getComposeOrderType())) { | |||
| record.setId(composeOrder.getMainOrderId()); | |||
| } | |||
| proxy.saveFreeOrder(record, user, coupon); | |||
| } catch (Exception e) { | |||
| logger.error("下订单错误:" + e.getMessage(),e); | |||
| @@ -17,6 +17,8 @@ public interface OrderAdapterService { | |||
| */ | |||
| WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user,List<OrderComposeSaveDto> orderSave,EnumPayWay payWay); | |||
| WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user,int payment,EnumPayWay payWay); | |||
| /** | |||
| * 获取支付时商品名称,供服务商API使用 | |||
| * @param lastCoupon | |||
| @@ -44,6 +44,13 @@ public class SingleOrderAdapterService extends BaseBatchOrderAdapterService { | |||
| return super.createDBMainOrder(tenantEntity,user, orderSave, payWay, EnumComposeOrder.SINGLE); | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public WxComposeOrder createDBMainOrder(TenantEntity tenantEntity, WxCUserBasicInfo user, int payment, | |||
| EnumPayWay payWay) { | |||
| return super.createDBMainOrder(tenantEntity,user, payment, payWay, EnumComposeOrder.SINGLE); | |||
| } | |||
| @Override | |||
| public boolean isOneNumberOneOrder() { | |||
| return true; | |||
| @@ -81,4 +88,6 @@ public class SingleOrderAdapterService extends BaseBatchOrderAdapterService { | |||
| return lastCoupon.getTitle(); | |||
| } | |||
| } | |||
| @@ -61,11 +61,6 @@ public abstract class BaseBatchOrderAdapterService implements OrderAdapterServic | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| protected WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user,List<OrderComposeSaveDto> orderSave,EnumPayWay payWay,EnumComposeOrder composeOrderType) { | |||
| WxBatchOrder order =new WxBatchOrder(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| order.setId(idWorker.nextId()); | |||
| order.setCUserId(user.getId()); | |||
| order.updateTenantInfo(tenantEntity); | |||
| int payment = 0; | |||
| for (OrderComposeSaveDto ocsd : orderSave) { | |||
| boolean isPress = ocsd.getSignleOrder().isPressOrder(); | |||
| @@ -73,6 +68,16 @@ public abstract class BaseBatchOrderAdapterService implements OrderAdapterServic | |||
| payment = payment+price.getRealPayMent(); | |||
| } | |||
| return createDBMainOrder(tenantEntity, user, payment, payWay, composeOrderType); | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| protected WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user,int payment,EnumPayWay payWay,EnumComposeOrder composeOrderType) { | |||
| WxBatchOrder order =new WxBatchOrder(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| order.setId(idWorker.nextId()); | |||
| order.setCUserId(user.getId()); | |||
| order.updateTenantInfo(tenantEntity); | |||
| order.setPayment(payment); | |||
| order.setPayVendor(payWay.getCode()); | |||
| order.setOrderType(composeOrderType.getCode()); | |||
| @@ -33,6 +33,13 @@ public class CouponPackageOrderAdapterService extends BaseBatchOrderAdapterServi | |||
| public WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user,List<OrderComposeSaveDto> orderSave,EnumPayWay payWay) { | |||
| return super.createDBMainOrder(tenantEntity,user, orderSave, payWay, EnumComposeOrder.PACKAGECOUPON); | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public WxComposeOrder createDBMainOrder(TenantEntity tenantEntity, WxCUserBasicInfo user, int payment, | |||
| EnumPayWay payWay) { | |||
| return super.createDBMainOrder(tenantEntity, user, payment, payWay, EnumComposeOrder.PACKAGECOUPON); | |||
| } | |||
| @Override | |||
| public WxComposeOrder getComposeOrder(Long mainOrderId, String tenantId) { | |||
| @@ -66,4 +73,6 @@ public class CouponPackageOrderAdapterService extends BaseBatchOrderAdapterServi | |||
| return "[券包]"+lastCoupon.getTitle(); | |||
| } | |||
| } | |||
| @@ -7,6 +7,8 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import com.iformall.domain.dto.OrderComposeSaveDto; | |||
| import com.iformall.enums.EnumComposeOrder; | |||
| @@ -26,11 +28,19 @@ public class MulityNumberOneOrderBatchOrderAdapterService extends BaseBatchOrder | |||
| return false; | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user, List<OrderComposeSaveDto> orderSave, | |||
| EnumPayWay payWay) { | |||
| return super.createDBMainOrder(tenantEntity,user, orderSave, payWay, EnumComposeOrder.MULITY_NUMBER_ORDER_BATCH); | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public WxComposeOrder createDBMainOrder(TenantEntity tenantEntity, WxCUserBasicInfo user, int payment, | |||
| EnumPayWay payWay) { | |||
| return super.createDBMainOrder(tenantEntity,user, payment, payWay, EnumComposeOrder.MULITY_NUMBER_ORDER_BATCH); | |||
| } | |||
| @Override | |||
| public WxComposeOrder getComposeOrder(Long mainOrderId, String tenantId) { | |||
| @@ -50,5 +60,7 @@ public class MulityNumberOneOrderBatchOrderAdapterService extends BaseBatchOrder | |||
| public String getPayProductName(WxCoupon lastCoupon) { | |||
| return "批量支付商品"; | |||
| } | |||
| } | |||
| @@ -6,6 +6,8 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Propagation; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import com.iformall.domain.dto.OrderComposeSaveDto; | |||
| import com.iformall.enums.EnumComposeOrder; | |||
| @@ -25,11 +27,19 @@ public class OneNumberOneOrderBatchOrderAdapterService extends BaseBatchOrderAda | |||
| return true; | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public WxComposeOrder createDBMainOrder(TenantEntity tenantEntity,WxCUserBasicInfo user, List<OrderComposeSaveDto> orderSave, | |||
| EnumPayWay payWay) { | |||
| return super.createDBMainOrder(tenantEntity,user, orderSave, payWay, EnumComposeOrder.ONE_NUMBER_ORDER_BATCH); | |||
| } | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| @Override | |||
| public WxComposeOrder createDBMainOrder(TenantEntity tenantEntity, WxCUserBasicInfo user, int payment, | |||
| EnumPayWay payWay) { | |||
| return super.createDBMainOrder(tenantEntity,user, payment, payWay, EnumComposeOrder.ONE_NUMBER_ORDER_BATCH); | |||
| } | |||
| @Override | |||
| public WxComposeOrder getComposeOrder(Long mainOrderId, String tenantId) { | |||
| @@ -50,5 +60,7 @@ public class OneNumberOneOrderBatchOrderAdapterService extends BaseBatchOrderAda | |||
| public String getPayProductName(WxCoupon lastCoupon) { | |||
| return "批量支付商品"; | |||
| } | |||
| } | |||