|
|
@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.config.PayloService; |
|
|
|
import com.hai.config.PayloService; |
|
|
|
import com.hai.config.PetroConfig; |
|
|
|
import com.hai.config.PetroConfig; |
|
|
|
|
|
|
|
import com.hai.config.PetroCouponConfig; |
|
|
|
import com.hai.entity.ApiCoupon; |
|
|
|
import com.hai.entity.ApiCoupon; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.openApi.service.ApiBlxCouponService; |
|
|
|
import com.hai.openApi.service.ApiBlxCouponService; |
|
|
@ -22,8 +23,11 @@ import org.springframework.web.bind.annotation.RequestParam; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
@Controller |
|
|
|
@RequestMapping(value = "/apiCoupon") |
|
|
|
@RequestMapping(value = "/apiCoupon") |
|
|
@ -64,7 +68,24 @@ public class ApiCouponController { |
|
|
|
public ResponseData synCouponRule(@RequestParam(name = "type", required = true) Integer type) { |
|
|
|
public ResponseData synCouponRule(@RequestParam(name = "type", required = true) Integer type) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (type == 4) { |
|
|
|
|
|
|
|
JSONObject jsonObject = PetroCouponConfig.getCouponList(); |
|
|
|
|
|
|
|
JSONArray array = jsonObject.getJSONArray("data"); |
|
|
|
|
|
|
|
List<JSONObject> list = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < array.size(); i++) { |
|
|
|
|
|
|
|
JSONObject object = array.getJSONObject(i); |
|
|
|
|
|
|
|
object.put("alias" , object.getString("reqCode")); |
|
|
|
|
|
|
|
object.put("title" , object.getString("tplName")); |
|
|
|
|
|
|
|
object.put("qty" , object.getString("ticketBalance")); |
|
|
|
|
|
|
|
object.put("faceValue" , object.getBigDecimal("tplAmount").divide(new BigDecimal(100))); |
|
|
|
|
|
|
|
object.put("bizTypeDesc" , "汽油券"); |
|
|
|
|
|
|
|
object.put("validDate" , "180"); |
|
|
|
|
|
|
|
list.add(object); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ResponseMsgUtil.success(list); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
PetroConfig.init(type); |
|
|
|
PetroConfig.init(type); |
|
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = petroConfig.synCouponRule(); |
|
|
|
JSONObject jsonObject = petroConfig.synCouponRule(); |
|
|
@ -73,7 +94,6 @@ public class ApiCouponController { |
|
|
|
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult")); |
|
|
|
String data = PetroConfig.decrypt(jsonObject.getString("jsonResult")); |
|
|
|
JSONArray jsonArray = JSONArray.parseArray(data); |
|
|
|
JSONArray jsonArray = JSONArray.parseArray(data); |
|
|
|
|
|
|
|
|
|
|
|
System.out.println(jsonArray); |
|
|
|
|
|
|
|
ApiCoupon apiCoupon; |
|
|
|
ApiCoupon apiCoupon; |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < jsonArray.size(); i++) { |
|
|
|
for (int i = 0; i < jsonArray.size(); i++) { |
|
|
@ -121,6 +141,9 @@ public class ApiCouponController { |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(jsonArray); |
|
|
|
return ResponseMsgUtil.success(jsonArray); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
return ResponseMsgUtil.success("请求失败"); |
|
|
|
return ResponseMsgUtil.success("请求失败"); |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|