|
|
@ -1,21 +1,27 @@ |
|
|
|
package com.v1.controller; |
|
|
|
package com.v1.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.config.HuiLianTongConfig; |
|
|
|
import com.hai.config.HuiLianTongConfig; |
|
|
|
|
|
|
|
import com.hai.config.HuiLianTongUnionCardConfig; |
|
|
|
import com.hai.dao.HighGasOrderPushMapper; |
|
|
|
import com.hai.dao.HighGasOrderPushMapper; |
|
|
|
|
|
|
|
import com.hai.entity.ApiMerchants; |
|
|
|
import com.hai.entity.HighGasOrderPush; |
|
|
|
import com.hai.entity.HighGasOrderPush; |
|
|
|
import com.hai.entity.HighUser; |
|
|
|
import com.hai.entity.HighUser; |
|
|
|
import com.hai.enum_type.OrderPushType; |
|
|
|
import com.hai.enum_type.OrderPushType; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
|
|
|
|
import com.hai.service.ApiMerchantsService; |
|
|
|
import com.hai.service.HighOpenApiService; |
|
|
|
import com.hai.service.HighOpenApiService; |
|
|
|
import com.hai.service.HighUserService; |
|
|
|
import com.hai.service.HighUserService; |
|
|
|
import com.hai.service.SecConfigService; |
|
|
|
import com.hai.service.SecConfigService; |
|
|
|
|
|
|
|
import com.v1.config.ToolConfig; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
@ -41,49 +47,18 @@ public class GzSinopecController { |
|
|
|
private HighUserService highUserService; |
|
|
|
private HighUserService highUserService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighGasOrderPushMapper highGasOrderPushMapper; |
|
|
|
private ApiMerchantsService apiMerchantsService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private SecConfigService secConfigService; |
|
|
|
private HighGasOrderPushMapper highGasOrderPushMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HuiLianTongConfig huiLianTongConfig; |
|
|
|
private SecConfigService secConfigService; |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getGuizhouSinopecList", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "获取专属优惠券") |
|
|
|
|
|
|
|
public ResponseData getUserExclusiveDiscount(@RequestParam(name = "useScope", required = false) Integer useScope, |
|
|
|
|
|
|
|
@RequestParam(name = "phone", required = true) String phone, |
|
|
|
|
|
|
|
@RequestParam(name = "year", required = false) String year) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HighUser highUser = highUserService.findByPhone(phone); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (highUser == null || highUser.getStatus() == 0) { |
|
|
|
|
|
|
|
log.error("getUserOrderPreList error!", "未找到用户"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前手机号暂无用户"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
map.put("userId", highUser.getId()); |
|
|
|
|
|
|
|
map.put("useScope", useScope); |
|
|
|
|
|
|
|
if (year != null) { |
|
|
|
|
|
|
|
map.put("createTimeS", year + "-01-01 00:00:00"); |
|
|
|
|
|
|
|
map.put("createTimeE", year + "-12-31 23:59:59"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(highOpenApiService.getUserCouponsList(map)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighOpenApiController --> getGuizhouSinopecList() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getGuizhouSinopecList", method = RequestMethod.POST) |
|
|
|
@RequestMapping(value = "/getGzSinopecList", method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "获取贵州中石化电子卡券") |
|
|
|
@ApiOperation(value = "获取贵州中石化电子卡券") |
|
|
|
public ResponseData getGuizhouSinopecList(HttpServletRequest request) { |
|
|
|
public ResponseData getGzSinopecList(@RequestBody JSONObject object , HttpServletRequest request) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
String ip = ""; |
|
|
|
String ip = ""; |
|
|
@ -99,28 +74,63 @@ public class GzSinopecController { |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取token
|
|
|
|
|
|
|
|
String token = huiLianTongConfig.getToken(); |
|
|
|
if (StringUtils.isBlank(object.getString("apiKey")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("timetable")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("merchId")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("sign")) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "请求参数校验失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
map.put("timetable" , object.getString("timetable")); |
|
|
|
|
|
|
|
map.put("apiKey" , object.getString("apiKey")); |
|
|
|
|
|
|
|
map.put("merchId" , object.getString("merchId")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!secConfigService.isSignVerify(map , object.getString("sign"))) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "签名校验失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (apiMerchants == null) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "错误商户,请联系管理人员!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!secConfigService.isConfig("GZ_SINOPEC_CONFIG" , object.getString("merchId"))) { |
|
|
|
|
|
|
|
log.error("getAllCities error!", "当前帐户无权限!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前帐户无权限!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "请求时间超过15分钟!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 查询电子卡券类型
|
|
|
|
// 查询电子卡券类型
|
|
|
|
JSONObject corpCouTypes = HuiLianTongConfig.getCorpCouTypes(token); |
|
|
|
JSONObject corpCouTypes = HuiLianTongConfig.getHltFuelCoupList(); |
|
|
|
System.out.println(corpCouTypes.toJSONString()); |
|
|
|
if (!corpCouTypes.getString("respCode").equals("0000")) { |
|
|
|
if (!corpCouTypes.getString("result").equals("success")) { |
|
|
|
log.error("HighCouponController -> insertCoupon() error!","获取电子卡券列表失败"); |
|
|
|
log.error("HighOpenApiController -> getGuizhouSinopecList() error!", "获取电子卡券列表失败"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取电子卡券列表失败"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取电子卡券列表失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 参数解密
|
|
|
|
|
|
|
|
JSONObject resolveResponseData = HuiLianTongUnionCardConfig.resolveResponse(corpCouTypes.getString("data")); |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(corpCouTypes.getJSONArray("data")); |
|
|
|
return ResponseMsgUtil.success(resolveResponseData); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("HighCouponController -> getGuizhouSinopec() error!", e); |
|
|
|
log.error("HighCouponController -> getGuizhouSinopec() error!", e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/checkCouponStatus", method = RequestMethod.POST) |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/couJointDist", method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "查询电子券状态") |
|
|
|
@ApiOperation(value = "商户派发电子券") |
|
|
|
public ResponseData checkCouponStatus(@RequestBody JSONObject object, HttpServletRequest request) { |
|
|
|
public ResponseData couJointDist(@RequestBody JSONObject object, HttpServletRequest request) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
String ip = ""; |
|
|
|
String ip = ""; |
|
|
@ -132,31 +142,101 @@ public class GzSinopecController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!secConfigService.isConfig("IP_WHITE", ip)) { |
|
|
|
if (!secConfigService.isConfig("IP_WHITE", ip)) { |
|
|
|
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!"); |
|
|
|
log.error("couJointDist error!", "非法ip地址,请联系管理人员!"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取token
|
|
|
|
if (StringUtils.isBlank(object.getString("apiKey")) || |
|
|
|
String token = huiLianTongConfig.getToken(); |
|
|
|
StringUtils.isBlank(object.getString("orderNo")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("count")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("couTypeCode")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("phone")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("timetable")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("merchId")) || |
|
|
|
|
|
|
|
StringUtils.isBlank(object.getString("sign")) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "请求参数校验失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 查询电子卡券类型
|
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
JSONObject data = HuiLianTongConfig.getCouState(token, object.getString("couNo")); |
|
|
|
map.put("timetable" , object.getString("timetable")); |
|
|
|
if (!data.getString("result").equals("success")) { |
|
|
|
map.put("apiKey" , object.getString("apiKey")); |
|
|
|
log.error("HighOpenApiController -> insertCoupon() error!", "查询电子券状态失败"); |
|
|
|
map.put("orderNo" , object.getString("orderNo")); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询电子券状态失败"); |
|
|
|
map.put("count" , object.getString("count")); |
|
|
|
|
|
|
|
map.put("couTypeCode" , object.getString("couTypeCode")); |
|
|
|
|
|
|
|
map.put("phone" , object.getString("phone")); |
|
|
|
|
|
|
|
map.put("merchId" , object.getString("merchId")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!secConfigService.isSignVerify(map , object.getString("sign"))) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "签名校验失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (apiMerchants == null) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "错误商户,请联系管理人员!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!secConfigService.isConfig("GZ_SINOPEC_CONFIG" , object.getString("merchId"))) { |
|
|
|
|
|
|
|
log.error("getAllCities error!", "当前帐户无权限!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前帐户无权限!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "请求时间超过15分钟!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (object.getInteger("count") > 5) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "下单数量限制5张!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "下单数量限制5张!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 下单请求
|
|
|
|
|
|
|
|
JSONObject rechargeObject = HuiLianTongConfig.recharge(object.getString("orderNo"), |
|
|
|
|
|
|
|
object.getInteger("count"), |
|
|
|
|
|
|
|
object.getString("couTypeCode"), |
|
|
|
|
|
|
|
object.getString("phone")); |
|
|
|
|
|
|
|
if (!rechargeObject.getString("respCode").equals("0000")) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "下单失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
JSONObject response = HuiLianTongUnionCardConfig.resolveResponse(rechargeObject.getString("data")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 购买卡券
|
|
|
|
|
|
|
|
JSONObject returnParam = HuiLianTongConfig.costRechargeOrder(response.getJSONObject("data").getString("rechargeOrderId")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (returnParam != null && returnParam.getString("respCode").equals("0000")) { |
|
|
|
|
|
|
|
// 解密
|
|
|
|
|
|
|
|
JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data")); |
|
|
|
|
|
|
|
JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 推送记录
|
|
|
|
|
|
|
|
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); |
|
|
|
|
|
|
|
highGasOrderPush.setType(OrderPushType.type6.getType()); |
|
|
|
|
|
|
|
highGasOrderPush.setOrderNo(object.getString("orderNo")); |
|
|
|
|
|
|
|
highGasOrderPush.setCreateTime(new Date()); |
|
|
|
|
|
|
|
highGasOrderPush.setCode(returnParam.getString("respCode")); |
|
|
|
|
|
|
|
highGasOrderPush.setRequestContent(object.toJSONString()); |
|
|
|
|
|
|
|
highGasOrderPush.setReturnContent(dataArray.toJSONString()); |
|
|
|
|
|
|
|
highGasOrderPushMapper.insert(highGasOrderPush); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(dataArray); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "下单失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(data.getJSONObject("data")); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("HighCouponController -> getGuizhouSinopec() error!", e); |
|
|
|
log.error("HighOpenApiController -> couJointDist() error!", e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/couJointDist", method = RequestMethod.POST) |
|
|
|
@RequestMapping(value = "/getPayOrderByCouNo", method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "商户派发电子券") |
|
|
|
@ApiOperation(value = "查询核销状态") |
|
|
|
public ResponseData couJointDist(@RequestBody JSONObject object, HttpServletRequest request) { |
|
|
|
public ResponseData getPayOrderByCouNo(@RequestBody JSONObject object , HttpServletRequest request) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
String ip = ""; |
|
|
|
String ip = ""; |
|
|
@ -168,55 +248,63 @@ public class GzSinopecController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!secConfigService.isConfig("IP_WHITE", ip)) { |
|
|
|
if (!secConfigService.isConfig("IP_WHITE", ip)) { |
|
|
|
log.error("couJointDist error!", "非法ip地址,请联系管理人员!"); |
|
|
|
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取token
|
|
|
|
|
|
|
|
String token = huiLianTongConfig.getToken(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 商户派发电子券
|
|
|
|
if (StringUtils.isBlank(object.getString("apiKey")) || |
|
|
|
JSONObject returnParam = HuiLianTongConfig.couJointDist(token, object.getString("orderNo"), object.getString("couTypeCode"), object.getInteger("distCouCount"), object.getString("phone"), object.getString("thirdUserId")); |
|
|
|
StringUtils.isBlank(object.getString("timetable")) || |
|
|
|
// 推送记录
|
|
|
|
StringUtils.isBlank(object.getString("merchId")) || |
|
|
|
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); |
|
|
|
StringUtils.isBlank(object.getString("couNo")) || |
|
|
|
highGasOrderPush.setType(OrderPushType.type6.getType()); |
|
|
|
StringUtils.isBlank(object.getString("sign")) |
|
|
|
highGasOrderPush.setOrderNo(object.getString("orderNo")); |
|
|
|
) { |
|
|
|
highGasOrderPush.setCreateTime(new Date()); |
|
|
|
log.error("getRechargeProduct error!", "请求参数校验失败!"); |
|
|
|
highGasOrderPush.setCode(returnParam.getString("result")); |
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); |
|
|
|
highGasOrderPush.setRequestContent(JSONObject.toJSONString(object)); |
|
|
|
|
|
|
|
highGasOrderPush.setReturnContent(returnParam.toJSONString()); |
|
|
|
|
|
|
|
highGasOrderPushMapper.insert(highGasOrderPush); |
|
|
|
|
|
|
|
if (!returnParam.getString("result").equals("success")) { |
|
|
|
|
|
|
|
log.error("HighOpenApiController -> couJointDist() error!", "商户派发电子券失败"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户派发电子券失败"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(returnParam.getJSONArray("data")); |
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
} catch (Exception e) { |
|
|
|
map.put("timetable" , object.getString("timetable")); |
|
|
|
log.error("HighOpenApiController -> couJointDist() error!", e); |
|
|
|
map.put("apiKey" , object.getString("apiKey")); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
map.put("couNo" , object.getString("couNo")); |
|
|
|
} |
|
|
|
map.put("merchId" , object.getString("merchId")); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!secConfigService.isSignVerify(map , object.getString("sign"))) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "签名校验失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/test", method = RequestMethod.POST) |
|
|
|
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); |
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "测试") |
|
|
|
|
|
|
|
public ResponseData test(HttpServletRequest request) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String ip = ""; |
|
|
|
if (apiMerchants == null) { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "错误商户,请联系管理人员!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!secConfigService.isConfig("GZ_SINOPEC_CONFIG" , object.getString("merchId"))) { |
|
|
|
|
|
|
|
log.error("getAllCities error!", "当前帐户无权限!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前帐户无权限!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (request.getHeader("x-forwarded-for") == null) { |
|
|
|
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) { |
|
|
|
ip = request.getRemoteAddr(); |
|
|
|
log.error("getRechargeProduct error!", "请求时间超过15分钟!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject jsonObject = HuiLianTongConfig.getPayOrderByCouNo(object.getString("couNo")); |
|
|
|
|
|
|
|
if (jsonObject.getString("respCode").equals("0000")) { |
|
|
|
|
|
|
|
JSONObject data = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(data); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
log.error("getRechargeProduct error!", "查询失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "查询失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(ip); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("HighCouponController -> getGuizhouSinopec() error!", e); |
|
|
|
log.error("HighCouponController -> getGuizhouSinopec() error!", e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|