| @@ -123,7 +123,7 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||||
| return new ResultData(goodsTemplateGet); | return new ResultData(goodsTemplateGet); | ||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("allTreeList error.",e); | |||||
| logger.error("getTemplate error.",e); | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | return new ResultData(Result.ERROR,e.getMessage()); | ||||
| } | } | ||||
| } | } | ||||
| @@ -148,7 +148,7 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||||
| boolean isSaas = this.isGoodLifeSaas(); | boolean isSaas = this.isGoodLifeSaas(); | ||||
| return ttCouponGoodsService.productSave(coupon,isSaas); | return ttCouponGoodsService.productSave(coupon,isSaas); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("allTreeList error.",e); | |||||
| logger.error("product save error.",e); | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | return new ResultData(Result.ERROR,e.getMessage()); | ||||
| } | } | ||||
| } | } | ||||
| @@ -164,7 +164,7 @@ public class TtCouponGoodsController extends DouyinBaseController { | |||||
| boolean isSaas = this.isGoodLifeSaas(); | boolean isSaas = this.isGoodLifeSaas(); | ||||
| return ttCouponGoodsService.productDraftGet(getTenantInfo(),id,isSaas); | return ttCouponGoodsService.productDraftGet(getTenantInfo(),id,isSaas); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("allTreeList error.",e); | |||||
| logger.error("product draft error.",e); | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | return new ResultData(Result.ERROR,e.getMessage()); | ||||
| } | } | ||||
| @@ -0,0 +1,73 @@ | |||||
| package com.iformall.controller.market; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.po.WxCouponOrderReservation; | |||||
| import com.iformall.domain.po.base.BaseEntity; | |||||
| import com.iformall.service.WxCouponOrderReservationService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @RestController | |||||
| @RequestMapping("wxCouponOrderReservation") | |||||
| @Api(description = "查询预约接口") | |||||
| public class WxCouponOrderReservationController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxCouponOrderReservationService wxCouponOrderReservationService; | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| public ResultData list(@ModelAttribute WxCouponOrderReservation reservation, Integer pageNum, Integer pageSize) { | |||||
| if (reservation == null) reservation = new WxCouponOrderReservation(); | |||||
| reservation.updateTenantInfo(getTenantInfo()); | |||||
| reservation.setSortColumns(BaseEntity.SortField.CreateDate_DESC,BaseEntity.SortField.Id_DESC); | |||||
| PageInfo<WxCouponOrderReservation> wxCouponOrderReservationPageInfo = wxCouponOrderReservationService.listAsPage(reservation, pageNum, pageSize); | |||||
| return new ResultData(wxCouponOrderReservationPageInfo); | |||||
| } | |||||
| @ApiOperation(value = "卡券详情接口") | |||||
| @GetMapping("detail") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "预约ID", dataType = "Long", paramType = "query", required = true) | |||||
| }) | |||||
| public ResultData detail(@RequestParam("id") Long id) { | |||||
| if(id == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| WxCouponOrderReservation reservation = wxCouponOrderReservationService.getById(id, getTenantInfo().getTenantId()); | |||||
| return new ResultData(reservation); | |||||
| } | |||||
| @ApiOperation(value = "修改状态") | |||||
| @PostMapping("updateStatus") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "预约ID", dataType = "Long", paramType = "query", required = true) | |||||
| }) | |||||
| public ResultData updateStatus(@RequestBody WxCouponOrderReservation reservation) { | |||||
| if(reservation.getId() == null || reservation.getStatus() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| WxCouponOrderReservation updReservation = new WxCouponOrderReservation(); | |||||
| updReservation.updateTenantInfo(getTenantInfo()); | |||||
| updReservation.setId(reservation.getId()); | |||||
| updReservation.setStatus(reservation.getStatus()); | |||||
| updReservation.setRemark(reservation.getRemark()); | |||||
| wxCouponOrderReservationService.saveOrUpdate(updReservation); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,135 @@ | |||||
| DROP TABLE IF EXISTS `wx_coupon_order_reservation`; | |||||
| CREATE TABLE `wx_coupon_order_reservation` ( | |||||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||||
| `tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', | |||||
| `parent_tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | |||||
| `coupon_order_id` bigint(20) NOT NULL, | |||||
| `coupon_id` bigint(20) NOT NULL COMMENT '单张券ID', | |||||
| `coupon_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `c_user_id` bigint(20) UNSIGNED NOT NULL COMMENT 'c端用户id', | |||||
| `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `user_phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `user_region` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `user_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `start_date` datetime(0) DEFAULT NULL, | |||||
| `end_date` datetime(0) DEFAULT NULL, | |||||
| `describe` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `describe_img` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `status` smallint(1) NOT NULL, | |||||
| `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `finish_time` datetime(0) DEFAULT NULL, | |||||
| `btenant_id` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `buser_id` bigint(20) DEFAULT NULL, | |||||
| `buser_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `buser_phone` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `merchant_id` bigint(20) DEFAULT NULL, | |||||
| `create_date` datetime(0) DEFAULT CURRENT_TIMESTAMP, | |||||
| `update_date` datetime(0) DEFAULT CURRENT_TIMESTAMP, | |||||
| `is_del` smallint(1) NOT NULL, | |||||
| PRIMARY KEY (`id`) USING BTREE, | |||||
| UNIQUE INDEX `id_UNIQUE`(`id`) USING BTREE, | |||||
| UNIQUE INDEX `coupon_order_id`(`coupon_order_id`) USING BTREE | |||||
| ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '' ROW_FORMAT = Dynamic; | |||||
| create table wx_coupon_order_reservation_0 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_1 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_2 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_3 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_4 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_5 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_6 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_7 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_8 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_9 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_10 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_11 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_12 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_13 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_14 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_15 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_16 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_17 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_18 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_19 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_20 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_21 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_22 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_23 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_24 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_25 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_26 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_27 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_28 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_29 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_30 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_31 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_32 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_33 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_34 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_35 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_36 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_37 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_38 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_39 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_40 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_41 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_42 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_43 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_44 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_45 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_46 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_47 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_48 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_49 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_50 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_51 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_52 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_53 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_54 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_55 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_56 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_57 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_58 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_59 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_60 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_61 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_62 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_63 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_64 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_65 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_66 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_67 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_68 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_69 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_70 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_71 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_72 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_73 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_74 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_75 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_76 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_77 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_78 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_79 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_80 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_81 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_82 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_83 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_84 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_85 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_86 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_87 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_88 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_89 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_90 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_91 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_92 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_93 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_94 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_95 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_96 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_97 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_98 like wx_coupon_order_reservation; | |||||
| create table wx_coupon_order_reservation_99 like wx_coupon_order_reservation; | |||||
| @@ -0,0 +1,99 @@ | |||||
| package com.iformall.controller; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxCouponOrderReservation; | |||||
| import com.iformall.enums.EnumCouponOrderReservationStatus; | |||||
| import com.iformall.service.WxCouponOrderReservationService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @RestController | |||||
| @RequestMapping("wxCouponOrderReservation") | |||||
| @Api(description = "查询预约接口") | |||||
| public class WxCouponOrderReservationController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxCouponOrderReservationService wxCouponOrderReservationService; | |||||
| @ApiOperation("分页列表接口") | |||||
| @GetMapping("getUserReservation") | |||||
| @ApiImplicitParams({}) | |||||
| public ResultData getUserReservation(@RequestParam("couponOrderId") Long couponOrderId) { | |||||
| if(couponOrderId == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| WxCouponOrderReservation reservation = new WxCouponOrderReservation(); | |||||
| reservation.updateTenantInfo(getTenantInfo()); | |||||
| reservation.setCUserId(getMemberId()); | |||||
| reservation.setCouponOrderId(couponOrderId); | |||||
| reservation = wxCouponOrderReservationService.findUserReservation(reservation); | |||||
| return new ResultData(reservation); | |||||
| } | |||||
| @ApiOperation(value = "详情接口") | |||||
| @GetMapping("detail") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "预约ID", dataType = "Long", paramType = "query", required = true) | |||||
| }) | |||||
| public ResultData detail(@RequestParam("id") Long id) { | |||||
| if(id == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| WxCouponOrderReservation reservation = wxCouponOrderReservationService.getById(id, getTenantInfo().getTenantId()); | |||||
| if(reservation != null && !getMemberId().equals(reservation.getcUserId())){ | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||||
| } | |||||
| return new ResultData(reservation); | |||||
| } | |||||
| @ApiOperation(value = "") | |||||
| @PostMapping("saveOrUpdate") | |||||
| @ApiImplicitParams({ | |||||
| }) | |||||
| public ResultData saveOrUpdate(@RequestBody WxCouponOrderReservation reservation) { | |||||
| if(reservation.getId() == null){ | |||||
| if(reservation.getStartDate() == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"startDate is null"); | |||||
| } | |||||
| if(reservation.getEndDate() == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"endDate is null"); | |||||
| } | |||||
| } | |||||
| if(reservation.getCouponOrderId() == null){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"couponOrderId is null"); | |||||
| } | |||||
| reservation.updateTenantInfo(getTenantInfo()); | |||||
| reservation.setcUserId(getMemberId()); | |||||
| return wxCouponOrderReservationService.saveOrUpdate(reservation); | |||||
| } | |||||
| @ApiOperation(value = "取消预约") | |||||
| @PostMapping("cancelReservation") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "预约ID", dataType = "Long", paramType = "query", required = true) | |||||
| }) | |||||
| public ResultData cancelReservation(@RequestBody WxCouponOrderReservation reservation) { | |||||
| if(reservation.getId() == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| WxCouponOrderReservation updReservation = new WxCouponOrderReservation(); | |||||
| updReservation.updateTenantInfo(getTenantInfo()); | |||||
| updReservation.setId(reservation.getId()); | |||||
| updReservation.setStatus(EnumCouponOrderReservationStatus.reservation_user_cancellation.getCode()); | |||||
| wxCouponOrderReservationService.saveOrUpdate(updReservation); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | |||||
| @@ -8,10 +8,7 @@ import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxCouponOrderService; | |||||
| import com.iformall.service.WxOrderService; | |||||
| import com.iformall.service.WxProfitSharingOrderService; | |||||
| import com.iformall.service.WxRefundOrderService; | |||||
| import com.iformall.service.*; | |||||
| import com.iformall.service.order.entity.WxComposeChildOrderShare; | import com.iformall.service.order.entity.WxComposeChildOrderShare; | ||||
| import com.iformall.utils.DateUtils; | import com.iformall.utils.DateUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -37,6 +34,9 @@ public class CouponOrderExpiringSchedule { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponOrderService wxCouponOrderService; | private WxCouponOrderService wxCouponOrderService; | ||||
| @Autowired | |||||
| private WxCouponOrderReservationService wxCouponOrderReservationService; | |||||
| @Autowired | @Autowired | ||||
| private WxRefundOrderService wxRefundOrderService; | private WxRefundOrderService wxRefundOrderService; | ||||
| @@ -160,6 +160,9 @@ public class CouponOrderExpiringSchedule { | |||||
| updateRecord.updateTenantInfo(co); | updateRecord.updateTenantInfo(co); | ||||
| wxCouponOrderMapper.updateById(updateRecord); | wxCouponOrderMapper.updateById(updateRecord); | ||||
| //取消在线预约 | |||||
| wxCouponOrderReservationService.cancelReservation(co,EnumCouponOrderReservationStatus.reservation_expire_cancellation); | |||||
| // 库存退回 | // 库存退回 | ||||
| if(bStockBack) { | if(bStockBack) { | ||||
| WxOrder order = wxOrderMapper.selectById(co.getOrderId(),co.getTenantId()); | WxOrder order = wxOrderMapper.selectById(co.getOrderId(),co.getTenantId()); | ||||
| @@ -193,6 +193,13 @@ public class BaseMyBatisConfiguration { | |||||
| wxCouponOrderSharding.setCount(100); | wxCouponOrderSharding.setCount(100); | ||||
| wxCouponOrderSharding.setRule(EnumShardingRule.HASH.getCode()); | wxCouponOrderSharding.setRule(EnumShardingRule.HASH.getCode()); | ||||
| shardingList.add(wxCouponOrderSharding); | shardingList.add(wxCouponOrderSharding); | ||||
| ShardingSphere wxCouponOrderReservationSharding = new ShardingSphere(); | |||||
| wxCouponOrderReservationSharding.setColumn("tenant_id"); | |||||
| wxCouponOrderReservationSharding.setTableName("wx_coupon_order_reservation"); | |||||
| wxCouponOrderReservationSharding.setCount(100); | |||||
| wxCouponOrderReservationSharding.setRule(EnumShardingRule.HASH.getCode()); | |||||
| shardingList.add(wxCouponOrderReservationSharding); | |||||
| // ShardingSphere wxCouponSendSharding = new ShardingSphere(); | // ShardingSphere wxCouponSendSharding = new ShardingSphere(); | ||||
| // wxCouponSendSharding.setColumn("tenant_id"); | // wxCouponSendSharding.setColumn("tenant_id"); | ||||
| @@ -0,0 +1,86 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.Date; | |||||
| @TableName(value = "wx_coupon_order_reservation") | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxCouponOrderReservation extends TenantEntity { | |||||
| protected Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "券码", name = "couponOrderId") | |||||
| private Long couponOrderId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "卡券ID", name = "couponId") | |||||
| private Long couponId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "couponTitle") | |||||
| private String couponTitle; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "c端用户id", name = "cUserId") | |||||
| private Long cUserId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "userName") | |||||
| private String userName; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "userPhone") | |||||
| private String userPhone; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "userRegion") | |||||
| private String userRegion; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "userAddress") | |||||
| private String userAddress; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "startDate") | |||||
| private Date startDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "endDate") | |||||
| private Date endDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "描述", name = "describe") | |||||
| private String describe; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "描述", name = "describeImg") | |||||
| private String describeImg; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "EnumCouponOrderReservationStatus", name = "status") | |||||
| private Integer status; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "remark") | |||||
| private String remark; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "finishTime") | |||||
| private Date finishTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "btenantId") | |||||
| private String btenantId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "merchantId") | |||||
| private Long merchantId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "buserId") | |||||
| private Long buserId; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "buserName") | |||||
| private String buserName; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "buserPhone") | |||||
| private String buserPhone; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate") | |||||
| private Date createDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate") | |||||
| private Date updateDate; | |||||
| public Long getcUserId() { | |||||
| return cUserId; | |||||
| } | |||||
| public void setcUserId(Long cUserId) { | |||||
| this.cUserId = cUserId; | |||||
| } | |||||
| public Long getCUserId() { | |||||
| return cUserId; | |||||
| } | |||||
| public void setCUserId(Long cUserId) { | |||||
| this.cUserId = cUserId; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,45 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumCouponOrderReservationStatus { | |||||
| // 0-可投放;1-已作废; | |||||
| reservation(0, "预约"), | |||||
| reservation_user_cancellation(1, "用户取消"), | |||||
| reservation_expire_cancellation(2, "过期取消"), | |||||
| reservation_refund_cancellation(3, "退款取消"), | |||||
| reservation_refuse_cancellation(4, "拒绝服务"), | |||||
| reservation_dispatch(5, "已派单"), | |||||
| reservation_refuse_dispatch(6, "派单被拒绝"), | |||||
| reservation_accept_cancellation(7, "派单已接受"), | |||||
| reservation_finish_cancellation(8, "服务已完成"), | |||||
| reservation_evaluate_cancellation(9, "服务已评价"), | |||||
| ; | |||||
| public static EnumCouponOrderReservationStatus getEnum(Integer code) { | |||||
| for (EnumCouponOrderReservationStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumCouponOrderReservationStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,29 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.dto.MarkingCouponDataReportDto; | |||||
| import com.iformall.domain.po.WxCouponOrder; | |||||
| import com.iformall.domain.po.WxCouponOrderReservation; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.*; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import java.util.Date; | |||||
| import java.util.HashMap; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| public interface WxCouponOrderReservationMapper extends CommonMapper<WxCouponOrderReservation, Long> { | |||||
| WxCouponOrderReservation selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| List<WxCouponOrderReservation> findList(WxCouponOrderReservation wxCouponOrderReservation); | |||||
| void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| WxCouponOrderReservation findUserReservation(WxCouponOrderReservation reservation); | |||||
| Long getIdByCouponOrder(@Param("couponOrderId")Long couponOrderId,@Param("tenantId") String tenantId); | |||||
| WxCouponOrderReservation getSortByCouponOrder(@Param("couponOrderId")Long couponOrderId,@Param("tenantId") String tenantId); | |||||
| } | |||||
| @@ -0,0 +1,53 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.EnumCouponOrderReservationStatus; | |||||
| public interface WxCouponOrderReservationService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxCouponOrderReservation> listAsPage(WxCouponOrderReservation record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxCouponOrderReservation getById(Long id,String tenantId); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| ResultData saveOrUpdate(WxCouponOrderReservation record); | |||||
| // WxCouponOrderReservation findOne(WxCouponOrderReservation reservation); | |||||
| WxCouponOrderReservation findUserReservation(WxCouponOrderReservation reservation); | |||||
| void finishReservation(WxCouponOrder couponOrder); | |||||
| void cancelReservation(WxCouponOrder co, EnumCouponOrderReservationStatus enumReservationStatus); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| //void deleteById(Long id); | |||||
| } | |||||
| @@ -0,0 +1,166 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.*; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.mapper.*; | |||||
| import com.iformall.service.*; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.*; | |||||
| @Service | |||||
| public class WxCouponOrderReservationServiceImpl implements WxCouponOrderReservationService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxCouponOrderReservationMapper wxCouponOrderReservationMapper; | |||||
| @Autowired | |||||
| WxCouponOrderMapper wxCouponOrderMapper; | |||||
| @Autowired | |||||
| WxCouponMapper wxCouponMapper; | |||||
| @Autowired | |||||
| WxCUserBasicInfoMapper wxCUserBasicInfoMapper; | |||||
| @Autowired | |||||
| WxMerchantBUserMapper wxMerchantBUserMapper; | |||||
| @Override | |||||
| public PageInfo<WxCouponOrderReservation> listAsPage(WxCouponOrderReservation record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderReservationMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxCouponOrderReservation getById(Long id,String tenantId) { | |||||
| return wxCouponOrderReservationMapper.selectById(id,tenantId); | |||||
| } | |||||
| @Override | |||||
| public ResultData saveOrUpdate(WxCouponOrderReservation record) { | |||||
| if(record.getCouponOrderId() != null){ | |||||
| WxCouponOrder couponOrder = wxCouponOrderMapper.selectById(record.getCouponOrderId(), record.getTenantId()); | |||||
| if(couponOrder == null){ | |||||
| return new ResultData(ErrorCode.ORDER_IS_NOT_FIND.getCode(),"未找到该订单"); | |||||
| } | |||||
| if(!EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode().equals(couponOrder.getCouponOrderStatus())){ | |||||
| return new ResultData(ErrorCode.COUPON_ORDER_IS_USED.getCode(),"券订单状态不支持"); | |||||
| } | |||||
| record.setCouponId(couponOrder.getCouponId()); | |||||
| WxCoupon wxCoupon = wxCouponMapper.selectById(record.getCouponId(), record.getTenantId()); | |||||
| if(wxCoupon == null){ | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||||
| } | |||||
| if(!EnumCouponType.COUPON_DOUYIN_GO_HOME.getCode().equals(wxCoupon.getType())){ | |||||
| return new ResultData(ErrorCode.COUPON_VALID_NOT_SUPPORTED); | |||||
| } | |||||
| if(record.getStartDate() != null && wxCoupon.getValidStartDate() != null | |||||
| && record.getStartDate().before(wxCoupon.getValidStartDate())){ | |||||
| return new ResultData(ErrorCode.COUPON_CHANNEL_IS_NOT_STARTED.getCode(),"当前时间无法预约"); | |||||
| } | |||||
| if(record.getEndDate() != null && record.getEndDate().after(couponOrder.getExpiredTime())){ | |||||
| return new ResultData(ErrorCode.COUPON_CHANNEL_IS_NOT_STARTED.getCode(),"当前时间无法预约"); | |||||
| } | |||||
| record.setCouponTitle(wxCoupon.getTitle()); | |||||
| } | |||||
| if(record.getcUserId() != null){ | |||||
| WxCUserBasicInfo basicInfo = wxCUserBasicInfoMapper.selectById(record.getcUserId(), record.getFinalTenantId()); | |||||
| if(basicInfo == null){ | |||||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||||
| } | |||||
| record.setUserName(basicInfo.getName()); | |||||
| record.setUserPhone(basicInfo.getPhone()); | |||||
| } | |||||
| if(record.getBuserId() != null){ | |||||
| WxMerchantBUser bUser = wxMerchantBUserMapper.selectById(record.getBuserId()); | |||||
| if(bUser == null){ | |||||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||||
| } | |||||
| record.setBtenantId(bUser.getTenantId()); | |||||
| record.setMerchantId(bUser.getMerchantId()); | |||||
| record.setBuserName(bUser.getName()); | |||||
| record.setBuserPhone(bUser.getPhone()); | |||||
| } | |||||
| Date now = new Date(); | |||||
| if(record.getId() == null && record.getCouponOrderId() != null){ | |||||
| Long id = wxCouponOrderReservationMapper.getIdByCouponOrder(record.getCouponOrderId(),record.getTenantId()); | |||||
| record.setId(id); | |||||
| } | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| record.setCreateDate(now); | |||||
| record.setUpdateDate(now); | |||||
| wxCouponOrderReservationMapper.insert(record); | |||||
| } else { | |||||
| record.setUpdateDate(now); | |||||
| wxCouponOrderReservationMapper.updateById(record); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| // @Override | |||||
| // public WxCouponOrderReservation findOne(WxCouponOrderReservation reservation) { | |||||
| // return null; | |||||
| // } | |||||
| @Override | |||||
| public WxCouponOrderReservation findUserReservation(WxCouponOrderReservation reservation) { | |||||
| return wxCouponOrderReservationMapper.findUserReservation(reservation); | |||||
| } | |||||
| @Override | |||||
| public void finishReservation(WxCouponOrder couponOrder) { | |||||
| if(!EnumCouponOrderStatus.COUPON_ORDER_USED.getCode().equals(couponOrder.getCouponOrderStatus())){ | |||||
| return; | |||||
| } | |||||
| Long id = wxCouponOrderReservationMapper.getIdByCouponOrder(couponOrder.getId(), couponOrder.getTenantId()); | |||||
| if(id == null){ | |||||
| return; | |||||
| } | |||||
| WxCouponOrderReservation updReservation = new WxCouponOrderReservation(); | |||||
| updReservation.setId(id); | |||||
| updReservation.updateTenantInfo(couponOrder); | |||||
| updReservation.setStatus(EnumCouponOrderReservationStatus.reservation_finish_cancellation.getCode()); | |||||
| if(couponOrder.getBUserId() != null && couponOrder.getBMerchantId() != 0){ | |||||
| updReservation.setBuserId(couponOrder.getBMerchantId()); | |||||
| } | |||||
| updReservation.setFinishTime(couponOrder.getUpdateDate()); | |||||
| this.saveOrUpdate(updReservation); | |||||
| } | |||||
| @Override | |||||
| public void cancelReservation(WxCouponOrder couponOrder, EnumCouponOrderReservationStatus enumReservationStatus) { | |||||
| WxCouponOrderReservation reservation = wxCouponOrderReservationMapper.getSortByCouponOrder(couponOrder.getId(), couponOrder.getTenantId()); | |||||
| if(reservation == null){ | |||||
| return; | |||||
| } | |||||
| //预约状态下取消 | |||||
| if(!EnumCouponOrderReservationStatus.reservation.getCode().equals(reservation.getStatus())){ | |||||
| return; | |||||
| } | |||||
| WxCouponOrderReservation updReservation = new WxCouponOrderReservation(); | |||||
| updReservation.setId(reservation.getId()); | |||||
| updReservation.updateTenantInfo(couponOrder); | |||||
| updReservation.setStatus(enumReservationStatus.getCode()); | |||||
| this.saveOrUpdate(updReservation); | |||||
| } | |||||
| // @Override | |||||
| // public void deleteById(Long id) { | |||||
| // wxCouponOrderMapper.deleteById(id); | |||||
| // } | |||||
| } | |||||
| @@ -188,6 +188,10 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| WxMerchantBUserService wxMerchantBUserService; | WxMerchantBUserService wxMerchantBUserService; | ||||
| @Lazy | |||||
| @Autowired | |||||
| WxCouponOrderReservationService wxCouponOrderReservationService; | |||||
| @Autowired | @Autowired | ||||
| @@ -1764,6 +1768,12 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| @Override | @Override | ||||
| public void actionAfterVerify(WxCouponOrder couponOrder, WxMerchant merchant) { | public void actionAfterVerify(WxCouponOrder couponOrder, WxMerchant merchant) { | ||||
| //完成预约 | |||||
| try{ | |||||
| wxCouponOrderReservationService.finishReservation(couponOrder); | |||||
| }catch(Exception e){ | |||||
| logger.error("完成预约失败"+e.getMessage(),e); | |||||
| } | |||||
| try { | try { | ||||
| boolean mulityShare = true; | boolean mulityShare = true; | ||||
| @@ -111,6 +111,9 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| @Autowired | @Autowired | ||||
| WxCashOutService wxCashOutService; | WxCashOutService wxCashOutService; | ||||
| @Autowired | |||||
| WxCouponOrderReservationService wxCouponOrderReservationService; | |||||
| @Autowired | @Autowired | ||||
| private MqBaseProducer mqBaseProducer; | private MqBaseProducer mqBaseProducer; | ||||
| @@ -315,6 +318,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | ||||
| } | } | ||||
| try{ | |||||
| wxCouponOrderReservationService.cancelReservation(wxCouponOrder,EnumCouponOrderReservationStatus.reservation_refund_cancellation); | |||||
| }catch(Exception e){ | |||||
| logger.error("couponOrder- cancelReservation" + wxCouponOrder.getId() + ", e:" + e.getMessage()); | |||||
| } | |||||
| // 卡退款,把卡余额设为0 | // 卡退款,把卡余额设为0 | ||||
| if (wxCouponOrder.getCouponType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { | if (wxCouponOrder.getCouponType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { | ||||
| WxCardInfo updateCardInfo = new WxCardInfo(); | WxCardInfo updateCardInfo = new WxCardInfo(); | ||||
| @@ -957,6 +966,12 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { | |||||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); | ||||
| } | } | ||||
| try{ | |||||
| wxCouponOrderReservationService.cancelReservation(wxCouponOrder,EnumCouponOrderReservationStatus.reservation_refund_cancellation); | |||||
| }catch(Exception e){ | |||||
| logger.error("couponOrder- cancelReservation" + wxCouponOrder.getId() + ", e:" + e.getMessage()); | |||||
| } | |||||
| // 卡退款,把卡余额设为0 | // 卡退款,把卡余额设为0 | ||||
| if (wxCouponOrder.getCouponType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { | if (wxCouponOrder.getCouponType().equals(EnumCouponType.CARD_MULTIMCH.getCode())) { | ||||
| WxCardInfo updateCardInfo = new WxCardInfo(); | WxCardInfo updateCardInfo = new WxCardInfo(); | ||||
| @@ -0,0 +1,144 @@ | |||||
| <?xml version="1.0" encoding="UTF-8"?> | |||||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
| <mapper namespace="com.iformall.mapper.WxCouponOrderReservationMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCouponOrderReservation"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" /> | |||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||||
| <result column="coupon_title" jdbcType="VARCHAR" property="couponTitle" /> | |||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | |||||
| <result column="user_name" jdbcType="VARCHAR" property="userName" /> | |||||
| <result column="user_phone" jdbcType="VARCHAR" property="userPhone" /> | |||||
| <result column="user_region" jdbcType="VARCHAR" property="userRegion" /> | |||||
| <result column="user_address" jdbcType="VARCHAR" property="userAddress" /> | |||||
| <result column="start_date" jdbcType="TIMESTAMP" property="startDate" /> | |||||
| <result column="end_date" jdbcType="TIMESTAMP" property="endDate" /> | |||||
| <result column="describe" jdbcType="VARCHAR" property="describe" /> | |||||
| <result column="describe_img" jdbcType="VARCHAR" property="describeImg" /> | |||||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | |||||
| <result column="btenant_id" jdbcType="VARCHAR" property="btenantId" /> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||||
| <result column="buser_id" jdbcType="BIGINT" property="buserId" /> | |||||
| <result column="buser_name" jdbcType="VARCHAR" property="buserName" /> | |||||
| <result column="buser_phone" jdbcType="VARCHAR" property="buserPhone" /> | |||||
| <result column="finish_time" jdbcType="TIMESTAMP" property="finishTime" /> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`coupon_order_id`,`coupon_id`,`coupon_title`, | |||||
| `c_user_id`,`user_name`,`user_phone`,`user_region`,`user_address`, | |||||
| `start_date`,`end_date`,`describe`,`describe_img`,`status`,`remark`, | |||||
| `btenant_id`,`merchant_id`,`buser_id`,`buser_name`,`buser_phone`,`finish_time`, | |||||
| `create_date`,`update_date` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where is_del = 0 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != couponOrderId "> | |||||
| and `coupon_order_id` = #{couponOrderId} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and `coupon_id` = #{couponId} | |||||
| </if> | |||||
| <if test=" null != couponTitle and '' != couponTitle"> | |||||
| and `coupon_title` like concat('%', #{couponTitle},'%') | |||||
| </if> | |||||
| <if test=" null != cUserId "> | |||||
| and `c_user_id` = #{cUserId} | |||||
| </if> | |||||
| <if test=" null != userName and '' != userName"> | |||||
| and `user_name` like concat('%', #{userName},'%') | |||||
| </if> | |||||
| <if test=" null != userPhone and '' != userPhone"> | |||||
| and `user_phone` like concat('%', #{userPhone},'%') | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != btenantId and '' != btenantId"> | |||||
| and `btenant_id` = #{btenantId} | |||||
| </if> | |||||
| <if test=" null != buserId "> | |||||
| and `buser_id` = #{buserId} | |||||
| </if> | |||||
| <if test=" null != buserName and '' != buserName"> | |||||
| and `buser_name` like concat('%', #{buserName},'%') | |||||
| </if> | |||||
| <if test=" null != buserPhone and '' != buserPhone"> | |||||
| and `buser_phone` like concat('%', #{buserPhone},'%') | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </sql> | |||||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_coupon_order_reservation where id = #{id} and tenant_id=#{tenantId} | |||||
| </select> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCouponOrderReservation" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns" /> from wx_coupon_order_reservation | |||||
| <include refid="dynamicWhereConditions" /> | |||||
| </select> | |||||
| <update id="deleteById" parameterType="java.util.HashMap"> | |||||
| update wx_coupon set is_del = 1,update_date=now() where id = #{id} and tenant_id = #{tenantId} | |||||
| </update> | |||||
| <select id="findUserReservation" parameterType="com.iformall.domain.po.WxCouponOrderReservation" resultMap="BaseResultMap"> | |||||
| select `id`,`tenant_id`,`parent_tenant_id`,`start_date`,`end_date`,`status` | |||||
| from wx_coupon_order_reservation | |||||
| where is_del = 0 | |||||
| and `tenant_id` = #{tenantId} | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| and `coupon_order_id` = #{couponOrderId} | |||||
| and `c_user_id` = #{cUserId} | |||||
| </select> | |||||
| <select id="getIdByCouponOrder" parameterType="java.util.HashMap" resultType="Long"> | |||||
| select id from wx_coupon_order_reservation where `coupon_order_id` = #{couponOrderId} and tenant_id=#{tenantId} | |||||
| </select> | |||||
| <select id="getSortByCouponOrder" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||||
| select `id`,`tenant_id`,`parent_tenant_id`,`status` | |||||
| from wx_coupon_order_reservation | |||||
| where `coupon_order_id` = #{couponOrderId} and tenant_id=#{tenantId} | |||||
| </select> | |||||
| </mapper> | |||||