Просмотр исходного кода

[B端][添加]:添加券详情获取接口

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
fc3131a3c0
4 измененных файлов: 67 добавлений и 5 удалений
  1. +15
    -0
      mallinkBApi/src/main/java/com/simple/controller/WxCouponOrderController.java
  2. +7
    -0
      mallinkService/src/main/java/com/simple/service/WxCouponOrderService.java
  3. +22
    -0
      mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java
  4. +23
    -5
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml

+ 15
- 0
mallinkBApi/src/main/java/com/simple/controller/WxCouponOrderController.java Просмотреть файл

@@ -87,6 +87,21 @@ public class WxCouponOrderController extends BaseController {
return wxCouponOrderService.listOnDateAsPage(getUser().getId(), date, null, null, true);
}


@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(wxCouponOrderService.detailBUserVo(getUser().getId(), couponOrderId));
}

@ApiOperation(value = "核销接口", notes = "{\"couponOrderId\":\"string\"}")
@PostMapping("verify")
public ResultData verify(@RequestBody Map<String, String> paramMap) {


+ 7
- 0
mallinkService/src/main/java/com/simple/service/WxCouponOrderService.java Просмотреть файл

@@ -88,4 +88,11 @@ public interface WxCouponOrderService {
* @param bUserId C端用户
*/
ResultData detailCUserVo(Long cUserId, String couponOrderId);

/**
* B用户查券详情
*
* @param bUserId B端用户
*/
ResultData detailBUserVo(Long bUserId, String couponOrderId);
}

+ 22
- 0
mallinkService/src/main/java/com/simple/service/impl/WxCouponOrderServiceImpl.java Просмотреть файл

@@ -182,6 +182,28 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
return new ResultData(wxCouponOrderMapper.selectDetailOfCUser(paramMap));
}

@Override
public ResultData detailBUserVo(Long bUserId, String couponOrderId) {
WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectByPrimaryKey(bUserId);
if(wxMerchantBUser == null){
logger.error("用户不存在:"+ bUserId);
throw new MallinkException(ErrorCode.USER_IS_EMPTY);
}

WxMerchant wxMerchant = wxMerchantMapper.selectByPrimaryKey(wxMerchantBUser.getMerchantId());
if (wxMerchant == null) {
logger.error("商户不存在:" + bUserId);
throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND);
}

Map paramMap = new HashMap();
paramMap.put("merchantId", wxMerchant.getId());
paramMap.put("tenantId", wxMerchant.getTenantId());
paramMap.put("couponOrderId", couponOrderId);

return new ResultData(wxCouponOrderMapper.selectDetailOfCUser(paramMap));
}


@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})


+ 23
- 5
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml Просмотреть файл

@@ -257,8 +257,16 @@
<select id="findListOfCUser" parameterType="map" resultMap="CVoResultMap">
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}
where 1=1
<if test="cUserId != null">
and c.c_user_id = #{cUserId}
</if>
<if test="merchantId != null">
and co.merchant_id = #{merchantId}
</if>
<if test="tenantId != null">
and c.tenant_id = #{tenantId}
</if>
and c.coupon_id = co.id
and co.merchant_id = m.id
<if test="status != null">
@@ -272,10 +280,20 @@
wx_shop s,wx_merchant_shop ms,
wx_mall_building mb,
wx_mall_floor mf
where c.c_user_id = #{cUserId}
and c.tenant_id = #{tenantId}
where 1=1
<if test="cUserId != null">
and c.c_user_id = #{cUserId}
</if>
<if test="merchantId != null">
and co.merchant_id = #{merchantId}
</if>
<if test="tenantId != null">
and c.tenant_id = #{tenantId}
</if>
<if test="couponOrderId != null">
and c.id = #{couponOrderId}
</if>
and c.coupon_id = co.id
and c.id = #{couponOrderId}
and co.merchant_id = m.id
and ms.merchant_id = m.id
and ms.shop_id = s.id


Загрузка…
Отмена
Сохранить