diff --git a/fuintAdmin/src/api/convenienceStore/ljgoods.js b/fuintAdmin/src/api/convenienceStore/ljgoods.js index 593525633..b40ad4f14 100644 --- a/fuintAdmin/src/api/convenienceStore/ljgoods.js +++ b/fuintAdmin/src/api/convenienceStore/ljgoods.js @@ -26,11 +26,11 @@ export function createGoodsNo() { } // 对接扫码枪 -export function scanCode(data) { +export function scanCode(goodsNo) { return request({ - url: '/business/convenience/goods/scanCode', - method: 'put', - data: data + url: '/business/convenience/goods/scanCode/'+goodsNo, + method: 'get', + // data: data }) } diff --git a/fuintAdmin/src/api/convenienceStore/stockstatistic.js b/fuintAdmin/src/api/convenienceStore/stockstatistic.js new file mode 100644 index 000000000..9ce12ae22 --- /dev/null +++ b/fuintAdmin/src/api/convenienceStore/stockstatistic.js @@ -0,0 +1,18 @@ +import request from '@/utils/request' + +// 查询商品列表 +export function listStock(query) { + return request({ + url: '/business/convenience/stockStatistic/list', + method: 'get', + params: query + }) +} + +// 查询供应商详细 +export function getStock(id) { + return request({ + url: '/business/convenience/stockStatistic/' + id, + method: 'get' + }) +} diff --git a/fuintAdmin/src/api/convenienceStore/stocktrack.js b/fuintAdmin/src/api/convenienceStore/stocktrack.js new file mode 100644 index 000000000..d4ef93aec --- /dev/null +++ b/fuintAdmin/src/api/convenienceStore/stocktrack.js @@ -0,0 +1,9 @@ +import request from '@/utils/request' + +// 查询商品列表 +export function listTrack(stockId) { + return request({ + url: '/business/convenience/stockTrack/list/'+stockId, + method: 'get', + }) +} diff --git a/fuintAdmin/src/views/convenienceStore/goodsFile.vue b/fuintAdmin/src/views/convenienceStore/goodsFile.vue index 7e16884d5..105f9a3a5 100644 --- a/fuintAdmin/src/views/convenienceStore/goodsFile.vue +++ b/fuintAdmin/src/views/convenienceStore/goodsFile.vue @@ -116,7 +116,9 @@ @@ -180,7 +182,7 @@ - 查询 + 查询
商品无条码?您可以生成条码 @@ -217,7 +219,7 @@ - + @@ -284,7 +286,7 @@ - {{ dict.label }} + {{ dict.label }} @@ -413,6 +415,10 @@ export default { computed:{ }, methods:{ + // 价格填写 + getPrice(){ + this.form.memberPrice = this.form.retailPrice + }, // 点击标签页 handleClick(tab, event) { if (this.activeName == 'goods'){ @@ -449,11 +455,18 @@ export default { }, // 扫描识别商品信息 getGoods(form){ - // console.log(form){goodsNo:form.goodsNo} - scanCode({goodsNo:form.goodsNo}).then(response => { - console.log(response) - // this.form = response.data - }) + if (form.goodsNo!=""){ + scanCode(form.goodsNo).then(response => { + if (response.data!=null && response.data!=""){ + this.form.goodsNo = response.data.barcode; + this.form.name = response.data.goodsName; + this.form.buyingPrice = response.data.price; + this.form.retailPrice = response.data.price; + this.form.memberPrice = response.data.price; + this.pinyin(); + } + }) + } }, // 生成13位数字条码信息 createGoodNo(){ diff --git a/fuintAdmin/src/views/convenienceStore/stockStatistic.vue b/fuintAdmin/src/views/convenienceStore/stockStatistic.vue new file mode 100644 index 000000000..65277892b --- /dev/null +++ b/fuintAdmin/src/views/convenienceStore/stockStatistic.vue @@ -0,0 +1,354 @@ + + + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/LJGoodsController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/LJGoodsController.java index 64746803b..fb83e331d 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/LJGoodsController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/LJGoodsController.java @@ -1,5 +1,6 @@ package com.fuint.business.convenienceSore.controller; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fuint.business.convenienceSore.entity.LJGoods; @@ -62,12 +63,10 @@ public class LJGoodsController extends BaseController { * 扫码枪对接 * @return */ - @PutMapping("/scanCode") - public ResponseObject scanCode(@Validated @RequestBody Map map){ - System.out.println(map.get("goodsNo")); - String goodsNo = map.get("goodsNo"); -// String result = goodsService.scanCode(goodsNo); - return getSuccessResult(1); + @GetMapping("/scanCode/{goodsNo}") + public ResponseObject scanCode( @PathVariable String goodsNo){ + JSONObject object = goodsService.scanCode(goodsNo); + return getSuccessResult(object.get("data")); } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/StockStatisticController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/StockStatisticController.java new file mode 100644 index 000000000..1a6281e6b --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/StockStatisticController.java @@ -0,0 +1,44 @@ +package com.fuint.business.convenienceSore.controller; + +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.framework.web.BaseController; +import com.fuint.framework.web.ResponseObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/business/convenience/stockStatistic") +public class StockStatisticController extends BaseController { + @Autowired + private StockStatisticService stockService; + + /** + * 根据条件查询库存商品信息 + * @param stockVo + * @param pageNo + * @param pageSize + * @return + */ + @GetMapping("/list") + public ResponseObject list(StockStatisticVo stockVo, + @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){ + Page page =new Page(pageNo,pageSize); + IPage list = stockService.selectStockList(page,stockVo); + return getSuccessResult(list); + } + + /** + * 根据id查询库存统计信息 + * @param id + * @return + */ + @GetMapping("/{id}") + public ResponseObject stockInfo(@PathVariable Integer id){ + StockStatisticVo stockStatisticVo = stockService.selectStockById(id); + return getSuccessResult(stockStatisticVo); + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/StockTrackController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/StockTrackController.java new file mode 100644 index 000000000..4099859c5 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/controller/StockTrackController.java @@ -0,0 +1,36 @@ +package com.fuint.business.convenienceSore.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.convenienceSore.entity.StockTrack; +import com.fuint.business.convenienceSore.service.StockTrackService; +import com.fuint.business.convenienceSore.vo.StockStatisticVo; +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.*; + +/** + * 库存跟踪信息 controller层 + */ +@RestController +@RequestMapping("/business/convenience/stockTrack") +public class StockTrackController extends BaseController { + @Autowired + private StockTrackService trackService; + + /** + * 根据条件查询库存跟踪信息 + * @param pageNo + * @param pageSize + * @return + */ + @GetMapping("/list/{stockId}") + public ResponseObject list(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, + @PathVariable Integer stockId){ + Page page =new Page(pageNo,pageSize); + IPage list = trackService.selectStockTrackList(page,stockId); + return getSuccessResult(list); + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/LJGoods.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/LJGoods.java index 338d44661..5bc1279b1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/LJGoods.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/LJGoods.java @@ -54,7 +54,7 @@ public class LJGoods extends BaseEntity implements Serializable { * 货架号 */ @ApiModelProperty("货架号") - private Integer shelfNumber; + private String shelfNumber; /** * 进货价 */ diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/StockStatistic.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/StockStatistic.java new file mode 100644 index 000000000..b57abc31b --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/StockStatistic.java @@ -0,0 +1,54 @@ +package com.fuint.business.convenienceSore.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fuint.framework.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + * 库存统计表(StockStatistic)实体类 + */ +@Data +@TableName("stock_statistic") +@ApiModel(value = "StockStatistic对象", description = "库存统计表") +public class StockStatistic extends BaseEntity implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 主键 + */ + @ApiModelProperty("自增ID") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + /** + * 供应商id + */ + @ApiModelProperty("供应商id") + private Integer supplierId; + /** + * 商品分类ID + */ + @ApiModelProperty("商品分类ID") + private Integer cvsGoodId; + /** + * 商品id + */ + @ApiModelProperty("商品id") + private Integer goodsId; + /** + * 所属店铺ID + */ + @ApiModelProperty("所属店铺ID") + private Integer storeId; + /** + * 成本金额 + */ + @ApiModelProperty("成本金额") + private Double costAmount; + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/StockTrack.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/StockTrack.java new file mode 100644 index 000000000..8829c5ea4 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/StockTrack.java @@ -0,0 +1,50 @@ +package com.fuint.business.convenienceSore.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fuint.framework.entity.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.io.Serializable; + +/** + * 库存跟踪表(StockTrack)实体类 + */ +@Data +@TableName("stock_track") +@ApiModel(value = "StockTrack对象", description = "库存跟踪表") +public class StockTrack extends BaseEntity implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 主键 + */ + @ApiModelProperty("自增ID") + @TableId(value = "ID", type = IdType.AUTO) + private Integer id; + /** + * 库存统计id + */ + private Integer stockId; + /** + * 所属店铺ID + */ + private Integer storeId; + /** + * 单据 + */ + private String document; + /** + * 单号 + */ + private String oddNumber; + /** + * 变动数量 + */ + private Integer changeNumber; + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/Supplier.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/Supplier.java index b331d5dd4..0239e7432 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/Supplier.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/entity/Supplier.java @@ -8,7 +8,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; import java.io.Serializable; /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/StockStatisticMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/StockStatisticMapper.java new file mode 100644 index 000000000..fb35472ab --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/StockStatisticMapper.java @@ -0,0 +1,25 @@ +package com.fuint.business.convenienceSore.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.convenienceSore.entity.StockStatistic; +import com.fuint.business.convenienceSore.vo.StockStatisticVo; +import org.apache.ibatis.annotations.Param; + +public interface StockStatisticMapper extends BaseMapper { + /** + * 根据条件分页查询库存统计信息 + * @param page + * @param stock + * @return + */ + public IPage selectStockList(Page page, @Param("stock") StockStatisticVo stock); + + /** + * 根据id查询库存统计信息 + * @param id + * @return + */ + public StockStatisticVo selectStockById(@Param("id") int id); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/StockTrackMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/StockTrackMapper.java new file mode 100644 index 000000000..a3f7a9d1d --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/StockTrackMapper.java @@ -0,0 +1,7 @@ +package com.fuint.business.convenienceSore.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fuint.business.convenienceSore.entity.StockTrack; + +public interface StockTrackMapper extends BaseMapper { +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/xml/StockStatisticMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/xml/StockStatisticMapper.xml new file mode 100644 index 000000000..a91c1a605 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/mapper/xml/StockStatisticMapper.xml @@ -0,0 +1,45 @@ + + + + + select st.id, st.supplier_id, st.cvs_good_id, st.goods_id, st.store_id, st.cost_amount, mg.status, + mg.name,mg.goods_no,mg.pinyin_code,mg.shelf_number, + mg.retail_price,mg.unit,mg.stock,mg.buying_price,mg.update_time + from stock_statistic st inner join mt_goods mg on st.goods_id = mg.id + + + + + \ No newline at end of file diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/CvsGoodsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/CvsGoodsService.java index c0cc8c0c1..7e1dc8337 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/CvsGoodsService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/CvsGoodsService.java @@ -2,6 +2,7 @@ package com.fuint.business.convenienceSore.service; 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.CvsGoods; import com.fuint.business.convenienceSore.vo.CvsGoodsVo; import io.swagger.models.auth.In; @@ -11,7 +12,7 @@ import java.util.List; /** * 便利店商品分类信息 业务层 */ -public interface CvsGoodsService { +public interface CvsGoodsService extends IService { /** * 添加商品分类信息 * @param cvsGoods diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/LJGoodsService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/LJGoodsService.java index 3171c9064..ea5f024a5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/LJGoodsService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/LJGoodsService.java @@ -1,13 +1,15 @@ package com.fuint.business.convenienceSore.service; +import com.alibaba.fastjson2.JSONObject; 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.LJGoods; /** * 商品信息 业务层 */ -public interface LJGoodsService { +public interface LJGoodsService extends IService { /** * 根据条件分页查询商品信息 * @param page @@ -32,7 +34,7 @@ public interface LJGoodsService { * 扫码枪对接 * @return */ - public String scanCode(String goodNo); + public JSONObject scanCode(String goodNo); /** * 根据id删除商品信息 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/StockStatisticService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/StockStatisticService.java new file mode 100644 index 000000000..6404a93c2 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/StockStatisticService.java @@ -0,0 +1,26 @@ +package com.fuint.business.convenienceSore.service; + +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.vo.StockStatisticVo; + +/** + * 库存统计 业务层 + */ +public interface StockStatisticService extends IService { + /** + * 根据条件分页查询库存统计信息 + * @param page + * @return + */ + public IPage selectStockList(Page page, StockStatisticVo stockStatisticVo); + + /** + * 根据id查询库存统计信息 + * @param id + * @return + */ + public StockStatisticVo selectStockById(int id); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/StockTrackService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/StockTrackService.java new file mode 100644 index 000000000..4df9ef0d2 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/StockTrackService.java @@ -0,0 +1,25 @@ +package com.fuint.business.convenienceSore.service; + +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.StockTrack; + +/** + * 库存跟踪信息 业务层 + */ +public interface StockTrackService extends IService { + /** + * 分页查询库存跟踪信息 + * @param page + * @return + */ + public IPage selectStockTrackList(Page page,Integer stockId); + + /** + * 增加供应商信息 + * @param stockTrack + * @return + */ + public int insertStockTrack(StockTrack stockTrack); +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/SupplierService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/SupplierService.java index b58acdad5..df89cdbe9 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/SupplierService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/SupplierService.java @@ -2,12 +2,13 @@ package com.fuint.business.convenienceSore.service; 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.Supplier; /** * 供应商信息 业务层 */ -public interface SupplierService { +public interface SupplierService extends IService { /** * 根据条件分页查询供应商信息 * @param page diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/LJGoodsServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/LJGoodsServiceImpl.java index 3f7657542..e7d30881b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/LJGoodsServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/LJGoodsServiceImpl.java @@ -1,6 +1,7 @@ package com.fuint.business.convenienceSore.service.impl; import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -75,10 +76,11 @@ public class LJGoodsServiceImpl extends ServiceImpl impl * @return */ @Override - public String scanCode(String goodNo) { + public JSONObject scanCode(String goodNo) { String result = HttpUtil.get("https://www.mxnzp.com/api/barcode/goods/details?barcode=" - +goodNo+"&app_id=oudmngsxohrpsngw&app_secret=FoKv7iOPbT9LmdZpy0kg8CW75Hcc1BJc"); - return result; + + goodNo + "&app_id=oudmngsxohrpsngw&app_secret=FoKv7iOPbT9LmdZpy0kg8CW75Hcc1BJc"); + JSONObject object = JSONObject.parseObject(result); + return object; } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/StockStatisticServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/StockStatisticServiceImpl.java new file mode 100644 index 000000000..ae2756ccd --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/StockStatisticServiceImpl.java @@ -0,0 +1,42 @@ +package com.fuint.business.convenienceSore.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.convenienceSore.entity.StockStatistic; +import com.fuint.business.convenienceSore.mapper.StockStatisticMapper; +import com.fuint.business.convenienceSore.service.StockStatisticService; +import com.fuint.business.convenienceSore.vo.StockStatisticVo; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; +import org.springframework.stereotype.Service; + +/** + * 库存统计 业务层 + */ +@Service +public class StockStatisticServiceImpl extends ServiceImpl implements StockStatisticService { + /** + * 根据条件分页查询库存统计信息 + * @param page + * @return + */ + @Override + public IPage selectStockList(Page page, StockStatisticVo stockStatisticVo) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Integer storeId = nowAccountInfo.getStoreId(); + stockStatisticVo.setStoreId(storeId); + IPage stockStatisticVoIPage = baseMapper.selectStockList(page, stockStatisticVo); + return stockStatisticVoIPage; + } + + /** + * 根据id查询库存统计信息 + * @param id + * @return + */ + @Override + public StockStatisticVo selectStockById(int id) { + return baseMapper.selectStockById(id); + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/StockTrackServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/StockTrackServiceImpl.java new file mode 100644 index 000000000..a8d5a6c6f --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/service/impl/StockTrackServiceImpl.java @@ -0,0 +1,58 @@ +package com.fuint.business.convenienceSore.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuint.business.convenienceSore.entity.StockTrack; +import com.fuint.business.convenienceSore.mapper.StockTrackMapper; +import com.fuint.business.convenienceSore.service.StockTrackService; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; +import org.springframework.stereotype.Service; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; + +/** + * 库存跟踪信息 业务层 + */ +@Service +public class StockTrackServiceImpl extends ServiceImpl implements StockTrackService { + /** + * 分页查询库存跟踪信息 + * @param page + * @return + */ + @Override + public IPage selectStockTrackList(Page page,Integer stockId) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Integer storeId = nowAccountInfo.getStoreId(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("store_id",storeId); + queryWrapper.eq("stock_id",stockId); + IPage iPage = baseMapper.selectPage(page, queryWrapper); + return iPage; + } + + /** + * 增加供应商信息 + * @param stockTrack + * @return + */ + @Override + public int insertStockTrack(StockTrack stockTrack) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + Integer storeId = nowAccountInfo.getStoreId(); + stockTrack.setStockId(storeId); + if (stockTrack.getOddNumber()!=null && stockTrack.getOddNumber()!=""){ + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + String timestamp = dateFormat.format(new Date()); + String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6); + stockTrack.setOddNumber(timestamp+randomString); + } + int row = baseMapper.insert(stockTrack); + return row; + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/vo/StockStatisticVo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/vo/StockStatisticVo.java new file mode 100644 index 000000000..2a782fd66 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/convenienceSore/vo/StockStatisticVo.java @@ -0,0 +1,40 @@ +package com.fuint.business.convenienceSore.vo; + +import com.fuint.framework.entity.BaseEntity; +import lombok.Data; + +import java.util.Date; + +@Data +public class StockStatisticVo extends BaseEntity { +// id + private Integer id; +// 店铺id + private Integer storeId; +// 供应商id + private Integer supplierId; +// 商品分类id + private Integer cvsGoodId; +// 商品id + private Integer goodsId; +// 商品名称 + private String name; +// 条码 + private String goodsNo; +// 拼音码 + private String pinyinCode; +// 货架号 + private String shelfNumber; +// 零售价 + private String retailPrice; +// 单位 + private String unit; +// 库存 + private String stock; +// 进货价(当前成本价) + private String buyingPrice; +// 成本金额 + private Double costAmount; +// 状态 + private String status; +}