Commit 0532fa31 authored by shiyu's avatar shiyu

使用明细

parent c4945143
......@@ -43,7 +43,7 @@ public class EarnestEnum {
public enum TypeEnum {
GIFT(1, "赠送保证金"),
PAY(2, "缴纳保证金"),
PAY(2, "充值保证金"),
WITHDRAW(3, "提取保证金"),
OCCUPY(4, "占用出价额度"),
RELEASE(5, "释放保证金"),
......
......@@ -273,7 +273,7 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
//保证金扣除记录
EarnestRecord earnestRecord = new EarnestRecord();
earnestRecord.setUserId(dto.getUserId());
earnestRecord.setAmount(earnestAmount.longValue());
earnestRecord.setAmount(occupyAmount);
earnestRecord.setItemId(dto.getItemId());
earnestRecord.setSpecialPerformanceId(dto.getSpecialPerformanceId());
earnestRecord.setEntryType(EarnestEnum.EntryEnum.DEDUCT.getCode());
......@@ -283,7 +283,6 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
earnestRecord.setState(EarnestEnum.StateEnum.VALID.getCode());
earnestRecordDao.insert(earnestRecord);
//更新用户账户,更新保证金额度,先扣除赠送的保证金,额度不够再扣用户自己缴纳的
UserAccount newUserAccount = new UserAccount();
newUserAccount.setUserId(dto.getUserId());
......
......@@ -77,15 +77,12 @@ public class EarnestRecordServiceImpl implements EarnestRecordService {
EarnestRecordVo earnestRecordVo = new EarnestRecordVo();
EntityMapper.copyAttribute(earnestRecord, earnestRecordVo);
earnestRecordVo.setTypeName(EarnestEnum.TypeEnum.getNameByCode(earnestRecord.getType()));
earnestRecordVo.setAmount(PriceUtil.convertPriceFenToYuan(earnestRecord.getAmount()));
//占用的额度
earnestRecordVo.setAmount(PriceUtil.convertPriceFenToYuan(earnestRecord.getAmount() * CommConsts.EARNEST_TRANSFORM_AUCTION_REBATE));
if (earnestRecord.getState() != EarnestEnum.StateEnum.VALID.getCode()) {
earnestRecordVo.setStateName(EarnestEnum.StateEnum.getNameByCode(earnestRecord.getState()));
if (earnestRecord.getState() == EarnestEnum.StateEnum.DEDUCT.getCode()) {
//算出被扣除的保证金金额
BigDecimal earnestAmount = new BigDecimal(String.valueOf(earnestRecord.getAmount())).multiply(new BigDecimal(CommConsts.EARNEST_REBATE));
//换算成对应占用的保证金
long occupyAmount = earnestAmount.longValue();
earnestRecordVo.setStateName(EarnestEnum.StateEnum.getNameByCode(earnestRecord.getState()) + "¥" + PriceUtil.convertPriceFenToYuan(occupyAmount));
earnestRecordVo.setStateName(EarnestEnum.StateEnum.getNameByCode(earnestRecord.getState()) + "¥" + PriceUtil.convertPriceFenToYuan(earnestRecord.getAmount()));
}
}
SupplierItem supplierItem = supplierItemDao.findById(earnestRecord.getItemId());
......@@ -116,7 +113,7 @@ public class EarnestRecordServiceImpl implements EarnestRecordService {
map.put("usedPayAmount", "0");
} else {
map.put("usedGiftAmount", PriceUtil.convertPriceFenToYuan(giftAmount));
map.put("usedPayAmount", PriceUtil.convertPriceFenToYuan(earnestAmount - giftAmount));
map.put("usedPayAmount", PriceUtil.convertPriceFenToYuan(occupyAmount - giftAmount));
}
return Result.success(map);
} catch (Exception e) {
......
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