@ -647,119 +647,119 @@ public class OrderController {
public ResponseData fleetOilCardPay ( @RequestBody String reqBodyStr , HttpServletRequest request ) {
public ResponseData fleetOilCardPay ( @RequestBody String reqBodyStr , HttpServletRequest request ) {
try {
try {
// 用户
// 用户
SessionObject sessionObject = userCenter . getSessionObject ( request ) ;
// SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = ( HighUserModel ) sessionObject . getObject ( ) ;
// HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
//
if ( StringUtils . isBlank ( reqBodyStr ) ) {
// if (StringUtils.isBlank(reqBodyStr)) {
log . error ( "orderToPay error!" , "参数错误" ) ;
// log.error("orderToPay error!", "参数错误");
throw ErrorHelp . genException ( SysCode . System , ErrorCode . REQ_PARAMS_ERROR , "" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// }
JSONObject jsonObject = JSONObject . parseObject ( reqBodyStr ) ;
// JSONObject jsonObject = JSONObject.parseObject(reqBodyStr);
String cardNo = jsonObject . getString ( "cardNo" ) ;
// String cardNo = jsonObject.getString("cardNo");
Long orderId = jsonObject . getLong ( "orderId" ) ;
// Long orderId = jsonObject.getLong("orderId");
String password = jsonObject . getString ( "password" ) ;
// String password = jsonObject.getString("password");
String carLicensePlate = jsonObject . getString ( "carLicensePlate" ) ;
// String carLicensePlate = jsonObject.getString("carLicensePlate");
//
if ( StringUtils . isBlank ( cardNo ) | | orderId = = null ) {
// if (StringUtils.isBlank(cardNo) || orderId == null) {
log . error ( "orderToPay error!" , "参数错误" ) ;
// log.error("orderToPay error!", "参数错误");
throw ErrorHelp . genException ( SysCode . System , ErrorCode . REQ_PARAMS_ERROR , "" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// }
// 查询用户支付密码
// // 查询用户支付密码
HighUserPayPassword userPayPassword = highUserPayPasswordService . getDetailByUser ( userInfoModel . getHighUser ( ) . getId ( ) ) ;
// HighUserPayPassword userPayPassword = highUserPayPasswordService.getDetailByUser(userInfoModel.getHighUser().getId());
if ( userPayPassword = = null ) {
// if (userPayPassword == null) {
log . error ( "orderToPay error!" , "未设置支付密码" ) ;
// log.error("orderToPay error!", "未设置支付密码");
throw ErrorHelp . genException ( SysCode . System , ErrorCode . NOT_SET_USER_PAY_PWD , "" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, "");
}
// }
if ( StringUtils . isBlank ( password ) ) {
// if (StringUtils.isBlank(password)) {
log . error ( "orderToPay error!" , "未输入支付密码" ) ;
// log.error("orderToPay error!", "未输入支付密码");
throw ErrorHelp . genException ( SysCode . System , ErrorCode . NOT_ENTER_USER_PAY_PWD , "" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, "");
}
// }
// 校验支付密码是否一直
// // 校验支付密码是否一直
if ( ! AESEncodeUtil . aesEncrypt ( password ) . equals ( userPayPassword . getPassword ( ) ) ) {
// if (!AESEncodeUtil.aesEncrypt(password).equals(userPayPassword.getPassword())) {
log . error ( "orderToPay error!" , "" ) ;
// log.error("orderToPay error!", "");
throw ErrorHelp . genException ( SysCode . System , ErrorCode . USER_PAY_PWD_ERROR , "" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PAY_PWD_ERROR, "");
}
// }
//
// 查询用户与卡号的关系
// // 查询用户与卡号的关系
HighUserCard userCard = highUserCardService . getDetailByUserCardNo ( userInfoModel . getHighUser ( ) . getId ( ) , cardNo ) ;
// HighUserCard userCard = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), cardNo);
if ( userCard = = null ) {
// if (userCard == null) {
log . error ( "OrderController --> orderToPay() ERROR" , "未绑定卡号" ) ;
// log.error("OrderController --> orderToPay() ERROR", "未绑定卡号");
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "未绑定卡号" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号");
}
// }
HighOrder order = highOrderService . getOrderById ( orderId ) ;
// HighOrder order = highOrderService.getOrderById(orderId);
if ( order = = null ) {
// if(order == null) {
log . error ( "OrderController --> orderToPay() ERROR" , "未找到订单信息" ) ;
// log.error("OrderController --> orderToPay() ERROR", "未找到订单信息");
throw ErrorHelp . genException ( SysCode . System , ErrorCode . NOT_FOUND_ORDER , "" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
// }
//校验订单状态 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
// //校验订单状态 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
if ( order . getOrderStatus ( ) ! = 1 ) {
// if(order.getOrderStatus() != 1) {
log . error ( "OrderController --> orderToPay() ERROR" , "订单不处于待支付状态" ) ;
// log.error("OrderController --> orderToPay() ERROR", "订单不处于待支付状态");
throw ErrorHelp . genException ( SysCode . System , ErrorCode . ORDER_NO_STAY_PAY , "" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, "");
}
// }
//
// 商品类型 1:卡卷 2:金币充值
// // 商品类型 1:卡卷 2:金币充值
for ( HighChildOrder childOrder : order . getHighChildOrderList ( ) ) {
// for (HighChildOrder childOrder : order.getHighChildOrderList()) {
if ( childOrder . getGoodsType ( ) = = 3 ) {
// if (childOrder.getGoodsType() = = 3) {
if ( highOrderService . getGasTheDayOrderNum ( order . getMemId ( ) ) > = 1 ) {
// if (highOrderService.getGasTheDayOrderNum(order.getMemId()) >= 1) {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "已达到每日加油次数上限" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限");
}
// }
//
// 查询加油站
// // 查询加油站
HighMerchantStoreModel store = merchantStoreService . getMerchantStoreById ( childOrder . getGoodsId ( ) ) ;
// HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(childOrder.getGoodsId());
if ( store = = null ) {
// if (store = = null) {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "已达到每日加油次数上限" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已达到每日加油次数上限");
}
// }
// 来源类型 1:平台自建 2:团油
// // 来源类型 1:平台自建 2:团油
if ( store . getSourceType ( ) . equals ( 2 ) ) {
// if (store.getSourceType().equals(2)) {
// 查询账号余额
// // 查询账号余额
JSONObject accountInfo2JD = TuanYouConfig . queryCompanyAccountInfo2JD ( ) ;
// JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD();
JSONArray result = accountInfo2JD . getJSONArray ( "result" ) ;
// JSONArray result = accountInfo2JD.getJSONArray("result");
for ( Object accountObject : result ) {
// for (Object accountObject : result) {
JSONObject account = ( JSONObject ) accountObject ;
// JSONObject account = (JSONObject)accountObject;
// 1:汽油:2:柴油;3:天然气
// // 1:汽油:2:柴油;3:天然气
if ( account . getInteger ( "energyType" ) = = c hildOrder. getGasOilType ( ) ) {
// if (account.getInteger("energyType") = = c hildOrder.getGasOilType()) {
// 支付金额 大于 团油账号余额
// // 支付金额 大于 团油账号余额
if ( order . getPayPrice ( ) . compareTo ( account . getBigDecimal ( "accountBalance" ) ) = = 1 ) {
// if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) = = 1){
log . error ( "OrderController --> orderToPay() ERROR" , "无法进行支付,请联系平台客服" ) ;
// log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服");
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "无法进行支付,请联系平台客服" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服");
}
// }
}
// }
}
// }
}
// }
// 来源类型 1:平台自建 2:团油
// // 来源类型 1:平台自建 2:团油
if ( store . getSourceType ( ) . equals ( MerchantStoreSourceType . type3 . getNumber ( ) ) ) {
// if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) {
BigDecimal account = new BigDecimal ( "0" ) ;
// BigDecimal account = new BigDecimal("0");
// 查询账号余额
// // 查询账号余额
HighMerchantAccount merAccount = merchantAccountService . getMerAccountDetail ( store . getMerchantId ( ) ) ;
// HighMerchantAccount merAccount = merchantAccountService.getMerAccountDetail(store.getMerchantId());
if ( merAccount ! = null ) {
// if (merAccount != null) {
account = merAccount . getAmounts ( ) . subtract ( merchantAccountService . countMerGasOilAmount ( store . getMerchantId ( ) ) ) ;
// account = merAccount.getAmounts().subtract(merchantAccountService.countMerGasOilAmount(store.getMerchantId()));
}
// }
// 客户加油金额 大于 商户账号余额
// // 客户加油金额 大于 商户账号余额
if ( order . getTotalPrice ( ) . compareTo ( account ) = = 1 ) {
// if(order.getTotalPrice().compareTo(account) = = 1) {
log . error ( "OrderController --> orderToPay() ERROR" , "暂时无法进行支付,请联系平台客服" ) ;
// log.error("OrderController --> orderToPay() ERROR", "暂时无法进行支付,请联系平台客服");
throw ErrorHelp . genException ( SysCode . System , ErrorCode . COMMON_ERROR , "暂时无法进行支付,请联系平台客服" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服");
}
// }
}
// }
}
// }
}
// }
//
highOrderService . fleetOilCardPayOrder ( userCard . getId ( ) , order . getId ( ) , carLicensePlate ) ;
// highOrderService.fleetOilCardPayOrder(userCard.getId(), order.getId(), carLicensePlate);
//
new Thread ( ( ) - > {
// new Thread(() -> {
// 查询订单信息
// // 查询订单信息
if ( order = = null ) {
// if (order = = null) {
throw ErrorHelp . genException ( SysCode . System , ErrorCode . NOT_FOUND_ORDER , "" ) ;
// throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
// }
HighUser highUser = highUserService . findByUserId ( order . getMemId ( ) ) ;
// HighUser highUser = highUserService.findByUserId(order.getMemId());
HighChildOrder presentation = highOrderService . getChildOrderByPresentation ( order . getId ( ) ) ;
// HighChildOrder presentation = highOrderService.getChildOrderByPresentation(order.getId());
WxMsgConfig . pushOneUser (
// WxMsgConfig.pushOneUser(
presentation . getGoodsName ( ) + "(" + GoodsType . getNameByType ( presentation . getGoodsType ( ) ) + ")" ,
// presentation.getGoodsName() + "(" + GoodsType.getNameByType(presentation.getGoodsType()) + ")",
String . valueOf ( order . getPayPrice ( ) ) ,
// String.valueOf(order.getPayPrice()),
order . getOrderNo ( ) ,
// order.getOrderNo(),
order . getPayTime ( ) ,
// order.getPayTime(),
PayType . getNameByType ( order . getPayType ( ) ) , order . getId ( ) ,
// PayType.getNameByType(order.getPayType()), order.getId(),
highUser . getOpenId ( ) ) ;
// highUser.getOpenId());
} ) . start ( ) ;
// }).start();
return ResponseMsgUtil . success ( "支付成功" ) ;
return ResponseMsgUtil . success ( "支付成功" ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {