parent
07b406e55a
commit
f1c44be035
@ -0,0 +1,24 @@ |
||||
package com.hfkj.service; |
||||
|
||||
/** |
||||
* @className: UserDiscountService |
||||
* @author: HuRui |
||||
* @date: 2023/3/29 |
||||
**/ |
||||
public interface UserDiscountService { |
||||
|
||||
/** |
||||
* 用户优惠券使用 |
||||
* @param userDiscountId |
||||
* @param userPhone |
||||
*/ |
||||
void userDiscountUse(Long userDiscountId,String userPhone); |
||||
|
||||
/** |
||||
* 用户优惠券退回 |
||||
* @param userDiscountId |
||||
* @param userPhone |
||||
*/ |
||||
void userDiscountReturn(Long userDiscountId,String userPhone); |
||||
|
||||
} |
@ -0,0 +1,51 @@ |
||||
package com.hfkj.service.impl; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.utils.HttpsUtils; |
||||
import com.hfkj.config.CommonSysConst; |
||||
import com.hfkj.service.UserDiscountService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @className: UserDiscountServiceImpl |
||||
* @author: HuRui |
||||
* @date: 2023/3/29 |
||||
**/ |
||||
@Service("userDiscountService") |
||||
public class UserDiscountServiceImpl implements UserDiscountService { |
||||
@Override |
||||
public void userDiscountUse(Long userDiscountId, String userPhone) { |
||||
try { |
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("userDiscountId", userDiscountId); |
||||
param.put("userPhone", userPhone); |
||||
JSONObject jsonObject = HttpsUtils.doGet(CommonSysConst.getSysConfig().getHsg_domain_name() + "user/discount/hzfUserDiscountUse", param); |
||||
if (!jsonObject.getString("return_code").equals("000000")) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("return_data")); |
||||
} |
||||
} catch (Exception e) { |
||||
System.out.println(e); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void userDiscountReturn(Long userDiscountId, String userPhone) { |
||||
try { |
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("userDiscountId", userDiscountId); |
||||
param.put("userPhone", userPhone); |
||||
JSONObject jsonObject = HttpsUtils.doGet(CommonSysConst.getSysConfig().getHsg_domain_name() + "user/discount/hzfUserDiscountReturn", param); |
||||
if (!jsonObject.getString("return_code").equals("000000")) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("return_data")); |
||||
} |
||||
} catch (Exception e) { |
||||
System.out.println(e); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue