Ctrip卡券记录查询修改

master
yangkai 6 years ago
parent 2a688ae378
commit 3bfb19535f

@ -174,6 +174,8 @@ public class RetailAppServiceImp implements RetailAppService {
private CustomerServiceService customerServiceService; private CustomerServiceService customerServiceService;
@Resource @Resource
private CouponAccuessLogMapper couponAccuessLogMapper; private CouponAccuessLogMapper couponAccuessLogMapper;
@Resource
private CouponValidateService couponValidateService;
private Map<String, AppMsgSender> senderMap = new HashMap<>(); private Map<String, AppMsgSender> senderMap = new HashMap<>();
private final String fileName[] = { "client_bank_file", "client_id_file", "client_company_file" }; private final String fileName[] = { "client_bank_file", "client_id_file", "client_company_file" };
@ -449,7 +451,7 @@ public class RetailAppServiceImp implements RetailAppService {
@Override @Override
public JSONObject ctripCouponInfo(JSONObject device, String coupon_id) { 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) { if (client == null) {
throw new BadRequestException("Partner not exists"); 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"))); 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 @Override

@ -18,7 +18,7 @@ public interface CouponValidateService {
JSONObject ctripCheck(int client_id); 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); JSONObject ctripCouponLogNotice(String coupon_log_id,String order_id,String open_id,String status);
} }

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

Loading…
Cancel
Save