|
|
|
@@ -11,6 +11,8 @@ import com.iformall.service.order.OrderFactory; |
|
|
|
import com.iformall.service.order.entity.WxComposeOrder; |
|
|
|
import com.iformall.utils.Constant; |
|
|
|
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; |
|
|
|
@@ -19,6 +21,7 @@ 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 |
|
|
|
@@ -204,4 +207,64 @@ public class WxCouponPasswordController extends BaseController { |
|
|
|
} |
|
|
|
couponPasswordService.saveOrUpdate(updateCouponPwd); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "查询卡详情") |
|
|
|
@GetMapping("getCardDetail") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "cardId", value = "券ID", dataType = "String", paramType = "query", required = true) |
|
|
|
}) |
|
|
|
public ResultData getCardDetail(String cardId) { |
|
|
|
if (StringUtils.isBlank(cardId) || cardId.equalsIgnoreCase(Constant.UNDEFINED)) { |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"参数错误."); |
|
|
|
} |
|
|
|
cardId = StringUtils.trimToNull(cardId); |
|
|
|
WxCouponPassword password = null; |
|
|
|
try { |
|
|
|
password = couponPasswordService.getById(Long.parseLong(cardId)); |
|
|
|
if (null == password) { |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"参数错误."); |
|
|
|
} |
|
|
|
}catch(Exception e) { |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"参数错误."); |
|
|
|
} |
|
|
|
WxCoupon coupon = couponService.getById(password.getCouponId(),password.getTenantId()); |
|
|
|
if (coupon == null) { |
|
|
|
return new ResultData(ErrorCode.COUPON_IS_EMPTY); |
|
|
|
} |
|
|
|
|
|
|
|
Map retMap = new HashMap(); |
|
|
|
retMap.put("title", coupon.getTitle()); |
|
|
|
retMap.put("couponPasswordId", password.getId()); |
|
|
|
if (null != password.getCardId()) { |
|
|
|
WxCardInfo cardInfo = wxCardInfoService.getById(password.getCardId()); |
|
|
|
if (null != cardInfo) { |
|
|
|
Long owner = cardInfo.getOwnerUserId(); |
|
|
|
if (!owner.equals(Constant.defaultCUserId)) { |
|
|
|
WxCUserBasicInfo user = userService.getById(owner, password.getFinalTenantId()); |
|
|
|
if (null != user) { |
|
|
|
retMap.put("owner", user.getPhone()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(retMap); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "实体卡转赠", notes = "{\"cardId\":\"String\",\"formId\":\"String\",\"payCheck\":\"String\",\"payPassword\":\"String\"}") |
|
|
|
@PostMapping("transfer") |
|
|
|
public ResultData transfer(@RequestBody Map<String, String> params) { |
|
|
|
logger.info("getCouponOrderByPassword: " + getIpAddr() + params.toString()); |
|
|
|
String password = params.get("password"); |
|
|
|
String formId = params.get("formId"); |
|
|
|
String payCheck = params.get("payCheck"); |
|
|
|
String payPassword = params.get("payPassword"); |
|
|
|
Long memberId; |
|
|
|
try { |
|
|
|
memberId = getMemberId(); |
|
|
|
} catch (Exception e) { |
|
|
|
return new ResultData(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
return getCouponOrderByPassword(password, formId,payCheck,payPassword, memberId,EnumPayWay.PAY_WAY_NOT_UNPAY_PASSWD,EnumPayVersion.NO_VERSION); |
|
|
|
} |
|
|
|
} |