Ctrip卡券记录查询修改

master
yangkai 6 years ago
parent 2a688ae378
commit 3bfb19535f

@ -174,6 +174,8 @@ public class RetailAppServiceImp implements RetailAppService {
private CustomerServiceService customerServiceService;
@Resource
private CouponAccuessLogMapper couponAccuessLogMapper;
@Resource
private CouponValidateService couponValidateService;
private Map<String, AppMsgSender> senderMap = new HashMap<>();
private final String fileName[] = { "client_bank_file", "client_id_file", "client_company_file" };
@ -449,7 +451,7 @@ public class RetailAppServiceImp implements RetailAppService {
@Override
public JSONObject ctripCouponInfo(JSONObject device, String coupon_id) {
return couponVerificationService.ctripCouponInfo(coupon_id,device.getIntValue("client_id"));
return couponVerificationService.ctripCouponInfo(coupon_id,device.getIntValue("client_id"), true);
}
@ -459,9 +461,20 @@ public class RetailAppServiceImp implements RetailAppService {
if (client == null) {
throw new BadRequestException("Partner not exists");
}
PageList<JSONObject> cusCouponLog = couponAccuessLogMapper.getCouponAccuessLog(
PageList<JSONObject> cusCouponLogs = couponAccuessLogMapper.getCouponAccuessLog(
client.getIntValue("client_id"), new PageBounds(appQueryBean.getPage(), appQueryBean.getLimit(), Order.formString("creation_date.desc")));
return PageListUtils.buildPageListResult(cusCouponLog);
HashMap<String, JSONObject> couponMap = new HashMap<>();
for(JSONObject cusCouponLog : cusCouponLogs) {
cusCouponLog.put("client_moniker", client_moniker);
if (couponMap.containsKey(cusCouponLog.getString("coupon_id"))) {
cusCouponLog.put("coupon", couponMap.get(cusCouponLog.getString("coupon_id")));
continue;
}
JSONObject coupon = couponValidateService.ctripCouponInfo(cusCouponLog.getString("coupon_id"), cusCouponLog.getIntValue("client_id"), false);
couponMap.put(cusCouponLog.getString("coupon_id"), coupon);
cusCouponLog.put("coupon", coupon);
}
return PageListUtils.buildPageListResult(cusCouponLogs);
}
@Override

@ -18,7 +18,7 @@ public interface CouponValidateService {
JSONObject ctripCheck(int client_id);
JSONObject ctripCouponInfo(String coupon_log_id,int client_id);
JSONObject ctripCouponInfo(String coupon_log_id,int client_id,boolean is_expiry);
JSONObject ctripCouponLogNotice(String coupon_log_id,String order_id,String open_id,String status);
}

@ -177,7 +177,7 @@ public class CouponValidateServiceImpl implements CouponValidateService {
}
@Override
public JSONObject ctripCouponInfo(String coupon_id, int client_id) {
public JSONObject ctripCouponInfo(String coupon_id, int client_id, boolean is_expiry) {
JSONObject client = clientManager.getClientInfo(client_id);
if(client==null){
throw new NotFoundException("Merchant Not Found");
@ -185,6 +185,9 @@ public class CouponValidateServiceImpl implements CouponValidateService {
String uri = signUrl(UriComponentsBuilder.fromHttpUrl(CUSTOMER_HOST + "/coupon/"+coupon_id+"/couponLogInfo"));
HttpRequestGenerator gen = new HttpRequestGenerator(uri, RequestMethod.GET);
gen.addQueryString("client_moniker",client.getString("client_moniker"));
if (!is_expiry) {
gen.addQueryString("is_expiry", "0");
}
try {
HttpRequestResult reqResult = gen.execute();
if (reqResult.isSuccess()) {

Loading…
Cancel
Save