This commit is contained in:
DESKTOP-369JRHT\12997 2023-10-13 18:14:19 +08:00
parent c63b6018a1
commit e89ddfecab
21 changed files with 607 additions and 170 deletions

View File

@ -37,7 +37,7 @@ export function dictSelect(data) {
})
}
// 字典查询
//
export function getOilPresetList(data) {
return request({
url: 'business/petrolStationManagement/oilPresetPrices/getList',
@ -45,3 +45,40 @@ export function getOilPresetList(data) {
data: data
})
}
// 查询油品
export function getOilNameListApi(data) {
return request({
url: '/business/petrolStationManagement/oilNumber/getOilName',
method: 'get',
params: data
})
}
// 查询油品名称
export function getOilNameApi(data) {
return request({
url: '/business/petrolStationManagement/oilName/getList',
method: 'get',
params: data
})
}
// 查询油品名称
export function getAllOilListApi(data) {
return request({
url: '/business/petrolStationManagement/oilName/getOilName',
method: 'get',
params: data
})
}
// 新增预设
export function insertOilPresePricesApi(data) {
return request({
url: 'business/petrolStationManagement/oilPresetPrices',
method: 'post',
data: data
})
}

View File

@ -8,18 +8,21 @@
<div class="top-box">
<!-- 循环-->
<div class="oil-box" v-for="(item,index) in oilNumberList " :key="index" >
<div class="top-icon">
<div>启用</div>
<div v-if="item.state == '启用'" class="top-icon">
<div>{{item.state}}</div>
</div>
<div class="box-icon"><i class="el-icon-edit" style="color:#409EFF" @click="dialogFormNumberEdit = true, openOilNumberEdit(item),oilTypeMethods"></i></div>
<div class="box-title"> {{item.oilType}} </div>
<div v-if="item.state == '禁用'" class="top-icon2">
<div>{{item.state}}</div>
</div>
<div class="box-icon"><i class="el-icon-edit" style="color:#409EFF" @click="dialogFormNumberEdit = true,oilTypeMethods(),openOilNumberEdit(item)"></i></div>
<div class="box-title"> {{item.allOil}} </div>
<div class="between-box">
<div>油站价:</div>
<div><span class="jiacu">{{ item.oilPrice }}</span> /L</div>
<div><span class="jiacu">{{ item.oilPrice }}</span>/{{item.unit}}</div>
</div>
<div class="between-box">
<div>国标价:</div>
<div> <span class="jiacu">{{ item.gbPrice }}</span> /L</div>
<div> <span class="jiacu">{{ item.gbPrice }}</span>/{{item.unit}}</div>
</div>
<div class="between-box">
<div>最后更新时间:</div>
@ -27,8 +30,6 @@
</div>
</div>
</div>
</el-card>
<el-card style="margin-bottom: 20px">
<div slot="header" class="clearfix">
@ -44,8 +45,10 @@
label="任务id"
width="100">
</el-table-column>
<!-- prop="presetGbPrice"-->
<el-table-column
prop="presetGbPrice"
prop="oilNameT"
label="预设油号"
>
</el-table-column>
@ -78,11 +81,16 @@
label="预设时间"
>
</el-table-column>
<el-table-column
prop="state"
label="处理状态"
>
</el-table-column>
<!-- <el-table-column-->
<!-- prop="state"-->
<!-- label="处理状态"-->
<!-- >-->
<el-table-column label="状态">
<template slot-scope="scope">
{{ getStatusText(scope.row.state) }}
</template>
</el-table-column>
<el-table-column
prop="createTime"
label="创建时间"
@ -94,10 +102,10 @@
width="120">
<template slot-scope="scope">
<el-button
@click.native.prevent="deleteRow(scope.$index, tableData)"
@click.native.prevent="deleteRow(scope.$index, oilPresetPricesList)"
type="text"
size="small">
移除
停止
</el-button>
</template>
</el-table-column>
@ -116,32 +124,32 @@
</el-radio>
</el-radio-group>
</el-form-item>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="油品名称">
<el-select v-model="oilNumber.oilName" placeholder="请选择油品名称">
<!-- <el-option v-for="option in oilNameList" :key="option.dictValue" :label="option.dictValue">-->
<!-- {{ option.dictLabel }}-->
<!-- </el-option>-->
<el-select v-model="oilNumber.oilName" style="width: 217px" placeholder="请选择油品名称">
<el-option
v-for="option in oilNameList"
:key="option.dictCode"
:label="option.dictLabel"
:value="option.dictValue"
:key="option.id"
:label="option.oilName"
:value="option.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计价单位">
<el-select v-model="oilNumber.receivingUnits" placeholder="请选择活动区域">
<!-- <el-option label="单位一" value="shanghai"></el-option>-->
<!-- <el-option label="单位二" value="beijing"></el-option>-->
<el-select v-model="oilNumber.unit" style="width: 217px"
placeholder="请选择活动区域">
<el-option
v-for="option in receivingUnitList"
:key="option.dictCode"
:label="option.dictLabel"
:value="option.dictValue"
:key="option.value"
:label="option.label"
:value="option.label"
:disabled="option.dis"
></el-option>
</el-select>
</el-form-item>
@ -151,37 +159,39 @@
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="油品单价">
<el-input v-model="oilNumber.oilPrice"></el-input>
<el-input v-model="oilNumber.oilPrice" style="width: 217px"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="国际价格">
<el-input v-model="oilNumber.gbPrice"></el-input>
<el-input v-model="oilNumber.gbPrice" style="width: 217px"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="收款单位">
<el-radio-group v-model="oilNumber.receivingUnits">
<el-radio label="元"></el-radio>
<el-radio label="元" ></el-radio>
<el-radio label="计价单位"></el-radio>
</el-radio-group>
</el-form-item>
<div class="hui-seiz">点击油品输入的计算单位可默认元或计价单位(L//kg),页面也可自行切换</div>
<el-form-item label="状态">
<el-radio-group v-model="oilNumber.state">
<el-radio label="启用"></el-radio>
<el-radio label="禁用"></el-radio>
<el-radio label="启用" value="0"></el-radio>
<el-radio label="禁用" value="1"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="排序">
<el-input-number v-model="oilNumber.num" controls-position="right" @change="handleChange" :min="1" :max="10"></el-input-number>
<el-input-number v-model="oilNumber.sort" controls-position="right" @change="handleChange" :min="1" :max="10"></el-input-number>
</el-form-item>
<el-form-item label="备注">
<el-input type="textarea" v-model="oilNumber.remark"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
@ -201,29 +211,25 @@
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="油品名称">
<el-select v-model="oilNumber.oilName" placeholder="请选择油品名称">
<!-- <el-option v-for="option in oilNameList" :key="option.dictValue" :label="option.dictValue">-->
<!-- {{ option.dictLabel }}-->
<!-- </el-option>-->
<el-select v-model="oilNumber.oilName" style="width: 217px" placeholder="请选择油品名称">
<el-option
v-for="option in oilNameList"
:key="option.dictCode"
:label="option.dictLabel"
:value="option.dictValue"
:key="option.id"
:label="option.oilName"
:value="option.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计价单位">
<el-select v-model="oilNumber.receivingUnits" placeholder="请选择活动区域">
<!-- <el-option label="单位一" value="shanghai"></el-option>-->
<!-- <el-option label="单位二" value="beijing"></el-option>-->
<el-select v-model="oilNumber.unit" style="width: 217px" placeholder="请选择活动区域">
<el-option
v-for="option in receivingUnitList"
:key="option.dictCode"
:label="option.dictLabel"
:value="option.dictValue"
:key="option.value"
:label="option.label"
:value="option.label"
:disabled="option.dis"
></el-option>
</el-select>
</el-form-item>
@ -233,12 +239,12 @@
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="油品单价">
<el-input v-model="oilNumber.oilPrice"></el-input>
<el-input v-model="oilNumber.oilPrice" style="width: 217px"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="国际价格">
<el-input v-model="oilNumber.gbPrice"></el-input>
<el-input v-model="oilNumber.gbPrice" style="width: 217px"></el-input>
</el-form-item>
</el-col>
</el-row>
@ -256,7 +262,7 @@
</el-radio-group>
</el-form-item>
<el-form-item label="排序">
<el-input-number v-model="oilNumber.num" controls-position="right" @change="handleChange" :min="1" :max="10"></el-input-number>
<el-input-number v-model="oilNumber.sort" controls-position="right" @change="handleChange" :min="1" :max="10"></el-input-number>
</el-form-item>
<el-form-item label="备注">
<el-input type="textarea" v-model="oilNumber.remark"></el-input>
@ -267,19 +273,19 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormNumberEdit = false"> </el-button>
<el-button type="primary" @click="dialogFormNumberEdit = false,insertOilNumberin()"> </el-button>
<el-button type="primary" @click="dialogFormNumberEdit = false,updateOilNumberin()"> </el-button>
</div>
</el-dialog>
<el-dialog title="添加预设" :visible.sync="dialogFormPricesAdd">
<el-dialog title="添加预设" :visible.sync="dialogFormPricesAdd" width="450px">
<el-form :model="oilPresetPrices" label-width="100px">
<el-form-item label="预设油号">
<el-select v-model="oilPresetPrices.oilType" placeholder="请选择油号" @change="oilTypeClickByPrice()">
<el-option
v-for="option in selectOilTypeByPrice"
:key="option.numberId"
:label="option.numberId"
:value="option.oilName"
:label="option.oilType +' '+option.oilName"
:value="option.numberId"
></el-option>
</el-select>
@ -291,24 +297,24 @@
<el-input v-model="oilPresetPrices.presetOilPrices" style="width: 217px"></el-input>
</el-form-item>
<el-form-item label="当前国标价">
<el-input v-model="oilPresetPrices.currentPetrolPrices" style="width: 217px"></el-input>
<el-input v-model="oilPresetPrices.currentPetrolPrices" style="width: 217px" readonly></el-input>
</el-form-item>
<el-form-item label="预设国标价">
<el-input v-model="oilPresetPrices.presetGbPrice" style="width: 217px"></el-input>
</el-form-item>
<el-form-item label="活动时间">
<el-date-picker
v-model="oilNumber.effectiveTime"
v-model="oilPresetPrices.effectiveTime"
type="datetime"
placeholder="选择日期时间"
style="width: 100%;">
style="width: 217px">
</el-date-picker>
</el-form-item>
<div class="hui-seiz">点击油品输入的计算单位可默认元或计价单位(L//kg),页面也可自行切换</div>
<div class="hui-seiz">如生效时间与当前时间间隔小于1分钟,当前油价将立即生效</div>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormPricesAdd = false"> </el-button>
<el-button type="primary" @click="dialogFormPricesAdd = false,insertOilNumberin()"> </el-button>
<el-button type="primary" @click="dialogFormPricesAdd = false,insertOilPresePrices()"> </el-button>
</div>
</el-dialog>
@ -318,13 +324,24 @@
<script>
import {getOilNumberList, dictSelect, insertOilNumber, updateOilNumber, getOilPresetList} from "@/api/oilPrice";
import {
getOilNumberList,
dictSelect,
insertOilNumber,
updateOilNumber,
getOilPresetList,
getOilNameApi,
getAllOilListApi,
getOilNameListApi, insertOilPresePricesApi
} from "@/api/oilPrice";
export default {
name: 'index',
data() {
return {
oilNumberList: [],
oilNumberList2: [],
num: 1,
dialogFormVisible: false, //
@ -336,6 +353,8 @@ import {getOilNumberList, dictSelect, insertOilNumber, updateOilNumber, getOilPr
oilNameList: [], //
receivingUnitList: [], //
receivingUnitCN: [],
receivingUnitEN: [],
oilNumber:{
@ -350,9 +369,14 @@ import {getOilNumberList, dictSelect, insertOilNumber, updateOilNumber, getOilPr
sort: '',
remark: '',
ifDelete: '',
allOil:'',
oilTypeT: '',
oilNameT: '',
unit:'', //
},
oilPresetPricesList:[],
AllOilList:[],
selectOilTypeByPrice: [],
oilPresetPrices: {
@ -362,14 +386,11 @@ import {getOilNumberList, dictSelect, insertOilNumber, updateOilNumber, getOilPr
currentGbPrice:'',
presetGbPrice:'',
createTime:'',
updateTime:',',
updateTime:'',
effectiveTime:'',
ifDelete:'',
},
form: {
name: '',
region: '',
@ -383,71 +404,159 @@ import {getOilNumberList, dictSelect, insertOilNumber, updateOilNumber, getOilPr
formLabelWidth: '100px'
}
},
created() {
this.getList();
this.getOilPresetListin();
async created() {
try {
await this.getList();
await this.getAllOilList();
await this.getOilPresetListin();
} catch (error) {
console.error(error);
}
},
mounted() {
},
methods:{
getStatusText(data) {
if (data == 1) {
return "停止"
} else {
return "启用"
}
},
handleChange(value) {
console.log(value);
},
//
getList() {
var this_ = this
getOilNumberList().then( response => {
this_.oilNumberList = response.data.records
// for (const record of response.data.records) {
// console.log("response", record);
// this_.oilNumberList.push(record);
// }
return new Promise(async (resolve, reject) => {
try {
const response = await getOilNumberList();
this.oilNumberList2 = response.data.records;
await this.getAllOilList();
resolve();
} catch (error) {
reject(error);
}
});
},
oilTypeMethods() {
//
this.getOilTypeList("oil_type")
//
this.getOilTypeList("pricingUnit")
async getAllOilList() {
try {
const response = await getAllOilListApi();
const oilList = response.data;
this.AllOilList = oilList
this.oilNumberList = this.oilNumberList2
this.oilNumberList.forEach(oilNumber => {
oilList.forEach(oil => {
if (parseInt(oilNumber.oilName) === oil.id) {
oilNumber.allOil = oil.oilType + " " + oil.oilName;
oilNumber.oilTypeT = oil.oilType;
oilNumber.oilNameT = oil.oilName;
}
});
});
} catch (error) {
// Handle error here if needed
}
},
// 使
async oilTypeMethods() {
try {
await Promise.all([
this.getOilTypeList("oil_type"),
this.getOilTypeList("pricingUnitCN"),
this.getOilTypeList("pricingUnitEN"),
]);
this.receivingUnitList = [];
var cla1 = {
label : "英文简称",
value : -1,
dis : true
}
this.receivingUnitList.push(cla1);
// this.receivingUnitCN receivingUnitList
for (const argumentsKey in this.receivingUnitCN) {
const value = this.receivingUnitCN[argumentsKey];
var cla = {
label : value.dictLabel,
value : value.dictValue,
dis : false
}
this.receivingUnitList.push(cla);
}
var cla2 = {
label : "中文简称",
value : -2,
dis : true
}
cla2 = {
label : "中文简称",
value : -3,
dis : true
}
this.receivingUnitList.push(cla2);
for (const argumentsKey in this.receivingUnitEN) {
const value = this.receivingUnitEN[argumentsKey];
var cla = {
label : value.dictLabel,
value : value.dictValue,
dis : false
}
this.receivingUnitList.push(cla);
}
console.log("this.receivingUnitList",this.receivingUnitList)
} catch (error) {
console.error(error);
}
},
//
oilTypeClick() {
const selectedValue = this.oilNumber.oilType;
this.getOilTypeList(selectedValue)
// this.getOilTypeList(selectedValue)
this.getOilName(selectedValue)
},
//
openOilNumberEdit(item) {
console.log("hellopllolloloo",item)
this.oilNumber = item
},
//
insertOilNumberin(){
async insertOilNumberin(){
insertOilNumber(this.oilNumber).then( response => {
var list = response.data
console.log("updateOilNumber",list)
});
await this.getList();
},
//
updateOilNumberin(){
async updateOilNumberin(){
updateOilNumber(data).then( response => {
var list = response.data
console.log("updateOilNumber",list)
});
await this.getList();
},
getOilTypeList(data) {
//
async getOilTypeList(data) {
var this_ = this
dictSelect(data).then( response => {
await dictSelect(data).then( response => {
var list = response.data
if (data == "oil_type") {
this_.oilTypeList = list;
}else if (data == "pricingUnit"){ //
this_.receivingUnitList = list;
}else if (data == "pricingUnitCN"){ //
this_.receivingUnitCN = list;
}else if (data == "pricingUnitEN"){ //
this_.receivingUnitEN = list;
}else {
this_.oilNameList = list;
}
@ -455,31 +564,83 @@ import {getOilNumberList, dictSelect, insertOilNumber, updateOilNumber, getOilPr
});
},
//
getOilName(data) {
var OilNumber = {
oilType: data
}
var this_ = this
getOilNameApi(OilNumber).then( response => {
var list = response.data
this_.oilNameList = list;
});
},
//
//
/**
* 油价预设
*/
//
getOilPresetListin() {
var this_=this
getOilPresetList().then( response => {
var list = response.data.records
this_.oilPresetPricesList = list
console.log("this_.listlistlistlistlistlistlist",this_.oilPresetPricesList)
this.oilPresetPricesList = response.data.records
this.oilPresetPricesList.forEach(oilNumber => {
this.AllOilList.forEach(oil => {
if (parseInt(oilNumber.oilType) === oil.id) {
oilNumber.oilNameT = oil.oilName;
}
});
});
console.log("111111111111111111111111111111",this.oilPresetPricesList)
console.log("111111111111111111111111111111",)
console.log("111111111111111111111111111111")
});
},
//
getOilNameList() {
var this_=this
getOilNameListApi().then( response => {
var list = response.data
this_.selectOilTypeByPrice = list
});
},
//
addOilPresePrices() {
this.selectOilTypeByPrice = this.oilNumberList;
console.log("this.selectOilTypeByPrice",this.selectOilTypeByPrice);
console.log("this.oilNumberList",this.oilNumberList);
// this.selectOilTypeByPrice = this.oilNumberList;
//
this.getOilNameList();
},
// youjia1 yusheeeeeeeeeeeeeeeeeee
insertOilPresePrices(){
insertOilPresePricesApi(this.oilPresetPrices).then( response => {
var list = response.data
console.log("updateOilNumber",list)
});
},
//
deleteRow(data1, data2) {
console.log("data1",data1);
console.log("data2",data2);
},
//
oilTypeClickByPrice() {
console.log("hello-worldqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq",oilNumberList)
this.selectOilTypeByPrice = this.oilNumberList;
var count = this.oilPresetPrices.oilType;
this.selectOilTypeByPrice.forEach((oil) => {
if (oil.numberId == parseInt(count)) {
this.oilPresetPrices.currentPetrolPrices = oil.oilPrice;
this.oilPresetPrices.currentGbPrice = oil.gbPrice;
}
});
}
}
}
@ -554,6 +715,17 @@ import {getOilNumberList, dictSelect, insertOilNumber, updateOilNumber, getOilPr
font-size: 13px;
border-bottom-right-radius: 6px;
}
.top-icon2{
position: absolute;
top: 0px;
left: 0px;
background-color: #3f3f3f;
padding: 3px 7px;
color: #d9d9d9;
font-size: 13px;
border-bottom-right-radius: 6px;
}
.table-box{
width: 100%;
margin: 20px auto;

View File

@ -103,7 +103,14 @@ public class OilNameController extends BaseController {
// }
/**
* 查询所有的油类名称
*/
@GetMapping("getOilName")
public ResponseObject getAllOilName() {
return getSuccessResult(oilNameService.getAllOilName());
}
}

View File

@ -44,7 +44,7 @@ public class OilNumberController extends BaseController {
@ApiOperation("查询所有油号")
@GetMapping("getList")
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@RequestParam(value = "pageSize",defaultValue = "10000") Integer pageSize,
OilNumber oilNumber) {
Page page =new Page(pageNo,pageSize);
IPage<OilNumber> list = oilPresetPricesService.selectOilNumberList(page,oilNumber);
@ -92,7 +92,7 @@ public class OilNumberController extends BaseController {
*/
@DeleteMapping("/{id}")
public ResponseObject delete(@PathVariable Integer id) {
return getSuccessResult(this.oilPresetPricesService.deleteOilNumberById(id));
return getSuccessResult(oilPresetPricesService.deleteOilNumberById(id));
}
/**
@ -104,6 +104,20 @@ public class OilNumberController extends BaseController {
// }
/**
* 查询一个加油站所有的油品类型
*/
@GetMapping("getOilName")
public ResponseObject getOilName() {
return getSuccessResult(oilPresetPricesService.getOilName());
}
//
// @GetMapping("getOilName")
// public ResponseObject getOilName(OilNumber oilNumber) {
// return getSuccessResult(oilPresetPricesService.updateOilNumber(oilNumber));
// }

View File

@ -94,5 +94,13 @@ public class OilPresetPricesController extends BaseController {
public ResponseObject delete(@PathVariable Integer id) {
return getSuccessResult(oilPresetPricesService.deleteOilPresetPricesById(id));
}
/**
* 根据id更改状态
*/
@GetMapping("editStart")
public ResponseObject editStart(Long id){
return getSuccessResult(oilPresetPricesService.editStart(id));
}
}

View File

@ -1,6 +1,7 @@
package com.fuint.business.petrolStationManagement.entity;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fuint.repository.model.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -13,17 +14,17 @@ import lombok.Data;
*/
@ApiModel("油品数据")
@Data
public class OilName extends Model<OilName> {
public class OilName extends BaseEntity {
@ApiModelProperty("商户名")
public Long numberId; //id主键)
public Long id; //id主键)
private String oilType; // 油品类型
private String oilName; //油品名称
private Double oilPrice; //油品单价
private String createTime; //创建时间
private String updateTime; //更新时间
private String state; // 状态 启用或禁用0禁用1启用
private String sort; //排序
private String remark; //
private String ifDelete; //
private String receivingUnits; //
private String unit; //
}

View File

@ -1,8 +1,10 @@
package com.fuint.business.petrolStationManagement.entity;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fuint.repository.model.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
/**
@ -13,19 +15,21 @@ import lombok.Data;
*/
@ApiModel("油品数据")
@Data
public class OilNumber extends Model<OilNumber> {
public class OilNumber extends BaseEntity {
@ApiModelProperty("商户名")
public Long numberId; //id主键)
public Integer numberId; //id主键)
private String oilType; // 油品类型
private String oilName; //油品名称
private Double oilPrice; //油品单价
private Double gbPrice; //国标价格
private String receivingUnits; //收款单位
private String createTime; //创建时间
private String updateTime; //更新时间
// private String createTime; //创建时间
// private String updateTime; //更新时间
private String state; // 状态 启用或禁用0禁用1启用
private String sort; //排序
private String remark; //
private String ifDelete; //
private String unit; //
private String storeId; //
}

View File

@ -1,6 +1,7 @@
package com.fuint.business.petrolStationManagement.entity;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fuint.repository.model.base.BaseEntity;
import lombok.Data;
import java.io.Serializable;
@ -13,7 +14,7 @@ import java.util.Date;
* @since 2023-10-11 16:36:02
*/
@Data
public class OilPresetPrices extends Model<OilPresetPrices> {
public class OilPresetPrices extends BaseEntity {
private Long presetId; // id主键)
private Long oilType; // 预设油号 id
@ -21,10 +22,12 @@ public class OilPresetPrices extends Model<OilPresetPrices> {
private Double presetOilPrices; // 预设油站价
private Double currentGbPrice; // 当前国标价
private Double presetGbPrice; // 预设国标价
private String createTime; // 创建时间
private String updateTime; // 更新时间
// private String createTime; // 创建时间
// private String updateTime; // 更新时间
private String effectiveTime; // 生效时间时间戳
private Integer ifDelete; // 是否删除0未删除|1删除
private Integer state; // 状态
private Integer numberId; // 状态
// /**

View File

@ -2,6 +2,7 @@ package com.fuint.business.petrolStationManagement.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.petrolStationManagement.entity.OilName;
import com.fuint.business.petrolStationManagement.entity.OilNumber;
import java.util.List;
@ -10,4 +11,6 @@ public interface OilNameMapper extends BaseMapper<OilName> {
// 根据字典油的类型查询
List<OilName> oilNameListByType(OilName oilName);
public List<OilName> getAllOilName();
}

View File

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilNumber;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (ChainStoreInfo)表数据库访问层
*
@ -44,5 +46,14 @@ public interface OilNumberMapper extends BaseMapper<OilNumber> {
* @return
*/
public int updateOilNumber(OilNumber oilNumber);
public List<OilNumber> getOilName();
// 根据店铺和油号查询是否存在重复
public OilNumber selectOilNameByStore(OilNumber oilNumber);
}

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilNumber;
import com.fuint.business.petrolStationManagement.entity.OilPresetPrices;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
/**
@ -25,7 +26,7 @@ public interface OilPresetPricesMapper extends BaseMapper<OilPresetPrices> {
* @param id
* @return
*/
public OilPresetPrices selectOilPresetPricesById(@Param("id") int id);
public OilPresetPrices selectOilPresetPricesById(@Param("id") Integer id);
/**
* 根据id删除员工信息
@ -44,4 +45,7 @@ public interface OilPresetPricesMapper extends BaseMapper<OilPresetPrices> {
* @return
*/
public int updateOilPresetPrices(OilPresetPrices presetPrices);
public int editStart(Integer id, Integer state);
}

View File

@ -6,7 +6,19 @@
<select id="oilNameListByType" resultType="com.fuint.business.petrolStationManagement.entity.OilName">
select * from oil_name where oil_type = #{oilType}
select id id ,oil_name oilName from oil_name where oil_type = #{oilType}
</select>
<select id="getAllOilName" resultType="com.fuint.business.petrolStationManagement.entity.OilName">
SELECT
NA.id AS id,
NA.oil_name AS oilName,
dict.dict_label AS oilType
FROM
oil_name NA
LEFT JOIN (
SELECT dict_label,dict_value FROM sys_dict_data WHERE dict_type = 'oil_type'
) dict ON NA.oil_type = dict.dict_value;
</select>
</mapper>

View File

@ -17,10 +17,11 @@
<result property="sort" column="sort" />
<result property="remark" column="remark" />
<result property="ifDelete" column="if_delete" />
<result property="unit" column="unit"/>
</resultMap>
<sql id="selectOilNumber">
select `number_id`,`oil_type`,oil_name,oil_price,gb_price,receiving_units,create_time,update_time,`state`,sort,remark,if_delete
select `number_id`,`oil_type`,oil_name,oil_price,gb_price,receiving_units,create_time,update_time,`state`,sort,remark,if_delete,unit
from oil_number
</sql>
@ -42,7 +43,6 @@
<insert id="insertOilNumber">
insert into oil_number
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="oilType != null">oil_type,</if>
<if test="oilName != null">oil_name,</if>
<if test="oilPrice != null">oil_price,</if>
@ -54,6 +54,7 @@
<if test="sort != null">sort,</if>
<if test="remark != null">remark,</if>
<if test="ifDelete != null">if_delete,</if>
<if test="unit != null">unit,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test=" oilType != null">#{oilType },</if>
@ -67,6 +68,7 @@
<if test=" sort != null">#{sort },</if>
<if test=" remark != null">#{remark },</if>
<if test=" ifDelete != null">#{ifDelete },</if>
<if test=" unit != null">#{unit},</if>
</trim>
</insert>
@ -84,6 +86,7 @@
<if test=" sort != null">sort= #{sort},</if>
<if test=" remark != null">remark= #{remark},</if>
<if test=" ifDelete != null">if_delete= #{ifDelete},</if>
<if test=" unit != null">unit= #{unit},</if>
</set>
where number_id = #{numberId}
</update>
@ -91,7 +94,22 @@
delete from oil_number where number_id = #{numberId}
</delete>
<!-- oilType-->
<select id="getOilName" resultType="com.fuint.business.petrolStationManagement.entity.OilNumber">
select onm.number_id numberId,name.oil_name oilName, dict.dict_label oilType,onm.oil_price oilPrice ,onm.gb_price gbPrice
from oil_number onm
left join oil_name name on onm.oil_name = name.id
left join (select dict_label,dict_value from sys_dict_data where dict_type = 'oil_type') dict on name.oil_type = dict.dict_value
</select>
<select id="selectOilNameByStore" resultType="com.fuint.business.petrolStationManagement.entity.OilNumber">
select number_id numberId
from oil_number
WHERE store_id = #{storeId}
oil_name = #{oilName}
limit 1
</select>
<!-- oilType-->
<!-- oilName-->
<!-- oilPrice-->
<!-- gbPrice-->

View File

@ -15,11 +15,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time"/>
<result property="effectiveTime" column="effective_time"/>
<result property="ifDelete" column="if_delete"/>
<result property="state" column="state"/>
</resultMap>
<sql id="selectOilPresetPrices">
select preset_id, oil_type, current_petrol_prices, preset_oil_prices, current_gb_price,
preset_gb_price, create_time, update_time, effective_time, if_delete
preset_gb_price, create_time, update_time, effective_time, if_delete, state
from oil_preset_prices
</sql>
@ -37,44 +38,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="insertOilPresetPrices">
insert into oil_preset_prices(
<if test=" oilType != null">oil_type,</if>
<if test=" currentPetrolPrices != null">current_petrol_prices,</if>
<if test=" presetOilPrices != null">preset_oil_prices,</if>
<if test=" currentGbPrice != null">current_gb_price,</if>
<if test=" presetGbPrice != null">preset_gb_price,</if>
<if test=" createTime != null">create_time,</if>
<if test=" updateTime != null">update_time,</if>
<if test=" effectiveTime != null">effective_time,</if>
<if test=" ifDelete != null">if_delete,</if>
)values (
<if test=" oilType != null">#{oilType},</if>
<if test=" currentPetrolPrices != null">#{currentPetrolPrices},</if>
<if test=" presetOilPrices != null">#{presetOilPrices},</if>
<if test=" currentGbPrice != null">#{currentGbPrice},</if>
<if test=" presetGbPrice != null">#{presetGbPrice},</if>
<if test=" createTime != null">#{createTime},</if>
<if test=" updateTime != null">#{updateTime},</if>
<if test=" effectiveTime != null">#{effectiveTime},</if>
<if test=" ifDelete != null">#{ifDelete},</if>
)
insert into oil_preset_prices
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test=" oilType != null">oil_type,</if>
<if test=" currentPetrolPrices != null">current_petrol_prices,</if>
<if test=" presetOilPrices != null">preset_oil_prices,</if>
<if test=" currentGbPrice != null">current_gb_price,</if>
<if test=" presetGbPrice != null">preset_gb_price,</if>
<if test=" createTime != null">create_time,</if>
<if test=" updateTime != null">update_time,</if>
<if test=" effectiveTime != null">effective_time,</if>
<if test=" ifDelete != null">if_delete,</if>
<if test=" state != null">state,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test=" oilType != null">#{oilType},</if>
<if test=" currentPetrolPrices != null">#{currentPetrolPrices},</if>
<if test=" presetOilPrices != null">#{presetOilPrices},</if>
<if test=" currentGbPrice != null">#{currentGbPrice},</if>
<if test=" presetGbPrice != null">#{presetGbPrice},</if>
<if test=" createTime != null">#{createTime},</if>
<if test=" updateTime != null">#{updateTime},</if>
<if test=" effectiveTime != null">#{effectiveTime},</if>
<if test=" ifDelete != null">#{ifDelete},</if>
<if test=" state != null">#{state},</if>
</trim>
</insert>
<update id="updateOilPresetPrices">
update oil_preset_prices
<set>
<if test=" oilType != null">= preset_id = #{oilType},</if>
<if test=" currentPetrolPrices != null">= oil_type = #{currentPetrolPrices},</if>
<if test=" presetOilPrices != null">= current_petrol_prices = #{presetOilPrices},</if>
<if test=" currentGbPrice != null">= preset_oil_prices = #{currentGbPrice},</if>
<if test=" presetGbPrice != null">= current_gb_price = #{presetGbPrice},</if>
<if test=" createTime != null">= preset_gb_price = #{createTime},</if>
<if test=" updateTime != null">= create_time = #{updateTime},</if>
<if test=" effectiveTime != null">= update_time = #{effectiveTime},</if>
<if test=" ifDelete != null">= effective_time = #{ifDelete},</if>
<if test=" oilType != null">preset_id = #{oilType},</if>
<if test=" currentPetrolPrices != null"> oil_type = #{currentPetrolPrices},</if>
<if test=" presetOilPrices != null"> current_petrol_prices = #{presetOilPrices},</if>
<if test=" currentGbPrice != null"> preset_oil_prices = #{currentGbPrice},</if>
<if test=" presetGbPrice != null"> current_gb_price = #{presetGbPrice},</if>
<if test=" createTime != null"> preset_gb_price = #{createTime},</if>
<if test=" updateTime != null"> create_time = #{updateTime},</if>
<if test=" effectiveTime != null"> update_time = #{effectiveTime},</if>
<if test=" ifDelete != null"> effective_time = #{ifDelete},</if>
<if test=" state != null"> effective_time = #{ifDelete},</if>
</set>
where number_id = #{numberId}
</update>
<delete id="deleteOilPresetPricesById">
delete from oil_preset_prices where number_id = #{id}
delete from oil_preset_prices where preset_id = #{id}
</delete>
<update id="editStart">
update oil_preset_prices state = #{oilType} where number_id = #{numberId}
</update>
</mapper>

View File

@ -21,6 +21,9 @@ public interface OilNameService extends IService<OilName> {
// 根据字典油的类型查询
List<OilName> oilNameListByType(OilName oilName);
public List<OilName> getAllOilName();
// /**
// * 根据条件分页查询员工信息
// * @param page

View File

@ -7,6 +7,8 @@ import com.fuint.business.petrolStationManagement.entity.OilNumber;
import com.fuint.business.petrolStationManagement.entity.OilPresetPrices;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*
@ -41,9 +43,17 @@ public interface OilNumberService extends IService<OilNumber> {
public int insertOilNumber(OilNumber oilNumber);
/**
* 修改员工信息
* 修改油品信息
* @return
*/
public int updateOilNumber(OilNumber oilNumber);
public List<OilNumber> getOilName();
public OilNumber selectOilNameByStore(OilNumber oilNumber);
}

View File

@ -26,7 +26,7 @@ public interface OilPresetPricesService extends IService<OilPresetPrices> {
* @param id
* @return
*/
public OilPresetPrices selectOilPresetPricesById(@Param("id") int id);
public OilPresetPrices selectOilPresetPricesById(@Param("id") Integer id);
/**
* 根据id删除员工信息
@ -45,5 +45,13 @@ public interface OilPresetPricesService extends IService<OilPresetPrices> {
* @return
*/
public int updateOilPresetPrices(OilPresetPrices presetPrices);
public int editStart(Long id);
/**
* 定时器设置定时调整油价
*/
public void timingAdjustment(Integer id);
}

View File

@ -28,6 +28,12 @@ public class OilNameServiceImpl extends ServiceImpl<OilNameMapper, OilName> impl
return baseMapper.oilNameListByType(oilName);
}
@Override
public List<OilName> getAllOilName() {
return baseMapper.getAllOilName();
}
// @Override
// public IPage<OilNumber> selectOilNumberList(Page page, OilNumber oilNumber) {
// return baseMapper.selectOilNumberList(page,oilNumber);

View File

@ -10,6 +10,10 @@ import com.fuint.business.petrolStationManagement.mapper.OilNumberMapper;
import com.fuint.business.petrolStationManagement.service.OilNumberService;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* (OilNumber)表服务实现类
*
@ -36,6 +40,8 @@ public class OilNumberServiceImpl extends ServiceImpl<OilNumberMapper, OilNumber
@Override
public int insertOilNumber(OilNumber oilNumber) {
// todo 根据id查询这个店铺是否加过该型号的油
// baseMapper.selectOilNameByStore(oilNumber);
return baseMapper.insertOilNumber(oilNumber);
}
@ -43,4 +49,18 @@ public class OilNumberServiceImpl extends ServiceImpl<OilNumberMapper, OilNumber
public int updateOilNumber(OilNumber oilNumber) {
return baseMapper.updateOilNumber(oilNumber);
}
@Override
public List<OilNumber> getOilName() {
return baseMapper.getOilName();
}
@Override
public OilNumber selectOilNameByStore(OilNumber oilNumber) {
return null;
// return baseMapper.selectOilNameByStore(oilNumber);
}
}

View File

@ -3,15 +3,21 @@ package com.fuint.business.petrolStationManagement.service.impl;
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.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.OilPresetPricesService;
import com.fuint.common.util.DateUtil;
import com.fuint.quartz.common.TaskException;
import com.fuint.quartz.domain.SysJob;
import com.fuint.quartz.service.ISysJobService;
import org.quartz.SchedulerException;
import org.springframework.stereotype.Service;
import javax.xml.crypto.Data;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.annotation.Resource;
import java.time.Instant;
/**
* (ChainStoreInfo)表服务实现类
@ -23,6 +29,12 @@ import java.util.Date;
public class OilPresetPricesServiceImpl extends ServiceImpl<OilPresetPricesMapper, OilPresetPrices> implements OilPresetPricesService {
@Resource
private OilNumberMapper oilNumberMapper;
@Resource
private ISysJobService iSysJobService;
@Override
public IPage<OilPresetPrices> selectOilPresetPricesList(Page page, OilPresetPrices presetPrices) {
@ -30,7 +42,7 @@ public class OilPresetPricesServiceImpl extends ServiceImpl<OilPresetPricesMappe
}
@Override
public OilPresetPrices selectOilPresetPricesById(int id) {
public OilPresetPrices selectOilPresetPricesById(Integer id) {
return baseMapper.selectOilPresetPricesById(id);
}
@ -41,19 +53,63 @@ public class OilPresetPricesServiceImpl extends ServiceImpl<OilPresetPricesMappe
@Override
public int insertOilPresetPrices(OilPresetPrices presetPrices) {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String format = sdf.format(date);
presetPrices.setCreateTime(format);
presetPrices.setUpdateTime(format);
// Date date = new Date();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
// String format = sdf.format(date);
// presetPrices.setCreateTime(format);
// presetPrices.setUpdateTime(format);
//
// SysJob sysJob = new SysJob();
// sysJob.setJobGroup("sdsd");
// sysJob.setJobGroup("dssd");
// sysJob.setInvokeTarget("ssdsd");
// try {
// iSysJobService.insertJob(sysJob);
// } catch (SchedulerException e) {
// e.printStackTrace();
// } catch (TaskException e) {
// e.printStackTrace();
// }
Instant instant = Instant.parse(presetPrices.getEffectiveTime());
Long timestamp = instant.toEpochMilli();
presetPrices.setEffectiveTime(timestamp.toString());
return baseMapper.insertOilPresetPrices(presetPrices);
}
@Override
public int updateOilPresetPrices(OilPresetPrices presetPrices) {
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String format = sdf.format(date);
presetPrices.setUpdateTime(format); return baseMapper.insertOilPresetPrices(presetPrices);
// Date date = new Date();
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
// String format = sdf.format(date);
// presetPrices.setUpdateTime(format);
return baseMapper.insertOilPresetPrices(presetPrices);
}
@Override
public int editStart(Long id) {
return 0;
}
/**
* 定时器设置定时调整油价
*/
@Override
public void timingAdjustment(Integer id) {
System.out.println("ssssssssssssssssssssssssssssssssssssss");
// 通过id查出这一条的数据
// OilPresetPrices oilPresetPrices = baseMapper.selectOilPresetPricesById(id);
// // 关联价格将number中的数据修改掉
// OilNumber oilNumber = new OilNumber();
// oilNumber.setNumberId(oilPresetPrices.getNumberId());
// oilNumber.setOilPrice(oilPresetPrices.getPresetOilPrices());
// oilNumber.setGbPrice(oilPresetPrices.getPresetGbPrice());
// oilNumberMapper.updateOilNumber(oilNumber);
//
// // 将状态调整为开始
// baseMapper.editStart(id, 1);
}
}

View File

@ -0,0 +1,28 @@
package com.fuint.business.petrolStationManagement.task;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.springframework.stereotype.Component;
/**
* 定时任务调度测试
*
* @author ruoyi
*/
@Component("presetPrices")
public class PresetPrices
{
// public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
// {
// System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
// }
public void ryParams(String params)
{
System.out.println("执行有参方法:" + params);
}
// public void ryNoParams()
// {
// System.out.println("执行无参方法");
// }
}