diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilNumberController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilNumberController.java index ce9a0e96f..308f8ed1c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilNumberController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilNumberController.java @@ -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 oilPresetPricesVOS = oilPresetPricesService.selectOilNumberList3(page, oilNumber); + return getSuccessResult(oilPresetPricesVOS); + } + /** * 通过主键查询单条数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilPresetPricesMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilPresetPricesMapper.java index 38e74b1e2..c4160199c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilPresetPricesMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilPresetPricesMapper.java @@ -61,5 +61,4 @@ public interface OilPresetPricesMapper extends BaseMapper { * @return */ public int updateJobId(OilPresetPrices presetPrices); - } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPresetPricesMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPresetPricesMapper.xml index d8c30cc68..e2c89f781 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPresetPricesMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPresetPricesMapper.xml @@ -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() - \ No newline at end of file + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNumberService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNumberService.java index 48adb1fc3..7864aa7b8 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNumberService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilNumberService.java @@ -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 { */ public IPage selectOilNumberList(Page page, @Param("oilNumber") OilNumber oilNumber); public IPage selectOilNumberList2(Page page, @Param("oilNumber") OilNumber oilNumber); + List selectOilNumberList3(Page page, @Param("oilNumber") OilNumber oilNumber); /** * 根据id查询员工信息 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNumberServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNumberServiceImpl.java index 7b44e8914..665ed34e5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNumberServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNumberServiceImpl.java @@ -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 implements OilNumberService { + @Resource + private OilPresetPricesMapper oilPresetPricesMapper; + @Resource + private OilNameService oilNameService; @Override public IPage selectOilNumberList(Page page, OilNumber oilNumber) { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); @@ -45,6 +59,46 @@ public class OilNumberServiceImpl extends ServiceImpl selectOilNumberList3(Page page, OilNumber oilNumber) { + + //获取预设油价列表 + OilPresetPrices oilPresetPrices = new OilPresetPrices(); + oilPresetPrices.setStoreId(oilNumber.getStoreId()); + IPage oilPresetPricesIPage = oilPresetPricesMapper.selectOilPresetPricesList(page, oilPresetPrices); + List records1 = oilPresetPricesIPage.getRecords(); + List collect = records1.stream().map(s -> { + OilPresetPricesVO oilPresetPricesVO = new OilPresetPricesVO(); + //如果预设时间等于当前时间 + if (s.getEffectiveTime().equals(DateUtil.format(new Date(), "yyyy-MM-dd"))){ + LambdaQueryWrapper 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 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); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPresetPricesServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPresetPricesServiceImpl.java index 3868c0f05..8ec83a8ef 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPresetPricesServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPresetPricesServiceImpl.java @@ -38,6 +38,9 @@ public class OilPresetPricesServiceImpl extends ServiceImpl selectOilPresetPricesList(Page page, OilPresetPrices presetPrices) { diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilPresetPricesVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilPresetPricesVO.java new file mode 100644 index 000000000..3c72d2c0a --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilPresetPricesVO.java @@ -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; +} diff --git a/gasStation-uni/pagesMy/today/today.vue b/gasStation-uni/pagesMy/today/today.vue index e62e0763c..07b755edb 100644 --- a/gasStation-uni/pagesMy/today/today.vue +++ b/gasStation-uni/pagesMy/today/today.vue @@ -13,27 +13,27 @@ 对比上次价格波动 - + - #92 + {{item.oilName}} 政府指导油价(元) - ¥7.8 + {{item.presetGbPrice}} - 30% + {{item.rate}} 最新油价 - ¥7.8 + {{item.presetOilPrices}} - 30% + {{item.rate}} @@ -47,19 +47,40 @@