| @@ -57,7 +57,7 @@ public class WxCouponOrderController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation("分页列表接口") | |||||
| @ApiOperation("券包分页列表接口") | |||||
| @GetMapping("list") | @GetMapping("list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @@ -65,26 +65,24 @@ public class WxCouponOrderController extends BaseController { | |||||
| @ApiImplicitParam(name = "couponOrderStatus", value="券状态状态:0,待使用 1,已核销 2,已过期 3,已作废", dataType="int", paramType = "query",required=false) | @ApiImplicitParam(name = "couponOrderStatus", value="券状态状态:0,待使用 1,已核销 2,已过期 3,已作废", dataType="int", paramType = "query",required=false) | ||||
| }) | }) | ||||
| public ResultData list(Integer couponOrderStatus, Integer pageNum, Integer pageSize) { | public ResultData list(Integer couponOrderStatus, Integer pageNum, Integer pageSize) { | ||||
| if(pageNum == null || pageSize == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | |||||
| return wxCouponOrderService.listCUserVoAsPage(getUser().getId(), couponOrderStatus, pageNum, pageSize); | return wxCouponOrderService.listCUserVoAsPage(getUser().getId(), couponOrderStatus, pageNum, pageSize); | ||||
| } | } | ||||
| @ApiOperation(value = "根据id查询接口", notes = "{\"couponOrderId\":\"string\"}") | |||||
| @PostMapping("/findById") | |||||
| public ResultData findById(@RequestBody Map<String, String> paramMap) { | |||||
| logger.info(paramMap.toString()); | |||||
| String couponOrderIdStr = paramMap.get("couponOrderId"); | |||||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||||
| logger.error("couponOrderId不能为空: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponOrderId不能为空"); | |||||
| } | |||||
| Long couponOrderId = 0L; | |||||
| try { | |||||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| couponOrderId = 0L; | |||||
| logger.error("couponOrderId参数不正确: " + paramMap.toString()); | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponOrderId参数不正确"); | |||||
| @ApiOperation(value = "卡券详情接口") | |||||
| @GetMapping("detail") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "couponOrderId", value = "券ID", dataType = "string", paramType = "query", required = true) | |||||
| }) | |||||
| public ResultData detail(String couponOrderId) { | |||||
| if(couponOrderId == null) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCouponOrderService.getById(couponOrderId)); | |||||
| return new ResultData(wxCouponOrderService.detailCUserVo(getUser().getId(), couponOrderId)); | |||||
| } | } | ||||
| } | } | ||||
| @@ -82,7 +82,7 @@ public class WxMerchant implements Serializable { | |||||
| /*停车厂商参数**/ | /*停车厂商参数**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="停车厂商参数",name="carParams") | @io.swagger.annotations.ApiModelProperty(value="停车厂商参数",name="carParams") | ||||
| private String carParams; | private String carParams; | ||||
| /*商户状态**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="状态1可用0停用",name="status") | @io.swagger.annotations.ApiModelProperty(value="状态1可用0停用",name="status") | ||||
| private Integer status; | private Integer status; | ||||
| @@ -108,6 +108,20 @@ public class WxCouponOrderCVo extends WxCouponOrder{ | |||||
| @io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") | @io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") | ||||
| private String remark; | private String remark; | ||||
| /*发券商户信息*/ | |||||
| /*商户图片**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户图片",name="imgUrl") | |||||
| private String merchantImgUrl; | |||||
| /*商户名**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | |||||
| private String merchantName; | |||||
| /*联系方式**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户联系方式",name="linkPhone") | |||||
| private String merchantLinkPhone; | |||||
| /*商户状态**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户状态1可用0停用",name="status") | |||||
| private Integer merchantStatus; | |||||
| public String getTenantId() { | public String getTenantId() { | ||||
| return tenantId; | return tenantId; | ||||
| } | } | ||||
| @@ -231,6 +245,33 @@ public class WxCouponOrderCVo extends WxCouponOrder{ | |||||
| remark = _remark; | remark = _remark; | ||||
| } | } | ||||
| public String getMerChantImgUrl() { | |||||
| return merchantImgUrl; | |||||
| } | |||||
| public void setMerChantImgUrl(String _imgUrl) { | |||||
| merchantImgUrl = _imgUrl; | |||||
| } | |||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String _name) { | |||||
| merchantName = _name; | |||||
| } | |||||
| public String getMerchantLinkPhone() { | |||||
| return merchantLinkPhone; | |||||
| } | |||||
| public void setMerchantLinkPhone(String _linkPhone) { | |||||
| merchantLinkPhone = _linkPhone; | |||||
| } | |||||
| public Integer getMerchantStatus() { | |||||
| return merchantStatus; | |||||
| } | |||||
| public void setMerchantStatus(Integer status) { | |||||
| this.merchantStatus = status; | |||||
| } | |||||
| public static enum Field { | public static enum Field { | ||||
| Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | Id_ASC("`id` ASC"), Id_DESC("`id` DESC"), | ||||
| TenantId_ASC("`tenantId` ASC"), | TenantId_ASC("`tenantId` ASC"), | ||||
| @@ -14,5 +14,5 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> { | |||||
| List<WxCouponOrder> findListOfVerifiedByDate(Map dateMap); | List<WxCouponOrder> findListOfVerifiedByDate(Map dateMap); | ||||
| List<WxCouponOrderCVo> findListOfCUser(Map paramMap); | List<WxCouponOrderCVo> findListOfCUser(Map paramMap); | ||||
| WxCouponOrderCVo selectDetailOfCUser(Map paramMap); | |||||
| } | } | ||||
| @@ -75,10 +75,17 @@ public interface WxCouponOrderService { | |||||
| ResultData listOnDateAsPage(Long bUserId, String date, Integer pageIndex, Integer pageSize, boolean isVerified); | ResultData listOnDateAsPage(Long bUserId, String date, Integer pageIndex, Integer pageSize, boolean isVerified); | ||||
| /** | /** | ||||
| * 根据日期 b用户查券list | |||||
| * C用户查券list | |||||
| * | * | ||||
| * @param bUserId B端用户 | |||||
| * @param bUserId C端用户 | |||||
| */ | */ | ||||
| ResultData listCUserVoAsPage(Long cUserId, Integer pageIndex, Integer pageSize, Integer status); | ResultData listCUserVoAsPage(Long cUserId, Integer pageIndex, Integer pageSize, Integer status); | ||||
| /** | |||||
| * C用户查券详情 | |||||
| * | |||||
| * @param bUserId C端用户 | |||||
| */ | |||||
| ResultData detailCUserVo(Long cUserId, String couponOrderId); | |||||
| } | } | ||||
| @@ -148,7 +148,6 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| return new ResultData(resultMap); | return new ResultData(resultMap); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public ResultData listCUserVoAsPage(Long cUserId, Integer status, Integer pageIndex, Integer pageSize) { | public ResultData listCUserVoAsPage(Long cUserId, Integer status, Integer pageIndex, Integer pageSize) { | ||||
| @@ -167,6 +166,22 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| return new ResultData(PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfCUser(paramMap))); | return new ResultData(PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findListOfCUser(paramMap))); | ||||
| } | } | ||||
| @Override | |||||
| public ResultData detailCUserVo(Long cUserId, String couponOrderId) { | |||||
| WxCUser wxCuser = wxCUserMapper.selectByPrimaryKey(cUserId); | |||||
| if(wxCuser == null){ | |||||
| logger.error("用户不存在:"+ cUserId); | |||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY); | |||||
| } | |||||
| Map paramMap = new HashMap(); | |||||
| paramMap.put("cUserId", cUserId); | |||||
| paramMap.put("tenantId", wxCuser.getTenantId()); | |||||
| paramMap.put("couponOrderId", couponOrderId); | |||||
| return new ResultData(wxCouponOrderMapper.selectDetailOfCUser(paramMap)); | |||||
| } | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| @@ -125,11 +125,13 @@ | |||||
| <sql id="allCUserCouponOrderListColumns"> | <sql id="allCUserCouponOrderListColumns"> | ||||
| c.id,c.expired_time,c.coupon_order_status,c.create_date,c.update_date,c.coupon_price, | c.id,c.expired_time,c.coupon_order_status,c.create_date,c.update_date,c.coupon_price, | ||||
| co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price | co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price | ||||
| m.name | |||||
| </sql> | </sql> | ||||
| <sql id="allCUserCouponOrderDetailColumns"> | <sql id="allCUserCouponOrderDetailColumns"> | ||||
| c.id,c.tenant_id,c.coupon_id,c.c_user_id,c.b_user_id,c.order_id,c.expired_time,c.coupon_order_status,c.create_date,c.update_date,c.coupon_price | |||||
| co.merchant_id,co.type,co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.detail,co.remark | |||||
| c.id,c.tenant_id,c.coupon_id,c.c_user_id,c.b_user_id,c.order_id,c.expired_time,c.coupon_order_status,c.create_date,c.update_date,c.coupon_price, | |||||
| co.merchant_id,co.type,co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.detail, | |||||
| m.img_url,m.name,m.link_phone,m.status | |||||
| </sql> | </sql> | ||||
| <resultMap id="CVoResultMap" type="com.simple.domain.vo.WxCouponOrderCVo"> | <resultMap id="CVoResultMap" type="com.simple.domain.vo.WxCouponOrderCVo"> | ||||
| @@ -155,16 +157,35 @@ | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail" /> | <result column="detail" jdbcType="VARCHAR" property="detail" /> | ||||
| <result column="price" jdbcType="INTEGER" property="price" /> | <result column="price" jdbcType="INTEGER" property="price" /> | ||||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | <result column="remark" jdbcType="VARCHAR" property="remark" /> | ||||
| <result column="img_url" jdbcType="VARCHAR" property="merchantImgUrl" /> | |||||
| <result column="name" jdbcType="VARCHAR" property="merchantName" /> | |||||
| <result column="link_phone" jdbcType="VARCHAR" property="merchantLinkPhone" /> | |||||
| <result column="status" jdbcType="VARCHAR" property="merchantStatus" /> | |||||
| </resultMap> | </resultMap> | ||||
| <select id="findListOfCUser" parameterType="map" resultMap="CVoResultMap"> | <select id="findListOfCUser" parameterType="map" resultMap="CVoResultMap"> | ||||
| select <include refid="allCUserCouponOrderListColumns" /> from wx_coupon_order c,wx_coupon co | |||||
| where c.c_user_id = #{cUserId} and c.tenant_id = #{tenantId} and c.coupon_id = co.id | |||||
| select <include refid="allCUserCouponOrderListColumns" /> from wx_coupon_order c,wx_coupon co,wx_merchant m | |||||
| where c.c_user_id = #{cUserId} | |||||
| and c.tenant_id = #{tenantId} | |||||
| and c.coupon_id = co.id | |||||
| and co.merchant_id = m.id | |||||
| <if test="status != null"> | <if test="status != null"> | ||||
| AND c.coupon_order_status = #{status} | AND c.coupon_order_status = #{status} | ||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="selectDetailOfCUser" parameterType="map" resultMap="CVoResultMap"> | |||||
| select <include refid="allCUserCouponOrderDetailColumns" /> from wx_coupon_order c,wx_coupon co,wx_merchant m | |||||
| where c.c_user_id = #{cUserId} | |||||
| and c.tenant_id = #{tenantId} | |||||
| and c.coupon_id = co.id | |||||
| and c.id = #{couponOrderId} | |||||
| and co.merchant_id = m.id | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||