Commit 3c950f1c by 章家宝

feat:车辆固定佣金设置

1 parent cf3d2d87
...@@ -6,7 +6,6 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth; ...@@ -6,7 +6,6 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.glsx.usedcar.export.converter.ListConverter; import com.glsx.usedcar.export.converter.ListConverter;
import com.glsx.usedcar.export.converter.VehicleStateConverter; import com.glsx.usedcar.export.converter.VehicleStateConverter;
import com.glsx.usedcar.module.vehicle.entity.*; import com.glsx.usedcar.module.vehicle.entity.*;
import jakarta.persistence.Column;
import lombok.Data; import lombok.Data;
import java.time.LocalDate; import java.time.LocalDate;
...@@ -214,6 +213,15 @@ public class VehicleBean { ...@@ -214,6 +213,15 @@ public class VehicleBean {
@ColumnWidth(12) @ColumnWidth(12)
private double reservePrice; private double reservePrice;
@ExcelProperty("是否开启固定佣金模式")
@ColumnWidth(18)
private String fixedCommissionSwitch;
@ExcelProperty("固定佣金")
@ColumnWidth(15)
private double fixedCommission;
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
@ColumnWidth(15) @ColumnWidth(15)
private LocalDateTime createTime; private LocalDateTime createTime;
...@@ -245,6 +253,8 @@ public class VehicleBean { ...@@ -245,6 +253,8 @@ public class VehicleBean {
this.vehicleState = vehicle.getVehicleState(); this.vehicleState = vehicle.getVehicleState();
this.startingBidPrice = vehicle.getStartingBidPrice(); this.startingBidPrice = vehicle.getStartingBidPrice();
this.reservePrice = vehicle.getReservePrice(); this.reservePrice = vehicle.getReservePrice();
this.fixedCommissionSwitch = vehicle.getFixedCommissionSwitch() == null || vehicle.getFixedCommissionSwitch() == 0 ? "否" : "是";
this.fixedCommission = vehicle.getFixedCommission() == null ? 0 : vehicle.getFixedCommission();
BaseInfo baseInfo = vehicle.getBaseInfo(); BaseInfo baseInfo = vehicle.getBaseInfo();
......
...@@ -66,6 +66,18 @@ public class AppraisePrice extends AuditingEntity implements Serializable { ...@@ -66,6 +66,18 @@ public class AppraisePrice extends AuditingEntity implements Serializable {
private double referencePrice; private double referencePrice;
/** /**
* 固定佣金开关 0: 关闭 1: 开启
*/
@Column(nullable = true)
private Integer fixedCommissionSwitch;
/**
* 固定佣金
*/
@Column(nullable = true)
private Double fixedCommission;
/**
* 评估备注 * 评估备注
*/ */
@Column(nullable = true, length = 255) @Column(nullable = true, length = 255)
......
...@@ -54,6 +54,10 @@ public class AppraiseService extends AbstractAuctionService { ...@@ -54,6 +54,10 @@ public class AppraiseService extends AbstractAuctionService {
if (appraisePriceDao.existsByVehicleAndAuditState(appeal.getVehicle(), AuditState.UNAUDITED)) { if (appraisePriceDao.existsByVehicleAndAuditState(appeal.getVehicle(), AuditState.UNAUDITED)) {
throw new FieldException("startingBidPrice", appeal.getStartingBidPrice(), "该车辆已有未审核的评估申请,请勿重复提交。"); throw new FieldException("startingBidPrice", appeal.getStartingBidPrice(), "该车辆已有未审核的评估申请,请勿重复提交。");
} }
int fixedCommissionSwitch = appeal.getFixedCommissionSwitch() == null ? 0 : appeal.getFixedCommissionSwitch();
double fixedCommission = fixedCommissionSwitch == 1 ? appeal.getFixedCommission() : 0;
appeal.setFixedCommission(fixedCommission);
appeal.setFixedCommissionSwitch(fixedCommissionSwitch);
Vehicle vehicle = vehicleDao.findById(appeal.getVehicle().getVehicleId()).orElseThrow(); Vehicle vehicle = vehicleDao.findById(appeal.getVehicle().getVehicleId()).orElseThrow();
appeal.setVehicle(vehicle); appeal.setVehicle(vehicle);
BaseInfo baseInfo = vehicle.getBaseInfo(); BaseInfo baseInfo = vehicle.getBaseInfo();
...@@ -68,7 +72,9 @@ public class AppraiseService extends AbstractAuctionService { ...@@ -68,7 +72,9 @@ public class AppraiseService extends AbstractAuctionService {
NoticeField.APPRAISE_TIME, DateTimeUtils.DATE_TIME_NO_SECOND_FORMATTER.format(save.getCreateTime()), NoticeField.APPRAISE_TIME, DateTimeUtils.DATE_TIME_NO_SECOND_FORMATTER.format(save.getCreateTime()),
NoticeField.RESERVE_PRICE, save.getReservePrice(), NoticeField.RESERVE_PRICE, save.getReservePrice(),
NoticeField.STARTING_BID_PRICE, save.getStartingBidPrice(), NoticeField.STARTING_BID_PRICE, save.getStartingBidPrice(),
NoticeField.REFERENCE_PRICE, save.getReferencePrice() NoticeField.REFERENCE_PRICE, save.getReferencePrice(),
NoticeField.FIXED_COMMISSION_SWITCH, save.getFixedCommissionSwitch() == 1 ? "是" : "否",
NoticeField.FIXED_COMMISSION, fixedCommission
)); ));
return save; return save;
} }
...@@ -82,11 +88,14 @@ public class AppraiseService extends AbstractAuctionService { ...@@ -82,11 +88,14 @@ public class AppraiseService extends AbstractAuctionService {
if (vehicle.getVehicleState() == Vehicle.VehicleState.AUCTIONING) { if (vehicle.getVehicleState() == Vehicle.VehicleState.AUCTIONING) {
throw new FieldException("vehicleState", vehicle.getVehicleState(), "该车辆已在拍卖中,不能评估定价。"); throw new FieldException("vehicleState", vehicle.getVehicleState(), "该车辆已在拍卖中,不能评估定价。");
} }
int fixedCommissionSwitch = appraisePrice.getFixedCommissionSwitch() == null ? 0 : appraisePrice.getFixedCommissionSwitch();
double fixedCommission = fixedCommissionSwitch == 1 ? appraisePrice.getFixedCommission() : 0;
vehicle.setStartingBidPrice(appraisePrice.getStartingBidPrice()); vehicle.setStartingBidPrice(appraisePrice.getStartingBidPrice());
vehicle.setReferencePrice(appraisePrice.getReferencePrice()); vehicle.setReferencePrice(appraisePrice.getReferencePrice());
vehicle.setReservePrice(appraisePrice.getReservePrice()); vehicle.setReservePrice(appraisePrice.getReservePrice());
vehicle.setAppraisalRemark(appraisePrice.getAppraisalRemark()); vehicle.setAppraisalRemark(appraisePrice.getAppraisalRemark());
vehicle.setFixedCommissionSwitch(fixedCommissionSwitch);
vehicle.setFixedCommission(fixedCommission);
// 车辆状态变更为已定价 // 车辆状态变更为已定价
if (vehicle.getVehicleState() == Vehicle.VehicleState.TO_BE_PRICED) { if (vehicle.getVehicleState() == Vehicle.VehicleState.TO_BE_PRICED) {
vehicle.setVehicleState(Vehicle.VehicleState.PRICED); vehicle.setVehicleState(Vehicle.VehicleState.PRICED);
......
...@@ -341,6 +341,11 @@ public class AuctionOrderService extends AbstractAuctionService { ...@@ -341,6 +341,11 @@ public class AuctionOrderService extends AbstractAuctionService {
* @return * @return
*/ */
private double calculateCommissionPrice(LocalDateTime now, Bid bid) { private double calculateCommissionPrice(LocalDateTime now, Bid bid) {
AuctionVehicle auctionVehicle = bid.getAuctionVehicle();
Integer fixedCommissionSwitch = auctionVehicle.getVehicle().getFixedCommissionSwitch();
if (fixedCommissionSwitch == 1) {
return auctionVehicle.getVehicle().getFixedCommission();
}
Account account = bid.getAccount(); Account account = bid.getAccount();
LocalDate today = now.toLocalDate(); LocalDate today = now.toLocalDate();
double bidPrice = bid.getBidPrice(); double bidPrice = bid.getBidPrice();
......
...@@ -21,6 +21,10 @@ public interface NoticeField { ...@@ -21,6 +21,10 @@ public interface NoticeField {
String REFERENCE_PRICE = "{{基础参考价}}"; String REFERENCE_PRICE = "{{基础参考价}}";
String FIXED_COMMISSION = "{{固定佣金}}";
String FIXED_COMMISSION_SWITCH = "{{固定佣金开关}}";
/***************2. 待办 - 拍场审批***************/ /***************2. 待办 - 拍场审批***************/
String AUCTION_NAME = "{{拍场名称}}"; String AUCTION_NAME = "{{拍场名称}}";
......
...@@ -213,6 +213,18 @@ public class Vehicle extends AuditingEntity implements Serializable { ...@@ -213,6 +213,18 @@ public class Vehicle extends AuditingEntity implements Serializable {
private double referencePrice; private double referencePrice;
/** /**
* 固定佣金开关 0: 关闭 1: 开启
*/
@Column(nullable = true)
private Integer fixedCommissionSwitch;
/**
* 固定佣金
*/
@Column(nullable = true)
private Double fixedCommission;
/**
* 评估备注 * 评估备注
*/ */
@Column(nullable = true, length = 255) @Column(nullable = true, length = 255)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!