Commit e79c5b33 authored by wuwz's avatar wuwz

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

parents 11601461 fb960a0a
......@@ -7,6 +7,7 @@ import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.ReflectionUtils;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -144,5 +145,8 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
return ObjectRestResponse.succ();
}
@Data
public static class BaseDetailDTO {
Integer id;
}
}
......@@ -11,6 +11,7 @@ public enum AccountTypeEnum {
OUT_DEPOSIT(202, "所有押金"),
OUT_PART_DEPOSIT(203, "部分押金(扣除该扣除的 + 保留违章预备金)"),
OUT_RESIDUE_DEPOSIT(204, "剩余押金(扣除该扣除的)"),
OUT_RESIDUE_ORDER(205, "部分订单退款"),
;
/**
* 编码
......
......@@ -18,6 +18,7 @@ public enum DeductionTypeEnum {
VIOLATE_TRAFFIC_DEDUCT(401, "违章扣款"),
VIOLATE_TRAFFIC_KEEP(402, "违章扣款保留金"),
OTHER_DELAY_SAFE(501, "其他费用-延迟用车不记免赔"),
OTHER_PUBLISH_REJECTED(502, "其他费用-申请调车接单被拒绝退款"),
;
/**
* 编码
......
......@@ -14,6 +14,7 @@ import com.xxfc.platform.vehicle.pojo.BookVehicleVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
......@@ -23,6 +24,7 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail
private VehicleModel vehicleModel;
private BookVehicleVO bookVehicleVO;
private Vehicle vehicle;
private BigDecimal specialUnitPrice;
/**
* 订单标记 1--普通订单;2--需求预定申请订单;3--特惠租车订单
......
......@@ -47,6 +47,7 @@ import java.util.*;
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.xxfc.platform.order.contant.enumerate.AccountTypeEnum.OUT_RESIDUE_ORDER;
import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_DEPOSIT;
import static com.xxfc.platform.order.pojo.account.OrderAccountDeduction.ORIGIN_ORDER_DEPOSIT;
import static com.xxfc.platform.order.pojo.pay.NotifyUrlDTO.PAY_WAY_ALI;
......@@ -218,6 +219,31 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
return refundAmount;
}
/**
* 调车发布 退款流程
* @param baseOrder 基础订单信息
* @param refundDesc 退款描述
* @param originalRefundAmount 原退款金额
* @param deductAmount 扣除金额
*/
public void publishRefundProcess(BaseOrder baseOrder, String refundDesc, BigDecimal originalRefundAmount, BigDecimal deductAmount) {
BigDecimal refundAmount = BigDecimal.ZERO.add(originalRefundAmount);
if(null != deductAmount) {
refundAmount = originalRefundAmount.subtract(deductAmount);
}
BigDecimal finalRefundAmount = refundAmount;
OrderAccountDetail oad = new OrderAccountDetail(){{
setOriginOrderAmount(originalRefundAmount);
setOrderAmount(finalRefundAmount);
}};
OrderAccountDeduction violateDeduction = initDeduction(deductAmount, refundDesc, DeductionTypeEnum.OTHER_PUBLISH_REJECTED, OrderAccountDeduction.ORIGIN_ORDER);
oad.getDeductions().add(violateDeduction);
refundSubProcess(baseOrder, refundDesc, originalRefundAmount, refundAmount, OUT_RESIDUE_ORDER.getCode(), RefundStatusEnum.ALL.getCode(), oad);
}
/**
* 退款子流程
* @param baseOrder 基础订单信息
......
......@@ -33,10 +33,7 @@ import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.persistence.Column;
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.xxfc.platform.order.entity.SpecialRent.*;
@RestController
......@@ -114,7 +111,7 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
@ResponseBody
@ApiOperation(value = "分页查询可参加特惠租车")
@IgnoreUserToken
public ObjectRestResponse<SpecialRentVO> pageList(QueryDTO dto) {
public ObjectRestResponse<PageDataVO<SpecialRentVO>> pageList(QueryDTO dto) {
//查询列表数据
Query query = new Query(dto);
PageDataVO<SpecialRentVO> pages = PageDataVO.pageInfo(query, () -> baseBiz.selectByWeekend(w -> {
......@@ -131,6 +128,16 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
return ObjectRestResponse.succ(pages);
}
@RequestMapping(value = "/app/unauth/app/detail", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询特惠租车详情")
@IgnoreUserToken
public ObjectRestResponse<SpecialRent> detail(BaseDetailDTO dto) {
//查询数据
AssertUtils.isBlankBean(dto);
return ObjectRestResponse.succ(baseBiz.selectById(dto.getId()));
}
@RequestMapping(value = "/appBusiness/myList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "分页查询我发布的特惠租车")
......@@ -192,6 +199,7 @@ public class SpecialRentController extends BaseController<SpecialRentBiz, Specia
bo.setOrderSign(BaseOrder.ORDER_SIGN_SPECIAL);
bo.setAppUserDTO(getAppUser());
bo.setBookRecordId(specialRent.getBookRecordId());
bo.setSpecialUnitPrice(specialRent.getUnitPrice());
orderRentVehicleService.specialCreateOrder(bo, specialRent.getOrderNo());
baseBiz.updateSelectiveById(new SpecialRent(){{
setId(specialRent.getId());
......
......@@ -440,6 +440,11 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
detail.initDate();
List<VehicleModelCalendarPriceDTO> metaVmcpds = vehicleFeign.getPriceByVehicleIdFeignV2(detail.getVehicleId(), detail.getStartTime(), detail.getEndTime(), dto.getUserid()).getData();
if(null != detail.getSpecialUnitPrice()) {
metaVmcpds.forEach(meta -> {
meta.setPrice(detail.getSpecialUnitPrice());
});
}
List<VMCalendarPriceCostDTO> vmcpds = Convert.toList(VMCalendarPriceCostDTO.class, metaVmcpds);
......@@ -628,6 +633,11 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
detail.initDate();
List<VehicleModelCalendarPriceDTO> metaVmcpds = vehicleFeign.getPriceByVehicleIdFeignV2(detail.getVehicleId(), detail.getStartTime(), detail.getEndTime(), dto.getUserid()).getData();
if(null != detail.getSpecialUnitPrice()) {
metaVmcpds.forEach(meta -> {
meta.setPrice(detail.getSpecialUnitPrice());
});
}
List<VMCalendarPriceCostDTO> vmcpds = Convert.toList(VMCalendarPriceCostDTO.class, metaVmcpds);
......
......@@ -45,6 +45,11 @@ public class VehiclePublishGoods implements Serializable {
private Integer number;
@Column(name = "receive_number")
@ApiModelProperty(value = "已接数量")
private Integer receiveNumber;
@Column(name = "receive_amount")
@ApiModelProperty(value = "接单者服务费(单个商品)")
private BigDecimal receiveAmount;
......
......@@ -64,6 +64,20 @@ public class VehiclePublishGoodsBiz extends BaseBiz<VehiclePublishGoodsMapper, V
}
public List<VehiclePublishGoods> getListByPublishId(Integer publishId){
return mapper.groupGoodsIdList(publishId);
}
public void updReceiveNumber(Integer publishId){
List<VehiclePublishGoods> list = getListByPublishId(publishId);
if (CollectionUtils.isNotEmpty(list)){
for (VehiclePublishGoods publishGoods : list){
updateSelectiveById(publishGoods);
}
}
}
......
......@@ -214,11 +214,13 @@ public class VehiclePublishReceiveBiz extends BaseBiz<VehiclePublishReceiveMappe
addVehicleUseTime(publishReceiveDTO);
VehicleReceiveRefundDTO receiveRefundDTO = new VehicleReceiveRefundDTO();
receiveRefundDTO.setOrderNoStr(orderNoStr);
publishGoodsBiz.updReceiveNumber(publishId);
sendQueue(receiveRefundDTO);
}else if (type == 1){
if (status.equals( VehiclePublishReceiveDTO.PAY)){
vehiclePublishBiz.updWaitConfirmNumber(number,publishId);
addVehicleUseTime(publishReceiveDTO);
publishGoodsBiz.updReceiveNumber(publishId);
}
}
}
......
......@@ -4,6 +4,8 @@ package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.VehiclePublishGoods;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishGoodsVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;
......@@ -17,4 +19,13 @@ public interface VehiclePublishGoodsMapper extends Mapper<VehiclePublishGoods>,
List<VehiclePublishGoodsVo> selectListByOrderNo(VehiclePublishFindDTO publishFindDTO);
@Select("SELECT r.publish_goods_id as id,IFNULL(COUNT(r.id)) as receiveNumber FROM vehicle_publish_receive r \n" +
"\n" +
"LEFT JOIN vehicle_publish_goods g ON r.publish_goods_id = g.id\n" +
"\n" +
"WHERE g.publish_id=#{publishId} and r.`status` in (1,3) and r.is_del = 0\n" +
"\n" +
"GROUP BY r.publish_goods_id")
List<VehiclePublishGoods> groupGoodsIdList(@Param("publishId") Integer publishId );
}
\ No newline at end of file
......@@ -14,6 +14,9 @@
<if test="companyId != null and companyId > 0">
AND p.`company_id`= #{companyId}
</if>
<if test="publishId != null and publishId > 0">
AND p.`id`= #{publishId}
</if>
<if test="goodsType != null ">
AND p.`goods_type`= #{goodsType}
</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