|
|
|
@@ -0,0 +1,69 @@ |
|
|
|
package com.iformall.controller; |
|
|
|
|
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxCardInfo; |
|
|
|
import com.iformall.domain.po.WxMerchantBUser; |
|
|
|
import com.iformall.domain.vo.WxCardSpendVo; |
|
|
|
import com.iformall.domain.vo.WxCouponOrderCVo; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.pay.WxPayConstant; |
|
|
|
import com.iformall.service.PosBrunService; |
|
|
|
import com.iformall.service.WxCardInfoService; |
|
|
|
import com.iformall.utils.Constant; |
|
|
|
import com.iformall.utils.DateUtils; |
|
|
|
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequestMapping("/api/cardInfo") |
|
|
|
public class WxCardInfoController extends BaseController { |
|
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCardInfoService wxCardInfoService; |
|
|
|
|
|
|
|
@ApiOperation(value = "查询卡信息") |
|
|
|
@GetMapping("detail") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "dynamicId", value = "动态码ID", dataType = "String", paramType = "query", required = true)}) |
|
|
|
public ResultData detail(String dynamicId) { |
|
|
|
if (StringUtils.isBlank(dynamicId) || dynamicId.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardId不能为空"); |
|
|
|
} |
|
|
|
String cardIdStr = dynamicId; |
|
|
|
boolean isECard = false; |
|
|
|
String _decodeCouponOrderId = WxCouponOrderCVo.getDecodeExpiredCouponOrderId(dynamicId); |
|
|
|
if (_decodeCouponOrderId.contains(WxCouponOrderCVo.arg)) { |
|
|
|
String[] decodeids = _decodeCouponOrderId.split(WxCouponOrderCVo.arg); |
|
|
|
cardIdStr = decodeids[0]; |
|
|
|
isECard = true; |
|
|
|
} |
|
|
|
WxCardInfo cardInfo = wxCardInfoService.getById(Long.parseLong(cardIdStr)); |
|
|
|
if (null == cardInfo) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "未查询到卡:"+cardIdStr); |
|
|
|
} |
|
|
|
Map map = new HashMap(); |
|
|
|
if (isECard) { |
|
|
|
map.put("cardId", cardInfo.getId()); |
|
|
|
}else { |
|
|
|
map.put("cardId", cardInfo.getCouponPasswordId()); |
|
|
|
} |
|
|
|
map.put("amount", cardInfo.getAmount()); |
|
|
|
map.put("remainAmount", cardInfo.getRemainingAmount()); |
|
|
|
return new ResultData(map); |
|
|
|
} |
|
|
|
} |