|
|
|
@ -23,6 +23,7 @@ import org.springframework.stereotype.Controller; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import java.net.URLDecoder; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
@ -83,6 +84,32 @@ public class HighDiscountController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getDiscountByCode",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "根据Code查询优惠券") |
|
|
|
|
public ResponseData getDiscountByCode(@RequestParam(name = "code", required = true) String code) { |
|
|
|
|
try { |
|
|
|
|
String discountAgentId; |
|
|
|
|
try { |
|
|
|
|
discountAgentId = AESEncodeUtil.aesDecrypt(URLDecoder.decode(code, "UTF-8")); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("HighDiscountController -> getDiscountByQrCode() error!","code解码错误"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "code解码错误"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询优惠券与代理商关系id
|
|
|
|
|
HighDiscountAgentRel discountAgentRel = highDiscountAgentRelService.getRelById(Long.parseLong(discountAgentId)); |
|
|
|
|
if (discountAgentRel == null) { |
|
|
|
|
log.error("HighDiscountController -> getDiscountByQrCode() error!","code解码错误"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "code解码错误"); |
|
|
|
|
} |
|
|
|
|
return ResponseMsgUtil.success(discountAgentRel); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("HighDiscountController -> getDiscountByQrCode() error!",e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getDiscountByDiscountAgentId",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|