Commit a6cd9b2e authored by shiyu's avatar shiyu

出价记录

parent ffdac52a
...@@ -26,6 +26,8 @@ public class PriceUtil { ...@@ -26,6 +26,8 @@ public class PriceUtil {
return bigDecimal.longValue(); return bigDecimal.longValue();
} }
public static Integer convertPriceFromStrToInt(String price){ public static Integer convertPriceFromStrToInt(String price){
BigDecimal bigDecimal = new BigDecimal(price); BigDecimal bigDecimal = new BigDecimal(price);
bigDecimal = bigDecimal.multiply(new BigDecimal(100)); bigDecimal = bigDecimal.multiply(new BigDecimal(100));
...@@ -53,6 +55,9 @@ public class PriceUtil { ...@@ -53,6 +55,9 @@ public class PriceUtil {
DecimalFormat df = new DecimalFormat("#0.00"); DecimalFormat df = new DecimalFormat("#0.00");
String a = df.format(bigDecimal); String a = df.format(bigDecimal);
System.out.println(new BigDecimal(a).stripTrailingZeros().toPlainString()); System.out.println(new BigDecimal(a).stripTrailingZeros().toPlainString());
System.out.println("+++++++" + convertPriceFromStr("0"));
} }
......
...@@ -268,7 +268,7 @@ public class AuctionRecordServiceImpl implements AuctionRecordService { ...@@ -268,7 +268,7 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
List<AuctionRecord> auctionRecordList = auctionRecordDao.findByItemId(itemId); List<AuctionRecord> auctionRecordList = auctionRecordDao.findByItemId(itemId);
//查询商品竞拍信息 //查询商品竞拍信息
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(dto.getItemId()); AuctionConfig auctionConfig = auctionConfigDao.findByItemId(dto.getItemId());
//最新出价记录 //当前拍品价格
AuctionRecord lastedRecord = auctionRecordList.get(0); AuctionRecord lastedRecord = auctionRecordList.get(0);
auctionRecordVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(lastedRecord.getPrice())); auctionRecordVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(lastedRecord.getPrice()));
if (lastedRecord.getUserId().longValue() == dto.getUserId().longValue()) { if (lastedRecord.getUserId().longValue() == dto.getUserId().longValue()) {
...@@ -290,7 +290,28 @@ public class AuctionRecordServiceImpl implements AuctionRecordService { ...@@ -290,7 +290,28 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
Date realEndTime = auctionConfig.getRealEndTime(); Date realEndTime = auctionConfig.getRealEndTime();
auctionRecordVo.setStartTime(startTime); auctionRecordVo.setStartTime(startTime);
auctionRecordVo.setRealEndTime(realEndTime); auctionRecordVo.setRealEndTime(realEndTime);
//出价记录对应展示的按钮
if (CollectionUtils.isEmpty(auctionRecordList)) {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.PROCESS.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PROCESS.getDes());
}
if (now.after(realEndTime)) { if (now.after(realEndTime)) {
//如果最高价是自己出的,用户状态显示已领先
if (lastedRecord.getUserId().longValue() == dto.getUserId().longValue()) {
DistributionOrder distributionOrder = distributionOrderDao.findByItemId(itemId);
//竞拍结束后未生成订单
if (distributionOrder == null || distributionOrder.getPayTime() == null) {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.PRE_PAY.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PRE_PAY.getDes());
} else {
//竞拍结束页生成了订单并支付过了就显示竞拍结束
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.END.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.END.getDes());
}
} else {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.END.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.END.getDes());
}
auctionRecordVo.setState(DistributionEnum.AuctionStateEnum.END.getCode()); auctionRecordVo.setState(DistributionEnum.AuctionStateEnum.END.getCode());
auctionRecordVo.setStateName(DistributionEnum.AuctionStateEnum.END.getDes()); auctionRecordVo.setStateName(DistributionEnum.AuctionStateEnum.END.getDes());
} else { } else {
......
...@@ -358,7 +358,7 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -358,7 +358,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
if (CollectionUtils.isEmpty(auctionRecordList)) { if (CollectionUtils.isEmpty(auctionRecordList)) {
auctionDetailVo.setUserState(DistributionEnum.AuctionUserStateEnum.PROCESS.getCode()); auctionDetailVo.setUserState(DistributionEnum.AuctionUserStateEnum.PROCESS.getCode());
auctionDetailVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PROCESS.getDes()); auctionDetailVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PROCESS.getDes());
auctionDetailVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(auctionConfig.getStartPrice())); auctionDetailVo.setCurrentPrice("0");
} else { } else {
auctionDetailVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(lastedRecord.getPrice())); auctionDetailVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(lastedRecord.getPrice()));
//如果最高价是自己出的,用户状态显示已领先 //如果最高价是自己出的,用户状态显示已领先
......
...@@ -13,7 +13,7 @@ public interface AuctionRecordService { ...@@ -13,7 +13,7 @@ public interface AuctionRecordService {
Result createAuctionRecord(AuctionRecordRequestDto dto); Result createAuctionRecord(AuctionRecordRequestDto dto);
/** /**
* 查询出价记录 * 查询用户所有商品的出价记录
* @param dto * @param dto
* @return * @return
*/ */
......
...@@ -31,7 +31,7 @@ public class AuctionRecordController { ...@@ -31,7 +31,7 @@ public class AuctionRecordController {
@PostMapping("/findList") @PostMapping("/findList")
public Result findList(@RequestBody AuctionRecordRequestDto dto) { public Result findList(@RequestBody AuctionRecordRequestDto dto) {
logger.info("查询出价记录,请求参数:{}", JSON.toJSONString(dto)); logger.info("查询出价记录,请求参数:{}", JSON.toJSONString(dto));
if (dto.getItemId() == null || dto.getUserId() == null) { if (dto.getUserId() == null) {
return Result.failed(ResultCode.PARAM_ERROR); return Result.failed(ResultCode.PARAM_ERROR);
} }
return auctionRecordService.findList(dto); return auctionRecordService.findList(dto);
......
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