油罐 定时任务
This commit is contained in:
parent
754ee569be
commit
e9e3fcef5f
18
fuintAdmin/src/api/oilConfig/oilTank.js
Normal file
18
fuintAdmin/src/api/oilConfig/oilTank.js
Normal file
@ -0,0 +1,18 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 查询油罐列表
|
||||
export function getTankApi(data) {
|
||||
return request({
|
||||
url: '/business/petrolStationManagement/oilTank/queryByPage',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
// 新增有关信息
|
||||
export function insertTankApi(data) {
|
||||
return request({
|
||||
url: 'business/petrolStationManagement/oilPresetPrices',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
@ -81,4 +81,13 @@ export function insertOilPresePricesApi(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function stopJobApi(data) {
|
||||
console.log("dddddaaaaa",data)
|
||||
return request({
|
||||
url: 'business/petrolStationManagement/oilPresetPrices/stopJob',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
<div slot="header" class="clearfix">
|
||||
<span>油价配置</span>
|
||||
</div>
|
||||
<el-button type="primary" @click="dialogFormVisible = true,oilTypeMethods()">新增油号</el-button>
|
||||
<el-button type="primary" @click="dialogFormVisible = true,oilTypeMethods(1)">新增油号</el-button>
|
||||
<div class="top-box">
|
||||
<!-- 循环-->
|
||||
<div class="oil-box" v-for="(item,index) in oilNumberList " :key="index" >
|
||||
@ -87,8 +87,11 @@
|
||||
<!-- >-->
|
||||
|
||||
<el-table-column label="状态">
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ getStatusText(scope.row.state) }}-->
|
||||
<!-- </template>-->
|
||||
<template slot-scope="scope">
|
||||
{{ getStatusText(scope.row.state) }}
|
||||
<dict-tag :options="dict.type.jobState" :value="scope.row.state"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@ -102,7 +105,7 @@
|
||||
width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@click.native.prevent="deleteRow(scope.$index, oilPresetPricesList)"
|
||||
@click.native.prevent="deleteRow(scope.$index, scope.row)"
|
||||
type="text"
|
||||
size="small">
|
||||
停止
|
||||
@ -115,21 +118,25 @@
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-dialog title="添加" :visible.sync="dialogFormVisible">
|
||||
<el-form :model="oilNumber">
|
||||
<el-form-item label="油品类型">
|
||||
<el-radio-group v-model="oilNumber.oilType" @change="oilTypeClick()">
|
||||
<el-radio v-for="option in oilTypeList" :key="option.dictValue" :label="option.dictValue">
|
||||
{{ option.dictLabel }}
|
||||
</el-radio>
|
||||
<el-dialog title="添加" :visible.sync="dialogFormVisible" >
|
||||
<el-form :model="oilNumber" :rules="rules">
|
||||
<el-form-item label="油品类型" prop="oilType">
|
||||
<el-radio-group v-model="oilNumber.oilType" @change="oilTypeClick(oilNumber)">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.oil_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<!-- <el-radio v-for="option in oilTypeList" :key="option.dictValue" :label="option.dictValue">-->
|
||||
<!-- {{ option.dictLabel }}-->
|
||||
<!-- </el-radio>-->
|
||||
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="油品名称">
|
||||
<el-form-item label="油品名称" prop="oilName">
|
||||
<el-select v-model="oilNumber.oilName" style="width: 217px" placeholder="请选择油品名称">
|
||||
<el-option
|
||||
v-for="option in oilNameList"
|
||||
@ -141,9 +148,9 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计价单位">
|
||||
<el-select v-model="oilNumber.unit" style="width: 217px"
|
||||
placeholder="请选择活动区域">
|
||||
<el-form-item label="计价单位" prop="unit">
|
||||
<el-select v-model="oilNumber.unit" style="width: 217px"
|
||||
placeholder="请选择计价单位">
|
||||
<el-option
|
||||
v-for="option in receivingUnitList"
|
||||
:key="option.value"
|
||||
@ -158,14 +165,18 @@
|
||||
<!-- -->
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="油品单价">
|
||||
<el-input v-model="oilNumber.oilPrice" style="width: 217px"
|
||||
></el-input>
|
||||
<el-form-item label="油品单价" prop="oilPrice">
|
||||
<el-input v-model.number="oilNumber.oilPrice" style="width: 217px"
|
||||
>
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="国际价格">
|
||||
<el-input v-model="oilNumber.gbPrice" style="width: 217px"></el-input>
|
||||
<el-form-item label="国标价格" prop="gbPrice">
|
||||
<el-input v-model.number="oilNumber.gbPrice" style="width: 217px">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -173,17 +184,21 @@
|
||||
|
||||
|
||||
|
||||
<el-form-item label="收款单位">
|
||||
<el-form-item label="收款单位" prop="receivingUnits">
|
||||
<el-radio-group v-model="oilNumber.receivingUnits">
|
||||
<el-radio label="元" ></el-radio>
|
||||
<el-radio label="计价单位"></el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div class="hui-seiz">点击油品输入的计算单位、可默认元或计价单位(L/m³/kg),页面也可自行切换</div>
|
||||
<el-form-item label="状态">
|
||||
<el-form-item label="状态" prop="state">
|
||||
<el-radio-group v-model="oilNumber.state">
|
||||
<el-radio label="启用" value="0"></el-radio>
|
||||
<el-radio label="禁用" value="1"></el-radio>
|
||||
<el-radio
|
||||
v-for="dict in dict.type.zhzt"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
@ -200,17 +215,23 @@
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="修改" :visible.sync="dialogFormNumberEdit">
|
||||
<el-form :model="oilNumber">
|
||||
<el-form-item label="油品类型">
|
||||
<el-radio-group v-model="oilNumber.oilType" @change="oilTypeClick()">
|
||||
<el-radio v-for="option in oilTypeList" :key="option.dictValue" :label="option.dictValue">
|
||||
{{ option.dictLabel }}
|
||||
</el-radio>
|
||||
<el-form ref="form" :model="oilNumber" :rules="rules">
|
||||
<el-form-item label="油品类型" prop="oilType">
|
||||
<el-radio-group v-model="oilNumber.oilType" @change="oilTypeClick(oilNumber.oilType)">
|
||||
<!-- <el-radio v-for="option in oilTypeList" :key="option.dictValue" :label="option.dictValue">-->
|
||||
<!-- {{ option.dictLabel }}-->
|
||||
<!-- </el-radio>-->
|
||||
<el-radio
|
||||
v-for="dict in dict.type.oil_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="油品名称">
|
||||
<el-form-item label="油品名称" prop="oilName">
|
||||
<el-select v-model="oilNumber.oilName" style="width: 217px" placeholder="请选择油品名称">
|
||||
<el-option
|
||||
v-for="option in oilNameList"
|
||||
@ -222,7 +243,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计价单位">
|
||||
<el-form-item label="计价单位" prop="unit">
|
||||
<el-select v-model="oilNumber.unit" style="width: 217px" placeholder="请选择活动区域">
|
||||
<el-option
|
||||
v-for="option in receivingUnitList"
|
||||
@ -238,48 +259,56 @@
|
||||
<!-- -->
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="油品单价">
|
||||
<el-input v-model="oilNumber.oilPrice" style="width: 217px"></el-input>
|
||||
<el-form-item label="油品单价" prop="oilPrice">
|
||||
<el-input v-model.number="oilNumber.oilPrice" style="width: 217px">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="国际价格">
|
||||
<el-input v-model="oilNumber.gbPrice" style="width: 217px"></el-input>
|
||||
<el-form-item label="国标价格" prop="gbPrice">
|
||||
<el-input v-model.number="oilNumber.gbPrice" style="width: 217px">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="收款单位">
|
||||
<el-form-item label="收款单位" prop="receivingUnits">
|
||||
<el-radio-group v-model="oilNumber.receivingUnits">
|
||||
<el-radio label="元"></el-radio>
|
||||
<el-radio label="计价单位"></el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div class="hui-seiz">点击油品输入的计算单位、可默认元或计价单位(L/m³/kg),页面也可自行切换</div>
|
||||
<el-form-item label="状态">
|
||||
<el-form-item label="状态" prop="state">
|
||||
<el-radio-group v-model="oilNumber.state">
|
||||
<el-radio label="启用"></el-radio>
|
||||
<el-radio label="禁用"></el-radio>
|
||||
<el-radio
|
||||
v-for="dict in dict.type.zhzt"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
<!-- <el-radio label="启用"></el-radio>-->
|
||||
<!-- <el-radio label="禁用"></el-radio>-->
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
<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-input type="textarea" v-model="oilNumber.remark" ></el-input>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormNumberEdit = false">取 消</el-button>
|
||||
<el-button type="primary" @click="dialogFormNumberEdit = false,updateOilNumberin()">确 定</el-button>
|
||||
<el-button type="primary" @click=" updateOilNumberin()">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="添加预设" :visible.sync="dialogFormPricesAdd" width="450px">
|
||||
<el-form :model="oilPresetPrices" label-width="100px">
|
||||
<el-form-item label="预设油号">
|
||||
<el-form ref="Priform" :model="oilPresetPrices" label-width="100px" :rules="oilPresetPricesRules">
|
||||
<el-form-item label="预设油号" prop="oilType">
|
||||
<el-select v-model="oilPresetPrices.oilType" placeholder="请选择油号" @change="oilTypeClickByPrice()">
|
||||
<el-option
|
||||
v-for="option in selectOilTypeByPrice"
|
||||
@ -291,30 +320,39 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="当前油站价">
|
||||
<el-input v-model="oilPresetPrices.currentGbPrice" style="width: 217px" readonly></el-input>
|
||||
<el-input v-model="oilPresetPrices.currentGbPrice" style="width: 217px" readonly>
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="预设油站价">
|
||||
<el-input v-model="oilPresetPrices.presetOilPrices" style="width: 217px"></el-input>
|
||||
<el-form-item label="预设油站价" prop="presetOilPrices">
|
||||
<el-input v-model.number="oilPresetPrices.presetOilPrices" style="width: 217px">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="当前国标价">
|
||||
<el-input v-model="oilPresetPrices.currentPetrolPrices" style="width: 217px" readonly></el-input>
|
||||
<el-input v-model="oilPresetPrices.currentPetrolPrices" style="width: 217px" readonly>
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="预设国标价">
|
||||
<el-input v-model="oilPresetPrices.presetGbPrice" style="width: 217px"></el-input>
|
||||
<el-form-item label="预设国标价" prop="presetGbPrice">
|
||||
<el-input v-model.number="oilPresetPrices.presetGbPrice" style="width: 217px">
|
||||
<template slot="append">元</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="活动时间">
|
||||
<el-form-item label="活动时间" prop="effectiveTime">
|
||||
<el-date-picker
|
||||
v-model="oilPresetPrices.effectiveTime"
|
||||
type="datetime"
|
||||
placeholder="选择日期时间"
|
||||
style="width: 217px">
|
||||
style="width: 217px"
|
||||
value-format="yyyy-MM-dd HH:mm:ss">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<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,insertOilPresePrices()">确 定</el-button>
|
||||
<el-button type="primary" @click="insertOilPresePrices()">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
@ -332,14 +370,59 @@ import {
|
||||
getOilPresetList,
|
||||
getOilNameApi,
|
||||
getAllOilListApi,
|
||||
getOilNameListApi, insertOilPresePricesApi
|
||||
getOilNameListApi, insertOilPresePricesApi, stopJobApi
|
||||
|
||||
} from "@/api/oilPrice";
|
||||
|
||||
export default {
|
||||
name: 'index',
|
||||
dicts: ['jobState','oil_type','zhzt'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
oilPresetPricesRules: {
|
||||
oilType:[
|
||||
{ required: true, message: '请选择油品类型', trigger: 'change' }
|
||||
],
|
||||
presetOilPrices: [
|
||||
{required: true, message: '请输入', trigger: 'blur'},
|
||||
{ type: 'number', message: '价格必须为数字值'}
|
||||
],
|
||||
presetGbPrice: [
|
||||
{required: true, message: '请输入', trigger: 'blur'},
|
||||
{ type: 'number', message: '价格必须为数字值'}
|
||||
],
|
||||
effectiveTime:[
|
||||
{ type: 'date', required: true, message: '请选择日期', trigger: 'change' }
|
||||
],
|
||||
},
|
||||
rules: {
|
||||
oilType:[
|
||||
{ required: true, message: '请选择油品类型', trigger: 'change' }
|
||||
],
|
||||
unit:[
|
||||
{ required: true, message: '请选择', trigger: 'change' }
|
||||
],
|
||||
oilName: [
|
||||
{ required: true, message: '请选择', trigger: 'change' }
|
||||
],
|
||||
oilPrice: [
|
||||
{required: true, message: '请输入', trigger: 'blur'},
|
||||
{ type: 'number', message: '价格必须为数字值'}
|
||||
],
|
||||
gbPrice: [
|
||||
{required: true, message: '请输入', trigger: 'blur'},
|
||||
{ type: 'number', message: '价格必须为数字值'}
|
||||
],
|
||||
receivingUnits: [
|
||||
{ required: true, message: '请选择', trigger: 'change' }
|
||||
],
|
||||
state: [
|
||||
{ required: true, message: '请选择', trigger: 'change' }
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
oilNumberList: [],
|
||||
oilNumberList2: [],
|
||||
|
||||
@ -381,14 +464,15 @@ import {
|
||||
selectOilTypeByPrice: [],
|
||||
oilPresetPrices: {
|
||||
oilType:'',
|
||||
currentPetrolPrices:'',
|
||||
presetOilPrices:'',
|
||||
currentGbPrice:'',
|
||||
presetGbPrice:'',
|
||||
currentPetrolPrices:null ,
|
||||
presetOilPrices:null ,
|
||||
currentGbPrice:null ,
|
||||
presetGbPrice:null ,
|
||||
createTime:'',
|
||||
updateTime:'',
|
||||
effectiveTime:'',
|
||||
ifDelete:'',
|
||||
numberId:'',
|
||||
},
|
||||
|
||||
form: {
|
||||
@ -447,6 +531,7 @@ import {
|
||||
const oilList = response.data;
|
||||
this.AllOilList = oilList
|
||||
this.oilNumberList = this.oilNumberList2
|
||||
|
||||
this.oilNumberList.forEach(oilNumber => {
|
||||
oilList.forEach(oil => {
|
||||
if (parseInt(oilNumber.oilName) === oil.id) {
|
||||
@ -457,13 +542,18 @@ import {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
} catch (error) {
|
||||
// Handle error here if needed
|
||||
}
|
||||
},
|
||||
|
||||
// 编辑时使用
|
||||
async oilTypeMethods() {
|
||||
async oilTypeMethods(data) {
|
||||
if (data == 1) {
|
||||
this.oilNumber = {}
|
||||
}
|
||||
|
||||
try {
|
||||
await Promise.all([
|
||||
this.getOilTypeList("oil_type"),
|
||||
@ -477,7 +567,6 @@ import {
|
||||
dis : true
|
||||
}
|
||||
this.receivingUnitList.push(cla1);
|
||||
|
||||
// 遍历 this.receivingUnitCN 对象的属性并添加到 receivingUnitList
|
||||
for (const argumentsKey in this.receivingUnitCN) {
|
||||
const value = this.receivingUnitCN[argumentsKey];
|
||||
@ -509,14 +598,13 @@ import {
|
||||
}
|
||||
this.receivingUnitList.push(cla);
|
||||
}
|
||||
|
||||
console.log("this.receivingUnitList",this.receivingUnitList)
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
// 选择油品类型之后触发
|
||||
oilTypeClick() {
|
||||
oilTypeClick(data) {
|
||||
console.log("selectedValue",data)
|
||||
const selectedValue = this.oilNumber.oilType;
|
||||
// this.getOilTypeList(selectedValue)
|
||||
this.getOilName(selectedValue)
|
||||
@ -524,26 +612,34 @@ import {
|
||||
|
||||
// 打开修改窗口
|
||||
openOilNumberEdit(item) {
|
||||
console.log("item",item)
|
||||
this.oilNumber = item
|
||||
},
|
||||
|
||||
// 添加
|
||||
async insertOilNumberin(){
|
||||
insertOilNumberin(){
|
||||
insertOilNumber(this.oilNumber).then( response => {
|
||||
var list = response.data
|
||||
this.getList();
|
||||
|
||||
console.log("updateOilNumber",list)
|
||||
});
|
||||
await this.getList();
|
||||
},
|
||||
|
||||
// 修改
|
||||
async updateOilNumberin(){
|
||||
updateOilNumber(data).then( response => {
|
||||
var list = response.data
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.dialogFormNumberEdit = false
|
||||
|
||||
console.log("updateOilNumber",list)
|
||||
});
|
||||
await this.getList();
|
||||
var this_ = this
|
||||
updateOilNumber(this_.oilNumber).then( response => {
|
||||
var list = response.data
|
||||
this.getList();
|
||||
console.log("updateOilNumber",list)
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 查询数组字典类型
|
||||
@ -593,9 +689,6 @@ import {
|
||||
}
|
||||
});
|
||||
});
|
||||
console.log("111111111111111111111111111111",this.oilPresetPricesList)
|
||||
console.log("111111111111111111111111111111",)
|
||||
console.log("111111111111111111111111111111")
|
||||
});
|
||||
},
|
||||
// 油价预设查询列表
|
||||
@ -606,28 +699,36 @@ import {
|
||||
this_.selectOilTypeByPrice = list
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// 新增油价预设
|
||||
addOilPresePrices() {
|
||||
this.oilPresetPrices = {}
|
||||
// this.selectOilTypeByPrice = this.oilNumberList;
|
||||
// 油价预设查询列表
|
||||
this.getOilNameList();
|
||||
},
|
||||
|
||||
// 添加youjia1 yusheeeeeeeeeeeeeeeeeee
|
||||
// 添加youjia1
|
||||
insertOilPresePrices(){
|
||||
insertOilPresePricesApi(this.oilPresetPrices).then( response => {
|
||||
var list = response.data
|
||||
console.log("updateOilNumber",list)
|
||||
// console.log(typeof oilPresetPrices.presetOilPrices);
|
||||
console.log("typeof oilPresetPrices.presetOilPrices",this.oilPresetPrices);
|
||||
this.$refs["Priform"].validate(valid => {
|
||||
if (valid) {
|
||||
this.dialogFormPricesAdd = false
|
||||
insertOilPresePricesApi(this.oilPresetPrices).then(response => {
|
||||
var list = response.data
|
||||
this.getOilNameList();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 更改状态
|
||||
deleteRow(data1, data2) {
|
||||
console.log("data1",data1);
|
||||
console.log("data2",data2);
|
||||
stopJobApi(data2).then( response => {
|
||||
this.getOilPresetListin();
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
@ -639,6 +740,7 @@ import {
|
||||
if (oil.numberId == parseInt(count)) {
|
||||
this.oilPresetPrices.currentPetrolPrices = oil.oilPrice;
|
||||
this.oilPresetPrices.currentGbPrice = oil.gbPrice;
|
||||
this.oilPresetPrices.numberId = oil.numberId;
|
||||
}
|
||||
});
|
||||
}
|
373
fuintAdmin/src/views/oilConfig/oilTank/list.vue
Normal file
373
fuintAdmin/src/views/oilConfig/oilTank/list.vue
Normal file
@ -0,0 +1,373 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索框-->
|
||||
<el-card >
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="油罐名称" prop="tankName">
|
||||
<el-input
|
||||
v-model="queryParams.tankName"
|
||||
placeholder="请输入姓名"
|
||||
clearable
|
||||
style="width: 240px;"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<!-- <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>-->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 列表-->
|
||||
<el-card style="margin-top: 20px" >
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="tankAdd"
|
||||
>新增油罐</el-button>
|
||||
</el-col>
|
||||
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
|
||||
</el-row>
|
||||
|
||||
<el-table ref="tables"
|
||||
v-loading="loading"
|
||||
:data="tankList"
|
||||
:default-sort="defaultSort">
|
||||
<el-table-column label="油罐名称" align="center" prop="tankName"/>
|
||||
<el-table-column label="油品名称" align="center" prop="oilNumber" />
|
||||
<el-table-column label="当前数据" align="center">
|
||||
<el-table-column label="油罐容量" align="center" prop="tankVolume"/>
|
||||
<el-table-column label="下限预警" align="center" prop="lowerWarning"/>
|
||||
<el-table-column label="油品密度" align="center" prop="oilDensity"/>
|
||||
</el-table-column>
|
||||
<el-table-column label="油品密度" align="center" prop="specialPrem"/>
|
||||
<el-table-column label="存油数量" align="center" prop="storedQuantity"/>
|
||||
<el-table-column label="存油总价 " align="center" prop="totalPrice"/>
|
||||
<el-table-column label="折后单价" align="center" prop="discountedPrice"/>
|
||||
|
||||
<el-table-column label="更新时间" align="center" prop="updateTime" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.updateTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
v-hasPermi="['staff:list']"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
v-hasPermi="['staff:list']"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.page"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-card>
|
||||
|
||||
<!-- 新增/修改-->
|
||||
<el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
|
||||
<el-form ref="form" :model="tankForm" :rules="rules" label-width="120px">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="16">
|
||||
<el-form-item label="油罐名称" prop="tankName">
|
||||
<el-input v-model="tankForm.tankName" placeholder="请输入油罐名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="油品号" prop="oilNumber">
|
||||
<el-select v-model="tankForm.oilNumber" placeholder="请选择角色" style="width:100%">
|
||||
<el-option
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="油罐体积" prop="tankVolume">
|
||||
<el-input v-model="tankForm.tankVolume" placeholder="请输入登录密码" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="下限预警" prop="lowerWarning">
|
||||
<el-input v-model="tankForm.lowerWarning" placeholder="请输入登录密码" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="油品密度" prop="password">
|
||||
<el-input v-model="tankForm.oilDensity" placeholder="请输入油品密度" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="存油数量" prop="storedQuantity">
|
||||
<el-input v-model="tankForm.storedQuantity" placeholder="请输入存油数量" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="存油总价" prop="totalPrice">
|
||||
<el-input v-model="tankForm.totalPrice" placeholder="请输入存油总价" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="折合单价" prop="discountedPrice">
|
||||
<el-input v-model="tankForm.discountedPrice" placeholder="请输入折合单价" maxlength="30"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="油罐状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.zhzt"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="库存统计">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.zhzt"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注信息">
|
||||
<el-input type="textarea" v-model="form.remarks"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getTankApi,insertTankApi} from "@/api/oilConfig/oilTank";
|
||||
import {getName,parseTime} from "../../../utils/fuint";
|
||||
import {addStaff, updateStaff} from "@/api/staff/staff";
|
||||
|
||||
|
||||
export default {
|
||||
dicts: ['ywqx','write_off','special_prem','display','zhzt','transaction','time_frame','handover','handover_quit',
|
||||
'jbjl','official','notice','special_prem','role'],
|
||||
data() {
|
||||
return {
|
||||
// 表单参数
|
||||
form: {
|
||||
id:'', category:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:'', auditedStatus:'',
|
||||
auditedTime:'', description:'', isRefuel:'yc', handoverMode:'dqmdtyjb', handoverPrem:'yqx', handoverOut:'jbtc', record:'qbjl',
|
||||
merchantStatus:'qy',screen:'qy', posPrem:'', appletPrem:'', notice:'advice_jy', oilGunId:'', timeFrame:'bx', refund:'yqx',
|
||||
transaction:'qbjy', writeOff:'',specialPrem:'', official:'', status:'qy',pos:'jy',role:''
|
||||
},
|
||||
// 表单名称
|
||||
title:'',
|
||||
tankList: [], // 油罐列表
|
||||
tankForm: {
|
||||
id: null,
|
||||
tankName: '',
|
||||
oilNumber: '',
|
||||
tankVolume: null,
|
||||
lowerWarning: null,
|
||||
oilDensity: null,
|
||||
storedQuantity: null,
|
||||
totalPrice: null,
|
||||
discountedPrice: null,
|
||||
status: '',
|
||||
remarks: '',
|
||||
storeId: null,
|
||||
numberId: null,
|
||||
createTime: null,
|
||||
updateTime: null,
|
||||
createBy: '',
|
||||
updateBy: '',
|
||||
},
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
tankName: '',
|
||||
page:null,
|
||||
pageSize:null
|
||||
},
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
// 默认排序
|
||||
defaultSort: {prop: 'createTime', order: 'descending'},
|
||||
// 表单校验
|
||||
rules: {
|
||||
realName: [
|
||||
{ required: true, message: "姓名不能为空", trigger: "blur" },
|
||||
{ min: 2, max: 30, message: '姓名长度必须介于 2 和 20 之间', trigger: 'blur' }
|
||||
],
|
||||
mobile: [
|
||||
{ required: true, message: "手机号不能为空", trigger: "blur" },
|
||||
{ min: 11, max: 20, message: '手机号长度必须11', trigger: 'blur' }
|
||||
],
|
||||
role: [
|
||||
{ required: true, message: "请选择员工角色", trigger: "blur" }
|
||||
],
|
||||
isRefuel: [
|
||||
{ required: true, message: "请选择加油状态", trigger: "blur" }
|
||||
],
|
||||
pos: [
|
||||
{ required: true, message: "请选择员状态", trigger: "blur" }
|
||||
],
|
||||
transaction: [
|
||||
{ required: true, message: "请选择", trigger: "blur" }
|
||||
],
|
||||
notice: [
|
||||
{ required: true, message: "请选择", trigger: "blur" }
|
||||
],
|
||||
timeFrame: [
|
||||
{ required: true, message: "请选择", trigger: "blur" }
|
||||
],
|
||||
handoverMode: [
|
||||
{ required: true, message: "请选择", trigger: "blur" }
|
||||
],
|
||||
handoverPrem: [
|
||||
{ required: true, message: "请选择", trigger: "blur" }
|
||||
],
|
||||
handoverOut: [
|
||||
{ required: true, message: "请选择", trigger: "blur" }
|
||||
],
|
||||
record: [
|
||||
{ required: true, message: "请选择", trigger: "blur" }
|
||||
],
|
||||
merchantStatus: [
|
||||
{ required: true, message: "请选择", trigger: "blur" }
|
||||
],
|
||||
screen: [
|
||||
{ required: true, message: "请选择", trigger: "blur" }
|
||||
],
|
||||
|
||||
|
||||
|
||||
|
||||
tankName: [],
|
||||
oilNumber: [],
|
||||
tankVolume: [],
|
||||
lowerWarning: [],
|
||||
oilDensity: [],
|
||||
storedQuantity: [],
|
||||
totalPrice: [],
|
||||
discountedPrice: [],
|
||||
status: []
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
let this_ = this
|
||||
await this_.getList()
|
||||
},
|
||||
methods: {
|
||||
|
||||
getList() {
|
||||
this.loading = true;
|
||||
getTankApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.tankList = response.data.records;
|
||||
this.total = response.data.total;
|
||||
// response.data.records.forEach(item=>{
|
||||
// this.categoryOptions.push(item.category)
|
||||
})
|
||||
this.loading = false;
|
||||
},
|
||||
|
||||
// 提交按钮
|
||||
submitForm: function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (!this.form.id) {
|
||||
this.form.posPrem = JSON.stringify(this.form.posPrem);
|
||||
this.form.appletPrem = JSON.stringify(this.form.appletPrem);
|
||||
addStaff(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
updateStaff(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 搜索按钮操作
|
||||
handleQuery() {
|
||||
this.queryParams.page = 1;
|
||||
this.getList();
|
||||
},
|
||||
// 新增油罐
|
||||
tankAdd() {
|
||||
// 表单重置
|
||||
let this_ = this
|
||||
this_.tankList = {}
|
||||
this_.open = true;
|
||||
this_.title = "新增员工";
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.app-container{
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
background: #f6f8f9;
|
||||
}
|
||||
</style>
|
@ -45,7 +45,7 @@ public class OilPresetPricesController 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 = "1000") Integer pageSize,
|
||||
OilPresetPrices oilPresetPrices) {
|
||||
Page page =new Page(pageNo,pageSize);
|
||||
IPage<OilPresetPrices> list = oilPresetPricesService.selectOilPresetPricesList(page,oilPresetPrices);
|
||||
@ -102,5 +102,18 @@ public class OilPresetPricesController extends BaseController {
|
||||
public ResponseObject editStart(Long id){
|
||||
return getSuccessResult(oilPresetPricesService.editStart(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 停用定时任务
|
||||
*/
|
||||
@PostMapping("stopJob")
|
||||
public ResponseObject stopJob(@RequestBody OilPresetPrices presetPrices){
|
||||
int i = oilPresetPricesService.stopJob(presetPrices);
|
||||
if (i<=0) {
|
||||
return getFailureResult("停止失败");
|
||||
}
|
||||
return getSuccessResult("停止成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,94 @@
|
||||
package com.fuint.business.petrolStationManagement.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPresetPrices;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
||||
import com.fuint.business.petrolStationManagement.service.OilTankService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* (OilTank)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-16 15:15:06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("business/petrolStationManagement/oilTank")
|
||||
public class OilTankController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private OilTankService oilTankService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param oilTank 筛选条件
|
||||
* @param 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("queryByPage")
|
||||
public ResponseObject queryByPage(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "1000") Integer pageSize,
|
||||
@Param("oilTank") OilTank oilTank) {
|
||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page page =new Page(pageNo,pageSize);
|
||||
IPage<OilTank> oilTanks = this.oilTankService.queryByPage(page, oilTank);
|
||||
return getSuccessResult(oilTanks);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseObject queryById(@PathVariable("id") Integer id) {
|
||||
return getSuccessResult(this.oilTankService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param oilTank 实体
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject add(OilTank oilTank) {
|
||||
return getSuccessResult(this.oilTankService.insert(oilTank));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param oilTank 实体
|
||||
* @return 编辑结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject edit(OilTank oilTank) {
|
||||
return getSuccessResult(this.oilTankService.update(oilTank));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseObject deleteById(Integer id) {
|
||||
return getSuccessResult(this.oilTankService.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ import java.util.Date;
|
||||
@Data
|
||||
public class OilPresetPrices extends BaseEntity {
|
||||
|
||||
@TableId(value = "number_id", type = IdType.AUTO)
|
||||
private Long presetId; // id(主键)
|
||||
@TableId(value = "presetId", type = IdType.AUTO)
|
||||
private Integer presetId; // id(主键)
|
||||
private Long oilType; // 预设油号 id
|
||||
private Double currentPetrolPrices; // 当前油站价
|
||||
private Double presetOilPrices; // 预设油站价
|
||||
@ -27,10 +27,11 @@ public class OilPresetPrices extends BaseEntity {
|
||||
private Double presetGbPrice; // 预设国标价
|
||||
private String effectiveTime; // 生效时间(时间戳)
|
||||
private Integer ifDelete; // 是否删除(0未删除|1删除)
|
||||
private Integer state; // 状态
|
||||
private String state; // 状态
|
||||
private Integer numberId; // 状态
|
||||
private Integer storeId; // 关联的店铺id
|
||||
|
||||
private Long jobId; // 定时任务id
|
||||
|
||||
|
||||
// /**
|
||||
|
@ -0,0 +1,90 @@
|
||||
package com.fuint.business.petrolStationManagement.entity;
|
||||
|
||||
import com.fuint.repository.model.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* (OilTank)实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-16 15:15:18
|
||||
*/
|
||||
@Data
|
||||
public class OilTank extends BaseEntity {
|
||||
private static final long serialVersionUID = 248745823149959397L;
|
||||
/**
|
||||
* 油罐ID
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 油罐名称
|
||||
*/
|
||||
private String tankName;
|
||||
/**
|
||||
* 油品号
|
||||
*/
|
||||
private String oilNumber;
|
||||
/**
|
||||
* 油罐体积
|
||||
*/
|
||||
private Double tankVolume;
|
||||
/**
|
||||
* 下限预警
|
||||
*/
|
||||
private Double lowerWarning;
|
||||
/**
|
||||
* 油品密度
|
||||
*/
|
||||
private Double oilDensity;
|
||||
/**
|
||||
* 存油数量
|
||||
*/
|
||||
private Double storedQuantity;
|
||||
/**
|
||||
* 存油总价
|
||||
*/
|
||||
private Double totalPrice;
|
||||
/**
|
||||
* 折后单价
|
||||
*/
|
||||
private Double discountedPrice;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
private String remarks;
|
||||
/**
|
||||
* 店铺ID
|
||||
*/
|
||||
private Integer storeId;
|
||||
/**
|
||||
* 关联油号表ID
|
||||
*/
|
||||
private Integer numberId;
|
||||
// /**
|
||||
// * 创建时间
|
||||
// */
|
||||
// private Date createTime;
|
||||
// /**
|
||||
// * 更新时间
|
||||
// */
|
||||
// private Date updateTime;
|
||||
// /**
|
||||
// * 创建人
|
||||
// */
|
||||
// private Integer createBy;
|
||||
// /**
|
||||
// * 更新人
|
||||
// */
|
||||
// private Integer updateBy;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -46,6 +46,13 @@ public interface OilPresetPricesMapper extends BaseMapper<OilPresetPrices> {
|
||||
*/
|
||||
public int updateOilPresetPrices(OilPresetPrices presetPrices);
|
||||
|
||||
public int editStart(Integer id, Integer state);
|
||||
public int editStart(@Param("id") Integer id,@Param("state") String state);
|
||||
|
||||
/**
|
||||
* 修改定时任务id
|
||||
* @param presetPrices
|
||||
* @return
|
||||
*/
|
||||
public int updateJobId(OilPresetPrices presetPrices);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,86 @@
|
||||
package com.fuint.business.petrolStationManagement.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPresetPrices;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (OilTank)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-16 15:15:06
|
||||
*/
|
||||
public interface OilTankMapper {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
OilTank queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询指定行数据
|
||||
*
|
||||
* @param oilTank 查询条件
|
||||
* @param pageable 分页对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
IPage<OilTank> queryAllByLimit(@Param("page")Page page,@Param("oilTank") OilTank oilTank);
|
||||
|
||||
/**
|
||||
* 统计总行数
|
||||
*
|
||||
* @param oilTank 查询条件
|
||||
* @return 总行数
|
||||
*/
|
||||
long count(OilTank oilTank);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param oilTank 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(OilTank oilTank);
|
||||
|
||||
/**
|
||||
* 批量新增数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<OilTank> 实例对象列表
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insertBatch(@Param("entities") List<OilTank> entities);
|
||||
|
||||
/**
|
||||
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
|
||||
*
|
||||
* @param entities List<OilTank> 实例对象列表
|
||||
* @return 影响行数
|
||||
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
|
||||
*/
|
||||
int insertOrUpdateBatch(@Param("entities") List<OilTank> entities);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param oilTank 实例对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int update(OilTank oilTank);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 影响行数
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
}
|
||||
|
@ -13,12 +13,17 @@
|
||||
SELECT
|
||||
NA.id AS id,
|
||||
NA.oil_name AS oilName,
|
||||
dict.dict_label AS oilType
|
||||
NA.oil_type 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>
|
||||
|
||||
<!-- 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;-->
|
||||
</mapper>
|
@ -16,11 +16,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="effectiveTime" column="effective_time"/>
|
||||
<result property="ifDelete" column="if_delete"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="numberId" column="number_id"/>
|
||||
<result property="jobId" column="job_id"/>
|
||||
|
||||
</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, state
|
||||
preset_gb_price, create_time, update_time, effective_time, if_delete, state,number_id,job_id
|
||||
from oil_preset_prices
|
||||
</sql>
|
||||
|
||||
@ -29,15 +31,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectOilPresetPricesList"
|
||||
resultType="com.fuint.business.petrolStationManagement.entity.OilPresetPrices">
|
||||
<include refid="selectOilPresetPrices"></include>
|
||||
|
||||
</select>
|
||||
<!-- older by preset_id desc-->
|
||||
|
||||
<select id="selectOilPresetPricesById"
|
||||
resultType="com.fuint.business.petrolStationManagement.entity.OilPresetPrices">
|
||||
<include refid="selectOilPresetPrices"></include>
|
||||
where presetId = #{preset_id}
|
||||
where preset_id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertOilPresetPrices">
|
||||
<insert id="insertOilPresetPrices" useGeneratedKeys="true" keyProperty="presetId">
|
||||
insert into oil_preset_prices
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test=" oilType != null">oil_type,</if>
|
||||
@ -50,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test=" effectiveTime != null">effective_time,</if>
|
||||
<if test=" ifDelete != null">if_delete,</if>
|
||||
<if test=" state != null">state,</if>
|
||||
<if test=" numberId != null">number_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test=" oilType != null">#{oilType},</if>
|
||||
@ -62,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test=" effectiveTime != null">#{effectiveTime},</if>
|
||||
<if test=" ifDelete != null">#{ifDelete},</if>
|
||||
<if test=" state != null">#{state},</if>
|
||||
<if test=" numberId != null">#{numberId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateOilPresetPrices">
|
||||
@ -78,15 +83,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test=" ifDelete != null"> effective_time = #{ifDelete},</if>
|
||||
<if test=" state != null"> effective_time = #{ifDelete},</if>
|
||||
</set>
|
||||
where number_id = #{numberId}
|
||||
where preset_id = #{presetId}
|
||||
</update>
|
||||
<delete id="deleteOilPresetPricesById">
|
||||
delete from oil_preset_prices where preset_id = #{id}
|
||||
</delete>
|
||||
|
||||
<update id="editStart">
|
||||
update oil_preset_prices state = #{oilType} where number_id = #{numberId}
|
||||
update oil_preset_prices set state = #{state} where preset_id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateJobId">
|
||||
update oil_preset_prices set job_id = #{jobId} where preset_id = #{presetId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,254 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuint.business.petrolStationManagement.mapper.OilTankMapper">
|
||||
|
||||
<resultMap type="com.fuint.business.petrolStationManagement.entity.OilTank" id="OilTankMap">
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="tankName" column="tank_name" jdbcType="VARCHAR"/>
|
||||
<result property="oilNumber" column="oil_number" jdbcType="VARCHAR"/>
|
||||
<result property="tankVolume" column="tank_volume" jdbcType="NUMERIC"/>
|
||||
<result property="lowerWarning" column="lower_warning" jdbcType="NUMERIC"/>
|
||||
<result property="oilDensity" column="oil_density" jdbcType="NUMERIC"/>
|
||||
<result property="storedQuantity" column="stored_quantity" jdbcType="NUMERIC"/>
|
||||
<result property="totalPrice" column="total_price" jdbcType="NUMERIC"/>
|
||||
<result property="discountedPrice" column="discounted_price" jdbcType="NUMERIC"/>
|
||||
<result property="status" column="status" jdbcType="VARCHAR"/>
|
||||
<result property="remarks" column="remarks" jdbcType="VARCHAR"/>
|
||||
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
||||
<result property="numberId" column="number_id" jdbcType="INTEGER"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createBy" column="create_by" jdbcType="INTEGER"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="OilTankMap">
|
||||
select
|
||||
id, tank_name, oil_number, tank_volume, lower_warning, oil_density, stored_quantity, total_price, discounted_price, status, remarks, store_id, number_id, create_time, update_time, create_by, update_by
|
||||
from oil_tank
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="OilTankMap">
|
||||
select
|
||||
id, tank_name, oil_number, tank_volume, lower_warning, oil_density, stored_quantity, total_price, discounted_price, status, remarks, store_id, number_id, create_time, update_time, create_by, update_by
|
||||
from oil_tank
|
||||
<where>
|
||||
<if test="oilTank.id != null">
|
||||
and id = #{oilTank.id}
|
||||
</if>
|
||||
<if test="oilTank.tankName != null and oilTank.tankName != ''">
|
||||
and tank_name = #{oilTank.tankName}
|
||||
</if>
|
||||
<if test="oilTank.oilNumber != null and oilTank.oilNumber != ''">
|
||||
and oil_number = #{oilTank.oilNumber}
|
||||
</if>
|
||||
<if test="oilTank.tankVolume != null">
|
||||
and tank_volume = #{oilTank.tankVolume}
|
||||
</if>
|
||||
<if test="oilTank.lowerWarning != null">
|
||||
and lower_warning = #{oilTank.lowerWarning}
|
||||
</if>
|
||||
<if test="oilTank.oilDensity != null">
|
||||
and oil_density = #{oilTank.oilDensity}
|
||||
</if>
|
||||
<if test="oilTank.storedQuantity != null">
|
||||
and stored_quantity = #{oilTank.storedQuantity}
|
||||
</if>
|
||||
<if test="oilTank.totalPrice != null">
|
||||
and total_price = #{oilTank.otalPrice}
|
||||
</if>
|
||||
<if test="oilTank.discountedPrice != null">
|
||||
and discounted_price = #{oilTank.discountedPrice}
|
||||
</if>
|
||||
<if test="oilTank.status != null and oilTank.status != ''">
|
||||
and status = #{oilTank.status}
|
||||
</if>
|
||||
<if test="oilTank.remarks != null and oilTank.remarks != ''">
|
||||
and remarks = #{oilTank.remarks}
|
||||
</if>
|
||||
<if test="oilTank.storeId != null">
|
||||
and store_id = #{oilTank.storeId}
|
||||
</if>
|
||||
<if test="oilTank.numberId != null">
|
||||
and number_id = #{oilTank.numberId}
|
||||
</if>
|
||||
<if test="oilTank.createTime != null">
|
||||
and create_time = #{oilTank.createTime}
|
||||
</if>
|
||||
<if test="oilTank.updateTime != null">
|
||||
and update_time = #{oilTank.updateTime}
|
||||
</if>
|
||||
<if test="oilTank.createBy != null">
|
||||
and create_by = #{oilTank.createBy}
|
||||
</if>
|
||||
<if test="oilTank.updateBy != null">
|
||||
and update_by = #{oilTank.updateBy}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<!-- -- limit #{pageable.offset}, #{pageable.pageSize}-->
|
||||
<!---->
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from oil_tank
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="tankName != null and tankName != ''">
|
||||
and tank_name = #{tankName}
|
||||
</if>
|
||||
<if test="oilNumber != null and oilNumber != ''">
|
||||
and oil_number = #{oilNumber}
|
||||
</if>
|
||||
<if test="tankVolume != null">
|
||||
and tank_volume = #{tankVolume}
|
||||
</if>
|
||||
<if test="lowerWarning != null">
|
||||
and lower_warning = #{lowerWarning}
|
||||
</if>
|
||||
<if test="oilDensity != null">
|
||||
and oil_density = #{oilDensity}
|
||||
</if>
|
||||
<if test="storedQuantity != null">
|
||||
and stored_quantity = #{storedQuantity}
|
||||
</if>
|
||||
<if test="totalPrice != null">
|
||||
and total_price = #{totalPrice}
|
||||
</if>
|
||||
<if test="discountedPrice != null">
|
||||
and discounted_price = #{discountedPrice}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="remarks != null and remarks != ''">
|
||||
and remarks = #{remarks}
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
and store_id = #{storeId}
|
||||
</if>
|
||||
<if test="numberId != null">
|
||||
and number_id = #{numberId}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into oil_tank(tank_name, oil_number, tank_volume, lower_warning, oil_density, stored_quantity, total_price, discounted_price, status, remarks, store_id, number_id, create_time, update_time, create_by, update_by)
|
||||
values (#{tankName}, #{oilNumber}, #{tankVolume}, #{lowerWarning}, #{oilDensity}, #{storedQuantity}, #{totalPrice}, #{discountedPrice}, #{status}, #{remarks}, #{storeId}, #{numberId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into oil_tank(tank_name, oil_number, tank_volume, lower_warning, oil_density, stored_quantity, total_price, discounted_price, status, remarks, store_id, number_id, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.tankName}, #{entity.oilNumber}, #{entity.tankVolume}, #{entity.lowerWarning}, #{entity.oilDensity}, #{entity.storedQuantity}, #{entity.totalPrice}, #{entity.discountedPrice}, #{entity.status}, #{entity.remarks}, #{entity.storeId}, #{entity.numberId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into oil_tank(tank_name, oil_number, tank_volume, lower_warning, oil_density, stored_quantity, total_price, discounted_price, status, remarks, store_id, number_id, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.tankName}, #{entity.oilNumber}, #{entity.tankVolume}, #{entity.lowerWarning}, #{entity.oilDensity}, #{entity.storedQuantity}, #{entity.totalPrice}, #{entity.discountedPrice}, #{entity.status}, #{entity.remarks}, #{entity.storeId}, #{entity.numberId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
tank_name = values(tank_name),
|
||||
oil_number = values(oil_number),
|
||||
tank_volume = values(tank_volume),
|
||||
lower_warning = values(lower_warning),
|
||||
oil_density = values(oil_density),
|
||||
stored_quantity = values(stored_quantity),
|
||||
total_price = values(total_price),
|
||||
discounted_price = values(discounted_price),
|
||||
status = values(status),
|
||||
remarks = values(remarks),
|
||||
store_id = values(store_id),
|
||||
number_id = values(number_id),
|
||||
create_time = values(create_time),
|
||||
update_time = values(update_time),
|
||||
create_by = values(create_by),
|
||||
update_by = values(update_by)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update oil_tank
|
||||
<set>
|
||||
<if test="tankName != null and tankName != ''">
|
||||
tank_name = #{tankName},
|
||||
</if>
|
||||
<if test="oilNumber != null and oilNumber != ''">
|
||||
oil_number = #{oilNumber},
|
||||
</if>
|
||||
<if test="tankVolume != null">
|
||||
tank_volume = #{tankVolume},
|
||||
</if>
|
||||
<if test="lowerWarning != null">
|
||||
lower_warning = #{lowerWarning},
|
||||
</if>
|
||||
<if test="oilDensity != null">
|
||||
oil_density = #{oilDensity},
|
||||
</if>
|
||||
<if test="storedQuantity != null">
|
||||
stored_quantity = #{storedQuantity},
|
||||
</if>
|
||||
<if test="totalPrice != null">
|
||||
total_price = #{totalPrice},
|
||||
</if>
|
||||
<if test="discountedPrice != null">
|
||||
discounted_price = #{discountedPrice},
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="remarks != null and remarks != ''">
|
||||
remarks = #{remarks},
|
||||
</if>
|
||||
<if test="storeId != null">
|
||||
store_id = #{storeId},
|
||||
</if>
|
||||
<if test="numberId != null">
|
||||
number_id = #{numberId},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from oil_tank where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
@ -53,5 +53,7 @@ public interface OilPresetPricesService extends IService<OilPresetPrices> {
|
||||
* 定时器设置(定时调整油价)
|
||||
*/
|
||||
public void timingAdjustment(Integer id);
|
||||
|
||||
public int stopJob(OilPresetPrices presetPrices);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,61 @@
|
||||
package com.fuint.business.petrolStationManagement.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPresetPrices;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
/**
|
||||
* (OilTank)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-16 15:15:25
|
||||
*/
|
||||
public interface OilTankService {
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
OilTank queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param oilTank 筛选条件
|
||||
* @param 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
IPage<OilTank> queryByPage(@Param("page") Page page,@Param("oilTank") OilTank oilTank);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param oilTank 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
OilTank insert(OilTank oilTank);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param oilTank 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
OilTank update(OilTank oilTank);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteById(Integer id);
|
||||
|
||||
}
|
@ -8,17 +8,17 @@ 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.common.util.StringUtils;
|
||||
import com.fuint.quartz.domain.SysJob;
|
||||
import com.fuint.quartz.service.ISysJobService;
|
||||
import com.fuint.quartz.util.BeanUtils;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.Instant;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* (ChainStoreInfo)表服务实现类
|
||||
@ -55,33 +55,67 @@ public class OilPresetPricesServiceImpl extends ServiceImpl<OilPresetPricesMappe
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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);
|
||||
presetPrices.setState("wait");
|
||||
baseMapper.insertOilPresetPrices(presetPrices);
|
||||
|
||||
//
|
||||
// SysJob sysJob = new SysJob();
|
||||
// sysJob.setJobGroup("1111");
|
||||
// sysJob.setJobGroup("1111");
|
||||
// sysJob.setInvokeTarget("1111");
|
||||
// sysJob.setConcurrent("1");
|
||||
// sysJob.setCronExpression("1111");
|
||||
//
|
||||
// try {
|
||||
// iSysJobService.insertJob(sysJob);
|
||||
// } catch (SchedulerException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (TaskException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
// System.out.println("nowAccountInfo"+nowAccountInfo);
|
||||
String coreTime = changeCore(presetPrices.getEffectiveTime());
|
||||
// 创建定时任务
|
||||
SysJob sysJob = new SysJob();
|
||||
|
||||
sysJob.setJobName("系统默认(有参)");
|
||||
sysJob.setJobGroup("DEFAULT");
|
||||
sysJob.setInvokeTarget("presetPrices.ryParams('"+presetPrices.getPresetId()+"')");
|
||||
sysJob.setCronExpression(coreTime);
|
||||
sysJob.setMisfirePolicy("3");
|
||||
sysJob.setStatus("0");
|
||||
|
||||
try {
|
||||
iSysJobService.insertJob(sysJob);
|
||||
iSysJobService.resumeJob(sysJob);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
|
||||
presetPrices.setJobId(sysJob.getJobId());
|
||||
return baseMapper.updateJobId(presetPrices);
|
||||
}
|
||||
|
||||
|
||||
// Instant instant = Instant.parse(presetPrices.getEffectiveTime());
|
||||
// Long timestamp = instant.toEpochMilli();
|
||||
// presetPrices.setEffectiveTime(timestamp.toString());
|
||||
return baseMapper.insertOilPresetPrices(presetPrices);
|
||||
private String changeCore(String dateTimeString) {
|
||||
String inputPattern = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
SimpleDateFormat inputFormat = new SimpleDateFormat(inputPattern);
|
||||
|
||||
try {
|
||||
Date date = inputFormat.parse(dateTimeString);
|
||||
|
||||
// 获取日期时间的各个组件
|
||||
SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy");
|
||||
SimpleDateFormat secondFormat = new SimpleDateFormat("ss");
|
||||
SimpleDateFormat minuteFormat = new SimpleDateFormat("mm");
|
||||
SimpleDateFormat hourFormat = new SimpleDateFormat("HH");
|
||||
SimpleDateFormat dayFormat = new SimpleDateFormat("dd");
|
||||
SimpleDateFormat monthFormat = new SimpleDateFormat("MM");
|
||||
|
||||
String seconds = secondFormat.format(date);
|
||||
String minutes = minuteFormat.format(date);
|
||||
String hours = hourFormat.format(date);
|
||||
String dayOfMonth = dayFormat.format(date);
|
||||
String month = monthFormat.format(date);
|
||||
String year = yearFormat.format(date);
|
||||
|
||||
// 构建 Cron 表达式
|
||||
String cronExpression = seconds + " " + minutes + " " + hours + " " + dayOfMonth + " " + month + " ? " +year;
|
||||
|
||||
System.out.println("转换后的 Cron 表达式: " + cronExpression);
|
||||
return cronExpression;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -104,17 +138,33 @@ public class OilPresetPricesServiceImpl extends ServiceImpl<OilPresetPricesMappe
|
||||
@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);
|
||||
System.out.println("aaaaaaaaa"+id);
|
||||
// // 通过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, "occur");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int stopJob(OilPresetPrices presetPrices) {
|
||||
int ret = 0;
|
||||
baseMapper.editStart(presetPrices.getPresetId(), "lose");
|
||||
if (presetPrices.getJobId() == null) return 0;
|
||||
try {
|
||||
SysJob sysJob = iSysJobService.selectJobById(presetPrices.getJobId());
|
||||
ret = iSysJobService.pauseJob(sysJob);
|
||||
} catch (SchedulerException e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,84 @@
|
||||
package com.fuint.business.petrolStationManagement.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
||||
import com.fuint.business.petrolStationManagement.mapper.OilTankMapper;
|
||||
import com.fuint.business.petrolStationManagement.service.OilTankService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* (OilTank)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-10-16 15:15:25
|
||||
*/
|
||||
@Service("oilTankService")
|
||||
public class OilTankServiceImpl implements OilTankService {
|
||||
@Resource
|
||||
private OilTankMapper oilTankDao;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public OilTank queryById(Integer id) {
|
||||
return this.oilTankDao.queryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param oilTank 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
@Override
|
||||
public IPage<OilTank> queryByPage(@Param("page") Page page,@Param("oilTank") OilTank oilTank) {
|
||||
// long total = this.oilTankDao.count(oilTank);
|
||||
// return new PageImpl<>(this.oilTankDao.queryAllByLimit(oilTank, pageRequest), pageRequest, total);
|
||||
return oilTankDao.queryAllByLimit(page, oilTank);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param oilTank 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public OilTank insert(OilTank oilTank) {
|
||||
this.oilTankDao.insert(oilTank);
|
||||
return oilTank;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param oilTank 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public OilTank update(OilTank oilTank) {
|
||||
this.oilTankDao.update(oilTank);
|
||||
return this.queryById(oilTank.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
return this.oilTankDao.deleteById(id) > 0;
|
||||
}
|
||||
}
|
@ -1,24 +1,29 @@
|
||||
package com.fuint.business.petrolStationManagement.task;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.fuint.business.petrolStationManagement.service.OilPresetPricesService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 定时任务调度测试
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component("presetPrices")
|
||||
public class 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));
|
||||
// }
|
||||
@Resource
|
||||
private OilPresetPricesService oilPresetPricesService;
|
||||
|
||||
public void ryParams(String params)
|
||||
{
|
||||
System.out.println("执行有参方法:" + params);
|
||||
System.out.println("定时任务11111111:" + params);
|
||||
|
||||
oilPresetPricesService.timingAdjustment(Integer.parseInt(params));
|
||||
}
|
||||
|
||||
// public void ryNoParams()
|
||||
|
Loading…
Reference in New Issue
Block a user