|
|
@ -1,12 +1,10 @@ |
|
|
|
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.QianZhuConfig; |
|
|
|
|
|
|
|
import com.hai.config.WxOrderConfig; |
|
|
|
import com.hai.config.WxOrderConfig; |
|
|
|
import com.hai.entity.ApiMerchants; |
|
|
|
import com.hai.entity.ApiMerchants; |
|
|
|
import com.hai.entity.ApiOrder; |
|
|
|
import com.hai.entity.ApiOrder; |
|
|
@ -14,7 +12,6 @@ import com.hai.entity.ApiProductConfig; |
|
|
|
import com.hai.entity.HighOrder; |
|
|
|
import com.hai.entity.HighOrder; |
|
|
|
import com.hai.model.OrderRefundModel; |
|
|
|
import com.hai.model.OrderRefundModel; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ResponseData; |
|
|
|
import com.hai.model.ThirdPartyModel; |
|
|
|
|
|
|
|
import com.hai.openApi.service.ApiOrderService; |
|
|
|
import com.hai.openApi.service.ApiOrderService; |
|
|
|
import com.hai.order.model.RefundPriceModel; |
|
|
|
import com.hai.order.model.RefundPriceModel; |
|
|
|
import com.hai.order.service.OrderService; |
|
|
|
import com.hai.order.service.OrderService; |
|
|
@ -30,15 +27,15 @@ import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod; |
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.sound.midi.Soundbank; |
|
|
|
import javax.sound.midi.Soundbank; |
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
@Controller |
|
|
@ -86,11 +83,11 @@ public class orderController { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
} |
|
|
|
} |
|
|
|
//
|
|
|
|
|
|
|
|
// if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
|
|
|
|
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) { |
|
|
|
// log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
|
|
|
|
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!"); |
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
StringUtils.isBlank(object.getString("productType")) || |
|
|
|
StringUtils.isBlank(object.getString("productType")) || |
|
|
@ -213,10 +210,10 @@ public class orderController { |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
|
|
|
|
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) { |
|
|
|
// log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
|
|
|
|
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!"); |
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
StringUtils.isBlank(object.getString("mchOrderNo")) || |
|
|
|
StringUtils.isBlank(object.getString("mchOrderNo")) || |
|
|
@ -279,11 +276,11 @@ public class orderController { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
} |
|
|
|
} |
|
|
|
//
|
|
|
|
|
|
|
|
// if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
|
|
|
|
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) { |
|
|
|
// log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
|
|
|
|
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!"); |
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
StringUtils.isBlank(object.getString("mchOrderNo")) || |
|
|
|
StringUtils.isBlank(object.getString("mchOrderNo")) || |
|
|
@ -333,10 +330,10 @@ public class orderController { |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
|
|
|
|
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) { |
|
|
|
// log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
|
|
|
|
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!"); |
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
StringUtils.isBlank(object.getString("mchOrderNo")) || |
|
|
|
StringUtils.isBlank(object.getString("mchOrderNo")) || |
|
|
@ -406,10 +403,10 @@ public class orderController { |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
|
|
|
|
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) { |
|
|
|
// log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
|
|
|
|
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!"); |
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
StringUtils.isBlank(object.getString("paySerialNo")) || |
|
|
|
StringUtils.isBlank(object.getString("paySerialNo")) || |
|
|
@ -452,81 +449,4 @@ public class orderController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getThirdOrderByOrderNo", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "查询第三方订单详情") |
|
|
|
|
|
|
|
public ResponseData getThirdOrderByOrderNo(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo , HttpServletRequest request) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String ip = ""; |
|
|
|
|
|
|
|
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
|
|
|
|
|
|
|
|
if (request.getHeader("x-forwarded-for") == null) { |
|
|
|
|
|
|
|
ip = request.getRemoteAddr(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ip = request.getHeader("x-forwarded-for"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
|
|
|
|
|
|
|
|
// log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
|
|
|
|
|
|
|
|
// throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ApiOrder apiOrder = apiOrderService.findByOrderNo(mchOrderNo , null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HighOrder order = highOrderService.getOrderByOrderNo(apiOrder.getOrderNo()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject object; |
|
|
|
|
|
|
|
List<Map<String, Object>> list = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (order.getHighChildOrderList().get(0).getGoodsType() == 4) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object = QianZhuConfig.getKfcOrderByOrderNo(order.getHighChildOrderList().get(0).getChannelOrderNo()); |
|
|
|
|
|
|
|
if (object.getBoolean("success")) { |
|
|
|
|
|
|
|
if (object.getJSONObject("data").getString("ticket") != null) { |
|
|
|
|
|
|
|
String[] s = object.getJSONObject("data").getString("ticket").split(","); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (String s1 : s) { |
|
|
|
|
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
String[] childString = s1.split("\\|"); |
|
|
|
|
|
|
|
map.put("code" , childString[0]); |
|
|
|
|
|
|
|
list.add(map); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
log.error("getThirdOrderByOrderId error!", "查询失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("message")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
object = QianZhuConfig.starbucksOrderByOrderNo(order.getHighChildOrderList().get(0).getChannelOrderNo()); |
|
|
|
|
|
|
|
if (object.getBoolean("success")) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONArray jsonObject = object.getJSONObject("data").getJSONArray("orderItems"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Object a : jsonObject) { |
|
|
|
|
|
|
|
JSONObject orderItem = (JSONObject) a; |
|
|
|
|
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
map.put("code" , orderItem.getString("code")); |
|
|
|
|
|
|
|
list.add(map); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
log.error("getThirdOrderByOrderId error!", "查询失败!"); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("message")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ResponseMsgUtil.success(list); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.error("HighUserCardController --> oilCardRefund() error!", e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|