|
|
@ -6,8 +6,11 @@ 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.security.AESEncodeUtil; |
|
|
|
import com.hai.common.security.AESEncodeUtil; |
|
|
|
|
|
|
|
import com.hai.common.utils.DateUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
import com.hai.config.CommonSysConst; |
|
|
|
|
|
|
|
import com.hai.config.HuiLianTongUnionCardConfig; |
|
|
|
|
|
|
|
import com.hai.config.UnionPayConfig; |
|
|
|
import com.hai.config.WxOrderConfig; |
|
|
|
import com.hai.config.WxOrderConfig; |
|
|
|
import com.hai.dao.HighGasOrderRefundMapper; |
|
|
|
import com.hai.dao.HighGasOrderRefundMapper; |
|
|
|
import com.hai.entity.HighChildOrder; |
|
|
|
import com.hai.entity.HighChildOrder; |
|
|
@ -30,6 +33,7 @@ import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.*; |
|
|
|
import java.io.*; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.security.*; |
|
|
|
import java.security.*; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
@Controller |
|
|
@ -81,6 +85,8 @@ public class TuanYouController { |
|
|
|
if (order.getOrderStatus() == 2 || order.getOrderStatus() == 3 || order.getOrderStatus() == 6) { |
|
|
|
if (order.getOrderStatus() == 2 || order.getOrderStatus() == 3 || order.getOrderStatus() == 6) { |
|
|
|
// 退单结果 true:成功 false:失败
|
|
|
|
// 退单结果 true:成功 false:失败
|
|
|
|
if (object.getBoolean("refundResult") == true && order != null) { |
|
|
|
if (object.getBoolean("refundResult") == true && order != null) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (order.getPayType() == 2) { |
|
|
|
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), order.getPayRealPrice()); |
|
|
|
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(order.getPaySerialNo(), order.getPayRealPrice(), order.getPayRealPrice()); |
|
|
|
if(orderRefundModel.getResult_code().equals("SUCCESS")) { |
|
|
|
if(orderRefundModel.getResult_code().equals("SUCCESS")) { |
|
|
|
order.setOrderStatus(4); |
|
|
|
order.setOrderStatus(4); |
|
|
@ -88,6 +94,60 @@ public class TuanYouController { |
|
|
|
order.setRefundPrice(order.getPayRealPrice()); |
|
|
|
order.setRefundPrice(order.getPayRealPrice()); |
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if (order.getPayType() == 4) { |
|
|
|
|
|
|
|
String refundOrderNo = String.valueOf(System.currentTimeMillis()); |
|
|
|
|
|
|
|
JSONObject refund = HuiLianTongUnionCardConfig.refund(refundOrderNo, order.getPaySerialNo()); |
|
|
|
|
|
|
|
if(!refund.getString("respCode").equals("0000")) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR,refund.getString("respMessage")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(refund.getString("data")); |
|
|
|
|
|
|
|
if (consumptionResult.getBoolean("success") != true) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "交易失败!"+consumptionResult.getString("message")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
order.setOrderStatus(4); |
|
|
|
|
|
|
|
order.setRefundTime(new Date()); |
|
|
|
|
|
|
|
order.setRefundPrice(order.getPayRealPrice()); |
|
|
|
|
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
|
|
|
|
} else if (order.getPayType() == 5) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Calendar startTime = Calendar.getInstance(); |
|
|
|
|
|
|
|
startTime.set(Calendar.HOUR_OF_DAY, 00); |
|
|
|
|
|
|
|
startTime.set(Calendar.MINUTE, 00); |
|
|
|
|
|
|
|
startTime.set(Calendar.SECOND, 00); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Calendar endTime = Calendar.getInstance(); |
|
|
|
|
|
|
|
startTime.set(Calendar.HOUR_OF_DAY, 23); |
|
|
|
|
|
|
|
startTime.set(Calendar.MINUTE, 59); |
|
|
|
|
|
|
|
startTime.set(Calendar.SECOND, 59); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 订单是否处于当日的订单
|
|
|
|
|
|
|
|
if (DateUtil.isEffectiveDate(order.getPayTime(), startTime.getTime(), endTime.getTime())) { |
|
|
|
|
|
|
|
// 订单撤销
|
|
|
|
|
|
|
|
JSONObject refund = UnionPayConfig.cancel(order.getOrderNo(), order.getPaySerialNo()); |
|
|
|
|
|
|
|
if (!refund.getString("resultcode").equals("00")) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("respMessage")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
order.setOrderStatus(4); |
|
|
|
|
|
|
|
order.setRefundTime(new Date()); |
|
|
|
|
|
|
|
order.setRefundPrice(order.getPayRealPrice()); |
|
|
|
|
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 订单退款
|
|
|
|
|
|
|
|
JSONObject refund = UnionPayConfig.zwrefund(order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue()); |
|
|
|
|
|
|
|
if (!refund.getString("resultcode").equals("00")) { |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("respMessage")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
order.setOrderStatus(4); |
|
|
|
|
|
|
|
order.setRefundTime(new Date()); |
|
|
|
|
|
|
|
order.setRefundPrice(order.getPayRealPrice()); |
|
|
|
|
|
|
|
highOrderService.updateOrderDetail(order); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else if (!object.getBoolean("refundResult") == true && order != null) { |
|
|
|
} else if (!object.getBoolean("refundResult") == true && order != null) { |
|
|
|
order.setOrderStatus(7); |
|
|
|
order.setOrderStatus(7); |
|
|
|
order.setRefusalRefundContent(object.getString("refundFailReason")); |
|
|
|
order.setRefusalRefundContent(object.getString("refundFailReason")); |
|
|
|