| @@ -102,15 +102,15 @@ public class WxOrderController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("根据id删除接口") | |||||
| @GetMapping("/del") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| @SystemControllerLog(description = "订单管理-删除") | |||||
| public ResultData delete(Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] WxOrderController::delete"); | |||||
| wxOrderService.deleteById(id); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| } | |||||
| // @ApiOperation("根据id删除接口") | |||||
| // @GetMapping("/del") | |||||
| // @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| // @SystemControllerLog(description = "订单管理-删除") | |||||
| // public ResultData delete(Long id) { | |||||
| // logger.debug("[" + getIpAddr() + "] WxOrderController::delete"); | |||||
| // wxOrderService.deleteById(id); | |||||
| // return new ResultData(Result.SUCCESS, "删除成功", null); | |||||
| // } | |||||
| @ApiOperation("根据id查询接口") | @ApiOperation("根据id查询接口") | ||||
| @GetMapping("/findById") | @GetMapping("/findById") | ||||
| @@ -118,7 +118,7 @@ public class WxOrderController extends BaseController { | |||||
| @SystemControllerLog(description = "订单管理-id查询") | @SystemControllerLog(description = "订单管理-id查询") | ||||
| public ResultData findById(Long id) { | public ResultData findById(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxOrderController::findById"); | logger.debug("[" + getIpAddr() + "] WxOrderController::findById"); | ||||
| return new ResultData(Result.SUCCESS, "查询成功", wxOrderService.getById(id)); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxOrderService.getById(id,getTenantInfo().getTenantId())); | |||||
| } | } | ||||
| @@ -425,7 +425,7 @@ public class WxMicroPayController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | ||||
| } | } | ||||
| WxOrder microOrder = wxOrderService.getById(orderId); | |||||
| WxOrder microOrder = wxOrderService.getById(orderId,wxMerchantBUser.getTenantId()); | |||||
| if (microOrder == null) { | if (microOrder == null) { | ||||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | ||||
| } | } | ||||
| @@ -102,7 +102,7 @@ public class WxOrderController extends BaseController { | |||||
| } | } | ||||
| //判断是否是拼团订单,如果是拼团订单,判断现在进行中的,和已完成的数量是否超出券的限制 | //判断是否是拼团订单,如果是拼团订单,判断现在进行中的,和已完成的数量是否超出券的限制 | ||||
| if (coupon.getType().equals(EnumCouponType.COUPON_GROUP.getCode())) { | if (coupon.getType().equals(EnumCouponType.COUPON_GROUP.getCode())) { | ||||
| int ordercount = wxOrderService.countUserCouponGroupOrder(cUserId,coupon.getId()); | |||||
| int ordercount = wxOrderService.countUserCouponGroupOrder(cUserId,coupon.getId(),coupon.getTenantId()); | |||||
| if (ordercount>=coupon.getUseLimitQuantity()) { | if (ordercount>=coupon.getUseLimitQuantity()) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"您当前此券的有效拼团数量达到券的限购次数。"); | return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"您当前此券的有效拼团数量达到券的限购次数。"); | ||||
| } | } | ||||
| @@ -244,7 +244,7 @@ public class WxOrderController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "orderId: " + orderIdStr + ", e: " + e.getMessage()); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL, "orderId: " + orderIdStr + ", e: " + e.getMessage()); | ||||
| } | } | ||||
| try { | try { | ||||
| WxOrder order = wxOrderService.getById(orderId); | |||||
| WxOrder order = wxOrderService.getById(orderId,getTenantInfo().getTenantId()); | |||||
| if (order != null) { | if (order != null) { | ||||
| wxOrderService.updateOrderStatus(order, EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL); | wxOrderService.updateOrderStatus(order, EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL); | ||||
| } | } | ||||
| @@ -273,7 +273,7 @@ public class WxOrderController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "退款订单ID转换失败"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "退款订单ID转换失败"); | ||||
| } | } | ||||
| try { | try { | ||||
| WxOrder order = wxOrderService.getById(orderId); | |||||
| WxOrder order = wxOrderService.getById(orderId,getTenantInfo().getTenantId()); | |||||
| if (order != null) { | if (order != null) { | ||||
| wxOrderService.updateOrderStatus(order, EnumOrderStatus.ORDER_STATUS_REFUND_SUCCESS); | wxOrderService.updateOrderStatus(order, EnumOrderStatus.ORDER_STATUS_REFUND_SUCCESS); | ||||
| } | } | ||||
| @@ -385,7 +385,7 @@ public class WxOrderController extends BaseController { | |||||
| } | } | ||||
| WxOrder order = null; | WxOrder order = null; | ||||
| try { | try { | ||||
| order = wxOrderService.getById(id); | |||||
| order = wxOrderService.getById(id,getTenantInfo().getTenantId()); | |||||
| if (order != null) { | if (order != null) { | ||||
| return new ResultData(Result.SUCCESS, "查询成功", order); | return new ResultData(Result.SUCCESS, "查询成功", order); | ||||
| } else { | } else { | ||||
| @@ -182,7 +182,7 @@ public class WxPayOrderController extends BaseController { | |||||
| if (null == payOrder) { | if (null == payOrder) { | ||||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, "未查询到payOrder."); | return new ResultData(ErrorCode.PAY_ORDER_ERROR, "未查询到payOrder."); | ||||
| } | } | ||||
| WxOrder order = wxOrderService.getById(orderId); | |||||
| WxOrder order = wxOrderService.getById(orderId,payOrder.getTenantId()); | |||||
| if (null == order) { | if (null == order) { | ||||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, "未查询到Order["+orderId+"]."); | return new ResultData(ErrorCode.PAY_ORDER_ERROR, "未查询到Order["+orderId+"]."); | ||||
| } | } | ||||
| @@ -92,7 +92,7 @@ public class WxPressOrderController extends BaseController { | |||||
| order = operations.get(key); | order = operations.get(key); | ||||
| } else { | } else { | ||||
| // 订单没有入缓存,需要从数据库中读取 | // 订单没有入缓存,需要从数据库中读取 | ||||
| order = wxOrderService.getById(orderId); | |||||
| order = wxOrderService.getById(orderId,getTenantInfo().getTenantId()); | |||||
| if (order != null) { | if (order != null) { | ||||
| // 订单优化,进缓存 | // 订单优化,进缓存 | ||||
| orderRedisTemplate.opsForValue().set(key, order, 3600, TimeUnit.SECONDS); | orderRedisTemplate.opsForValue().set(key, order, 3600, TimeUnit.SECONDS); | ||||
| @@ -243,7 +243,7 @@ public class WxPressOrderController extends BaseController { | |||||
| logger.error("orderId convert error, " + orderId + ", e:" + e.getMessage()); | logger.error("orderId convert error, " + orderId + ", e:" + e.getMessage()); | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "orderId: " + orderId + ", e:" + e.getMessage()); | return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "orderId: " + orderId + ", e:" + e.getMessage()); | ||||
| } | } | ||||
| WxOrder order = wxOrderService.getById(orderIdL); | |||||
| WxOrder order = wxOrderService.getById(orderIdL,getTenantInfo().getTenantId()); | |||||
| if(order == null) { | if(order == null) { | ||||
| logger.error("订单不存在:" + orderId); | logger.error("订单不存在:" + orderId); | ||||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | return new ResultData(ErrorCode.ORDER_IS_NOT_FIND); | ||||
| @@ -45,6 +45,7 @@ public class DaliyAmountSchedule { | |||||
| dateMap.put("startDate", startDate); | dateMap.put("startDate", startDate); | ||||
| dateMap.put("endDate", endDate); | dateMap.put("endDate", endDate); | ||||
| dateMap.put("merchantId", merchant.getId()); | dateMap.put("merchantId", merchant.getId()); | ||||
| dateMap.put("tenantId", merchant.getTenantId()); | |||||
| List<WxCouponOrder> list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | List<WxCouponOrder> list = wxCouponOrderMapper.findListOfOrderedByDate(dateMap); | ||||
| logger.info("find " + list.size() + " coupon order from " + startDate + " to " + endDate); | logger.info("find " + list.size() + " coupon order from " + startDate + " to " + endDate); | ||||
| @@ -75,23 +75,35 @@ public class OrderExpiringSchedule { | |||||
| @Autowired | @Autowired | ||||
| WxPayAccountMapper wxPayAccountMapper; | WxPayAccountMapper wxPayAccountMapper; | ||||
| @Autowired | |||||
| WxMallMapper wxMallMapper; | |||||
| @Autowired | @Autowired | ||||
| WxPayOrderService wxPayOrderService; | WxPayOrderService wxPayOrderService; | ||||
| @Autowired | @Autowired | ||||
| PayServiceFactory payServiceFactory; | PayServiceFactory payServiceFactory; | ||||
| private List<WxMall> getMalls() { | |||||
| WxMall wxMall =new WxMall(); | |||||
| return wxMallMapper.findList(wxMall); | |||||
| } | |||||
| @Scheduled(cron = "0 */5 * * * *?") // 每5分钟检查一次 | @Scheduled(cron = "0 */5 * * * *?") // 每5分钟检查一次 | ||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | ||||
| public void orderExpireSchedule() { | public void orderExpireSchedule() { | ||||
| for (EnumPayWay payWay: EnumPayWay.values()) { | |||||
| if(null != payWay.getPlat()) { | |||||
| orderExpireSchedule(payWay); | |||||
| } | |||||
| List<WxMall> malls = getMalls(); | |||||
| for (WxMall mall : malls) { | |||||
| for (EnumPayWay payWay: EnumPayWay.values()) { | |||||
| if(null != payWay.getPlat()) { | |||||
| orderExpireSchedule(payWay,mall.getTenantId()); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| private void orderExpireSchedule(EnumPayWay payWay) { | |||||
| private void orderExpireSchedule(EnumPayWay payWay,String tenantId) { | |||||
| Map dateMap = new HashMap(); | Map dateMap = new HashMap(); | ||||
| Date curDate = new Date(); | Date curDate = new Date(); | ||||
| @@ -103,6 +115,7 @@ public class OrderExpiringSchedule { | |||||
| // 券相关订单, 15分钟未支付, 订单过期 | // 券相关订单, 15分钟未支付, 订单过期 | ||||
| dateMap.put("type", EnumOrderType.COUPON.getCode()); | dateMap.put("type", EnumOrderType.COUPON.getCode()); | ||||
| dateMap.put("endDate", expireDate); | dateMap.put("endDate", expireDate); | ||||
| dateMap.put("tenantId", tenantId); | |||||
| List<WxOrder> orderCoupons = wxOrderMapper.findListOfUnpaidOrderByDate(dateMap); | List<WxOrder> orderCoupons = wxOrderMapper.findListOfUnpaidOrderByDate(dateMap); | ||||
| orderCoupons.stream().forEach( o -> { | orderCoupons.stream().forEach( o -> { | ||||
| try { | try { | ||||
| @@ -117,6 +130,7 @@ public class OrderExpiringSchedule { | |||||
| Date pressExpireDate = new Date(curDate.getTime() - PRESS_TIME_OUT ); | Date pressExpireDate = new Date(curDate.getTime() - PRESS_TIME_OUT ); | ||||
| dateMap.put("type", EnumOrderType.COUPON.getCode()); | dateMap.put("type", EnumOrderType.COUPON.getCode()); | ||||
| dateMap.put("endDate", pressExpireDate); | dateMap.put("endDate", pressExpireDate); | ||||
| dateMap.put("tenantId", tenantId); | |||||
| List<WxOrder> orderPresss = wxOrderMapper.findListOfCompleteUnPaidPressOrderByDate(dateMap); | List<WxOrder> orderPresss = wxOrderMapper.findListOfCompleteUnPaidPressOrderByDate(dateMap); | ||||
| orderPresss.stream().forEach( o -> { | orderPresss.stream().forEach( o -> { | ||||
| try { | try { | ||||
| @@ -128,6 +142,7 @@ public class OrderExpiringSchedule { | |||||
| // 2. 当前已超过砍价结束时间, 订单过期 | // 2. 当前已超过砍价结束时间, 订单过期 | ||||
| dateMap.put("type", EnumOrderType.COUPON.getCode()); | dateMap.put("type", EnumOrderType.COUPON.getCode()); | ||||
| dateMap.put("endDate", curDate); | dateMap.put("endDate", curDate); | ||||
| dateMap.put("tenantId", tenantId); | |||||
| orderPresss = wxOrderMapper.findListOfUnpaidPressOrderByDate(dateMap); | orderPresss = wxOrderMapper.findListOfUnpaidPressOrderByDate(dateMap); | ||||
| orderPresss.stream().forEach( o -> { | orderPresss.stream().forEach( o -> { | ||||
| try { | try { | ||||
| @@ -151,6 +166,7 @@ public class OrderExpiringSchedule { | |||||
| Date groupExpireDate = new Date(curDate.getTime() - NORMAL_TIME_OUT ); | Date groupExpireDate = new Date(curDate.getTime() - NORMAL_TIME_OUT ); | ||||
| dateMap.put("type", EnumOrderType.COUPON.getCode()); | dateMap.put("type", EnumOrderType.COUPON.getCode()); | ||||
| dateMap.put("endDate", groupExpireDate); | dateMap.put("endDate", groupExpireDate); | ||||
| dateMap.put("tenantId", tenantId); | |||||
| List<WxOrder> orderGroups = wxOrderMapper.findListOfUnpaidGroupOrderByDate(dateMap); | List<WxOrder> orderGroups = wxOrderMapper.findListOfUnpaidGroupOrderByDate(dateMap); | ||||
| orderGroups.stream().forEach( o -> { | orderGroups.stream().forEach( o -> { | ||||
| try { | try { | ||||
| @@ -162,9 +178,10 @@ public class OrderExpiringSchedule { | |||||
| //更新拼团过期状态 | //更新拼团过期状态 | ||||
| wxOrderMapper.updateOrderStatusForGroup(); | |||||
| wxOrderMapper.updateOrderStatusForGroup(tenantId); | |||||
| //拼团过期 | //拼团过期 | ||||
| order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_OVERTIME.getCode()); | order.setOrderStatus(EnumOrderStatus.ORDER_STATUS_COOPERATING_OVERTIME.getCode()); | ||||
| order.setTenantId(tenantId); | |||||
| wxOrderMapper.selectList(new QueryWrapper(order)).stream().forEach(o -> { | wxOrderMapper.selectList(new QueryWrapper(order)).stream().forEach(o -> { | ||||
| try { | try { | ||||
| proxy.expiredAndReturnMoney((WxOrder) o,false,payWay); | proxy.expiredAndReturnMoney((WxOrder) o,false,payWay); | ||||
| @@ -236,6 +253,7 @@ public class OrderExpiringSchedule { | |||||
| public boolean wxPaySuccess(WxOrder order,boolean autoReHandle,EnumPayWay payWay) throws MallinkException, Exception { | public boolean wxPaySuccess(WxOrder order,boolean autoReHandle,EnumPayWay payWay) throws MallinkException, Exception { | ||||
| WxPayOrder payOrderq = new WxPayOrder(); | WxPayOrder payOrderq = new WxPayOrder(); | ||||
| payOrderq.setOrderId(order.getId()); | payOrderq.setOrderId(order.getId()); | ||||
| payOrderq.setTenantId(order.getTenantId()); | |||||
| List<WxPayOrder> payorderlist = wxPayOrderMapper.findList(payOrderq); | List<WxPayOrder> payorderlist = wxPayOrderMapper.findList(payOrderq); | ||||
| if (null == payorderlist || payorderlist.size() <=0 ) { | if (null == payorderlist || payorderlist.size() <=0 ) { | ||||
| return false; | return false; | ||||
| @@ -300,6 +318,7 @@ public class OrderExpiringSchedule { | |||||
| updateOrder.setId(order.getId()); | updateOrder.setId(order.getId()); | ||||
| updateOrder.setUpdateDate(new Date()); | updateOrder.setUpdateDate(new Date()); | ||||
| updateOrder.setOrderStatus(EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL.getCode()); | updateOrder.setOrderStatus(EnumOrderStatus.ORDER_STATUS_OVERTIME_CANCEL.getCode()); | ||||
| updateOrder.updateTenantInfo(order); | |||||
| wxOrderMapper.updateById(updateOrder); | wxOrderMapper.updateById(updateOrder); | ||||
| logger.info("券订单: " + order.getId() + " create at " + order.getCreateDate() + " expired at " + new Date()); | logger.info("券订单: " + order.getId() + " create at " + order.getCreateDate() + " expired at " + new Date()); | ||||
| @@ -9,8 +9,12 @@ import java.util.HashMap; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import org.apache.ibatis.annotations.Param; | |||||
| public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | ||||
| WxOrder selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| List<WxOrder> findList(WxOrder wxOrder); | List<WxOrder> findList(WxOrder wxOrder); | ||||
| Integer countList(WxOrder wxOrder); | Integer countList(WxOrder wxOrder); | ||||
| @@ -58,6 +62,6 @@ public interface WxOrderMapper extends CommonMapper<WxOrder, Long> { | |||||
| void updateOrderGroupStatusByCouponChannelId(WxOrder updateOrder); | void updateOrderGroupStatusByCouponChannelId(WxOrder updateOrder); | ||||
| void updateOrderStatusForGroup(); | |||||
| void updateOrderStatusForGroup(@Param("tenantId")String tenantId); | |||||
| } | } | ||||
| @@ -120,7 +120,7 @@ public interface WxOrderService { | |||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxOrder getById(Long id); | |||||
| WxOrder getById(Long id,String tenantId); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -128,7 +128,7 @@ public interface WxOrderService { | |||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxOrder getPressOrderById(Long id); | |||||
| WxOrder getPressOrderById(Long id,String tenantId); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| @@ -142,7 +142,7 @@ public interface WxOrderService { | |||||
| * | * | ||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | |||||
| //void deleteById(Long id); | |||||
| /** | /** | ||||
| * 条件查询不分页 | * 条件查询不分页 | ||||
| * @param record | * @param record | ||||
| @@ -235,8 +235,8 @@ public interface WxOrderService { | |||||
| Long saveOuterOrderForCoupon(WxCUserBasicInfo user, WxCoupon coupon, Long couponChannelId, String formId, Long couponPasswordId); | Long saveOuterOrderForCoupon(WxCUserBasicInfo user, WxCoupon coupon, Long couponChannelId, String formId, Long couponPasswordId); | ||||
| int countGroupOrder(Long groupId,boolean ignoreUnPay); | |||||
| int countGroupOrder(Long groupId,boolean ignoreUnPay,String tenantId); | |||||
| int countUserCouponGroupOrder(Long cuserId,Long couponId); | |||||
| int countUserCouponGroupOrder(Long cuserId,Long couponId,String tenantId); | |||||
| } | } | ||||
| @@ -678,6 +678,7 @@ public class MarkingDataReportServiceImpl implements MarkingDataReportService { | |||||
| } else { | } else { | ||||
| params.put("endTime", addDay(1)); | params.put("endTime", addDay(1)); | ||||
| } | } | ||||
| params.put("tenantId", wxOrderReportDto.getTenantId()); | |||||
| List<WxOrderReportVo> list = wxOrderMapper.listMicroPayOrderReportByDateAndMerchant(params); | List<WxOrderReportVo> list = wxOrderMapper.listMicroPayOrderReportByDateAndMerchant(params); | ||||
| String startdate = DateUtils.getTimeBefore(30, new Date()); | String startdate = DateUtils.getTimeBefore(30, new Date()); | ||||
| @@ -82,7 +82,7 @@ public class WxOrderGroupServiceImpl implements WxOrderGroupService { | |||||
| } | } | ||||
| if (stocksetlock) { | if (stocksetlock) { | ||||
| //此处拼团数量应从订单总数查询,支付成功的就算一个,没支付成功的不算. 提高拼团的成功率 | //此处拼团数量应从订单总数查询,支付成功的就算一个,没支付成功的不算. 提高拼团的成功率 | ||||
| int ordercount = wxOrderService.countGroupOrder(order.getOrderGroupId(),true); | |||||
| int ordercount = wxOrderService.countGroupOrder(order.getOrderGroupId(),true,order.getTenantId()); | |||||
| Integer remainPeople = wxCoupon.getPressLimitNum()-ordercount-1; | Integer remainPeople = wxCoupon.getPressLimitNum()-ordercount-1; | ||||
| if (remainPeople < 0) { | if (remainPeople < 0) { | ||||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD.getCode(),"参团失败,参团人数已满,将稍后退款."); | throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FAILD.getCode(),"参团失败,参团人数已满,将稍后退款."); | ||||
| @@ -280,6 +280,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| dateMap.put("endDate", endDate); | dateMap.put("endDate", endDate); | ||||
| dateMap.put("merchantId", wxMerchant.getId()); | dateMap.put("merchantId", wxMerchant.getId()); | ||||
| dateMap.put("type", type); | dateMap.put("type", type); | ||||
| dateMap.put("tenantId", wxMerchantBUser.getTenantId()); | |||||
| Map resultMap = new HashMap(); | Map resultMap = new HashMap(); | ||||
| @@ -342,6 +343,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| dateMap.put("endDate", endDate); | dateMap.put("endDate", endDate); | ||||
| dateMap.put("merchantId", wxMerchant.getId()); | dateMap.put("merchantId", wxMerchant.getId()); | ||||
| dateMap.put("type", type); | dateMap.put("type", type); | ||||
| dateMap.put("tenantId", wxMerchantBUser.getTenantId()); | |||||
| Map resultMap = new HashMap(); | Map resultMap = new HashMap(); | ||||
| @@ -1658,14 +1660,13 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxOrder getById(Long id) { | |||||
| return wxOrderMapper.selectById(id); | |||||
| public WxOrder getById(Long id,String tenantId) { | |||||
| return wxOrderMapper.selectById(id,tenantId); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxOrder getPressOrderById(Long id) { | |||||
| return wxOrderMapper.selectById(id); | |||||
| public WxOrder getPressOrderById(Long id,String tenantId) { | |||||
| return wxOrderMapper.selectById(id,tenantId); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -1680,10 +1681,10 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxOrderMapper.deleteById(id); | |||||
| } | |||||
| // @Override | |||||
| // public void deleteById(Long id) { | |||||
| // wxOrderMapper.deleteById(id); | |||||
| // } | |||||
| @Override | @Override | ||||
| public List<WxOrder> findList(WxOrder record) { | public List<WxOrder> findList(WxOrder record) { | ||||
| @@ -2332,7 +2333,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| //判断拼团人数是否已经超出限制 | //判断拼团人数是否已经超出限制 | ||||
| int groupCount = countGroupOrder(orderGroupId,true); | |||||
| int groupCount = countGroupOrder(orderGroupId,true,group.getTenantId()); | |||||
| if (groupCount>=coupon.getPressLimitNum()) { | if (groupCount>=coupon.getPressLimitNum()) { | ||||
| throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FINISHED.getCode(),"下单人数超出优惠券人数限制!"); | throw new MallinkException(ErrorCode.ORDER_GROUP_COOPERATING_FINISHED.getCode(),"下单人数超出优惠券人数限制!"); | ||||
| } | } | ||||
| @@ -2353,7 +2354,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public int countGroupOrder(Long groupId,boolean ignoreUnPay) { | |||||
| public int countGroupOrder(Long groupId,boolean ignoreUnPay,String tenantId) { | |||||
| WxOrder query = new WxOrder(); | WxOrder query = new WxOrder(); | ||||
| query.setOrderGroupId(groupId); | query.setOrderGroupId(groupId); | ||||
| List<Integer> statusS = new ArrayList<Integer>(); | List<Integer> statusS = new ArrayList<Integer>(); | ||||
| @@ -2364,11 +2365,12 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_UNPAID.getCode()); | ||||
| } | } | ||||
| query.setStatusS(statusS); | query.setStatusS(statusS); | ||||
| query.setTenantId(tenantId); | |||||
| return wxOrderMapper.countList(query); | return wxOrderMapper.countList(query); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public int countUserCouponGroupOrder(Long cuserId, Long couponId) { | |||||
| public int countUserCouponGroupOrder(Long cuserId, Long couponId,String tenantId) { | |||||
| WxOrder query = new WxOrder(); | WxOrder query = new WxOrder(); | ||||
| query.setCUserId(cuserId); | query.setCUserId(cuserId); | ||||
| query.setProductId(couponId); | query.setProductId(couponId); | ||||
| @@ -2376,8 +2378,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING.getCode()); | statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING.getCode()); | ||||
| statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode()); | statusS.add(EnumOrderStatus.ORDER_STATUS_COOPERATING_COMPLETE.getCode()); | ||||
| query.setStatusS(statusS); | query.setStatusS(statusS); | ||||
| query.setTenantId(tenantId); | |||||
| return wxOrderMapper.countList(query); | return wxOrderMapper.countList(query); | ||||
| } | } | ||||
| } | } | ||||
| @@ -44,7 +44,7 @@ public class FmInsideOrderSuccessMsgServiceImpl implements MsgSendService { | |||||
| @Override | @Override | ||||
| public void send(BaseMsg baseMsg) throws Exception{ | public void send(BaseMsg baseMsg) throws Exception{ | ||||
| FmInsideOrderSuccessMsg msg = (FmInsideOrderSuccessMsg)baseMsg; | FmInsideOrderSuccessMsg msg = (FmInsideOrderSuccessMsg)baseMsg; | ||||
| WxOrder record = orderService.getById(msg.getOrderId()); | |||||
| WxOrder record = orderService.getById(msg.getOrderId(),msg.getTenantId()); | |||||
| if(record == null) { | if(record == null) { | ||||
| logger.error("订单未找到: " + msg.getOrderId()); | logger.error("订单未找到: " + msg.getOrderId()); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND.getCode(), "订单未找到" + msg.getOrderId()); | throw new MallinkException(ErrorCode.ORDER_IS_NOT_FIND.getCode(), "订单未找到" + msg.getOrderId()); | ||||
| @@ -129,6 +129,10 @@ | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </sql> | </sql> | ||||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns"/> from wx_order where id =#{id} and tenant_id=#{tenantId} | |||||
| </select> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxOrder" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxOrder" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| @@ -175,7 +179,7 @@ | |||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_order | from wx_order | ||||
| where order_status = '0' and press_end_date is null | |||||
| where order_status = '0' and press_end_date is null and tenant_id = #{tenantId} | |||||
| <if test="type != null"> | <if test="type != null"> | ||||
| AND type = #{type,jdbcType=TINYINT} | AND type = #{type,jdbcType=TINYINT} | ||||
| </if> | </if> | ||||
| @@ -191,7 +195,7 @@ | |||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_order | from wx_order | ||||
| where press_end_date is not null and (order_status = 6 or order_status = 7) | |||||
| where press_end_date is not null and (order_status = 6 or order_status = 7) and tenant_id = #{tenantId} | |||||
| <if test="type != null"> | <if test="type != null"> | ||||
| AND type = #{type,jdbcType=TINYINT} | AND type = #{type,jdbcType=TINYINT} | ||||
| </if> | </if> | ||||
| @@ -207,7 +211,7 @@ | |||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_order | from wx_order | ||||
| where press_end_date is not null and order_status = 7 | |||||
| where press_end_date is not null and order_status = 7 and tenant_id = #{tenantId} | |||||
| <if test="type != null"> | <if test="type != null"> | ||||
| AND type = #{type,jdbcType=TINYINT} | AND type = #{type,jdbcType=TINYINT} | ||||
| </if> | </if> | ||||
| @@ -223,7 +227,7 @@ | |||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_order | from wx_order | ||||
| where order_status = 15 and press_end_date is null | |||||
| where order_status = 15 and press_end_date is null and tenant_id = #{tenantId} | |||||
| <if test="type != null"> | <if test="type != null"> | ||||
| AND type = #{type,jdbcType=TINYINT} | AND type = #{type,jdbcType=TINYINT} | ||||
| </if> | </if> | ||||
| @@ -590,7 +594,7 @@ | |||||
| from wx_order o | from wx_order o | ||||
| inner join wx_merchant_b_user bu on bu.id = o.product_id | inner join wx_merchant_b_user bu on bu.id = o.product_id | ||||
| inner join wx_merchant m on m.id = bu.merchant_id | inner join wx_merchant m on m.id = bu.merchant_id | ||||
| where m.`id` = #{merchantId} and o.`type` = 1 and o.`order_status` = 1 | |||||
| where m.`id` = #{merchantId} and o.tenant_id = #{tenantId} and o.`type` = 1 and o.`order_status` = 1 | |||||
| <if test=" null != startTime and null != endTime"> | <if test=" null != startTime and null != endTime"> | ||||
| and o.`create_date` BETWEEN #{startTime} and #{endTime} | and o.`create_date` BETWEEN #{startTime} and #{endTime} | ||||
| </if> | </if> | ||||
| @@ -976,8 +980,8 @@ | |||||
| </if> | </if> | ||||
| </update> | </update> | ||||
| <update id="updateOrderStatusForGroup"> | |||||
| update wx_order set order_status=12 where `type`=0 and order_status in(10,15) and now()>press_end_date | |||||
| <update id="updateOrderStatusForGroup" parameterType="java.util.HashMap"> | |||||
| update wx_order set order_status=12 where `type`=0 and tenant_id = #{tenantId} and order_status in(10,15) and now()>press_end_date | |||||
| </update> | </update> | ||||
| </mapper> | </mapper> | ||||