修改bug
This commit is contained in:
parent
18d96bb254
commit
0353336baf
@ -12,6 +12,7 @@ import com.fuint.business.petrolStationManagement.entity.OilNumber;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPresetPrices;
|
||||
import com.fuint.business.petrolStationManagement.service.OilNumberService;
|
||||
import com.fuint.business.petrolStationManagement.service.OilPresetPricesService;
|
||||
import com.fuint.business.petrolStationManagement.vo.OilPresetPricesVO;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -61,6 +62,17 @@ public class OilNumberController extends BaseController {
|
||||
return getSuccessResult(list);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("小程序端当天油价")
|
||||
@GetMapping("getList3")
|
||||
public ResponseObject selectAll3(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize,
|
||||
OilNumber oilNumber) {
|
||||
Page page =new Page(pageNo,pageSize);
|
||||
List<OilPresetPricesVO> oilPresetPricesVOS = oilPresetPricesService.selectOilNumberList3(page, oilNumber);
|
||||
return getSuccessResult(oilPresetPricesVOS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
|
@ -61,5 +61,4 @@ public interface OilPresetPricesMapper extends BaseMapper<OilPresetPrices> {
|
||||
* @return
|
||||
*/
|
||||
public int updateJobId(OilPresetPrices presetPrices);
|
||||
|
||||
}
|
||||
|
@ -104,4 +104,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update oil_preset_prices set state = 'lose' where state = 'wait' and effective_time < now()
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilNumber;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPresetPrices;
|
||||
import com.fuint.business.petrolStationManagement.vo.OilNumberNameVo;
|
||||
import com.fuint.business.petrolStationManagement.vo.OilPresetPricesVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@ -24,6 +25,7 @@ public interface OilNumberService extends IService<OilNumber> {
|
||||
*/
|
||||
public IPage<OilNumber> selectOilNumberList(Page page, @Param("oilNumber") OilNumber oilNumber);
|
||||
public IPage<OilNumber> selectOilNumberList2(Page page, @Param("oilNumber") OilNumber oilNumber);
|
||||
List<OilPresetPricesVO> selectOilNumberList3(Page page, @Param("oilNumber") OilNumber oilNumber);
|
||||
|
||||
/**
|
||||
* 根据id查询员工信息
|
||||
|
@ -2,22 +2,32 @@ package com.fuint.business.petrolStationManagement.service.impl;
|
||||
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilName;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilNumber;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPresetPrices;
|
||||
import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
|
||||
import com.fuint.business.petrolStationManagement.mapper.OilPresetPricesMapper;
|
||||
import com.fuint.business.petrolStationManagement.service.OilNameService;
|
||||
import com.fuint.business.petrolStationManagement.service.OilNumberService;
|
||||
import com.fuint.business.petrolStationManagement.vo.OilNumberNameVo;
|
||||
import com.fuint.business.petrolStationManagement.vo.OilPresetPricesVO;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* (OilNumber)表服务实现类
|
||||
@ -28,6 +38,10 @@ import java.util.List;
|
||||
@Service("OilNumberService")
|
||||
public class OilNumberServiceImpl extends ServiceImpl<OilNumberMapper, OilNumber> implements OilNumberService {
|
||||
|
||||
@Resource
|
||||
private OilPresetPricesMapper oilPresetPricesMapper;
|
||||
@Resource
|
||||
private OilNameService oilNameService;
|
||||
@Override
|
||||
public IPage<OilNumber> selectOilNumberList(Page page, OilNumber oilNumber) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
@ -45,6 +59,46 @@ public class OilNumberServiceImpl extends ServiceImpl<OilNumberMapper, OilNumber
|
||||
return baseMapper.selectOilNumberList2(page,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 -> {
|
||||
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%");
|
||||
}
|
||||
return oilPresetPricesVO;
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OilNumber selectOilNumberById(int id) {
|
||||
return baseMapper.selectOilNumberById(id);
|
||||
|
@ -38,6 +38,9 @@ public class OilPresetPricesServiceImpl extends ServiceImpl<OilPresetPricesMappe
|
||||
@Resource
|
||||
private ISysJobService iSysJobService;
|
||||
|
||||
@Resource
|
||||
private OilPresetPricesMapper oilPresetPricesMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<OilPresetPrices> selectOilPresetPricesList(Page page, OilPresetPrices presetPrices) {
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.fuint.business.petrolStationManagement.vo;
|
||||
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPresetPrices;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class OilPresetPricesVO extends OilPresetPrices implements Serializable {
|
||||
|
||||
//状态 1 上涨 2 下调
|
||||
private String status;
|
||||
private String rate;
|
||||
private String oilName;
|
||||
}
|
@ -13,27 +13,27 @@
|
||||
<view style="font-size: 14px;">对比上次价格波动</view>
|
||||
<view class="tupian"></view>
|
||||
</view>
|
||||
<view class="box-list">
|
||||
<view class="box-list" v-for="(item,index) in oilPriceList" :key="index">
|
||||
<view class="dis-top">
|
||||
<view class="gang"></view>
|
||||
<view class="">#92</view>
|
||||
<view class="">{{item.oilName}}</view>
|
||||
</view>
|
||||
<view class="bottom-bt">
|
||||
<view style="width: 50%;">
|
||||
<view class="hui-box">政府指导油价(元)</view>
|
||||
<view class="dis-c">
|
||||
<view class="dlan">¥7.8</view>
|
||||
<view class="dlan">{{item.presetGbPrice}}</view>
|
||||
<view class="dis"> <u-icon name="arrow-up-fill" color="#FF5700" size="12"></u-icon>
|
||||
<text style="font-size: 12px; color: #FF5700; ">30%</text>
|
||||
<text style="font-size: 12px; color: #FF5700; ">{{item.rate}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="width: 50%;">
|
||||
<view class="hui-box">最新油价</view>
|
||||
<view class="dis-c">
|
||||
<view class="dlan" style="color: #333333;">¥7.8</view>
|
||||
<view class="dlan" style="color: #333333;">{{item.presetOilPrices}}</view>
|
||||
<view class="dis"> <u-icon name="arrow-down-fill" color="#1FAD40" size="12"></u-icon>
|
||||
<text style="font-size: 12px; color: #1FAD40; ">30%</text>
|
||||
<text style="font-size: 12px; color: #1FAD40; ">{{item.rate}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -47,19 +47,40 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from '../../utils/request'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
oilPriceList: [],
|
||||
title: '',
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
onShow() {
|
||||
this.getTodayOilPriceList();
|
||||
},
|
||||
components: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
// 查询全部充值订单
|
||||
getTodayOilPriceList() {
|
||||
let params = {
|
||||
storeId: uni.getStorageSync("storeId")
|
||||
}
|
||||
request({
|
||||
url: 'business/petrolStationManagement/oilNumber/getList3',
|
||||
method: 'get',
|
||||
params: params
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.oilPriceList = res.data
|
||||
console.log("11111" + res.data);
|
||||
}
|
||||
})
|
||||
},
|
||||
goback() {
|
||||
uni.navigateBack()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user