1.优化
This commit is contained in:
parent
62d3dfbe3f
commit
ca95ea298f
|
@ -183,10 +183,10 @@ public class AppVerifyController extends BaseController
|
||||||
{
|
{
|
||||||
logger.info("【扫码/编号开锁骑行】请求:{}", JSON.toJSON(order));
|
logger.info("【扫码/编号开锁骑行】请求:{}", JSON.toJSON(order));
|
||||||
if(order.getRuleId()==null){
|
if(order.getRuleId()==null){
|
||||||
return error("=============================================ruleId未传!!!=============================================");
|
return error("ruleId未传!!!");
|
||||||
}
|
}
|
||||||
if(order.getUserId()==null){
|
if(order.getUserId()==null){
|
||||||
return error("=============================================userId未传!!!=============================================");
|
return error("userId未传!!!");
|
||||||
}
|
}
|
||||||
// 判断该订单是否已结束
|
// 判断该订单是否已结束
|
||||||
EtOrder etOrder = etOrderService.selectEtOrderByOrderNo(order.getOrderNo());
|
EtOrder etOrder = etOrderService.selectEtOrderByOrderNo(order.getOrderNo());
|
||||||
|
@ -1437,11 +1437,13 @@ public class AppVerifyController extends BaseController
|
||||||
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
|
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
|
||||||
// 骑行结束并且订单金额等于0,并且未支付
|
// 骑行结束并且订单金额等于0,并且未支付
|
||||||
if(ServiceConstants.ORDER_STATUS_RIDING_END.equals(order.getStatus()) && order.getTotalFee().compareTo(BigDecimal.ZERO) == 0 && order.getPaid().equals(ServiceConstants.ORDER_PAY_STATUS_NON_PAYMENT)){
|
if(ServiceConstants.ORDER_STATUS_RIDING_END.equals(order.getStatus()) && order.getTotalFee().compareTo(BigDecimal.ZERO) == 0 && order.getPaid().equals(ServiceConstants.ORDER_PAY_STATUS_NON_PAYMENT)){
|
||||||
order.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
EtOrder order1 = new EtOrder();
|
||||||
order.setPayTime(new Date());
|
order1.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
||||||
order.setPayType(ServiceConstants.PAY_TYPE_SYS);
|
order1.setPayTime(new Date());
|
||||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
order1.setPayType(ServiceConstants.PAY_TYPE_SYS);
|
||||||
int updateEtOrder = etOrderMapper.updateEtOrder(order);
|
order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
|
order1.setOrderId(order.getOrderId());
|
||||||
|
int updateEtOrder = etOrderMapper.updateEtOrder(order1);
|
||||||
if(updateEtOrder == 0){
|
if(updateEtOrder == 0){
|
||||||
throw new ServiceException("更新订单outTradeNo失败");
|
throw new ServiceException("更新订单outTradeNo失败");
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -6,7 +6,7 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://localhost:3306/ele2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://localhost:3306/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
# url: jdbc:mysql://117.26.179.22:61110/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://117.26.179.22:61110/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
|
|
@ -71,7 +71,7 @@ public interface AsDeviceMapper extends BaseMapper<AsDevice>
|
||||||
* @param asDevice 设备
|
* @param asDevice 设备
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Log(title = "修改设备", businessType = BusinessType.UPDATE)
|
// @Log(title = "修改设备", businessType = BusinessType.UPDATE)
|
||||||
public int updateAsDevice(AsDevice asDevice);
|
public int updateAsDevice(AsDevice asDevice);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -173,14 +173,17 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
Transaction transaction = checkAndParse(request, body, Transaction.class);
|
Transaction transaction = checkAndParse(request, body, Transaction.class);
|
||||||
if (Transaction.TradeStateEnum.SUCCESS.equals(transaction.getTradeState())) {
|
if (Transaction.TradeStateEnum.SUCCESS.equals(transaction.getTradeState())) {
|
||||||
// 充值成功后的业务处理
|
// 充值成功后的业务处理
|
||||||
logger.info("【微信支付回调】交易对象(验签后) : " + JSON.toJSONString(transaction));
|
// logger.info("【微信支付回调】交易对象(验签后) : " + JSON.toJSONString(transaction));
|
||||||
etCallbackLog.setBody(JSON.toJSONString(transaction));
|
etCallbackLog.setBody(JSON.toJSONString(transaction));
|
||||||
String transactionId = transaction.getTransactionId();
|
String transactionId = transaction.getTransactionId();
|
||||||
AttachVo attachVo = JSONObject.parseObject(transaction.getAttach(),AttachVo.class);
|
AttachVo attachVo = JSONObject.parseObject(transaction.getAttach(),AttachVo.class);
|
||||||
logger.info("【微信支付回调】附加信息 : " + JSON.toJSONString(attachVo));
|
// logger.info("【微信支付回调】附加信息 : " + JSON.toJSONString(attachVo));
|
||||||
outTradeNo = transaction.getOutTradeNo();
|
outTradeNo = transaction.getOutTradeNo();
|
||||||
EtOrder order = orderService.selectEtOrderByOutTradeNo(outTradeNo);
|
EtOrder order = orderService.selectEtOrderByOutTradeNo(outTradeNo);
|
||||||
|
EtOrder order1 = new EtOrder();
|
||||||
|
order1.setOrderId(order.getOrderId());
|
||||||
logger.info("【微信支付回调】订单信息 : " + JSON.toJSONString(order));
|
logger.info("【微信支付回调】订单信息 : " + JSON.toJSONString(order));
|
||||||
|
logger.info("【微信支付回调】订单信息 11111111: " + order1.getOrderId());
|
||||||
|
|
||||||
AsUser asUser = asUserMapper.selectUserById(order.getUserId());
|
AsUser asUser = asUserMapper.selectUserById(order.getUserId());
|
||||||
/** 支付回调逻辑 1. 处理预约还是开锁 电压 */
|
/** 支付回调逻辑 1. 处理预约还是开锁 电压 */
|
||||||
|
@ -193,10 +196,10 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
// 如果是,更新订单状态,pay_time、pay_type(默认是wx)、appointment_fee等于total_fee,状态改为4 订单结束
|
// 如果是,更新订单状态,pay_time、pay_type(默认是wx)、appointment_fee等于total_fee,状态改为4 订单结束
|
||||||
// 如果是扫码骑行后还车支付
|
// 如果是扫码骑行后还车支付
|
||||||
// 更新订单状态,pay_time、pay_type(默认是wx)、total_fee等于预约费+骑行费+管理费+调度费,状态改为4 订单结束,保存微信内部订单号 callbackVo.getOutTradeNo()
|
// 更新订单状态,pay_time、pay_type(默认是wx)、total_fee等于预约费+骑行费+管理费+调度费,状态改为4 订单结束,保存微信内部订单号 callbackVo.getOutTradeNo()
|
||||||
order.setPaid("1");
|
order1.setPaid("1");
|
||||||
order.setPayTime(DateUtils.getNowDate());
|
order1.setPayTime(DateUtils.getNowDate());
|
||||||
order.setPayType(ServiceConstants.PAY_TYPE_WX);
|
order1.setPayType(ServiceConstants.PAY_TYPE_WX);
|
||||||
order.setLocking("0");
|
order1.setLocking("0");
|
||||||
// 如果使用了优惠券则扣除一次使用次数
|
// 如果使用了优惠券则扣除一次使用次数
|
||||||
if(ObjectUtil.isNotNull(order.getLogId())){
|
if(ObjectUtil.isNotNull(order.getLogId())){
|
||||||
EtCouponUserLog couponUserLog = etCouponClaimLogMapper.selectEtCouponClaimLogByLogId(order.getLogId());
|
EtCouponUserLog couponUserLog = etCouponClaimLogMapper.selectEtCouponClaimLogByLogId(order.getLogId());
|
||||||
|
@ -211,11 +214,11 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
logger.info("【微信支付回调】骑行支付");
|
logger.info("【微信支付回调】骑行支付");
|
||||||
// 1-骑行支付 关锁
|
// 1-骑行支付 关锁
|
||||||
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(order.getAreaId());
|
EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(order.getAreaId());
|
||||||
order.setMark("骑行支付");
|
order1.setMark("骑行支付");
|
||||||
logger.info("=================【微信支付回调】11111111==================");
|
logger.info("=================【微信支付回调】11111111==================");
|
||||||
if(ServiceConstants.RETURN_VERIFY_YES.equals(area.getReturnVerify())){
|
if(ServiceConstants.RETURN_VERIFY_YES.equals(area.getReturnVerify())){
|
||||||
logger.info("【微信支付回调】还车-----需要-----拍照审核");
|
logger.info("【微信支付回调】还车-----需要-----拍照审核");
|
||||||
order.setStatus(ServiceConstants.ORDER_STATUS_TO_BE_AUDIT);//如果还车需要拍照审核,状态为待审核
|
order1.setStatus(ServiceConstants.ORDER_STATUS_TO_BE_AUDIT);//如果还车需要拍照审核,状态为待审核
|
||||||
BigDecimal amount = order.getPayFee();
|
BigDecimal amount = order.getPayFee();
|
||||||
|
|
||||||
// 异步处理短信
|
// 异步处理短信
|
||||||
|
@ -224,7 +227,7 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
logger.info("【微信支付回调】还车-----不需要-----拍照审核");
|
logger.info("【微信支付回调】还车-----不需要-----拍照审核");
|
||||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
// 还车结算___小时后自动退押金---创建一个定时器TimerTask,计算出退还时间后,执行退款操作
|
// 还车结算___小时后自动退押金---创建一个定时器TimerTask,计算出退还时间后,执行退款操作
|
||||||
logger.info("=================【微信支付回调】22222222==================");
|
logger.info("=================【微信支付回调】22222222==================");
|
||||||
// 退还押金处理
|
// 退还押金处理
|
||||||
|
@ -240,10 +243,11 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
// 新增资金流水记录
|
// 新增资金流水记录
|
||||||
EtCapitalFlow capitalFlow = capitalFlowRecords(order, ServiceConstants.FLOW_TYPE_INCOME, ServiceConstants.ORDER_TYPE_RIDING, ServiceConstants.OWNER_TYPE_OPERATOR, null, ServiceConstants.PAY_TYPE_WX);
|
EtCapitalFlow capitalFlow = capitalFlowRecords(order, ServiceConstants.FLOW_TYPE_INCOME, ServiceConstants.ORDER_TYPE_RIDING, ServiceConstants.OWNER_TYPE_OPERATOR, null, ServiceConstants.PAY_TYPE_WX);
|
||||||
logger.info("=================【骑行支付回调-新增资金流水记录后】=================={}",JSON.toJSON(capitalFlow));
|
logger.info("=================【骑行支付回调-新增资金流水记录后】=================={}",JSON.toJSON(capitalFlow));
|
||||||
order.setHandlingCharge(capitalFlow.getHandlingCharge());
|
order1.setHandlingCharge(capitalFlow.getHandlingCharge());
|
||||||
order.setPlatformServiceFee(capitalFlow.getPlatformServiceFee());
|
order1.setPlatformServiceFee(capitalFlow.getPlatformServiceFee());
|
||||||
order.setOperatorDividend(capitalFlow.getOperatorDividend());
|
order1.setOperatorDividend(capitalFlow.getOperatorDividend());
|
||||||
order.setCost(getCost(order.getPayFee()));
|
order1.setCost(getCost(order.getPayFee()));
|
||||||
|
logger.info("【微信支付回调】订单信息 12222222: " + order1.getOrderId());
|
||||||
// 发起分账
|
// 发起分账
|
||||||
// BigDecimal dividendAmount= order.getPayFee().subtract(capitalFlow.getHandlingCharge()).subtract(capitalFlow.getPlatformServiceFee());//分账金额(订单实际支付金额-平台服务费-支付手续费)
|
// BigDecimal dividendAmount= order.getPayFee().subtract(capitalFlow.getHandlingCharge()).subtract(capitalFlow.getPlatformServiceFee());//分账金额(订单实际支付金额-平台服务费-支付手续费)
|
||||||
// logger.info("=================【微信支付回调】分账金额=================={}",dividendAmount);
|
// logger.info("=================【微信支付回调】分账金额=================={}",dividendAmount);
|
||||||
|
@ -252,24 +256,24 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
}else if(attachVo.getType().equals(ServiceConstants.BUSINESS_TYPE_APPOINTMENT)){
|
}else if(attachVo.getType().equals(ServiceConstants.BUSINESS_TYPE_APPOINTMENT)){
|
||||||
logger.info("【微信支付回调】取消预约支付");
|
logger.info("【微信支付回调】取消预约支付");
|
||||||
// 2-取消预约支付
|
// 2-取消预约支付
|
||||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
order.setMark("取消预约支付");
|
order1.setMark("取消预约支付");
|
||||||
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//取消预约支付后车辆正常运营
|
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//取消预约支付后车辆正常运营
|
||||||
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
|
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
|
||||||
}else if(attachVo.getType().equals(ServiceConstants.ORDER_TYPE_COUPON)){
|
}else if(attachVo.getType().equals(ServiceConstants.ORDER_TYPE_COUPON)){
|
||||||
/** 优惠券订单 */
|
/** 优惠券订单 */
|
||||||
logger.info("【微信支付回调】优惠券支付");
|
logger.info("【微信支付回调】优惠券支付");
|
||||||
// 3-优惠券支付
|
// 3-优惠券支付
|
||||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
order.setMark("优惠券支付");
|
order1.setMark("优惠券支付");
|
||||||
// 优惠券成功处理逻辑
|
// 优惠券成功处理逻辑
|
||||||
couponSuccessHandle(order);
|
couponSuccessHandle(order);
|
||||||
}else if(attachVo.getType().equals(ServiceConstants.BUSINESS_TYPE_DEPOSIT)){
|
}else if(attachVo.getType().equals(ServiceConstants.BUSINESS_TYPE_DEPOSIT)){
|
||||||
logger.info("【微信支付回调】押金支付");
|
logger.info("【微信支付回调】押金支付");
|
||||||
// 4-押金支付
|
// 4-押金支付
|
||||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
asUser.setBalance(order.getTotalFee());
|
asUser.setBalance(order.getTotalFee());
|
||||||
order.setMark("押金支付");
|
order1.setMark("押金支付");
|
||||||
|
|
||||||
// 新增资金流水记录
|
// 新增资金流水记录
|
||||||
// capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_INCOME,ServiceConstants.ORDER_TYPE_DEPOSIT);
|
// capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_INCOME,ServiceConstants.ORDER_TYPE_DEPOSIT);
|
||||||
|
@ -291,8 +295,8 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
throw new ServiceException("【微信支付回调】更新车辆状态失败");
|
throw new ServiceException("【微信支付回调】更新车辆状态失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.info("=================【微信支付回调】开始更新订单信息=================={}",JSON.toJSON(order));
|
logger.info("=================【微信支付回调】开始更新订单信息=================={}",JSON.toJSON(order1));
|
||||||
int updateEtOrder = orderService.updateEtOrder(order);
|
int updateEtOrder = orderService.updateEtOrder(order1);
|
||||||
if(updateEtOrder==0){
|
if(updateEtOrder==0){
|
||||||
logger.error("【微信支付回调】更新订单信息失败");
|
logger.error("【微信支付回调】更新订单信息失败");
|
||||||
throw new ServiceException("【微信支付回调】更新订单信息失败");
|
throw new ServiceException("【微信支付回调】更新订单信息失败");
|
||||||
|
|
|
@ -512,6 +512,9 @@ public class EtOrderServiceImpl implements IEtOrderService
|
||||||
@Transactional
|
@Transactional
|
||||||
public int deduction(EtOrder etOrder) {
|
public int deduction(EtOrder etOrder) {
|
||||||
EtOrder order = etOrderMapper.selectEtOrderByOrderNo(etOrder.getOrderNo());
|
EtOrder order = etOrderMapper.selectEtOrderByOrderNo(etOrder.getOrderNo());
|
||||||
|
EtOrder order1 = new EtOrder();
|
||||||
|
order1.setOrderId(order.getOrderId());
|
||||||
|
order1.setOrderNo(order.getOrderNo());
|
||||||
if(!ServiceConstants.ORDER_STATUS_RIDING_END.equals(order.getStatus())){
|
if(!ServiceConstants.ORDER_STATUS_RIDING_END.equals(order.getStatus())){
|
||||||
throw new ServiceException("押金抵扣失败,订单非待支付状态,订单状态:"+order.getStatus());
|
throw new ServiceException("押金抵扣失败,订单非待支付状态,订单状态:"+order.getStatus());
|
||||||
}
|
}
|
||||||
|
@ -524,12 +527,12 @@ public class EtOrderServiceImpl implements IEtOrderService
|
||||||
try {
|
try {
|
||||||
if (Transaction.TradeStateEnum.SUCCESS.equals(transaction.getTradeState())) {
|
if (Transaction.TradeStateEnum.SUCCESS.equals(transaction.getTradeState())) {
|
||||||
// 订单已支付
|
// 订单已支付
|
||||||
order.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
order1.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
||||||
order.setPayTime(DateUtils.getNowDate());
|
order1.setPayTime(DateUtils.getNowDate());
|
||||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
order.setPayType(ServiceConstants.PAY_TYPE_WX);
|
order1.setPayType(ServiceConstants.PAY_TYPE_WX);
|
||||||
order.setMark("主动查询-骑行支付");
|
order1.setMark("主动查询-骑行支付");
|
||||||
int updateEtOrder = etOrderMapper.updateEtOrderByOrderNo(order);
|
int updateEtOrder = etOrderMapper.updateEtOrderByOrderNo(order1);
|
||||||
if (updateEtOrder == 0) {
|
if (updateEtOrder == 0) {
|
||||||
// 抛出自定义异常来标识订单更新失败
|
// 抛出自定义异常来标识订单更新失败
|
||||||
throw new ServiceException("押金抵扣失败,更新骑行订单失败");
|
throw new ServiceException("押金抵扣失败,更新骑行订单失败");
|
||||||
|
@ -556,20 +559,20 @@ public class EtOrderServiceImpl implements IEtOrderService
|
||||||
if(deposit.compareTo(ridingFee) <= 0){
|
if(deposit.compareTo(ridingFee) <= 0){
|
||||||
afterDeductionFee = BigDecimal.ZERO;
|
afterDeductionFee = BigDecimal.ZERO;
|
||||||
mark = "押金抵扣成功,骑行费【"+ridingFee+"】大于押金【"+deposit+"】";
|
mark = "押金抵扣成功,骑行费【"+ridingFee+"】大于押金【"+deposit+"】";
|
||||||
order.setPayFee(deposit);//实际支付金额等于押金
|
order1.setPayFee(deposit);//实际支付金额等于押金
|
||||||
}else{
|
}else{
|
||||||
// 押金大于订单金额 扣除后
|
// 押金大于订单金额 扣除后
|
||||||
afterDeductionFee = deposit.subtract(ridingFee);
|
afterDeductionFee = deposit.subtract(ridingFee);
|
||||||
mark = "押金抵扣成功,骑行费【"+ridingFee+"】小于押金【"+deposit+"】,扣除后金额【"+afterDeductionFee+"】";
|
mark = "押金抵扣成功,骑行费【"+ridingFee+"】小于押金【"+deposit+"】,扣除后金额【"+afterDeductionFee+"】";
|
||||||
}
|
}
|
||||||
/** 更新骑行订单*/
|
/** 更新骑行订单*/
|
||||||
order.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
order1.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
||||||
order.setPayTime(DateUtils.getNowDate());
|
order1.setPayTime(DateUtils.getNowDate());
|
||||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
order.setPayType(ServiceConstants.PAY_TYPE_YJ);
|
order1.setPayType(ServiceConstants.PAY_TYPE_YJ);
|
||||||
order.setMark(mark);
|
order1.setMark(mark);
|
||||||
order.setDepositDeduction(ServiceConstants.IS_DEPOSIT_DEDUCTION);
|
order1.setDepositDeduction(ServiceConstants.IS_DEPOSIT_DEDUCTION);
|
||||||
int updateEtOrder = etOrderMapper.updateEtOrder(order);
|
int updateEtOrder = etOrderMapper.updateEtOrder(order1);
|
||||||
if(updateEtOrder == 0){
|
if(updateEtOrder == 0){
|
||||||
throw new ServiceException("押金抵扣失败,更新骑行订单失败");
|
throw new ServiceException("押金抵扣失败,更新骑行订单失败");
|
||||||
}
|
}
|
||||||
|
@ -651,8 +654,10 @@ public class EtOrderServiceImpl implements IEtOrderService
|
||||||
@Override
|
@Override
|
||||||
public boolean passAudit(EtOrder etOrder) {
|
public boolean passAudit(EtOrder etOrder) {
|
||||||
/** 1.更新订单状态为订单结束*/
|
/** 1.更新订单状态为订单结束*/
|
||||||
etOrder.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
EtOrder etOrder1 = new EtOrder();
|
||||||
int updateEtOrder = etOrderMapper.updateEtOrder(etOrder);
|
etOrder1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
|
etOrder1.setOrderId(etOrder.getOrderId());
|
||||||
|
int updateEtOrder = etOrderMapper.updateEtOrder(etOrder1);
|
||||||
if(updateEtOrder == 0){
|
if(updateEtOrder == 0){
|
||||||
throw new ServiceException("还车审核失败,更新订单失败");
|
throw new ServiceException("还车审核失败,更新订单失败");
|
||||||
}
|
}
|
||||||
|
@ -738,8 +743,10 @@ public class EtOrderServiceImpl implements IEtOrderService
|
||||||
@Override
|
@Override
|
||||||
public boolean authoritypass(EtOrder etOrder) {
|
public boolean authoritypass(EtOrder etOrder) {
|
||||||
/** 1.更新订单状态为订单结束*/
|
/** 1.更新订单状态为订单结束*/
|
||||||
etOrder.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
EtOrder etOrder1 = new EtOrder();
|
||||||
int updateEtOrder = etOrderMapper.updateEtOrder(etOrder);
|
etOrder1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
|
etOrder1.setOrderId(etOrder.getOrderId());
|
||||||
|
int updateEtOrder = etOrderMapper.updateEtOrder(etOrder1);
|
||||||
if(updateEtOrder == 0){
|
if(updateEtOrder == 0){
|
||||||
throw new ServiceException("还车审核失败,更新订单失败");
|
throw new ServiceException("还车审核失败,更新订单失败");
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,9 +110,10 @@ public class WxPayService implements IWxPayService {
|
||||||
jsapiServiceExtension.closeOrder(closeOrderRequest);
|
jsapiServiceExtension.closeOrder(closeOrderRequest);
|
||||||
}
|
}
|
||||||
String outTradeNo = IdUtils.getOrderNo("wx");
|
String outTradeNo = IdUtils.getOrderNo("wx");
|
||||||
order.setOutTradeNo(outTradeNo);
|
EtOrder order1 = new EtOrder();
|
||||||
// order.setLocking("1");
|
order1.setOrderId(order.getOrderId());
|
||||||
int updateEtOrder = etOrderService.updateEtOrder(order);
|
order1.setOutTradeNo(outTradeNo);
|
||||||
|
int updateEtOrder = etOrderService.updateEtOrder(order1);
|
||||||
if(updateEtOrder == 0){
|
if(updateEtOrder == 0){
|
||||||
throw new ServiceException("更新订单outTradeNo失败");
|
throw new ServiceException("更新订单outTradeNo失败");
|
||||||
}
|
}
|
||||||
|
@ -170,8 +171,10 @@ public class WxPayService implements IWxPayService {
|
||||||
jsapiServiceExtension.closeOrder(closeOrderRequest);
|
jsapiServiceExtension.closeOrder(closeOrderRequest);
|
||||||
}
|
}
|
||||||
String outTradeNo = IdUtils.getOrderNo("wx");
|
String outTradeNo = IdUtils.getOrderNo("wx");
|
||||||
order.setOutTradeNo(outTradeNo);
|
EtOrder order1 = new EtOrder();
|
||||||
int updateEtOrder = etOrderService.updateEtOrder(order);
|
order1.setOrderId(order.getOrderId());
|
||||||
|
order1.setOutTradeNo(outTradeNo);
|
||||||
|
int updateEtOrder = etOrderService.updateEtOrder(order1);
|
||||||
if(updateEtOrder == 0){
|
if(updateEtOrder == 0){
|
||||||
throw new ServiceException("更新订单outTradeNo失败");
|
throw new ServiceException("更新订单outTradeNo失败");
|
||||||
}
|
}
|
||||||
|
@ -260,6 +263,8 @@ public class WxPayService implements IWxPayService {
|
||||||
@Override
|
@Override
|
||||||
public Boolean queryResultByOrderNo(String orderNo) {
|
public Boolean queryResultByOrderNo(String orderNo) {
|
||||||
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
|
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
|
||||||
|
EtOrder etOrder1 = new EtOrder();
|
||||||
|
etOrder1.setOrderId(order.getOrderId());
|
||||||
SysDept sysDept = getDeptObjByAreaId(order.getAreaId());
|
SysDept sysDept = getDeptObjByAreaId(order.getAreaId());
|
||||||
log.info("获取到运营商对象:【{}】",JSON.toJSON(sysDept));
|
log.info("获取到运营商对象:【{}】",JSON.toJSON(sysDept));
|
||||||
QueryOrderByOutTradeNoRequest request = new QueryOrderByOutTradeNoRequest();
|
QueryOrderByOutTradeNoRequest request = new QueryOrderByOutTradeNoRequest();
|
||||||
|
@ -273,15 +278,15 @@ public class WxPayService implements IWxPayService {
|
||||||
// 订单未支付并且微信支付结果是成功的情况下,更新订单状态和用户余额
|
// 订单未支付并且微信支付结果是成功的情况下,更新订单状态和用户余额
|
||||||
if(transaction.getTradeState().equals(Transaction.TradeStateEnum.SUCCESS)){
|
if(transaction.getTradeState().equals(Transaction.TradeStateEnum.SUCCESS)){
|
||||||
if(order.getPaid().equals(ServiceConstants.ORDER_PAY_STATUS_NON_PAYMENT)){
|
if(order.getPaid().equals(ServiceConstants.ORDER_PAY_STATUS_NON_PAYMENT)){
|
||||||
order.setPaid("1");
|
etOrder1.setPaid("1");
|
||||||
order.setPayTime(DateUtils.parseTime(transaction.getSuccessTime()));
|
etOrder1.setPayTime(DateUtils.parseTime(transaction.getSuccessTime()));
|
||||||
order.setPayType(ServiceConstants.PAY_TYPE_WX);
|
etOrder1.setPayType(ServiceConstants.PAY_TYPE_WX);
|
||||||
log.info("【主动查询】押金支付");
|
log.info("【主动查询】押金支付");
|
||||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
etOrder1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
if(ServiceConstants.ORDER_TYPE_RIDING.equals(order.getType())){
|
if(ServiceConstants.ORDER_TYPE_RIDING.equals(order.getType())){
|
||||||
order.setMark("主动查询-骑行支付");
|
etOrder1.setMark("主动查询-骑行支付");
|
||||||
}else{
|
}else{
|
||||||
order.setMark("押金支付");
|
etOrder1.setMark("押金支付");
|
||||||
// 更新用户余额
|
// 更新用户余额
|
||||||
AsUser asUser = asUserMapper.selectUserById(order.getUserId());
|
AsUser asUser = asUserMapper.selectUserById(order.getUserId());
|
||||||
asUser.setBalance(order.getTotalFee());
|
asUser.setBalance(order.getTotalFee());
|
||||||
|
@ -291,7 +296,7 @@ public class WxPayService implements IWxPayService {
|
||||||
throw new ServiceException("【微信支付回调】更新用户押金失败");
|
throw new ServiceException("【微信支付回调】更新用户押金失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int updateEtOrder = orderService.updateEtOrder(order);
|
int updateEtOrder = orderService.updateEtOrder(etOrder1);
|
||||||
if(updateEtOrder==0){
|
if(updateEtOrder==0){
|
||||||
log.error("【微信支付回调】更新订单信息失败");
|
log.error("【微信支付回调】更新订单信息失败");
|
||||||
throw new ServiceException("【微信支付回调】更新订单信息失败");
|
throw new ServiceException("【微信支付回调】更新订单信息失败");
|
||||||
|
|
|
@ -399,8 +399,10 @@ public class EtTask {
|
||||||
if(StrUtil.isNotBlank(tripRouteStr)){
|
if(StrUtil.isNotBlank(tripRouteStr)){
|
||||||
double[][] doubles = GeoUtils.parseJsonTrack(tripRouteStr);
|
double[][] doubles = GeoUtils.parseJsonTrack(tripRouteStr);
|
||||||
double v = GeoUtils.calculateTotalDistance(doubles);
|
double v = GeoUtils.calculateTotalDistance(doubles);
|
||||||
etOrder.setDistance((int)Math.round(v));
|
EtOrder etOrder1 = new EtOrder();
|
||||||
int updateEtOrder = etOrderService.updateEtOrder(etOrder);
|
etOrder1.setOrderId(etOrder.getOrderId());
|
||||||
|
etOrder1.setDistance((int)Math.round(v));
|
||||||
|
int updateEtOrder = etOrderService.updateEtOrder(etOrder1);
|
||||||
if(updateEtOrder>0){
|
if(updateEtOrder>0){
|
||||||
log.info("【定时任务】计算订单距离成功:【orderNo="+etOrder.getOrderNo()+"】");
|
log.info("【定时任务】计算订单距离成功:【orderNo="+etOrder.getOrderNo()+"】");
|
||||||
}
|
}
|
||||||
|
@ -511,13 +513,15 @@ public class EtTask {
|
||||||
|
|
||||||
/** 更新订单为已支付*/
|
/** 更新订单为已支付*/
|
||||||
private void updateOrderPaid(EtOrder order) {
|
private void updateOrderPaid(EtOrder order) {
|
||||||
order.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
EtOrder order1 = new EtOrder();
|
||||||
order.setPayTime(DateUtils.getNowDate());
|
order1.setOrderId(order.getOrderId());
|
||||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
order1.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
||||||
order.setPayType(ServiceConstants.PAY_TYPE_YJ);
|
order1.setPayTime(DateUtils.getNowDate());
|
||||||
order.setMark("超过7天系统自动押金抵扣");
|
order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
order.setDepositDeduction(ServiceConstants.IS_DEPOSIT_DEDUCTION);
|
order1.setPayType(ServiceConstants.PAY_TYPE_YJ);
|
||||||
int updateEtOrder = etOrderMapper.updateEtOrder(order);
|
order1.setMark("超过7天系统自动押金抵扣");
|
||||||
|
order1.setDepositDeduction(ServiceConstants.IS_DEPOSIT_DEDUCTION);
|
||||||
|
int updateEtOrder = etOrderMapper.updateEtOrder(order1);
|
||||||
if(updateEtOrder == 0){
|
if(updateEtOrder == 0){
|
||||||
throw new ServiceException("押金抵扣失败,更新骑行订单失败");
|
throw new ServiceException("押金抵扣失败,更新骑行订单失败");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user