Commit 4ccbc618 authored by hanfeng's avatar hanfeng

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/UserFeign.java
#	ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/AppUserController.java
#	ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCalculateBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/inner/OrderCancelBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderRefundController.java
#	xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
parents 9e0c1ce1 81ce0510
package com.github.wxiaoqi.security.admin.feign; package com.github.wxiaoqi.security.admin.feign;
import com.github.wxiaoqi.security.admin.bo.UserBo;
import com.github.wxiaoqi.security.admin.dto.UserMemberDTO; import com.github.wxiaoqi.security.admin.dto.UserMemberDTO;
import com.github.wxiaoqi.security.admin.entity.AppUserLogin; import com.github.wxiaoqi.security.admin.entity.AppUserLogin;
import com.github.wxiaoqi.security.admin.entity.BaseUserMember; import com.github.wxiaoqi.security.admin.entity.BaseUserMember;
...@@ -141,5 +142,13 @@ public interface UserFeign { ...@@ -141,5 +142,13 @@ public interface UserFeign {
@RequestParam(value = "reason",required = false) String reason, @RequestParam(value = "reason",required = false) String reason,
@RequestParam(value = "isSuccess") Boolean isSuccess); @RequestParam(value = "isSuccess") Boolean isSuccess);
}
@GetMapping(value = "/app/user/users")
List<Integer> findAppUserIds(@RequestParam(value = "phone",required = false) String phone,
@RequestParam(value = "leaderPhone",required = false) String leaderPhone,
@RequestParam(value = "name",required = false) String name);
@PostMapping(value = "/app/user/users/info")
List<UserBo> findUserDetailByUserBo(@RequestBody(required = false) List<UserBo> userBos);
}
...@@ -93,5 +93,6 @@ public class AppUserDTO { ...@@ -93,5 +93,6 @@ public class AppUserDTO {
private Boolean isBindWx; private Boolean isBindWx;
private Boolean isBindAliPay; private Boolean isBindAliPay;
private Boolean isBindQQ; private Boolean isBindQQ;
//用户上线
private Integer parentId;
} }
...@@ -19,6 +19,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; ...@@ -19,6 +19,7 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.msg.TableResultResponse; import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.rest.CommonBaseController; import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.feign.OrderFeign; import com.xxfc.platform.order.feign.OrderFeign;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -74,6 +75,9 @@ public class AppUserController extends CommonBaseController{ ...@@ -74,6 +75,9 @@ public class AppUserController extends CommonBaseController{
@Autowired @Autowired
private AppUserAlipayBiz appUserAlipayBiz; private AppUserAlipayBiz appUserAlipayBiz;
@Autowired
private AppUserRelationBiz relationBiz;
@GetMapping("page") @GetMapping("page")
...@@ -159,7 +163,6 @@ public class AppUserController extends CommonBaseController{ ...@@ -159,7 +163,6 @@ public class AppUserController extends CommonBaseController{
String icon=memberLevel.getIcon(); String icon=memberLevel.getIcon();
userDTO.setIcon(icon); userDTO.setIcon(icon);
userDTO.setBigIcon(memberLevel.getBigIcon()); userDTO.setBigIcon(memberLevel.getBigIcon());
userDTO.setItemImg(memberLevel.getItemImg());
} }
} }
} }
...@@ -167,7 +170,20 @@ public class AppUserController extends CommonBaseController{ ...@@ -167,7 +170,20 @@ public class AppUserController extends CommonBaseController{
if (userPosition!=null&&userPosition.getLevel()>0){ if (userPosition!=null&&userPosition.getLevel()>0){
userDTO.setPositionName(userPosition.getName()); userDTO.setPositionName(userPosition.getName());
} }
AppUserRelation relation=relationBiz.getRelationByIdUserIdAndTime(userid);
Integer parentId=0;
if (relation!=null){
parentId=relation.getParentId();
}
userDTO.setParentId(parentId);
List<AppUserAlipay> appUserAlipays = appUserAlipayBiz.getByUserId(request);
long count = appUserAlipays.stream().filter(appUserAlipay -> appUserAlipay.getType() == 1).count();
userDTO.setIsBindAliPay(count>0);
userDTO.setId(id); userDTO.setId(id);
userDTO.setAliPayNickName(userDTO.getIsBindAliPay()?appUserAlipays.get(0).getNickname():"");
AppUserLogin appUserLogin = appUserLoginBiz.selectById(userid);
userDTO.setIsBindWx(StringUtils.isNotEmpty(appUserLogin.getWxOpenid()));
userDTO.setIsBindQQ(StringUtils.isNotEmpty(appUserLogin.getOpenid()));
return ObjectRestResponse.succ(userDTO); return ObjectRestResponse.succ(userDTO);
} }
...@@ -217,7 +233,7 @@ public class AppUserController extends CommonBaseController{ ...@@ -217,7 +233,7 @@ public class AppUserController extends CommonBaseController{
appUserLogin.setOpenid(userVo.getOpenid()); appUserLogin.setOpenid(userVo.getOpenid());
appUserLogin.setId(userid); appUserLogin.setId(userid);
appUserLogin.setUsername(userVo.getUsername()); appUserLogin.setUsername(userVo.getUsername());
appUserLoginBiz.updateAppuserLogin(appUserLogin); appUserLoginBiz.bindOpenid(appUserLogin);
//支付宝绑定 //支付宝绑定
if (StringUtils.isNotEmpty(userVo.getAliCode()) && userVo.getAliCode().trim().length()>0){ if (StringUtils.isNotEmpty(userVo.getAliCode()) && userVo.getAliCode().trim().length()>0){
appUserAlipayBiz.getUserInfo(userVo.getAliCode(),request); appUserAlipayBiz.getUserInfo(userVo.getAliCode(),request);
...@@ -331,6 +347,8 @@ public class AppUserController extends CommonBaseController{ ...@@ -331,6 +347,8 @@ public class AppUserController extends CommonBaseController{
return appUserLoginBiz.test(); return appUserLoginBiz.test();
} }
@PostMapping("/bind") @PostMapping("/bind")
private ObjectRestResponse accountBinding(@RequestBody AccountBindDTO accountBindDTO, HttpServletRequest request){ private ObjectRestResponse accountBinding(@RequestBody AccountBindDTO accountBindDTO, HttpServletRequest request){
try { try {
......
...@@ -264,7 +264,6 @@ public class AppUserRest { ...@@ -264,7 +264,6 @@ public class AppUserRest {
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "验证码错误"); return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "验证码错误");
} }
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
@ApiModelProperty("修改手机号码") @ApiModelProperty("修改手机号码")
......
...@@ -215,6 +215,23 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -215,6 +215,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) {
...@@ -399,9 +416,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -399,9 +416,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,9 +170,9 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -170,9 +170,9 @@ 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, "今日不是交车日期");
} }
if (null == userDTO.getCompanyId() || !userDTO.getCompanyId().equals(orderRentVehicleDetail.getStartCompanyId())) { if (null == userDTO.getCompanyId() || !userDTO.getCompanyId().equals(orderRentVehicleDetail.getStartCompanyId())) {
return ObjectRestResponse.createFailedResult(3501, "无交车权限"); return ObjectRestResponse.createFailedResult(3501, "无交车权限");
...@@ -438,9 +438,15 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -438,9 +438,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;
......
...@@ -7,14 +7,17 @@ import cn.hutool.core.date.DateUtil; ...@@ -7,14 +7,17 @@ import cn.hutool.core.date.DateUtil;
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;
import com.github.wxiaoqi.security.common.constant.CommonConstants;
import com.xxfc.platform.activity.entity.Coupon; import com.xxfc.platform.activity.entity.Coupon;
import com.xxfc.platform.activity.feign.ActivityFeign; import com.xxfc.platform.activity.feign.ActivityFeign;
import com.xxfc.platform.app.feign.ConfigFeign; import com.xxfc.platform.app.feign.ConfigFeign;
import com.xxfc.platform.order.biz.BaseOrderBiz;
import com.xxfc.platform.order.biz.OrderAccountBiz; import com.xxfc.platform.order.biz.OrderAccountBiz;
import com.xxfc.platform.order.biz.OrderItemBiz; import com.xxfc.platform.order.biz.OrderItemBiz;
import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum; import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum; import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum; import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.entity.BaseOrder; import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderItem; import com.xxfc.platform.order.entity.OrderItem;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail; import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
...@@ -22,19 +25,29 @@ import com.xxfc.platform.order.pojo.account.OrderAccountDeduction; ...@@ -22,19 +25,29 @@ import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail; import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.calculate.InProgressVO; import com.xxfc.platform.order.pojo.calculate.InProgressVO;
import com.xxfc.platform.order.pojo.order.VehicleItemDTO; import com.xxfc.platform.order.pojo.order.VehicleItemDTO;
import com.xxfc.platform.order.pojo.calculate.OrderRefundPriceVO;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.universal.constant.DictionaryKey;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO; import com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO;
import com.xxfc.platform.vehicle.pojo.dto.order.VMCalendarPriceCostDTO; import com.xxfc.platform.vehicle.pojo.dto.order.VMCalendarPriceCostDTO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Lists; import org.assertj.core.util.Lists;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.universal.constant.DictionaryKey.*;
/** /**
* 订单退款记录表 * 订单退款记录表
...@@ -68,6 +81,9 @@ public class OrderCalculateBiz { ...@@ -68,6 +81,9 @@ public class OrderCalculateBiz {
@Autowired @Autowired
OrderAccountBiz orderAccountBiz; OrderAccountBiz orderAccountBiz;
@Autowired
BaseOrderBiz baseOrderBiz;
public InProgressVO inProgressCalculate(BaseOrder baseOrder, VehicleItemDTO vehicleItemDTO, Integer freeDays, Integer useDays, OrderAccountDetail oad, Boolean isCancel) { public InProgressVO inProgressCalculate(BaseOrder baseOrder, VehicleItemDTO vehicleItemDTO, Integer freeDays, Integer useDays, OrderAccountDetail oad, Boolean isCancel) {
BigDecimal refundAmount = BigDecimal.ZERO; BigDecimal refundAmount = BigDecimal.ZERO;
BigDecimal consumeAmount = BigDecimal.ZERO; BigDecimal consumeAmount = BigDecimal.ZERO;
...@@ -263,4 +279,124 @@ public class OrderCalculateBiz { ...@@ -263,4 +279,124 @@ public class OrderCalculateBiz {
oad.setOriginOrderAmount(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount())); oad.setOriginOrderAmount(baseOrder.getGoodsAmount().subtract(baseOrder.getCouponAmount()));
return inProgressVO; return inProgressVO;
} }
/**
* 计算包含多少天
* @param startLong
* @param endLong
* @return
*/
public Integer getIncludeDays(Long startLong, Long endLong) {
Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
Long hourLong = (60L * 60L * 1000L);
Long dayLong = hourLong * 24;
Long bufferLong = Long.valueOf(dictionaryMap.get(APP_ORDER+ "_"+ DictionaryKey.RENT_TIME_BUFFER).getDetail()) * hourLong;
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long bookTimeLag = endLong - startLong;
log.info("bookTimeLag {}", new BigDecimal(bookTimeLag + ""));
log.info("divide {}", new BigDecimal((24 * 60 * 60 * 1000)+ ""));
Integer bookDays = new BigDecimal(bookTimeLag + "").divide(new BigDecimal(dayLong+ ""), 0, RoundingMode.DOWN).intValue();
Long excess = bookTimeLag%dayLong;
if(excess > bufferLong) {
bookDays += 1;
}
if(0 == bookDays) {
bookDays = 1;
}
return bookDays;
}
public OrderRefundPriceVO getPriceCalculate (String no, OrderPageVO orderPageVO) {
//根据no 查订单
OrderTypeEnum orderTypeEnum = OrderTypeEnum.get(orderPageVO.getType());
BigDecimal totalRefundAmount = BigDecimal.ZERO;
BigDecimal totalDeductAmount = BigDecimal.ZERO;
StringBuilder refundDescBuilder = new StringBuilder("");
String refundDesc = "";
InProgressVO inProgressVO = new InProgressVO();
BigDecimal topAmount = BigDecimal.ZERO;
switch (orderTypeEnum) {
case RENT_VEHICLE:
DateTime nowTime = DateTime.parse(DateTime.now().toString(CommonConstants.YMR_SLASH_FORMATTER_JODA), CommonConstants.YMR_SLASH_FORMATTER_JODA);
DateTime startTime = DateTime.parse(new DateTime(orderPageVO.getOrderRentVehicleDetail().getStartTime()).toString(CommonConstants.YMR_SLASH_FORMATTER_JODA), CommonConstants.YMR_SLASH_FORMATTER_JODA);
DateTime endTime = DateTime.parse(new DateTime(orderPageVO.getOrderRentVehicleDetail().getEndTime()).toString(CommonConstants.YMR_SLASH_FORMATTER_JODA), CommonConstants.YMR_SLASH_FORMATTER_JODA);
Long timeLag = orderPageVO.getOrderRentVehicleDetail().getStartTime() - System.currentTimeMillis();
OrderItem vehicleItem = orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.VEHICLE_MODEL.getCode());
setOrderId(orderPageVO.getId());
}});
topAmount = vehicleItem.getUnitPrice().multiply(new BigDecimal(2+ ""));
if(timeLag < 0 ) {
OrderAccountDetail oad = new OrderAccountDetail();
Integer freeDays = (null == vehicleItem.getCutNum())?0 :vehicleItem.getCutNum();
//inProgressVO = inProgressCalculate(orderPageVO, vehicleItem, freeDays, baseOrderBiz.getDaysBetweenDateTime(startTime, nowTime), new OrderAccountDetail(), Boolean.FALSE);
totalDeductAmount = oad.realTotalDeduct();
totalRefundAmount = oad.getOrderAmount().add(oad.getDepositAmount());
refundDesc = inProgressVO.getViolateDesc();
}else {
String key = RENT_REFUND;
BigDecimal deductionAmount = orderAccountBiz.calculateDeduction(vehicleItem.getBuyAmount()
, orderPageVO.getOrderRentVehicleDetail().getStartTime() - System.currentTimeMillis()
, DictionaryKey.APP_ORDER+ "_"+ key
, refundDescBuilder);
totalDeductAmount = deductionAmount;
totalRefundAmount = orderPageVO.getRealAmount().subtract(deductionAmount);
refundDesc = refundDescBuilder.toString();
}
break;
case TOUR:
//判断是省内还是省外
String key = TOUR_IN_REFUND;
if(SYS_TRUE.equals(orderPageVO.getOrderTourDetail().getIsOutside())) {
key = TOUR_REFUND;
}
OrderItem adultItem = orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.TOUR_ADULT.getCode());
setOrderId(orderPageVO.getId());
}});
OrderItem childItem = orderItemBiz.selectOne(new OrderItem(){{
setType(ItemTypeEnum.TOUR_CHILD.getCode());
setOrderId(orderPageVO.getId());
}});
BigDecimal adultItemAmount = (null == adultItem)? BigDecimal.ZERO: adultItem.getRealAmount();
BigDecimal childItemAmount = (null == childItem)? BigDecimal.ZERO: childItem.getRealAmount();
topAmount = adultItemAmount.add(childItemAmount);
BigDecimal deductionAmount = orderAccountBiz.calculateDeduction(adultItemAmount.add(childItemAmount)
, orderPageVO.getOrderTourDetail().getStartTime() - System.currentTimeMillis()
, DictionaryKey.APP_ORDER+ "_"+ key
, refundDescBuilder);
totalDeductAmount = deductionAmount;
totalRefundAmount = orderPageVO.getRealAmount().subtract(deductionAmount);
refundDesc = refundDescBuilder.toString();
break;
default:
break;
}
OrderRefundPriceVO orpv = new OrderRefundPriceVO();
orpv.setRealAmount(orderPageVO.getRealAmount());
orpv.setRefundAmount(totalRefundAmount);
orpv.setCutAmount(totalDeductAmount);
orpv.setTopAmount(topAmount);
return orpv;
}
} }
\ No newline at end of file
...@@ -115,7 +115,7 @@ public class OrderCancelBiz { ...@@ -115,7 +115,7 @@ public class OrderCancelBiz {
* @param baseOrder * @param baseOrder
*/ */
@Transactional @Transactional
public void cancel(BaseOrder baseOrder) { public void cancel(BaseOrder baseOrder, BigDecimal changeViolateAmount) {
OrderRentVehicleDetail orvd = new OrderRentVehicleDetail(); OrderRentVehicleDetail orvd = new OrderRentVehicleDetail();
OrderTourDetail otd = new OrderTourDetail(); OrderTourDetail otd = new OrderTourDetail();
OrderMemberDetail omd = new OrderMemberDetail(); OrderMemberDetail omd = new OrderMemberDetail();
...@@ -149,14 +149,14 @@ public class OrderCancelBiz { ...@@ -149,14 +149,14 @@ public class OrderCancelBiz {
//获取出发时间 到现在 距离时间 //获取出发时间 到现在 距离时间
Long timeLag = orvd.getStartTime() - System.currentTimeMillis(); Long timeLag = orvd.getStartTime() - System.currentTimeMillis();
if(timeLag < 0 ) { if(timeLag < 0 ) {
//开始时间当天时间戳 Integer useDays = orderCalculateBiz.getIncludeDays(orvd.getStartTime(), System.currentTimeMillis());
Long beginOfStartDay = DateUtil.beginOfDay(DateUtil.date(orvd.getStartTime())).getTime();
//计算:使用天数 当前时间 - 开始时间的0时0分0秒
Long useTimeLag = System.currentTimeMillis() - beginOfStartDay;
log.info("useTimeLag {}", new BigDecimal(useTimeLag + ""));
log.info("divide {}", new BigDecimal((24 * 60 * 60 * 1000)+ ""));
Integer useDays = new BigDecimal(useTimeLag + "").divide(new BigDecimal((24 * 60 * 60 * 1000)+ ""), 0, RoundingMode.UP).intValue();
inProgressVO = orderCalculateBiz.calculateOrderComplete(baseOrder, orvd, oad, vehicleItemDTO, useDays, Boolean.TRUE); inProgressVO = orderCalculateBiz.calculateOrderComplete(baseOrder, orvd, oad, vehicleItemDTO, useDays, Boolean.TRUE);
//判断是否修改违约金
if(null != changeViolateAmount) {
oad.changeCancelViolate(changeViolateAmount);
}
//结合 //结合
//退款子流程: 订单基础,退款描述,退款金额 //退款子流程: 订单基础,退款描述,退款金额
orderAccountBiz.refundSubProcess(baseOrder, "", baseOrder.getRealAmount().subtract(orvd.getDeposit()), oad.getDepositAmount().add(oad.getOrderAmount()), AccountTypeEnum.OUT_ORDER_FUND.getCode(), RefundStatusEnum.ALL.getCode(), oad); orderAccountBiz.refundSubProcess(baseOrder, "", baseOrder.getRealAmount().subtract(orvd.getDeposit()), oad.getDepositAmount().add(oad.getOrderAmount()), AccountTypeEnum.OUT_ORDER_FUND.getCode(), RefundStatusEnum.ALL.getCode(), oad);
...@@ -166,7 +166,7 @@ public class OrderCancelBiz { ...@@ -166,7 +166,7 @@ public class OrderCancelBiz {
CancelStartedVO csv = new CancelStartedVO(); CancelStartedVO csv = new CancelStartedVO();
csv.setType(CostDetailExtend.CANCEL_STARTED); csv.setType(CostDetailExtend.CANCEL_STARTED);
csv.setConsumeAmount(inProgressVO.getConsumeAmount()); csv.setConsumeAmount(inProgressVO.getConsumeAmount());
csv.setModelAmount(orderItem.getUnitPrice()); csv.setModelAmount(vehicleItemDTO.getUnitPrice());
csv.setUsedAmount(inProgressVO.getUsedAmount()); csv.setUsedAmount(inProgressVO.getUsedAmount());
csv.setUsedDayNum(inProgressVO.getUsedDays()); csv.setUsedDayNum(inProgressVO.getUsedDays());
csv.setUsedfreeDayNum(inProgressVO.getUsedfreeDays()); csv.setUsedfreeDayNum(inProgressVO.getUsedfreeDays());
...@@ -199,7 +199,7 @@ public class OrderCancelBiz { ...@@ -199,7 +199,7 @@ public class OrderCancelBiz {
//退款流程 //退款流程
//违约金封顶 租车身份价 * 2天 //违约金封顶 租车身份价 * 2天
orderAccountBiz.rentRefundProcessCancel(baseOrder, BigDecimal.ZERO, timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), vehicleItemDTO.getBuyAmount(), oad, vehicleItemDTO.getTopAmount(0)); orderAccountBiz.rentRefundProcessCancel(baseOrder, BigDecimal.ZERO, timeLag, APP_ORDER+ "_"+ RENT_REFUND, orvd.getDeposit(), vehicleItemDTO.getBuyAmount(), oad, vehicleItemDTO.getTopAmount(0), null, changeViolateAmount);
//设置订单数据 //设置订单数据
//baseOrder.setDamagesAmount(csv.getDamagesAmount()); //baseOrder.setDamagesAmount(csv.getDamagesAmount());
...@@ -264,7 +264,7 @@ public class OrderCancelBiz { ...@@ -264,7 +264,7 @@ public class OrderCancelBiz {
} }
//退款流程 //退款流程
orderAccountBiz.rentRefundProcessCancel(baseOrder, adultItemAmount.add(childItemAmount), timeLag, APP_ORDER+ "_"+ key, BigDecimal.ZERO, BigDecimal.ZERO, oad, adultItemAmount.add(childItemAmount) ); orderAccountBiz.rentRefundProcessCancel(baseOrder, adultItemAmount.add(childItemAmount), timeLag, APP_ORDER+ "_"+ key, BigDecimal.ZERO, BigDecimal.ZERO, oad, adultItemAmount.add(childItemAmount), changeViolateAmount, null);
//如果有扣款项,则生成额外的费用明细 //如果有扣款项,则生成额外的费用明细
if(oad.getDeductions().size() > 0) { if(oad.getDeductions().size() > 0) {
...@@ -322,6 +322,8 @@ public class OrderCancelBiz { ...@@ -322,6 +322,8 @@ public class OrderCancelBiz {
if(result < 0) { if(result < 0) {
throw new BaseException(ResultCode.FAILED_CODE); throw new BaseException(ResultCode.FAILED_CODE);
} }
orvd.setBackFreeDays(freeDays);
orderRentVehicleBiz.updateSelectiveById(orvd);
} }
}else if(OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) { }else if(OrderTypeEnum.TOUR.getCode().equals(baseOrder.getType())) {
......
...@@ -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();
......
...@@ -15,19 +15,17 @@ import com.xxfc.platform.order.biz.OrderAccountBiz; ...@@ -15,19 +15,17 @@ import com.xxfc.platform.order.biz.OrderAccountBiz;
import com.xxfc.platform.order.biz.OrderItemBiz; import com.xxfc.platform.order.biz.OrderItemBiz;
import com.xxfc.platform.order.biz.OrderRefundBiz; import com.xxfc.platform.order.biz.OrderRefundBiz;
import com.xxfc.platform.order.biz.inner.OrderCalculateBiz; import com.xxfc.platform.order.biz.inner.OrderCalculateBiz;
import com.xxfc.platform.order.biz.inner.OrderCancelBiz;
import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum; import com.xxfc.platform.order.contant.enumerate.ItemTypeEnum;
import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum; import com.xxfc.platform.order.contant.enumerate.OrderStatusEnum;
import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum; import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import com.xxfc.platform.order.entity.OrderItem; import com.xxfc.platform.order.entity.OrderItem;
import com.xxfc.platform.order.entity.OrderRefund; import com.xxfc.platform.order.entity.OrderRefund;
import com.xxfc.platform.order.entity.OrderRentVehicleDetail;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail; import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import com.xxfc.platform.order.pojo.calculate.InProgressVO; import com.xxfc.platform.order.pojo.calculate.InProgressVO;
import com.xxfc.platform.order.pojo.calculate.OrderRefundPriceVO;
import com.xxfc.platform.order.pojo.order.OrderPageVO; import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.order.pojo.order.VehicleItemDTO; import com.xxfc.platform.order.pojo.order.VehicleItemDTO;
import com.xxfc.platform.universal.constant.DictionaryKey; import com.xxfc.platform.universal.constant.DictionaryKey;
import lombok.Data;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -37,9 +35,7 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -37,9 +35,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_FALSE;
import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE; import static com.github.wxiaoqi.security.common.constant.CommonConstants.SYS_TRUE;
import static com.xxfc.platform.universal.constant.DictionaryKey.*; import static com.xxfc.platform.universal.constant.DictionaryKey.*;
...@@ -160,7 +156,7 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe ...@@ -160,7 +156,7 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
orpv.setRefundAmount(totalRefundAmount); orpv.setRefundAmount(totalRefundAmount);
if(orderPageVO.getStatus().equals(OrderStatusEnum.ORDER_UNPAY.getCode()) if(orderPageVO.getStatus().equals(OrderStatusEnum.ORDER_UNPAY.getCode())
|| orderPageVO.getStatus().equals(OrderStatusEnum.ORDER_CRT.getCode()) || orderPageVO.getStatus().equals(OrderStatusEnum.ORDER_CRT.getCode())
|| totalDeductAmount.compareTo(BigDecimal.ZERO) <= 0) { || orpv.getRefundAmount().compareTo(BigDecimal.ZERO) <= 0) {
orpv.setRefundDesc("是否确定取消订单"); orpv.setRefundDesc("是否确定取消订单");
}else { }else {
orpv.setRefundDesc(StrUtil.format("本次取消操作需要扣除{}元违约金,实际退款金额为{}元,您确定要取消订单吗?", totalDeductAmount, totalRefundAmount)); orpv.setRefundDesc(StrUtil.format("本次取消操作需要扣除{}元违约金,实际退款金额为{}元,您确定要取消订单吗?", totalDeductAmount, totalRefundAmount));
...@@ -168,16 +164,18 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe ...@@ -168,16 +164,18 @@ public class OrderRefundController extends BaseController<OrderRefundBiz,OrderRe
return ObjectRestResponse.succ(orpv); return ObjectRestResponse.succ(orpv);
} }
@Data
public class OrderRefundPriceVO {
BigDecimal refundAmount;
BigDecimal realAmount;
BigDecimal cutAmount;
String refundDesc;
public void setRefundAmount(BigDecimal refundAmount) { @RequestMapping(value = "/bg-stage/getViolatePrice/{no}", method = RequestMethod.GET)
this.refundAmount = refundAmount; @ResponseBody
this.cutAmount = realAmount.subtract(refundAmount); @IgnoreClientToken
} public ObjectRestResponse<BigDecimal> getViolatePrice(@PathVariable(value = "no") String no) {
checkAppUser();
OrderPageVO orderPageVO = baseOrderBiz.pageByParm(new Query(new PageParam(){{
setLimit(1);
setPage(1);
}}){{put("no", no); }}.getSuper()).get(0);
OrderRefundPriceVO orderRefundPriceVO = orderCalculateBiz.getPriceCalculate(no, orderPageVO);
return ObjectRestResponse.succ(orderRefundPriceVO);
} }
} }
\ No newline at end of file
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;
/** /**
* 订单支付 * 订单支付
...@@ -45,6 +48,10 @@ public class OrderPay implements Serializable { ...@@ -45,6 +48,10 @@ public class OrderPay implements Serializable {
@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 + "",
......
...@@ -179,6 +179,9 @@ public interface VehicleFeign { ...@@ -179,6 +179,9 @@ public interface VehicleFeign {
@RequestMapping(value = "/vehicleInfo/bookRecord/update", method = RequestMethod.POST) @RequestMapping(value = "/vehicleInfo/bookRecord/update", method = RequestMethod.POST)
public ObjectRestResponse update(@RequestBody BookRecordUpdateLog bookRecordUpdateLog); public ObjectRestResponse update(@RequestBody BookRecordUpdateLog bookRecordUpdateLog);
@RequestMapping(value ="/branchCompany/app/unauth/getCompanyIds",method = RequestMethod.GET)
RestResponse<List<Integer>> getCompanyIds();
/** /**
* 车型日历价格 * 车型日历价格
* *
...@@ -197,6 +200,4 @@ public interface VehicleFeign { ...@@ -197,6 +200,4 @@ public interface VehicleFeign {
@GetMapping(value = "/bookRecord/get") @GetMapping(value = "/bookRecord/get")
public ObjectRestResponse<List<BookRecordUpdateLog>> get(@RequestParam(value = "bookRecordId")Long bookRecordId); public ObjectRestResponse<List<BookRecordUpdateLog>> get(@RequestParam(value = "bookRecordId")Long bookRecordId);
@RequestMapping(value ="/branchCompany/app/unauth/getCompanyIds",method = RequestMethod.GET)
RestResponse<List<Integer>> getCompanyIds();
} }
...@@ -1175,7 +1175,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1175,7 +1175,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));
} }
...@@ -1235,10 +1235,10 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1235,10 +1235,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个月)
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
from branch_company from branch_company
<where> <where>
<if test="addrCity != null"> <if test="addrCity != null">
and addr_city = #{addrCity} and (addr_city = #{addrCity} or addr_province = #{addrCity} or addr_town = #{addrCity})
</if> </if>
<if test="lon != null and lat != null"> <if test="lon != null and lat != null">
and longitude is not null and latitude is not null and longitude is not null and latitude is not null
......
...@@ -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