进油 盘点

This commit is contained in:
DESKTOP-369JRHT\12997 2023-10-23 15:03:04 +08:00
parent 3fd0db5a0d
commit 69feab70bc
19 changed files with 507 additions and 181 deletions

View File

@ -5,7 +5,16 @@ import request from "@/utils/request";
// 查询油罐列表
export function getInventoryApi(data) {
return request({
url: '/business/petrolStationManagement/oilInventory/getList',
url: '/business/petrolStationManagement/oilInventory/getListPage',
method: 'get',
params: data
})
}
// 根据id查询信息
export function getInventoryByIdApi(data) {
return request({
url: '/business/petrolStationManagement/oilInventory/data',
method: 'get',
params: data
})
@ -83,3 +92,20 @@ export function selectList2Api(data) {
})
}
// 删除有关信息
export function delInventoryOrderApi(data) {
return request({
url: 'business/petrolStationManagement/oilInventoryOrder',
method: 'delete',
params: data
})
}
// 批量处理数据
export function disposeBatchApi(data) {
return request({
url: 'business/petrolStationManagement/oilInventoryOrder/disposeBatch',
method: 'post',
data: data
})
}

View File

@ -59,14 +59,14 @@
<el-table ref="tables"
v-loading="loading"
:data="purchaseList"
:data="inventoryList"
:default-sort="defaultSort">
<el-table-column label="业务单号" align="center" prop="purchaseNo"/>
<el-table-column label="单据详情" align="center">
<el-table-column label="供应商" align="center" prop="supplierss"/>
<el-table-column label="油品" align="center" prop="oils"/>
<el-table-column label="入库油罐" align="center" prop="tanks"/>
<el-table-column label="单据金额" align="center" prop="theDocumentAmount"/>
<el-table-column label="盘点详情" align="center">
<el-table-column label="盘点油罐" align="center" prop="supplierss"/>
<el-table-column label="盘点升数" align="center" prop="oils"/>
<el-table-column label="库存差异升数" align="center" prop="tanks"/>
<el-table-column label="盈亏金额" align="center" prop="theDocumentAmount"/>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
@ -78,7 +78,7 @@
</div>
</template>
</el-table-column>
<el-table-column label="操作人" align="center">
<el-table-column label="操作人信息" align="center">
<el-table-column label="制单人" align="center" prop="creatorName"/>
<el-table-column label="审核人" align="center" prop="reviewerName"/>
</el-table-column>
@ -122,6 +122,7 @@
<script>
import {getPurchaseApi, getPurchaseOrderApi} from "@/api/oilConfig/oilPurchase";
import {getSuppliersListApi2} from "@/api/oilConfig/oilSuppliers";
import {getInventoryApi} from "@/api/oilConfig/oilInventory";
export default {
name: "list",
@ -129,6 +130,12 @@ export default {
data() {
return {
inventoryList: [],
purchaseList: [],
suppliersList: [],
@ -166,19 +173,20 @@ export default {
async created() {
await this.getList();
this.selectSuppliers();
},
methods: {
//
getList(){
this.loading = true;
getPurchaseApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.purchaseList = response.data.records;
console.log("this.tankList",this.purchaseList)
getInventoryApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.inventoryList = response.data.records;
console.log("this.inventoryList",this.purchaseList)
this.total = response.data.total;
})
this.loading = false;
},
//
purchaseAdd() {
this.$router.push('/oilInventory/order');
@ -195,12 +203,6 @@ export default {
},
handleDel(data) {
},
//
selectSuppliers() {
getSuppliersListApi2().then(response => {
this.suppliersList = response.data;
});
},
//
handleQuery() {
this.queryParams.page = 1;

View File

@ -15,24 +15,26 @@
<span>油罐数量</span>
</div>
<div class="box">
<span>{{countLiters}}</span>
<span>{{inventoryVolume}}</span>
<span>盘点升数</span>
</div>
<div class="box">
<span>{{inventoryDiscrepancies}}</span>
<span>{{stockDifference}}</span>
<span>库存差异(L)</span>
</div>
<div class="box">
<span>{{totalProfitAndLoss}}</span>
<span>{{profitLossAmount}}</span>
<span>盈亏总额()</span>
</div>
</div>
<div style="height: 100%; width: 30%; display: flex; flex-direction: column; justify-content: space-between;">
<el-form ref="myForm" label-width="100px">
<el-form-item label="进货单号">
<el-input v-model="purchaseForm.purchaseNo" @change="saveJudgment"
<el-input v-model="inventoryNo.inventoryNo" @change="saveJudgment"
style="width: 220Px">
<el-button slot="append" @click="refresh()" icon="el-icon-refresh"></el-button>
</el-input>
@ -40,7 +42,7 @@
<el-form-item label="进货时间" >
<el-date-picker
style="width: 220Px"
v-model="purchaseForm.purchaseDate"
v-model="inventoryNo.inventoryDate"
@change="saveJudgment"
type="date"
placeholder="选择日期">
@ -50,7 +52,7 @@
</div>
</div>
<div style="height: 100%; width: 30%; display: flex; align-items: center; justify-content: flex-end;">
<el-button type="primary" :disabled="saveFlag" @click="savePurchase()">保存</el-button>
<el-button type="primary" :disabled="saveFlag" @click="saveInventory()">保存</el-button>
<el-button type="success" :disabled="auditFlag" >保存并审核</el-button>
<el-button type="warning" :disabled="voidFlag">作废</el-button>
</div>
@ -88,10 +90,10 @@
<el-table-column label="当前库存升数(L)" align="center" prop="currentInventoryVolume"/>
<el-table-column label="盘点升数(L)" align="center" prop="inventoryVolume">
<template slot-scope="scope">
<el-input-number v-model="scope.row.productDensity" @change="change(scope.row)" controls-position="right" :min="0.000001" :max="1000" :step="1" style="max-width: 100%"></el-input-number>
<el-input-number v-model="scope.row.inventoryVolume" @change="change(scope.row)" controls-position="right" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="库存差异升数(L)" align="center" prop="stockDifferenceVolume"/>
<el-table-column label="库存差异升数(L)" align="center" prop="stockDifference"/>
<el-table-column label="盈亏金额L" align="center" prop="profitLossAmount"/>
<el-table-column v-if="true" label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
@ -192,7 +194,7 @@ import {
updateInventoryOrderApi,
updateInventoryApi,
selectList2Api,
insertBatchInventoryOrderApi
insertBatchInventoryOrderApi, getInventoryByIdApi, disposeBatchApi, delInventoryOrderApi
} from "@/api/oilConfig/oilInventory";
import {getOilNameListApi} from "@/api/oilPrice";
import {selectTankByNumberApi} from "@/api/oilConfig/oilGuns";
@ -235,18 +237,24 @@ export default {
totalAmountPurchased: 0, //
//--------------------------------------------
numberOfTanks: 0, //
countLiters: 0, //
inventoryDiscrepancies: 0, //
totalProfitAndLoss: 0, //
inventoryVolume: 0, //
stockDifference: 0, //
profitLossAmount: 0,//
tankList:[], //
tankForm: {
numberId:'',
tankName:''
},
inventoryId:'', // id
selectOilTypeByPrice: [], //
multipleSelection: [],
@ -287,9 +295,10 @@ export default {
],
},
purchaseForm: {
purchaseNo: null,
purchaseDate: null
inventoryNo: {
inventoryNo: null,
inventoryDate: null
},
form: {
id: "", // ID
@ -310,7 +319,7 @@ export default {
async created() {
// console.log("yourParamKey",this.$route.query.purchaseId)
// this.queryParams.purchaseId = this.$route.query.purchaseId;
// this.purchaseId = this.$route.query.purchaseId;
// console.log("yourParamKey2",this.$route.query.purchaseId)
//
@ -318,12 +327,17 @@ export default {
// this.queryParams.purchaseId = -parseInt(new Date().getTime())% 100000000;
// this.purchaseId = -parseInt(new Date().getTime()) % 100000000;
// }
// this.purchaseForm.purchaseNo = this.$route.query.purchaseNo;
// this.inventoryNo.inventoryNo = this.$route.query.inventoryNo;
if (this.purchaseForm.purchaseNo == null) {
// this.queryParams.inventoryId = this.$route.query.inventoryId;
// this.inventoryId = this.$route.query.inventoryId;
if (this.inventoryNo.inventoryNo == null) {
this.refresh();
}
console.log("yourParamKey3",this.$route.query.purchaseId)
console.log("yourParamKey3",this.$route.query.inventoryId)
await this.getList();
@ -334,53 +348,125 @@ export default {
getInventoryOrderApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.orderList = response.data.records;
this.total = response.data.total;
this.numberOfTanks = response.data.total;
//
// this.sumMethod(response.data.records);
this.sumMethod(response.data.records);
})
this.loading = false;
},
getTankList() {
console.log("response");
// id
getInventoryById() {
let this_ = this
let data = 0;
getInventoryByIdApi(data).then(response=>{
this_.inventoryVolume= response.data.inventoryVolume,
this_.stockDifference= response.data.stockDifference,
this_.profitLossAmount= response.data.profitLossAmount
}).catch()
},
// header
sumMethod(data) {
console.log("sumMethod",data)
let this_ = this
this_.inventoryVolume = new BigNumber(0),
this_.stockDifference = new BigNumber(0),
this_.profitLossAmount = new BigNumber(0),
data.forEach(da => {
if (da.inventoryVolume != null) {
this_.inventoryVolume= this_.inventoryVolume.plus(da.inventoryVolume)
}
if (da.stockDifference != null) {
this_.stockDifference= this_.stockDifference.plus(da.stockDifference)
}
if (da.profitLossAmount != null) {
this_.profitLossAmount= this_.profitLossAmount.plus(da.profitLossAmount)
}
})
},
//
change(data) {
//
data.stockDifference = data.inventoryVolume - data.currentInventoryVolume
//
data.profitLossAmount = data.inventoryVolume * data.stockDifference
this.sumMethod(this.orderList)
//
// this.orderForm = data
// this.edit()
},
//
inquireTank() {
this.getTankList()/**/
},
//
chooseOilNumber(data) {
this.getTankList()
// this.selectTankByNumber(this.orderForm.numberId);
},
getTankList() {
selectList2Api(this.tankForm).then(response => {
console.log("response",response);
this.tankList = response.data
})
},
//
inquireTank() {
this.getTankList()/**/
},
//
orderAdd() {
// //
// this.orderForm = {}
//
this.open = true;
// this.title = ""
this.title = "选择油罐"
this.getOilNameList()
// this.selectSuppliers()
},
//
addOrder () {
console.log("ccccccccccccccccc",this.multipleSelection)
let oilInventoryOrder = []
let this_ = this
// let oilInventoryOrder = []
//
// this.multipleSelection.forEach(mul=>{
// let now = {
// tankId: mul.id,
// numberId: mul.numberId,
// currentAveragePrice: mul.discountedPrice,
// currentInventoryVolume: mul.storedQuantity
// }
// oilInventoryOrder.push(now)
// })
this.multipleSelection.forEach(mul=>{
let now = {
tankId: mul.id,
tankName: mul.tankName,
numberId: mul.numberId,
numberName: mul.oilNumber,
inventoryVolume:mul.storedQuantity,
currentAveragePrice: mul.discountedPrice,
currentInventoryVolume: mul.storedQuantity
}
oilInventoryOrder.push(now)
this_.orderList.push(now)
})
// this_.getList();
this_.open = false
this.numberOfTanks = this.numberOfTanks+1
insertBatchInventoryOrderApi(oilInventoryOrder).then(response => {
// console.log("response",response);
// this.tankList = response.data
})
// this_.orderList
// insertBatchInventoryOrderApi(oilInventoryOrder).then(response => {
// this_.$modal.msgSuccess("");
// this_.getList();
// this_.open = false
// }).catch(response=>{
//
// })
},
//
handleSelectionChange(val) {
@ -391,8 +477,16 @@ export default {
orderDel() {
orderDel(data) {
if (data.id != null) {
delInventoryOrderApi(data).then(res=>{
})
}
const index = this.orderList.indexOf(data); //
if (index !== -1) {
this.orderList.splice(index, 1); // 使splice
}
this.numberOfTanks = this.numberOfTanks-1
},
//
submitForm: function() {
@ -427,18 +521,7 @@ export default {
cancel() {
this.open = false;
},
//
change(data) {
// //
// data.purchaseVolume = ((data.purchaseWeight*(1000))/data.productDensity).toFixed(2);
// //
// data.totalAmount = data.purchasePrice * data.purchaseWeight
// //
// data.discountedPrice = (data.purchaseVolume / data.totalAmount).toFixed(2);
// //
// this.orderForm = data
// this.edit()
},
edit() {
// updatePurchaseOrderApi(this.orderForm).then(response => {
// // this.$modal.msgSuccess("");
@ -447,11 +530,7 @@ export default {
// this.getList();
// });
},
//
chooseOilNumber(data) {
this.getTankList()
// this.selectTankByNumber(this.orderForm.numberId);
},
//
chooseTank(data){
// // id
@ -490,62 +569,62 @@ export default {
var max = 999; // 9999
var randomFourDigitNumber = Math.floor(Math.random() * (max - min + 1)) + min;
// this.purchaseOrderNumber = timestamp+randomFourDigitNumber.toString();
this.purchaseForm.purchaseNo = timestamp+randomFourDigitNumber.toString();
},
//
sumMethod(data) {
this.purchasedTonnage= new BigNumber(0),
this.purchaseLiters= new BigNumber(0),
this.totalAmountPurchased= new BigNumber(0),
data.forEach(da => {
this.purchasedTonnage = this.purchasedTonnage.plus(da.purchaseWeight);
this.purchaseLiters = this.purchaseLiters.plus(da.purchaseVolume);
this.totalAmountPurchased = this.totalAmountPurchased.plus(da.totalAmount);
})
this.inventoryNo.inventoryNo = timestamp+randomFourDigitNumber.toString();
},
//
savePurchase(){
let from = {
purchaseNo : this.purchaseForm.purchaseNo,
purchaseDate : this.purchaseForm.purchaseDate,
theDocumentAmount : this.totalAmountPurchased,
saveInventory(){
let this_ = this
let inventoryForm = {
inventoryNumber : this_.inventoryNo.inventoryNo,
inventoryTime : this_.inventoryNo.inventoryDate,
inventoryVolume : this_.inventoryVolume,
stockDifference : this_.stockDifference,
profitLossAmount : this_.profitLossAmount
}
if (this.queryParams.purchaseId < 0) {
insertPurchaseApi(from).then(response => {
console.log("response",response)
this.$modal.msgSuccess("添加成功");
// id
let oilPurchase = {
purchaseId:response.data.id,
id:this.queryParams.purchaseId
}
console.log("oilPurchase",oilPurchase)
//todo
editPurchuseApi(oilPurchase).then(response => {
this.$router.push({ path: '/oilPurchase/purchaseOrder', query: { purchaseId: oilPurchase.purchaseId } });
//
let disList = {
oilInventoryOrderList: this_.orderList,
}
//
if (this_.inventoryId != null) {
//
inventoryForm.id = this_.inventoryId
updateInventoryApi(inventoryForm).then(response=>{
//
disList.inventoryId= this_.inventoryId
disposeBatchApi(disList).then(response=> {
//
this.$modal.msgSuccess("保存成功");
})
// this.getList();
});
})
} else {
from.id = this.queryParams.purchaseId
updatePurchaseApi(from).then(response => {
this.$modal.msgSuccess("添加成功");
//
insertInventoryApi(inventoryForm).then(response=>{
disList.inventoryId= response.data.id
disposeBatchApi(disList).then(response=> {
//
this.$modal.msgSuccess("保存成功");
})
//
this.$router.push({ path: '/oilInventory/order', query: { inventoryId: response.data.id } });
})
}
},
//
saveJudgment(){
if (this.purchaseForm.purchaseNo != null && this.purchaseForm.purchaseDate != null && this.orderList.length > 0) {
if (this.inventoryNo.inventoryNo != null && this.inventoryNo.inventoryDate != null && this.orderList.length > 0) {
this.saveFlag = false;
}
},
//
// savePurchase(){
// saveInventory(){
//
// },
// //
// savePurchase(){
// saveInventory(){
//
// },
//
@ -567,6 +646,11 @@ export default {
<style scoped>
.app-container{
width: 100%;
height: 100%;
background: #f6f8f9;
}
.box {
height: 100%;
width: 50%;

View File

@ -1,14 +1,13 @@
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.OilInventory;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.service.OilInventoryService;
import com.fuint.business.petrolStationManagement.vo.OilInventoryVO;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@ -40,11 +39,21 @@ public class OilInventoryController extends BaseController {
public ResponseObject queryByPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("oilInventory") OilInventory oilInventory) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page page =new com.baomidou.mybatisplus.extension.plugins.pagination.Page(pageNo,pageSize);
Page page =new Page(pageNo,pageSize);
IPage<OilInventory> oilInventoryIPage = this.oilInventoryService.queryByPage(page, oilInventory);
return getSuccessResult(oilInventoryIPage);
}
@GetMapping("getListPage")
public ResponseObject getListPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("oilInventory") OilInventory oilInventory) {
Page page =new Page(pageNo,pageSize);
IPage<OilInventoryVO> oilInventoryIPage = this.oilInventoryService.getListPage(page, oilInventory);
return getSuccessResult(oilInventoryIPage);
}
/**
* 通过主键查询单条数据
*

View File

@ -7,6 +7,7 @@ import com.fuint.business.petrolStationManagement.service.OilInventoryOrderServi
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@ -46,7 +47,7 @@ public class OilInventoryOrderController extends BaseController {
@GetMapping("getListPage")
public ResponseObject getListPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@RequestParam(value = "pageSize",defaultValue = "100000") Integer pageSize,
@Param("oilInventory") OilInventoryOrder oilInventory) {
Page page =new Page(pageNo,pageSize);
IPage<OilInventoryOrderVO> oilInventoryIPage = this.oilInventoryOrderService.getListPage(page, oilInventory);
@ -77,6 +78,16 @@ public class OilInventoryOrderController extends BaseController {
return getSuccessResult(this.oilInventoryOrderService.insert(oilInventoryOrder));
}
/**
* 批量处理数据
* @param oilInventoryOrderList
* @return
*/
@PostMapping("disposeBatch")
public ResponseObject disposeBatch(@RequestBody @Param("oilInventoryOrderList") List<OilInventoryOrder> oilInventoryOrderList,@Param("inventoryId") Integer inventoryId) {
return getSuccessResult(this.oilInventoryOrderService.disposeBatch(oilInventoryOrderList,inventoryId));
}
/**
* 批量新增数据
* @param oilInventoryOrder

View File

@ -42,11 +42,11 @@ public class OilInventory extends BaseEntity {
/**
* 盘点人
*/
private String inventoryPerson;
private String creator;
/**
* 审核人
*/
private String auditPerson;
private String reviewer;
/**
* 制单时间
*/

View File

@ -44,9 +44,9 @@ public class OilInventoryOrder extends BaseEntity {
*/
private Double inventoryVolume;
/**
* 库存差异升数L
* 库存差异升数
*/
private Double stockDifferenceVolume;
private Double stockDifference;
/**
* 盈亏金额
*/
@ -56,5 +56,10 @@ public class OilInventoryOrder extends BaseEntity {
*/
private Integer storeId;
/**
* 制单时间
*/
private Data inventoryTime;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilInventory;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.vo.OilInventoryVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
@ -33,6 +34,8 @@ public interface OilInventoryMapper {
*/
IPage<OilInventory> queryAllByLimit(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory);
IPage<OilInventoryVO> getListPage(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory);
/**
* 统计总行数
*

View File

@ -3,7 +3,9 @@ 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.OilInventoryOrder;
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -36,6 +38,8 @@ public interface OilInventoryOrderMapper {
IPage<OilInventoryOrderVO> getListPage(@Param("page") Page page, @Param("oilInventoryOrder") OilInventoryOrder oilInventoryOrder);
List<OilInventoryOrderVO> getAllList(OilInventoryOrder oilInventoryOrder);
/**
* 统计总行数
*

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -92,5 +93,11 @@ public interface OilPurchaseOrderMapper {
*/
int deleteById(Integer id);
/**
* 根据油罐查找对应的所有的订单已完成
*/
List<OilPurchaseOrder> getlistByTankId(Integer tankId);
}

View File

@ -9,8 +9,8 @@
<result property="inventoryVolume" column="inventory_volume" jdbcType="NUMERIC"/>
<result property="stockDifference" column="stock_difference" jdbcType="NUMERIC"/>
<result property="profitLossAmount" column="profit_loss_amount" jdbcType="NUMERIC"/>
<result property="inventoryPerson" column="inventory_person" jdbcType="VARCHAR"/>
<result property="auditPerson" column="audit_person" jdbcType="VARCHAR"/>
<result property="creator" column="creator" jdbcType="VARCHAR"/>
<result property="reviewer" column="reviewer" jdbcType="VARCHAR"/>
<result property="orderTime" column="order_time" jdbcType="TIMESTAMP"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
@ -23,7 +23,7 @@
<!--查询单个-->
<select id="queryById" resultMap="OilInventoryMap">
select
id, inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, inventory_person, audit_person, order_time, status, store_id, create_time, update_time, create_by, update_by
id, inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, creator, reviewer, order_time, status, store_id, create_time, update_time, create_by, update_by
from oil_inventory
where id = #{id}
</select>
@ -31,7 +31,7 @@
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="OilInventoryMap">
select
id, inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, inventory_person, audit_person, order_time, status, store_id, create_time, update_time, create_by, update_by
id, inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, creator, reviewer, order_time, status, store_id, create_time, update_time, create_by, update_by
from oil_inventory
<where>
<if test="id != null">
@ -52,11 +52,11 @@
<if test="profitLossAmount != null">
and profit_loss_amount = #{profitLossAmount}
</if>
<if test="inventoryPerson != null and inventoryPerson != ''">
and inventory_person = #{inventoryPerson}
<if test="creator != null and creator != ''">
and creator = #{creator}
</if>
<if test="auditPerson != null and auditPerson != ''">
and audit_person = #{auditPerson}
<if test="reviewer != null and reviewer != ''">
and reviewer = #{reviewer}
</if>
<if test="orderTime != null">
and order_time = #{orderTime}
@ -105,11 +105,11 @@
<if test="profitLossAmount != null">
and profit_loss_amount = #{profitLossAmount}
</if>
<if test="inventoryPerson != null and inventoryPerson != ''">
and inventory_person = #{inventoryPerson}
<if test="creator != null and creator != ''">
and creator = #{creator}
</if>
<if test="auditPerson != null and auditPerson != ''">
and audit_person = #{auditPerson}
<if test="reviewer != null and reviewer != ''">
and reviewer = #{reviewer}
</if>
<if test="orderTime != null">
and order_time = #{orderTime}
@ -134,26 +134,49 @@
</if>
</where>
</select>
<select id="getListPage" resultType="com.fuint.business.petrolStationManagement.vo.OilInventoryVO">
SELECT
op.id id,
op.STATUS STATUS,
op.inventory_number inventoryNumber,
op.inventory_time inventoryTime,
op.inventory_volume inventoryVolume,
op.stock_difference stockDifference,
op.profit_loss_amount profitLossAmount,
op.reviewer reviewer,
op.creator creator,
ms1.real_name creatorName,
ms2.real_name reviewerName
FROM
oil_inventory op
LEFT JOIN oil_inventory_order opo ON op.id = opo.inventory_id
LEFT JOIN oil_tank ot ON ot.id = opo.tank_id
LEFT JOIN mt_staff ms1 ON op.creator = ms1.id
LEFT JOIN mt_staff ms2 ON op.reviewer = ms2.id
GROUP BY
op.id
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, inventory_person, audit_person, order_time, status, store_id, create_time, update_time, create_by, update_by)
values (#{inventoryNumber}, #{inventoryTime}, #{inventoryVolume}, #{stockDifference}, #{profitLossAmount}, #{inventoryPerson}, #{auditPerson}, #{orderTime}, #{status}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, creator, reviewer, order_time, status, store_id, create_time, update_time, create_by, update_by)
values (#{inventoryNumber}, #{inventoryTime}, #{inventoryVolume}, #{stockDifference}, #{profitLossAmount}, #{creator}, #{reviewer}, #{orderTime}, #{status}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, inventory_person, audit_person, order_time, status, store_id, create_time, update_time, create_by, update_by)
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, creator, reviewer, order_time, status, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.inventoryNumber}, #{entity.inventoryTime}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.inventoryPerson}, #{entity.auditPerson}, #{entity.orderTime}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
(#{entity.inventoryNumber}, #{entity.inventoryTime}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.creator}, #{entity.reviewer}, #{entity.orderTime}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, inventory_person, audit_person, order_time, status, store_id, create_time, update_time, create_by, update_by)
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, creator, reviewer, order_time, status, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.inventoryNumber}, #{entity.inventoryTime}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.inventoryPerson}, #{entity.auditPerson}, #{entity.orderTime}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
(#{entity.inventoryNumber}, #{entity.inventoryTime}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.creator}, #{entity.reviewer}, #{entity.orderTime}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
on duplicate key update
inventory_number = values(inventory_number),
@ -161,8 +184,8 @@
inventory_volume = values(inventory_volume),
stock_difference = values(stock_difference),
profit_loss_amount = values(profit_loss_amount),
inventory_person = values(inventory_person),
audit_person = values(audit_person),
creator = values(creator),
reviewer = values(reviewer),
order_time = values(order_time),
status = values(status),
store_id = values(store_id),
@ -191,11 +214,11 @@
<if test="profitLossAmount != null">
profit_loss_amount = #{profitLossAmount},
</if>
<if test="inventoryPerson != null and inventoryPerson != ''">
inventory_person = #{inventoryPerson},
<if test="creator != null and creator != ''">
creator = #{creator},
</if>
<if test="auditPerson != null and auditPerson != ''">
audit_person = #{auditPerson},
<if test="reviewer != null and reviewer != ''">
reviewer = #{reviewer},
</if>
<if test="orderTime != null">
order_time = #{orderTime},

View File

@ -10,7 +10,7 @@
<result property="currentAveragePrice" column="current_average_price" jdbcType="NUMERIC"/>
<result property="currentInventoryVolume" column="current_inventory_volume" jdbcType="NUMERIC"/>
<result property="inventoryVolume" column="inventory_volume" jdbcType="NUMERIC"/>
<result property="stockDifferenceVolume" column="stock_difference_volume" jdbcType="NUMERIC"/>
<result property="stockDifference" column="stock_difference" jdbcType="NUMERIC"/>
<result property="profitLossAmount" column="profit_loss_amount" jdbcType="NUMERIC"/>
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
@ -22,7 +22,7 @@
<!--查询单个-->
<select id="queryById" resultMap="OilInventoryOrderMap">
select
id, inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference_volume, profit_loss_amount, store_id, create_time, update_time, create_by, update_by
id, inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference, profit_loss_amount, store_id, create_time, update_time, create_by, update_by
from oil_inventory_order
where id = #{id}
</select>
@ -30,7 +30,7 @@
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="OilInventoryOrderMap">
select
id, inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference_volume, profit_loss_amount, store_id, create_time, update_time, create_by, update_by
id, inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference, profit_loss_amount, store_id, create_time, update_time, create_by, update_by
from oil_inventory_order
<where>
<if test="id != null">
@ -54,8 +54,8 @@
<if test="inventoryVolume != null">
and inventory_volume = #{inventoryVolume}
</if>
<if test="stockDifferenceVolume != null">
and stock_difference_volume = #{stockDifferenceVolume}
<if test="stockDifference != null">
and stock_difference = #{stockDifference}
</if>
<if test="profitLossAmount != null">
and profit_loss_amount = #{profitLossAmount}
@ -104,8 +104,8 @@
<if test="inventoryVolume != null">
and inventory_volume = #{inventoryVolume}
</if>
<if test="stockDifferenceVolume != null">
and stock_difference_volume = #{stockDifferenceVolume}
<if test="stockDifference != null">
and stock_difference = #{stockDifference}
</if>
<if test="profitLossAmount != null">
and profit_loss_amount = #{profitLossAmount}
@ -129,12 +129,14 @@
</select>
<select id="getListPage" resultType="com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO">
SELECT
oi.id id,
ot.tank_name tankName,
ot.id tankId,
CONCAT( onn.oil_type, ' ', onn.oil_name ) numberName,
current_average_price currentAveragePrice,
ot.stored_quantity currentInventoryVolume,
oi.inventory_volume inventoryVolume,
oi.stock_difference_volume stockDifferenceVolume,
oi.stock_difference stockDifference,
oi.profit_loss_amount profitLossAmount
FROM
oil_inventory_order oi
@ -143,25 +145,38 @@
LEFT JOIN oil_name onn ON n.oil_name = onn.id
</select>
<select id="getAllList" resultType="com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO">
SELECT
opo.id id,
opo.inventory_id inventoryId,
ot.tank_name tankName
FROM
oil_inventory_order opo
LEFT JOIN oil_inventory op ON opo.inventory_id = op.id
LEFT JOIN oil_tank ot ON ot.id = opo.tank_id
where opo.store_id = #{storeId}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference_volume, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
values (#{inventoryId}, #{numberId}, #{tankId}, #{currentAveragePrice}, #{currentInventoryVolume}, #{inventoryVolume}, #{stockDifferenceVolume}, #{profitLossAmount}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
values (#{inventoryId}, #{numberId}, #{tankId}, #{currentAveragePrice}, #{currentInventoryVolume}, #{inventoryVolume}, #{stockDifference}, #{profitLossAmount}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference_volume, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.inventoryId}, #{entity.numberId}, #{entity.tankId}, #{entity.currentAveragePrice}, #{entity.currentInventoryVolume}, #{entity.inventoryVolume}, #{entity.stockDifferenceVolume}, #{entity.profitLossAmount}, #{entity.storeId}, NOW(), NOW(), #{entity.createBy}, #{entity.updateBy})
(#{entity.inventoryId}, #{entity.numberId}, #{entity.tankId}, #{entity.currentAveragePrice}, #{entity.currentInventoryVolume}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.storeId}, NOW(), NOW(), #{entity.createBy}, #{entity.updateBy})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference_volume, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.inventoryId}, #{entity.numberId}, #{entity.tankId}, #{entity.currentAveragePrice}, #{entity.currentInventoryVolume}, #{entity.inventoryVolume}, #{entity.stockDifferenceVolume}, #{entity.profitLossAmount}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
(#{entity.inventoryId}, #{entity.numberId}, #{entity.tankId}, #{entity.currentAveragePrice}, #{entity.currentInventoryVolume}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
on duplicate key update
inventory_id = values(inventory_id),
@ -170,7 +185,7 @@
current_average_price = values(current_average_price),
current_inventory_volume = values(current_inventory_volume),
inventory_volume = values(inventory_volume),
stock_difference_volume = values(stock_difference_volume),
stock_difference = values(stock_difference),
profit_loss_amount = values(profit_loss_amount),
store_id = values(store_id),
create_time = values(create_time),
@ -201,8 +216,8 @@
<if test="inventoryVolume != null">
inventory_volume = #{inventoryVolume},
</if>
<if test="stockDifferenceVolume != null">
stock_difference_volume = #{stockDifferenceVolume},
<if test="stockDifference != null">
stock_difference = #{stockDifference},
</if>
<if test="profitLossAmount != null">
profit_loss_amount = #{profitLossAmount},

View File

@ -235,5 +235,18 @@
delete from oil_purchase_order where id = #{id}
</delete>
<select id="getlistByTankId"
resultType="com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder">
SELECT
po.total_amount totalAmount,
po.purchase_volume purchaseVolume
FROM
oil_purchase_order po
LEFT JOIN oil_purchase p ON po.purchase_id = p.id
WHERE
p.STATUS = 'qrts'
AND po.tank_id = 1
</select>
</mapper>

View File

@ -51,13 +51,20 @@ public interface OilInventoryOrderService {
*/
int insertBatch(List<OilInventoryOrder> oilInventoryOrder);
/**
* 批量处理数据
* @param oilInventoryOrder
* @return
*/
int disposeBatch(List<OilInventoryOrder> oilInventoryOrder, Integer inventoryId);
/**
* 修改数据
*
* @param oilInventoryOrder 实例对象
* @return 实例对象
*/
/**
* 修改数据
*
* @param oilInventoryOrder 实例对象
* @return 实例对象
*/
OilInventoryOrder update(OilInventoryOrder oilInventoryOrder);
/**

View File

@ -1,11 +1,11 @@
package com.fuint.business.petrolStationManagement.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilInventory;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.vo.OilInventoryVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
/**
* (OilInventory)表服务接口
@ -30,7 +30,9 @@ public interface OilInventoryService {
* @param page 分页对象
* @return 查询结果
*/
IPage<OilInventory> queryByPage(@Param("page") com.baomidou.mybatisplus.extension.plugins.pagination.Page page, @Param("oilInventory") OilInventory oilInventory);
IPage<OilInventory> queryByPage(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory);
IPage<OilInventoryVO> getListPage(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory);
/**
* 新增数据

View File

@ -3,13 +3,17 @@ package com.fuint.business.petrolStationManagement.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilInventoryOrder;
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
import com.fuint.business.petrolStationManagement.mapper.OilInventoryOrderMapper;
import com.fuint.business.petrolStationManagement.mapper.OilPurchaseOrderMapper;
import com.fuint.business.petrolStationManagement.service.OilInventoryOrderService;
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
@ -22,7 +26,8 @@ import java.util.List;
public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
@Resource
private OilInventoryOrderMapper oilInventoryOrderDao;
@Resource
private OilPurchaseOrderMapper oilPurchaseOrderMapper;
/**
* 通过ID查询单条数据
*
@ -48,7 +53,19 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
@Override
public IPage<OilInventoryOrderVO> getListPage(@Param("page") Page page, @Param("oilInventoryOrder") OilInventoryOrder oilInventoryOrder) {
return oilInventoryOrderDao.getListPage(page, oilInventoryOrder);
OilInventoryOrderMapper oilInventoryOrderDao = this.oilInventoryOrderDao;
IPage<OilInventoryOrderVO> listPage = oilInventoryOrderDao.getListPage(page, oilInventoryOrder);
// 获取所有油罐的当前均进价
for (OilInventoryOrderVO record : listPage.getRecords()) {
try {
Double aDouble = calculateTheAveragePrice(record.getTankId());
record.setCurrentAveragePrice(aDouble);
} catch (Exception e) {
e.printStackTrace();
}
}
return listPage;
}
/**
@ -63,6 +80,31 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
return oilInventoryOrder;
}
// 计算当前均进价
public Double calculateTheAveragePrice(Integer tankId) {
BigDecimal bigSunPrice = new BigDecimal(0);
BigDecimal bigSumL = new BigDecimal(0);
// 根据油罐id查询到所有的订单
List<OilPurchaseOrder> oilPurchaseOrders = oilPurchaseOrderMapper.getlistByTankId(tankId);
// 计算每个订单的平均进价并进行相加
for (OilPurchaseOrder oilPurchaseOrder : oilPurchaseOrders) {
bigSunPrice.add( new BigDecimal(oilPurchaseOrder.getTotalAmount()));
bigSumL.add( new BigDecimal(oilPurchaseOrder.getPurchaseVolume()));
}
// 用总的钱数/总的量
BigDecimal result = new BigDecimal(0);
try{
result = bigSunPrice.divide(bigSumL, 2, BigDecimal.ROUND_HALF_UP);
}catch (Exception e) {
return 0.0;
}
return Double.parseDouble(result.toString());
}
/**
* 批量新增
* @param oilInventoryOrder
@ -74,6 +116,19 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
return count;
}
@Override
public int disposeBatch(List<OilInventoryOrder> oilInventoryOrder, Integer inventoryId) {
// List<OilInventoryOrder> insInventory = new ArrayList<>();
// List<OilInventoryOrder> updateInventory = new ArrayList<>();
if (oilInventoryOrder.size()>0) {
oilInventoryOrder.stream().forEach(o -> o.setInventoryId(inventoryId));
oilInventoryOrderDao.insertOrUpdateBatch(oilInventoryOrder);
}
return 0;
}
/**
* 修改数据
*

View File

@ -1,17 +1,25 @@
package com.fuint.business.petrolStationManagement.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilInventory;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.entity.OilInventoryOrder;
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
import com.fuint.business.petrolStationManagement.mapper.OilInventoryMapper;
import com.fuint.business.petrolStationManagement.mapper.OilInventoryOrderMapper;
import com.fuint.business.petrolStationManagement.service.OilInventoryService;
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
import com.fuint.business.petrolStationManagement.vo.OilInventoryVO;
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
import com.fuint.business.petrolStationManagement.vo.OilPurchaseVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource;
import java.util.List;
/**
* (OilInventory)表服务实现类
@ -24,6 +32,9 @@ public class OilInventoryServiceImpl implements OilInventoryService {
@Resource
private OilInventoryMapper oilInventoryDao;
@Resource
private OilInventoryOrderMapper oilInventoryOrderMapper;
/**
* 通过ID查询单条数据
*
@ -43,10 +54,46 @@ public class OilInventoryServiceImpl implements OilInventoryService {
* @return 查询结果
*/
@Override
public IPage<OilInventory> queryByPage(@Param("page") com.baomidou.mybatisplus.extension.plugins.pagination.Page page, @Param("oilInventory") OilInventory oilInventory) {
public IPage<OilInventory> queryByPage(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory) {
return oilInventoryDao.queryAllByLimit(page, oilInventory);
}
@Override
public IPage<OilInventoryVO> getListPage(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilInventory.setStoreId(nowAccountInfo.getStoreId());
IPage<OilInventoryVO> listPage = oilInventoryDao.getListPage(page, oilInventory);
// 查出所有的油罐
OilInventoryOrder oilInventoryOrder = new OilInventoryOrder();
oilInventoryOrder.setStoreId(nowAccountInfo.getStoreId());
List<OilInventoryOrderVO> allList = oilInventoryOrderMapper.getAllList(oilInventoryOrder);
// 组合数据
for (OilInventoryVO record : listPage.getRecords()) {
for (OilInventoryOrderVO oilInventoryOrderVO : allList) {
if (record.getId().equals(oilInventoryOrderVO.getInventoryId())) {
record.setTanks(appendString(record.getTanks(),oilInventoryOrderVO.getTankName()));
}
}
}
return listPage;
}
private String appendString(String res,String com){
if (StringUtils.isEmpty(res)) {
return com;
}else {
if (res.contains(com)) {
return res;
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(res).append("/").append(com);
return stringBuilder.toString();
}
}
/**
* 新增数据
*

View File

@ -6,5 +6,6 @@ import lombok.Data;
@Data
public class OilInventoryOrderVO extends OilInventoryOrder {
private String tankName;
private Integer tankId;
private String numberName;
}

View File

@ -0,0 +1,12 @@
package com.fuint.business.petrolStationManagement.vo;
import com.fuint.business.petrolStationManagement.entity.OilInventoryOrder;
import lombok.Data;
@Data
public class OilInventoryVO extends OilInventoryOrder {
private String tankName;
private Integer tankId;
private String numberName;
private String tanks;
}