修改bug
This commit is contained in:
parent
4a5dcf2c61
commit
8889a06565
@ -24,6 +24,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -61,39 +62,20 @@ public class OilNumberServiceImpl extends ServiceImpl<OilNumberMapper, OilNumber
|
||||
|
||||
@Override
|
||||
public List<OilPresetPricesVO> selectOilNumberList3(Page page, OilNumber oilNumber) {
|
||||
|
||||
//获取预设油价列表
|
||||
OilPresetPrices oilPresetPrices = new OilPresetPrices();
|
||||
oilPresetPrices.setStoreId(oilNumber.getStoreId());
|
||||
IPage<OilPresetPrices> oilPresetPricesIPage = oilPresetPricesMapper.selectOilPresetPricesList(page, oilPresetPrices);
|
||||
List<OilPresetPrices> records1 = oilPresetPricesIPage.getRecords();
|
||||
List<OilPresetPricesVO> collect = records1.stream().map(s -> {
|
||||
OilNumber oilNumber1 = new OilNumber();
|
||||
oilNumber1.setStoreId(oilNumber.getStoreId());
|
||||
IPage<OilNumber> oilNumberIPage = selectOilNumberList2(page, oilNumber1);
|
||||
List<OilNumber> records = oilNumberIPage.getRecords();
|
||||
List<OilPresetPricesVO> collect = records.stream().map(s -> {
|
||||
OilPresetPricesVO oilPresetPricesVO = new OilPresetPricesVO();
|
||||
//如果预设时间等于当前时间
|
||||
if (s.getEffectiveTime().equals(DateUtil.format(new Date(), "yyyy-MM-dd"))){
|
||||
LambdaQueryWrapper<OilNumber> oilNumberLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
oilNumberLambdaQueryWrapper.eq(OilNumber::getStoreId,s.getStoreId());
|
||||
oilNumberLambdaQueryWrapper.eq(OilNumber::getOilType,s.getOilType());
|
||||
OilNumber oilNumber1 = this.getOne(oilNumberLambdaQueryWrapper);
|
||||
BeanUtils.copyProperties(s,oilPresetPricesVO);
|
||||
oilPresetPricesVO.setCurrentPetrolPrices(s.getPresetOilPrices());
|
||||
oilPresetPricesVO.setPresetGbPrice(s.getPresetGbPrice());
|
||||
//升降率 TODO
|
||||
oilPresetPricesVO.setOilName(oilNumber1.getOilName());
|
||||
oilPresetPricesVO.setStatus("1");
|
||||
oilPresetPricesVO.setRate("0%");
|
||||
}else {
|
||||
LambdaQueryWrapper<OilNumber> oilNumberLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
oilNumberLambdaQueryWrapper.eq(OilNumber::getStoreId,oilNumber.getStoreId());
|
||||
oilNumberLambdaQueryWrapper.eq(OilNumber::getOilName,s.getOilType());
|
||||
OilNumber oilNumber1 = this.getOne(oilNumberLambdaQueryWrapper);
|
||||
OilName oilName = oilNameService.selectOilNameById(Integer.parseInt(oilNumber1.getOilName()));
|
||||
oilPresetPricesVO.setPresetOilPrices(oilNumber1.getOilPrice());
|
||||
oilPresetPricesVO.setPresetGbPrice(oilNumber1.getGbPrice());
|
||||
oilPresetPricesVO.setOilName(oilName.getOilName());
|
||||
oilPresetPricesVO.setStatus("1");
|
||||
oilPresetPricesVO.setRate("0%");
|
||||
}
|
||||
oilPresetPricesVO.setOilName(s.getOilName());
|
||||
oilPresetPricesVO.setPresetOilPrices(s.getOilPrice());
|
||||
oilPresetPricesVO.setPresetGbPrice(s.getGbPrice());
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#0.00"); // 设置要显示的小数位数
|
||||
|
||||
double v = s.getOilPrice() / s.getGbPrice();
|
||||
String formattedNumber = decimalFormat.format((1-v) * 100);
|
||||
oilPresetPricesVO.setRate(formattedNumber + "%");
|
||||
return oilPresetPricesVO;
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
|
@ -23,13 +23,13 @@
|
||||
<view class="hui-box">政府指导油价(元)</view>
|
||||
<view class="dis-c">
|
||||
<view class="dlan">{{item.presetGbPrice}}</view>
|
||||
<view class="dis"> <u-icon name="arrow-up-fill" color="#FF5700" size="12"></u-icon>
|
||||
<!-- <view class="dis"> <u-icon name="arrow-up-fill" color="#FF5700" size="12"></u-icon>
|
||||
<text style="font-size: 12px; color: #FF5700; ">{{item.rate}}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<view style="width: 50%;">
|
||||
<view class="hui-box">最新油价</view>
|
||||
<view class="hui-box">本站油价</view>
|
||||
<view class="dis-c">
|
||||
<view class="dlan" style="color: #333333;">{{item.presetOilPrices}}</view>
|
||||
<view class="dis"> <u-icon name="arrow-down-fill" color="#1FAD40" size="12"></u-icon>
|
||||
|
Loading…
Reference in New Issue
Block a user