商品库存数据统计
商品库存查询变动记录 耗材库存数据统计 商品列表排序 耗材列表排序 商品报损 耗材报损
This commit is contained in:
@@ -36,92 +36,92 @@ public class StockController {
|
||||
|
||||
private final StockService stockService;
|
||||
|
||||
@ApiOperation("库存导出")
|
||||
@PostMapping(value = "download")
|
||||
public void exportTbOrderInfo(HttpServletResponse response, @RequestBody StockQueryDto criteria) throws IOException {
|
||||
stockService.download(criteria,response);
|
||||
}
|
||||
|
||||
@ApiOperation("库存导出")
|
||||
@PostMapping(value = "download/v2")
|
||||
public void exportTbOrderInfoV2(HttpServletResponse response, @RequestBody StockQueryDto criteria) throws IOException {
|
||||
stockService.downloadV2(criteria,response);
|
||||
}
|
||||
|
||||
@Log("库存导入")
|
||||
@PostMapping("/doImport")
|
||||
@ApiOperation("文件导入库存")
|
||||
public ResponseEntity<Object> importExcel(@RequestParam String shopId,@RequestParam("file") MultipartFile file) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
if (file.isEmpty()) {
|
||||
throw new BadRequestException("文件不能为空");
|
||||
}
|
||||
if (!fileName.contains("xls") && !fileName.contains("xlsx")) {
|
||||
throw new BadRequestException("文件格式不正确");
|
||||
}
|
||||
try {
|
||||
stockService.importExcel(shopId,file);
|
||||
} catch (Exception e) {
|
||||
log.error("文件导入库存异常:",e);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("库存导入")
|
||||
@PostMapping("/doImport/v2")
|
||||
@ApiOperation("文件导入库存")
|
||||
public ResponseEntity<Object> importExcelV2(@RequestParam String shopId,@RequestParam("file") MultipartFile file) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
if (file.isEmpty()) {
|
||||
throw new BadRequestException("文件不能为空");
|
||||
}
|
||||
if (!fileName.contains("xls") && !fileName.contains("xlsx")) {
|
||||
throw new BadRequestException("文件格式不正确");
|
||||
}
|
||||
try {
|
||||
stockService.importExcelV2(shopId,file);
|
||||
} catch (Exception e) {
|
||||
log.error("文件导入库存异常:",e);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询库存")
|
||||
public ResponseEntity<Object> queryTbProduct(StockQueryDto criteria,
|
||||
@RequestParam(required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size){
|
||||
return new ResponseEntity<>(stockService.queryAll(criteria,page,size), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/v2")
|
||||
@ApiOperation("查询库存")
|
||||
public ResponseEntity<Object> queryTbProductV2(StockQueryDto criteria,
|
||||
@RequestParam(required = false, defaultValue = "0") Integer page,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size){
|
||||
Page<StockV2Vo> stockV2Vos = stockService.queryAllV2(criteria, page, size);
|
||||
Map<String, Object> dataMap = BeanUtil.transBean2Map(stockV2Vos);
|
||||
if (stockV2Vos.getContent().isEmpty()) {
|
||||
dataMap.put("warnLine", 0);
|
||||
}else {
|
||||
StockV2Vo stockV2Vo = stockV2Vos.getContent().stream().filter(item -> item.getWarnLine() != null).findFirst().orElse(null);
|
||||
dataMap.put("warnLine", stockV2Vo != null ? stockV2Vo.getWarnLine() : 0);
|
||||
}
|
||||
return new ResponseEntity<>(dataMap, HttpStatus.OK);
|
||||
}
|
||||
// @ApiOperation("库存导出")
|
||||
// @PostMapping(value = "download")
|
||||
// public void exportTbOrderInfo(HttpServletResponse response, @RequestBody StockQueryDto criteria) throws IOException {
|
||||
// stockService.download(criteria,response);
|
||||
// }
|
||||
//
|
||||
// @ApiOperation("库存导出")
|
||||
// @PostMapping(value = "download/v2")
|
||||
// public void exportTbOrderInfoV2(HttpServletResponse response, @RequestBody StockQueryDto criteria) throws IOException {
|
||||
// stockService.downloadV2(criteria,response);
|
||||
// }
|
||||
//
|
||||
// @Log("库存导入")
|
||||
// @PostMapping("/doImport")
|
||||
// @ApiOperation("文件导入库存")
|
||||
// public ResponseEntity<Object> importExcel(@RequestParam String shopId,@RequestParam("file") MultipartFile file) {
|
||||
// String fileName = file.getOriginalFilename();
|
||||
// if (file.isEmpty()) {
|
||||
// throw new BadRequestException("文件不能为空");
|
||||
// }
|
||||
// if (!fileName.contains("xls") && !fileName.contains("xlsx")) {
|
||||
// throw new BadRequestException("文件格式不正确");
|
||||
// }
|
||||
// try {
|
||||
// stockService.importExcel(shopId,file);
|
||||
// } catch (Exception e) {
|
||||
// log.error("文件导入库存异常:",e);
|
||||
// }
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
// @Log("库存导入")
|
||||
// @PostMapping("/doImport/v2")
|
||||
// @ApiOperation("文件导入库存")
|
||||
// public ResponseEntity<Object> importExcelV2(@RequestParam String shopId,@RequestParam("file") MultipartFile file) {
|
||||
// String fileName = file.getOriginalFilename();
|
||||
// if (file.isEmpty()) {
|
||||
// throw new BadRequestException("文件不能为空");
|
||||
// }
|
||||
// if (!fileName.contains("xls") && !fileName.contains("xlsx")) {
|
||||
// throw new BadRequestException("文件格式不正确");
|
||||
// }
|
||||
// try {
|
||||
// stockService.importExcelV2(shopId,file);
|
||||
// } catch (Exception e) {
|
||||
// log.error("文件导入库存异常:",e);
|
||||
// }
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
// @GetMapping
|
||||
// @ApiOperation("查询库存")
|
||||
// public ResponseEntity<Object> queryTbProduct(StockQueryDto criteria,
|
||||
// @RequestParam(required = false, defaultValue = "0") Integer page,
|
||||
// @RequestParam(required = false, defaultValue = "10") Integer size){
|
||||
// return new ResponseEntity<>(stockService.queryAll(criteria,page,size), HttpStatus.OK);
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/v2")
|
||||
// @ApiOperation("查询库存")
|
||||
// public ResponseEntity<Object> queryTbProductV2(StockQueryDto criteria,
|
||||
// @RequestParam(required = false, defaultValue = "0") Integer page,
|
||||
// @RequestParam(required = false, defaultValue = "10") Integer size){
|
||||
// Page<StockV2Vo> stockV2Vos = stockService.queryAllV2(criteria, page, size);
|
||||
// Map<String, Object> dataMap = BeanUtil.transBean2Map(stockV2Vos);
|
||||
// if (stockV2Vos.getContent().isEmpty()) {
|
||||
// dataMap.put("warnLine", 0);
|
||||
// }else {
|
||||
// StockV2Vo stockV2Vo = stockV2Vos.getContent().stream().filter(item -> item.getWarnLine() != null).findFirst().orElse(null);
|
||||
// dataMap.put("warnLine", stockV2Vo != null ? stockV2Vo.getWarnLine() : 0);
|
||||
// }
|
||||
// return new ResponseEntity<>(dataMap, HttpStatus.OK);
|
||||
// }
|
||||
|
||||
|
||||
@Log("商品库存 上下架商品")
|
||||
@PutMapping("/grounding")
|
||||
@ApiOperation("上下架商品")
|
||||
public ResponseEntity<Object> grounding(
|
||||
@RequestParam Integer shopId,
|
||||
@RequestParam Integer skuId,
|
||||
@RequestParam Boolean isGrounding
|
||||
){
|
||||
stockService.grounding(shopId,skuId, isGrounding);
|
||||
return ResponseEntity.ok("success");
|
||||
}
|
||||
// @Log("商品库存 上下架商品")
|
||||
// @PutMapping("/grounding")
|
||||
// @ApiOperation("上下架商品")
|
||||
// public ResponseEntity<Object> grounding(
|
||||
// @RequestParam Integer shopId,
|
||||
// @RequestParam Integer skuId,
|
||||
// @RequestParam Boolean isGrounding
|
||||
// ){
|
||||
// stockService.grounding(shopId,skuId, isGrounding);
|
||||
// return ResponseEntity.ok("success");
|
||||
// }
|
||||
|
||||
@GetMapping("/sku")
|
||||
@ApiOperation("查询库存")
|
||||
@@ -129,14 +129,14 @@ public class StockController {
|
||||
return new ResponseEntity<>(stockService.queryProductSku(productId), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/isStock")
|
||||
public ResponseEntity<Object> updateIsHot(
|
||||
@RequestParam String shopId,
|
||||
@RequestParam Integer proId,
|
||||
@RequestParam Integer isStock){
|
||||
stockService.updateIsStock(proId,shopId,isStock);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
// @GetMapping("/isStock")
|
||||
// public ResponseEntity<Object> updateIsHot(
|
||||
// @RequestParam String shopId,
|
||||
// @RequestParam Integer proId,
|
||||
// @RequestParam Integer isStock){
|
||||
// stockService.updateIsStock(proId,shopId,isStock);
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
|
||||
// @Log("商品库存 修改商品状态")
|
||||
@PostMapping("updateProductData")
|
||||
|
||||
@@ -8,6 +8,7 @@ import cn.ysk.cashier.vo.TbProductVo;
|
||||
import cn.ysk.cashier.service.product.TbProductService;
|
||||
import cn.ysk.cashier.dto.product.TbProductQueryCriteria;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -36,8 +37,8 @@ public class TbProductController {
|
||||
|
||||
@GetMapping("/list/v2")
|
||||
@ApiOperation("查询商品列表 新")
|
||||
public ResponseEntity<Object> queryTbProductV2(TbProductQueryV2Criteria criteria){
|
||||
return new ResponseEntity<>(tbProductService.queryAllV2(criteria),HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryTbProductV2(TbProductQueryV2Criteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbProductService.queryAllV2(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package cn.ysk.cashier.controller.product;
|
||||
|
||||
import cn.ysk.cashier.annotation.Log;
|
||||
import cn.ysk.cashier.dto.product.TbProductFrmLossDto;
|
||||
import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria;
|
||||
import cn.ysk.cashier.dto.product.TbProductStockDetailQueryCriteria;
|
||||
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
|
||||
import cn.ysk.cashier.service.product.TbProductStockDetailService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -25,7 +28,7 @@ import java.text.ParseException;
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "/product/Stock管理")
|
||||
@Api(tags = "商品库存记录管理")
|
||||
@RequestMapping("/api/tbProductStockDetail")
|
||||
public class TbProductStockDetailController {
|
||||
|
||||
@@ -38,28 +41,28 @@ public class TbProductStockDetailController {
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询/product/Stock")
|
||||
@ApiOperation("查询商品库存记录")
|
||||
public ResponseEntity<Object> queryTbProductStockDetail(TbProductStockDetailQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbProductStockDetailService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/stock/count")
|
||||
@ApiOperation("库存统计")
|
||||
@ApiOperation("商品库存统计")
|
||||
public ResponseEntity<Object> stockCount(@RequestBody TbProductStockCountQueryCriteria criteria) throws ParseException {
|
||||
return new ResponseEntity<>(tbProductStockDetailService.stockCount(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/stock/list")
|
||||
@ApiOperation("库存统计列表")
|
||||
@ApiOperation("商品库存统计列表")
|
||||
public ResponseEntity<Object> stockList(@RequestBody TbProductStockCountQueryCriteria criteria) throws ParseException {
|
||||
return new ResponseEntity<>(tbProductStockDetailService.stockList(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/stock")
|
||||
@ApiOperation("库存记录列表")
|
||||
@ApiOperation("商品库存记录列表")
|
||||
public ResponseEntity<Object> queryPage(@RequestBody TbProductStockDetailQueryCriteria criteria){
|
||||
return new ResponseEntity<>(tbProductStockDetailService.queryPage(criteria),HttpStatus.OK);
|
||||
}
|
||||
@@ -69,29 +72,37 @@ public class TbProductStockDetailController {
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 出库/入库
|
||||
* @param resources
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
@Log("出入库:#resources.productName")
|
||||
@ApiOperation("新增/product/Stock")
|
||||
public ResponseEntity<Object> createTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){
|
||||
return new ResponseEntity<>(tbProductStockDetailService.create(resources),HttpStatus.CREATED);
|
||||
@Log("商品报损")
|
||||
@PostMapping("frmLoss")
|
||||
@ApiOperation("商品报损")
|
||||
public ResponseEntity<Object> frmLoss(@Validated @RequestBody TbProductFrmLossDto resources){
|
||||
tbProductStockDetailService.frmLoss(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改/product/Stock")
|
||||
public ResponseEntity<Object> updateTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){
|
||||
tbProductStockDetailService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation("删除/product/Stock")
|
||||
public ResponseEntity<Object> deleteTbProductStockDetail(@RequestBody Long[] ids) {
|
||||
tbProductStockDetailService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
// /**
|
||||
// * 商品库存记录
|
||||
// * @param resources
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping
|
||||
// @Log("报损")
|
||||
// @ApiOperation("新增商品库存记录")
|
||||
// public ResponseEntity<Object> createTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){
|
||||
// return new ResponseEntity<>(tbProductStockDetailService.create(resources),HttpStatus.CREATED);
|
||||
// }
|
||||
//
|
||||
// @PutMapping
|
||||
// @ApiOperation("修改商品库存记录")
|
||||
// public ResponseEntity<Object> updateTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){
|
||||
// tbProductStockDetailService.update(resources);
|
||||
// return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
// }
|
||||
//
|
||||
// @DeleteMapping
|
||||
// @ApiOperation("删除商品库存记录")
|
||||
// public ResponseEntity<Object> deleteTbProductStockDetail(@RequestBody Long[] ids) {
|
||||
// tbProductStockDetailService.deleteAll(ids);
|
||||
// return new ResponseEntity<>(HttpStatus.OK);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class TbProductStockOperateController {
|
||||
}
|
||||
|
||||
@PostMapping("/outAndOn")
|
||||
@ApiOperation("新增/product/StockOperate")
|
||||
@ApiOperation("商品出入库")
|
||||
@Log("商品::#outAndOnDto.type")
|
||||
// @PreAuthorize("@el.check('tbProductStockOperate:add')")
|
||||
public ResponseEntity<Object> createOutAndONOperate(@RequestBody OutAndOnDto outAndOnDto){
|
||||
|
||||
Reference in New Issue
Block a user