Commit 0532fa31 authored by shiyu's avatar shiyu

使用明细

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