便利店
This commit is contained in:
parent
99582ce083
commit
afa7d57bef
@ -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'
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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>
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -104,7 +104,5 @@ public class ExportController extends BaseController{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user