Commit 2b447198 authored by shiyu's avatar shiyu

保证金明细

parent 4701e3ff
......@@ -32,7 +32,7 @@ public interface EarnestRecordDao {
/**
* 查询用户当前被占用的保证金
* @param userId
* @param dto
* @return
*/
long sumForOccupy(EarnestRecordRequestDto dto);
......
......@@ -31,6 +31,9 @@ public class UserAccountDaoImpl implements UserAccountDao {
@Override
public UserAccount findByUserId(long userId) {
return null;
UserAccountExample example = new UserAccountExample();
UserAccountExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
return userAccountMapper.selectOneByExample(example);
}
}
......@@ -70,7 +70,6 @@ public interface EarnestRecordMapper {
int updateByPrimaryKey(EarnestRecord record);
/**
* 统计用户被占用的保证金
* @param example
......
......@@ -388,7 +388,7 @@
</select>
<select id="sumForOccupy" parameterType="com.wwdz.ch.db.domain.openShop.EarnestRecordExample" resultType="java.lang.Long">
select IFNULL(sum(amount), 0) as amount from earnest_order
select IFNULL(sum(amount), 0) as amount from earnest_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
......
......@@ -132,7 +132,7 @@ public class AuctionEarnestServiceImpl implements AuctionEarnestService {
//换算成对应占用的保证金
long occupyAmount = earnestAmount.longValue();
earnestRecord.setUserId(dto.getUserId());
earnestRecord.setAmount(-earnestAmount.longValue());
earnestRecord.setAmount(earnestAmount.longValue());
earnestRecord.setItemId(dto.getItemId());
earnestRecord.setSpecialPerformanceId(dto.getSpecialPerformanceId());
earnestRecord.setEntryType(EarnestEnum.EntryEnum.DEDUCT.getCode());
......
......@@ -86,7 +86,7 @@ public class EarnestRecordServiceImpl implements EarnestRecordService {
earnestRecordRequestDto.setUserId(dto.getUserId());
earnestRecordRequestDto.setType(EarnestEnum.TypeEnum.OCCUPY.getCode());
earnestRecordRequestDto.setState(EarnestEnum.StateEnum.VALID.getCode());
long occupyAmount = Math.abs(earnestRecordDao.sumForOccupy(earnestRecordRequestDto));
long occupyAmount = earnestRecordDao.sumForOccupy(earnestRecordRequestDto);
//已用保证金
map.put("usedEarnestAmount", PriceUtil.convertPriceFenToYuan(occupyAmount));
//已用出价,需要在保证金:出价额度 = 1:20
......
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