Commit 6e325d61 authored by 周健威's avatar 周健威

Merge branch 'master-alipay-change' into dev

# Conflicts:
#	xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/OrderPayBiz.java
parents 6ae52ecb 778ad949
...@@ -2,7 +2,6 @@ package com.xxfc.platform.order.biz; ...@@ -2,7 +2,6 @@ package com.xxfc.platform.order.biz;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.github.wxiaoqi.security.admin.feign.UserFeign; import com.github.wxiaoqi.security.admin.feign.UserFeign;
...@@ -185,9 +184,11 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -185,9 +184,11 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
* 退款子流程 * 退款子流程
* @param baseOrder * @param baseOrder
* @param refundDesc 退款描述 * @param refundDesc 退款描述
* @param originalRefundAmount 原金额
* @param refundAmount 退款金额 * @param refundAmount 退款金额
* @param refundType 退款类型 * @param refundType 退款类型
* @param refundStatus 退款状态 * @param refundStatus 退款状态
* @param oad 出入账详情
*/ */
public void refundSubProcess(BaseOrder baseOrder, String refundDesc, BigDecimal originalRefundAmount, BigDecimal refundAmount, Integer refundType, Integer refundStatus, OrderAccountDetail oad) { public void refundSubProcess(BaseOrder baseOrder, String refundDesc, BigDecimal originalRefundAmount, BigDecimal refundAmount, Integer refundType, Integer refundStatus, OrderAccountDetail oad) {
String refundTradeNo = null; String refundTradeNo = null;
...@@ -200,6 +201,23 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -200,6 +201,23 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
orv.setOrderNo(baseOrder.getNo()); orv.setOrderNo(baseOrder.getNo());
orv.setRefundDesc(refundDesc+ refundAmount.toString()); orv.setRefundDesc(refundDesc+ refundAmount.toString());
orv.setRefundAmount(refundAmount.multiply(new BigDecimal("100")).intValue()); orv.setRefundAmount(refundAmount.multiply(new BigDecimal("100")).intValue());
// originalRefundAmount - refundAmount
Integer freeze2PayAmount = originalRefundAmount.subtract(refundAmount).multiply(new BigDecimal("100")).intValue();
if(AccountTypeEnum.OUT_PART_DEPOSIT.getCode().equals(refundType)) {
// freeze2PayAmount - 违章保证金
for(OrderAccountDeduction deduction : oad.getDeductions()) {
if(DeductionTypeEnum.VIOLATE_TRAFFIC_KEEP.getCode().equals(deduction.getType())) {
freeze2PayAmount -= deduction.getAmount().multiply(new BigDecimal("100")).intValue();
break;
}
}
}
orv.setFreeze2PayAmount(freeze2PayAmount);
orv.setFreeze2PayDesc("");
ObjectRestResponse<String> result = thirdFeign.refund(orv); ObjectRestResponse<String> result = thirdFeign.refund(orv);
refundTradeNo = result.getData(); refundTradeNo = result.getData();
if(null == refundTradeNo) { if(null == refundTradeNo) {
...@@ -384,9 +402,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -384,9 +402,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
BigDecimal originalRefundAmount = oad.getOriginDepositAmount().add(oad.getOriginOrderAmount()); BigDecimal originalRefundAmount = oad.getOriginDepositAmount().add(oad.getOriginOrderAmount());
//crosstown.getRestDeposit().add(crosstown.getDeductionCost()).subtract(illegalReserve); //crosstown.getRestDeposit().add(crosstown.getDeductionCost()).subtract(illegalReserve);
String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString(); String refundDesc = "退还车辆押金:"+ refundAmont.toString();
refundDesc += handleDedRefundDesc;
refundDesc += ")";
//还车扣除款 剩余的 钱,再减去违章预备金 //还车扣除款 剩余的 钱,再减去违章预备金
oad.getDeductions().add( oad.getDeductions().add(
......
...@@ -170,7 +170,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -170,7 +170,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
OrderRentVehicleDetail orderRentVehicleDetail = orderRentVehicleBiz.selectById(baseOrder.getDetailId()); OrderRentVehicleDetail orderRentVehicleDetail = orderRentVehicleBiz.selectById(baseOrder.getDetailId());
if (orderVehicleCrosstownDto.getType() == CrosstownTypeEnum.DEPARTURE.getCode()) { if (orderVehicleCrosstownDto.getType() == CrosstownTypeEnum.DEPARTURE.getCode()) {
boolean flag = getTodayTime(orderRentVehicleDetail.getStartTime()); boolean flag = getTodayTime(orderRentVehicleDetail.getStartTime(), orderRentVehicleDetail.getEndTime());
if (!flag) { if (!flag) {
return ObjectRestResponse.createFailedResult(3502, "今日不是交车日期"); return ObjectRestResponse.createFailedResult(3502, "今日不是交车日期");
} }
...@@ -431,9 +431,15 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -431,9 +431,15 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return illegalReserve; return illegalReserve;
} }
public boolean getTodayTime(Long time) { /**
* 当前时间大于预定开始时间当天0点,小于结束时间当天时间24点 2019.11.04
* @param startTime
* @param endTime
* @return
*/
public boolean getTodayTime(Long startTime, Long endTime) {
long current = System.currentTimeMillis(); long current = System.currentTimeMillis();
if (current <= (getDayStart(time) + 24 * 60 * 60 * 1000 - 1) && current >= getDayStart(time)) { if (getDayStart(startTime) <= (current) && current <= getDayStart(endTime) + 1000 * 3600 * 24 - 1) {
return true; return true;
} }
return false; return false;
......
...@@ -110,7 +110,7 @@ public class RentDepositJobHandler extends IJobHandler { ...@@ -110,7 +110,7 @@ public class RentDepositJobHandler extends IJobHandler {
OrderAccountDetail oad = new OrderAccountDetail(); OrderAccountDetail oad = new OrderAccountDetail();
String refundDesc = "退还押金:"; String refundDesc = "退还违章押金:";
BigDecimal refundAmont; BigDecimal refundAmont;
if(null != orderViolation) { if(null != orderViolation) {
//设置扣款项 //设置扣款项
...@@ -120,8 +120,7 @@ public class RentDepositJobHandler extends IJobHandler { ...@@ -120,8 +120,7 @@ public class RentDepositJobHandler extends IJobHandler {
//还车扣除款 剩余的 钱,再减去违章预备金 //还车扣除款 剩余的 钱,再减去违章预备金
refundAmont = orvd.getReturnPayResidue().subtract(orderViolation.getPrice()); refundAmont = orvd.getReturnPayResidue().subtract(orderViolation.getPrice());
refundDesc += refundAmont.toString()+ "(已扣除 违章扣款:"+ refundAmont.toString(); refundDesc += refundAmont.toString();
refundDesc += ")";
}else { }else {
refundAmont = orvd.getReturnPayResidue(); refundAmont = orvd.getReturnPayResidue();
refundDesc += refundAmont.toString(); refundDesc += refundAmont.toString();
......
package com.xxfc.platform.universal.entity; package com.xxfc.platform.universal.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/** /**
* 订单支付 * 订单支付
...@@ -44,7 +47,11 @@ public class OrderPay implements Serializable { ...@@ -44,7 +47,11 @@ public class OrderPay implements Serializable {
@Column(name = "pay_way") @Column(name = "pay_way")
@ApiModelProperty(value = "1:微信公众号支付 2.支付宝即时到账,3,银联") @ApiModelProperty(value = "1:微信公众号支付 2.支付宝即时到账,3,银联")
private Integer payWay; private Integer payWay;
@Column(name = "pay_type")
@ApiModelProperty(value = "1:支付宝APP支付,2:支付宝预授权支付")
private Integer payType;
//渠道:1-租车;2-旅游 //渠道:1-租车;2-旅游
@Column(name = "channel") @Column(name = "channel")
@ApiModelProperty(value = "渠道:1-租车;2-旅游") @ApiModelProperty(value = "渠道:1-租车;2-旅游")
......
...@@ -4,10 +4,6 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -4,10 +4,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/** /**
...@@ -69,5 +65,11 @@ public class OrderPayVo{ ...@@ -69,5 +65,11 @@ public class OrderPayVo{
private String tradeNo; private String tradeNo;
//支付接口返回的流水号
@Column(name = "serial_number")
@ApiModelProperty(value = "支付接口返回的流水号")
private String serialNumber;
@ApiModelProperty(value = "1:支付宝APP支付,2:支付宝预授权支付")
private Integer payType;
} }
...@@ -8,6 +8,7 @@ import javax.persistence.GeneratedValue; ...@@ -8,6 +8,7 @@ import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
/** /**
...@@ -37,5 +38,12 @@ public class OrderRefundVo{ ...@@ -37,5 +38,12 @@ public class OrderRefundVo{
@ApiModelProperty(value = "退款描述") @ApiModelProperty(value = "退款描述")
private String refundDesc; private String refundDesc;
//冻结转支付描述 只用于预支付相关
@ApiModelProperty(value = "冻结转支付描述")
private String freeze2PayDesc;
//冻结转支付金额 只用于预支付相关
@ApiModelProperty(value = "冻结转支付金额")
private Integer freeze2PayAmount;
} }
...@@ -5,7 +5,6 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -5,7 +5,6 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.github.wxiaoqi.security.common.util.process.SystemConfig; import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.github.wxiaoqi.security.common.util.result.JsonResultUtil; import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.entity.OrderPay; import com.xxfc.platform.universal.entity.OrderPay;
import com.xxfc.platform.universal.entity.OrderRefund; import com.xxfc.platform.universal.entity.OrderRefund;
import com.xxfc.platform.universal.mapper.OrderRefundMapper; import com.xxfc.platform.universal.mapper.OrderRefundMapper;
...@@ -21,10 +20,6 @@ import org.springframework.stereotype.Service; ...@@ -21,10 +20,6 @@ import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.util.List; import java.util.List;
import java.util.Map;
import static com.xxfc.platform.universal.constant.DictionaryKey.PAY_DEMOTION;
import static com.xxfc.platform.universal.constant.DictionaryKey.UNIVERSAL_PAY;
/** /**
* 订单支付退款表 * 订单支付退款表
...@@ -59,17 +54,17 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> { ...@@ -59,17 +54,17 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
Integer refundAmount = orderRefundVo.getRefundAmount(); Integer refundAmount = orderRefundVo.getRefundAmount();
//临时处理 //临时处理
Map<String, Dictionary> dictionaryMap = dictionaryBiz.getAll4Map(); // Map<String, Dictionary> dictionaryMap = dictionaryBiz.getAll4Map();
Integer demotion = Integer.valueOf(dictionaryMap.get(UNIVERSAL_PAY + "_" + PAY_DEMOTION).getDetail()); // Integer demotion = Integer.valueOf(dictionaryMap.get(UNIVERSAL_PAY + "_" + PAY_DEMOTION).getDetail());
payAmount = payAmount / demotion; // payAmount = payAmount / demotion;
if (payAmount <= 0) { // if (payAmount <= 0) {
payAmount = 1; // payAmount = 1;
} // }
//
refundAmount = refundAmount / demotion; // refundAmount = refundAmount / demotion;
if (refundAmount <= 0) { // if (refundAmount <= 0) {
refundAmount = 1; // refundAmount = 1;
} // }
String refundDesc = StringUtils.isNotBlank(orderRefundVo.getRefundDesc()) ? orderRefundVo.getRefundDesc() : "审核通过,退款"; String refundDesc = StringUtils.isNotBlank(orderRefundVo.getRefundDesc()) ? orderRefundVo.getRefundDesc() : "审核通过,退款";
String out_refund_no = Snowflake.build() + ""; String out_refund_no = Snowflake.build() + "";
...@@ -89,9 +84,19 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> { ...@@ -89,9 +84,19 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
OrderPay orderPay = list.get(0); OrderPay orderPay = list.get(0);
String out_trade_no = orderPay.getTradeNo(); String out_trade_no = orderPay.getTradeNo();
boolean flag = false; boolean flag = false;
if (orderPay.getPayWay() == 2) { if (orderPay.getPayWay() == 2 && orderPay.getPayType() == 1) {
log.info("======支付宝退款中==========="); log.info("======支付宝APP支付退款中===========");
flag = payBiz.alipayOrderRefund(out_trade_no, orderPay.getSerialNumber(), refundAmount, refundDesc, out_trade_no + System.currentTimeMillis()); flag = payBiz.alipayOrderRefund(out_trade_no, orderPay.getSerialNumber(), refundAmount, refundDesc, out_trade_no + System.currentTimeMillis());
} else if (orderPay.getPayWay() == 2 && orderPay.getPayType() == 2) {
log.info("======支付宝预授权支付退款中===========");
//需要根据实际传过来的参数类型来进行解冻或者预授权转支付
if (orderRefundVo.getRefundAmount() != 0) { //解冻金额
flag = payBiz.fundAuthOrderUnFreeze(orderPay.getTradeNo() + System.currentTimeMillis(), orderPay.getSerialNumber(), orderRefundVo.getRefundAmount(), orderRefundVo.getRefundDesc());
}
//预授权转支付
if(orderRefundVo.getFreeze2PayAmount() != 0) {
flag = payBiz.tradePay(orderPay.getTradeNo() + System.currentTimeMillis(), orderPay.getSerialNumber(), orderRefundVo.getFreeze2PayAmount(), orderRefundVo.getFreeze2PayDesc(), orderRefundVo.getFreeze2PayDesc());
}
} else if(orderPay.getPayWay() == 1){ } else if(orderPay.getPayWay() == 1){
log.info("======微信退款中==========="); log.info("======微信退款中===========");
flag = WxPayRefundUtils.refund(appid, mchId, partnerKey, out_trade_no, out_refund_no, payAmount + "", flag = WxPayRefundUtils.refund(appid, mchId, partnerKey, out_trade_no, out_refund_no, payAmount + "",
......
...@@ -1154,7 +1154,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1154,7 +1154,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
public PageDataVO<UsableVehicleModelVO> searchUsableModel(UsableVeicleDTO dto) { public PageDataVO<UsableVehicleModelVO> searchUsableModel(UsableVeicleDTO dto) {
Map<String, Object> params = BeanUtil.beanToMap(dto); Map<String, Object> params = BeanUtil.beanToMap(dto);
if (StrUtil.isNotBlank(dto.getStartDate()) && StrUtil.isNotBlank(dto.getEndDate())) { if (StrUtil.isNotBlank(dto.getStartDate()) && StrUtil.isNotBlank(dto.getEndDate())) {
initBookSearchParam(dto, params, Boolean.TRUE); initBookSearchParam(dto, params, Boolean.FALSE);
} }
return PageDataVO.pageInfo(dto.getPage(), dto.getLimit(), () -> mapper.searchUsableModel(params)); return PageDataVO.pageInfo(dto.getPage(), dto.getLimit(), () -> mapper.searchUsableModel(params));
} }
...@@ -1214,10 +1214,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1214,10 +1214,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
List<String> notBookedDates = Lists.newArrayList(); List<String> notBookedDates = Lists.newArrayList();
if (StringUtils.isNotBlank(dto.getBookEndDate()) && if (StringUtils.isNotBlank(dto.getBookEndDate()) &&
StringUtils.isNotBlank(dto.getBookEndDate())) { StringUtils.isNotBlank(dto.getBookEndDate())) {
// notBookedDates = convertDatePeriod2List(dto.getBookStartDate(), notBookedDates = convertDatePeriod2List(dto.getBookStartDate(),
// dto.getBookEndDate()); dto.getBookEndDate());
notBookedDates = convertDatePeriod2List(dto.getStartDateExtend(), // notBookedDates = convertDatePeriod2List(dto.getStartDateExtend(),
dto.getEndDateExtend()); // dto.getEndDateExtend());
} }
//若传入预定信息查询条件,则查询对应月份预定信息查询条件(不超过3个月) //若传入预定信息查询条件,则查询对应月份预定信息查询条件(不超过3个月)
......
...@@ -526,7 +526,7 @@ ...@@ -526,7 +526,7 @@
</if> </if>
<!--增加时间限制,已审核的未出车小于当前时间的不显示, 已出车的结束时间延后两天小于当前时间的不显示--> <!--增加时间限制,已审核的未出车小于当前时间的不显示, 已出车的结束时间延后两天小于当前时间的不显示-->
<if test="flag == true and status == 2"> <if test="flag == true and status == 2">
and ( v4.id IS NOT NULL OR (v4.id IS NULL AND v1.book_end_date &gt;= now())) and ( (v4.id IS NOT NULL and DATE_ADD(v1.book_end_date,INTERVAL '2' DAY) >= now()) OR (v4.id IS NULL AND v1.book_end_date &gt;= now()))
</if> </if>
and v1.book_user != -2 and v1.book_user != -2
</where> </where>
......
...@@ -558,14 +558,14 @@ ...@@ -558,14 +558,14 @@
</if> </if>
<!-- yearNo4Where 标识时间参数不用于where条件,用于select部分 --> <!-- yearNo4Where 标识时间参数不用于where条件,用于select部分 -->
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true"> <if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
,(max( ,(ifnull(max(
vbi.bit_str = #{yearMonthAndParamBitStr} vbi.bit_str = #{yearMonthAndParamBitStr}
<!-- 租车列表 不过滤前后预约记录不符的车辆 但是合并标示车型是否有车 即 hasVehicle--> <!-- 租车列表 不过滤前后预约记录不符的车辆 但是合并标示车型是否有车 即 hasVehicle-->
<if test="withoutRecordWhere != null and withoutRecordWhere = 1 and startCompanyId != null and endCompanyId != null "> <if test="withoutRecordWhere != null and withoutRecordWhere = 1 and startCompanyId != null and endCompanyId != null ">
and (abr.to_lift_company is null or abr.to_lift_company = #{startCompanyId}) and (abr.to_lift_company is null or abr.to_lift_company = #{startCompanyId})
and (abr.to_return_company is null or abr.to_return_company = #{endCompanyId}) and (abr.to_return_company is null or abr.to_return_company = #{endCompanyId})
</if> </if>
) ), 1)
) as hasVehicle ) as hasVehicle
</if> </if>
<if test="lon != null and lat != null"> <if test="lon != null and lat != null">
...@@ -576,6 +576,7 @@ ...@@ -576,6 +576,7 @@
and vm.id is not null and vm.id is not null
and vm.status = 1 and vm.status = 1
and vm.isdel = 0 and vm.isdel = 0
and vm.app_show = 1
and bc.id is not null and bc.id is not null
GROUP BY model_id, company_id GROUP BY model_id, company_id
<if test="lon != null and lat != null">, distance</if> <if test="lon != null and lat != null">, distance</if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment