This commit is contained in:
DESKTOP-369JRHT\12997 2023-10-27 18:07:02 +08:00
commit 2a586c09ba
10 changed files with 191 additions and 17 deletions

View File

@ -1,6 +1,6 @@
import request from '@/utils/request'
// 查询商品列表
// 查询库存统计列表
export function listStock(query) {
return request({
url: '/business/convenience/stockStatistic/list',
@ -9,10 +9,20 @@ export function listStock(query) {
})
}
// 查询供应商详细
// 查询库存统计详细
export function getStock(id) {
return request({
url: '/business/convenience/stockStatistic/' + id,
method: 'get'
})
}
// 导出库存统计信息
export function exportStocks() {
return request({
url: '/business/convenience/stockStatistic/export',
method: 'get'
})
}

View File

@ -85,7 +85,7 @@
<el-card style="margin-top: 20px" >
<div style="display: flex;justify-content: space-between">
<div style="font-size: 18px">列表</div>
<el-button type="primary">导出</el-button>
<el-button type="primary" @click="dialogVisible = true">导出</el-button>
</div>
<el-table ref="tables" v-loading="loading" :data="list"
@ -205,17 +205,29 @@
</el-card>
</div>
</el-drawer>
<el-dialog
title="导出状态"
:visible.sync="dialogVisible"
width="20%"
style="margin-top: 200px"
:before-close="handleClose">
<span>导出文档已生成,请点击下载按钮进行下载</span>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="exportStock">
<!-- -->
<a href="/dev-api/business/convenience/stockStatistic/export"> </a>
</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {exportExcelTankApi, getTankApi} from "@/api/oilConfig/oilTank";
import {getTrackingApi} from "@/api/oilConfig/oilStatistics";
import {getOilNameListApi} from "@/api/oilPrice";
import {selectTree} from "@/api/convenienceStore/goods";
import {listSupplier} from "@/api/convenienceStore/supplier";
import {listLJGoods} from "@/api/convenienceStore/ljgoods";
import {getStock, listStock} from "@/api/convenienceStore/stockstatistic";
import {exportStock, exportStocks, getStock, listStock} from "@/api/convenienceStore/stockstatistic";
import {listTrack} from "@/api/convenienceStore/stocktrack";
export default {
@ -224,6 +236,7 @@ export default {
data() {
return {
dialogVisible: false,
//
showSearch: true,
//
@ -269,9 +282,14 @@ export default {
this.getQueryList();
},
methods: {
getTrackList(){
exportStock(){
exportStocks().then(() => {})
this.dialogVisible = false
},
//
getTrackList(stockId){
this.loading = true;
listTrack().then(response => {
listTrack(stockId).then(response => {
this.trackList = response.data.records;
this.total1 = response.data.total;
this.loading = false;

View File

@ -1,19 +1,28 @@
package com.fuint.business.convenienceSore.controller;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.convenienceSore.service.StockStatisticService;
import com.fuint.business.convenienceSore.vo.StockStatisticVo;
import com.fuint.business.userManager.listener.EasyExcelListener;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.List;
@RestController
@RequestMapping("/business/convenience/stockStatistic")
public class StockStatisticController extends BaseController {
@Autowired
private StockStatisticService stockService;
@Autowired
private EasyExcelListener listener;
/**
* 根据条件查询库存商品信息
@ -41,4 +50,27 @@ public class StockStatisticController extends BaseController {
StockStatisticVo stockStatisticVo = stockService.selectStockById(id);
return getSuccessResult(stockStatisticVo);
}
@GetMapping("/export")
public void export(HttpServletResponse response, HttpServletRequest request) {
try {
String filenames = "商品-库存统计";
String userAgent = request.getHeader("User-Agent");
if (userAgent.contains("MSIE") || userAgent.contains("Trident")) {
filenames = URLEncoder.encode(filenames, "UTF-8");
} else {
filenames = new String(filenames.getBytes("UTF-8"), "ISO-8859-1");
}
response.setContentType("application/json.ms-exce");
response.setCharacterEncoding("utf-8");
response.addHeader("Content-Disposition", "filename=" + filenames + ".xlsx");
List<StockStatisticVo> list = stockService.selectStocks();
EasyExcel.write(response.getOutputStream(), StockStatisticVo.class).sheet("sheet").doWrite(list);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -7,6 +7,8 @@ import com.fuint.business.convenienceSore.entity.StockStatistic;
import com.fuint.business.convenienceSore.vo.StockStatisticVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface StockStatisticMapper extends BaseMapper<StockStatistic> {
/**
* 根据条件分页查询库存统计信息
@ -16,6 +18,13 @@ public interface StockStatisticMapper extends BaseMapper<StockStatistic> {
*/
public IPage<StockStatisticVo> selectStockList(Page page, @Param("stock") StockStatisticVo stock);
/**
*
* @param storeId
* @return
*/
public List<StockStatisticVo> selectStocks(@Param("storeId") Integer storeId);
/**
* 根据id查询库存统计信息
* @param id

View File

@ -42,4 +42,11 @@
st.id = #{id}
</where>
</select>
<select id="selectStocks" resultType="com.fuint.business.convenienceSore.vo.StockStatisticVo"
parameterType="java.lang.Integer">
<include refid="selectStock"></include>
<where>
st.store_id = #{storeId}
</where>
</select>
</mapper>

View File

@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.convenienceSore.entity.StockStatistic;
import com.fuint.business.convenienceSore.entity.StockTrack;
import com.fuint.business.convenienceSore.vo.StockStatisticVo;
import java.util.List;
/**
* 库存统计 业务层
*/
@ -17,10 +20,23 @@ public interface StockStatisticService extends IService<StockStatistic> {
*/
public IPage<StockStatisticVo> selectStockList(Page page, StockStatisticVo stockStatisticVo);
/**
* 查询所有库存统计信息
* @return
*/
public List<StockStatisticVo> selectStocks();
/**
* 根据id查询库存统计信息
* @param id
* @return
*/
public StockStatisticVo selectStockById(int id);
/**
* 增加库存统计信息
* @param stock
* @return
*/
public int insertStock(StockStatistic stock);
}

View File

@ -11,6 +11,8 @@ import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 库存统计 业务层
*/
@ -30,6 +32,18 @@ public class StockStatisticServiceImpl extends ServiceImpl<StockStatisticMapper,
return stockStatisticVoIPage;
}
/**
* 查询所有库存统计信息
* @return
*/
@Override
public List<StockStatisticVo> selectStocks() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
List<StockStatisticVo> list = baseMapper.selectStocks(storeId);
return list;
}
/**
* 根据id查询库存统计信息
* @param id
@ -39,4 +53,13 @@ public class StockStatisticServiceImpl extends ServiceImpl<StockStatisticMapper,
public StockStatisticVo selectStockById(int id) {
return baseMapper.selectStockById(id);
}
@Override
public int insertStock(StockStatistic stock) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
stock.setStoreId(storeId);
int row = baseMapper.insert(stock);
return row;
}
}

View File

@ -1,11 +1,12 @@
package com.fuint.business.convenienceSore.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fuint.framework.entity.BaseEntity;
import lombok.Data;
import java.util.Date;
@Data
@ExcelIgnoreUnannotated
public class StockStatisticVo extends BaseEntity {
// id
private Integer id;
@ -18,22 +19,31 @@ public class StockStatisticVo extends BaseEntity {
// 商品id
private Integer goodsId;
// 商品名称
@ExcelProperty(value = "商品名称")
private String name;
// 条码
@ExcelProperty(value = "商品条码")
private String goodsNo;
// 拼音码
@ExcelProperty(value = "拼音码")
private String pinyinCode;
// 货架号
@ExcelProperty(value = "货架号")
private String shelfNumber;
// 零售价
@ExcelProperty(value = "零售价")
private String retailPrice;
// 单位
@ExcelProperty(value = "单位")
private String unit;
// 库存
@ExcelProperty(value = "库存")
private String stock;
// 进货价当前成本价
@ExcelProperty(value = "当前成本价")
private String buyingPrice;
// 成本金额
@ExcelProperty(value = "成本金额")
private Double costAmount;
// 状态
private String status;

View File

@ -104,7 +104,5 @@ public class ExportController extends BaseController{
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -1,15 +1,66 @@
<template>
<div>
详情页
<div class="app-center">
<el-card class="box-card">
<div slot="header" class="clearfix">
<i class="el-icon-back"></i>
<span>会员详情</span>
</div>
<div>基础资料</div>
<div class="vip-my-top">
<!-- -->
<div class="f-box">
<div class="imgtoux"><el-avatar :size="80" :src="circleUrl"></el-avatar></div>
<div>
<el-button type="warning" plain round>绑定实体卡</el-button>
</div>
<div>
<el-button type="primary" plain round>会员充值</el-button>
</div>
</div>
<!-- -->
</div>
</el-card>
<el-card class="box-card">
</el-card>
<el-card class="box-card">
</el-card>
</div>
</template>
<script>
export default {
name: "index"
name: "index",
data(){
return{
circleUrl: "https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png",
}
}
}
</script>
<style scoped>
.app-center{
width: 100%;
box-sizing: border-box;
padding: 10px;
}
.vip-my-top{
width: 100%;
display: flex;
}
.f-box{
width: 20%;
}
.imgtoux{
width: 80px;
margin: 10px auto;
}
</style>