diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoFlow.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoFlow.java index 2def2fa8..461630a3 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoFlow.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoFlow.java @@ -97,6 +97,12 @@ public class TbConsInfoFlow implements Serializable { @Column(name = "`order_no`") @ApiModelProperty(value = "订单编号") private String orderNo; + @Column(name = "`cover_img`") + @ApiModelProperty(value = "图片") + private String coverImg; + @Column(name = "`remark`") + @ApiModelProperty(value = "备注") + private String remark; @Transient @TableField(exist = false) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConsInfoFlowController.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConsInfoFlowController.java index 64acbc06..9bffe9af 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConsInfoFlowController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConsInfoFlowController.java @@ -1,18 +1,21 @@ package cn.ysk.cashier.cons.rest; import cn.ysk.cashier.annotation.Log; -import cn.ysk.cashier.cons.domain.TbConsInfoFlow; import cn.ysk.cashier.cons.service.TbConsInfoFlowService; +import cn.ysk.cashier.cons.service.dto.TbConsInfoFlowDto; import cn.ysk.cashier.cons.service.dto.TbConsInfoFlowQueryCriteria; -import org.springframework.data.domain.Pageable; +import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import io.swagger.annotations.*; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.text.ParseException; /** * @author admin @@ -26,39 +29,65 @@ public class TbConsInfoFlowController { private final TbConsInfoFlowService tbConsInfoFlowService; - @Log("导出数据") - @ApiOperation("导出数据") - @GetMapping(value = "/download") - public void exportTbConsInfoFlow(HttpServletResponse response, TbConsInfoFlowQueryCriteria criteria) throws IOException { - tbConsInfoFlowService.download(tbConsInfoFlowService.queryAll(criteria), response); +// @Log("导出数据") +// @ApiOperation("导出数据") +// @GetMapping(value = "/download") +// public void exportTbConsInfoFlow(HttpServletResponse response, TbConsInfoFlowQueryCriteria criteria) throws IOException { +// tbConsInfoFlowService.download(tbConsInfoFlowService.queryAll(criteria), response); +// } + + @PostMapping("/count") + @ApiOperation("耗材库存统计") + public ResponseEntity stockCount(@RequestBody TbProductStockCountQueryCriteria criteria) throws ParseException { + return new ResponseEntity<>(tbConsInfoFlowService.stockCount(criteria),HttpStatus.OK); + } +// +// @PostMapping("/list") +// @ApiOperation("耗材库存统计列表") +// public ResponseEntity stockList(@RequestBody TbProductStockCountQueryCriteria criteria) throws ParseException { +// return new ResponseEntity<>(tbConsInfoFlowService.stockList(criteria),HttpStatus.OK); +// } + + @PostMapping("/stock") + @ApiOperation("耗材库存记录列表") + public ResponseEntity queryPage(@RequestBody TbConsInfoFlowQueryCriteria criteria){ + return new ResponseEntity<>(tbConsInfoFlowService.queryPage(criteria),HttpStatus.OK); } - @GetMapping - @ApiOperation("查询耗材流水") - public ResponseEntity queryTbConsInfoFlow(TbConsInfoFlowQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(tbConsInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK); + @Log("耗材报损") + @PostMapping("frmLoss") + @ApiOperation("耗材报损") + public ResponseEntity frmLoss(@RequestBody TbConsInfoFlowDto resources){ + tbConsInfoFlowService.frmLoss(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } - @PostMapping - @Log("新增耗材流水") - @ApiOperation("新增耗材流水") - public ResponseEntity createTbConsInfoFlow(@Validated @RequestBody TbConsInfoFlow resources){ - return new ResponseEntity<>(tbConsInfoFlowService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @Log("修改耗材流水") - @ApiOperation("修改耗材流水") - public ResponseEntity updateTbConsInfoFlow(@Validated @RequestBody TbConsInfoFlow resources){ - tbConsInfoFlowService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @Log("删除耗材流水") - @ApiOperation("删除耗材流水") - public ResponseEntity deleteTbConsInfoFlow(@RequestBody Integer[] ids) { - tbConsInfoFlowService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } +// @GetMapping +// @ApiOperation("查询耗材流水") +// public ResponseEntity queryTbConsInfoFlow(TbConsInfoFlowQueryCriteria criteria, Pageable pageable){ +// return new ResponseEntity<>(tbConsInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK); +// } +// +// @PostMapping +// @Log("新增耗材流水") +// @ApiOperation("新增耗材流水") +// public ResponseEntity createTbConsInfoFlow(@Validated @RequestBody TbConsInfoFlow resources){ +// return new ResponseEntity<>(tbConsInfoFlowService.create(resources),HttpStatus.CREATED); +// } +// +// @PutMapping +// @Log("修改耗材流水") +// @ApiOperation("修改耗材流水") +// public ResponseEntity updateTbConsInfoFlow(@Validated @RequestBody TbConsInfoFlow resources){ +// tbConsInfoFlowService.update(resources); +// return new ResponseEntity<>(HttpStatus.NO_CONTENT); +// } +// +// @DeleteMapping +// @Log("删除耗材流水") +// @ApiOperation("删除耗材流水") +// public ResponseEntity deleteTbConsInfoFlow(@RequestBody Integer[] ids) { +// tbConsInfoFlowService.deleteAll(ids); +// return new ResponseEntity<>(HttpStatus.OK); +// } } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConInfoFlowController.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConInfoFlowController.java index 8de657ce..3f25bf93 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConInfoFlowController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConInfoFlowController.java @@ -33,9 +33,9 @@ public class ViewConInfoFlowController { viewConInfoFlowService.download(viewConInfoFlowService.queryAll(criteria), response); } - @GetMapping + @PostMapping("get") @ApiOperation("查询获取耗材流水信息") - public ResponseEntity queryViewConInfoFlow(ViewConInfoFlowQueryCriteria criteria, Pageable pageable){ + public ResponseEntity queryViewConInfoFlow(@RequestBody ViewConInfoFlowQueryCriteria criteria, Pageable pageable){ return new ResponseEntity<>(viewConInfoFlowService.queryAll(criteria,pageable),HttpStatus.OK); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/TbConsInfoFlowService.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/TbConsInfoFlowService.java index 8db39ddb..2c4d7b9b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/TbConsInfoFlowService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/TbConsInfoFlowService.java @@ -3,11 +3,15 @@ package cn.ysk.cashier.cons.service; import cn.ysk.cashier.cons.domain.TbConsInfoFlow; import cn.ysk.cashier.cons.service.dto.TbConsInfoFlowDto; import cn.ysk.cashier.cons.service.dto.TbConsInfoFlowQueryCriteria; +import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria; +import cn.ysk.cashier.vo.TbProductStockCountVo; import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; + import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.ParseException; +import java.util.List; +import java.util.Map; /** * @author admin @@ -30,6 +34,11 @@ public interface TbConsInfoFlowService { */ List queryAll(TbConsInfoFlowQueryCriteria criteria); + Map queryPage(TbConsInfoFlowQueryCriteria criteria); + TbProductStockCountVo stockCount(TbProductStockCountQueryCriteria criteria) throws ParseException; + Map stockList(TbProductStockCountQueryCriteria criteria) throws ParseException; + + void frmLoss(TbConsInfoFlowDto resources); /** * 根据ID查询 * @param id ID diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoFlowDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoFlowDto.java index 0af74af0..ebbca0f0 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoFlowDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoFlowDto.java @@ -1,27 +1,10 @@ -/* -* Copyright 2019-2020 Zheng Jie -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ package cn.ysk.cashier.cons.service.dto; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import javax.persistence.Column; -import java.sql.Timestamp; -import java.math.BigDecimal; import java.io.Serializable; +import java.math.BigDecimal; +import java.sql.Timestamp; /** * @author admin @@ -68,6 +51,9 @@ public class TbConsInfoFlowDto implements Serializable { private Integer orderId; private String orderNo; + private String coverImg; + private String remark; + } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoFlowQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoFlowQueryCriteria.java index 7e44066c..7909e3df 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoFlowQueryCriteria.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoFlowQueryCriteria.java @@ -13,23 +13,27 @@ import cn.ysk.cashier.annotation.Query; @Data public class TbConsInfoFlowQueryCriteria{ - /** 精确 */ + + @Query + private Integer shopId; @Query private Integer consId; - - /** 模糊 */ @Query(type = Query.Type.INNER_LIKE) private String conName; - /** 精确 */ - @Query - private Integer shopId; - - + private String column; + @Query(type = Query.Type.IN) + private List bizCode; @Query private String orderNo; @Query(type = Query.Type.NOT_EQUAL) private BigDecimal amount; + + private Integer page; + + private Integer size; + + } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowQueryCriteria.java index 8f09a610..6a045efe 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowQueryCriteria.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConInfoFlowQueryCriteria.java @@ -1,24 +1,35 @@ package cn.ysk.cashier.cons.service.dto; import lombok.Data; + +import java.util.Date; import java.util.List; + import cn.ysk.cashier.annotation.Query; /** -* @author admin -* @date 2024-07-17 -**/ + * @author admin + * @date 2024-07-17 + **/ @Data -public class ViewConInfoFlowQueryCriteria{ +public class ViewConInfoFlowQueryCriteria { - /** 模糊 */ + /** + * 模糊 + */ @Query(type = Query.Type.INNER_LIKE) private String conName; + @Query(type = Query.Type.INNER_LIKE) + private String productName; + @Query private String shopId; @Query - private String conTypeCode; + private Integer conTypeId; + + @Query(type = Query.Type.BETWEEN) + private List createTime; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoFlowServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoFlowServiceImpl.java index 7ad1151f..2aa8d71a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoFlowServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoFlowServiceImpl.java @@ -1,16 +1,27 @@ package cn.ysk.cashier.cons.service.impl; +import cn.hutool.core.bean.copier.CopyOptions; +import cn.hutool.core.util.StrUtil; +import cn.ysk.cashier.cons.domain.TbConsInfo; import cn.ysk.cashier.cons.domain.TbConsInfoFlow; -import cn.ysk.cashier.utils.FileUtil; -import cn.ysk.cashier.utils.PageUtil; -import cn.ysk.cashier.utils.QueryHelp; -import cn.ysk.cashier.utils.ValidationUtil; +import cn.ysk.cashier.cons.repository.TbConsInfoRepository; +import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria; +import cn.ysk.cashier.dto.product.TbProductStockDetailQueryCriteria; +import cn.ysk.cashier.dto.product.TbProductStockListDto; +import cn.ysk.cashier.exception.BadRequestException; +import cn.ysk.cashier.pojo.product.TbProduct; +import cn.ysk.cashier.pojo.product.TbProductStockDetail; +import cn.ysk.cashier.pojo.shop.TbShopUnit; +import cn.ysk.cashier.repository.product.ProductStockCountRepository; +import cn.ysk.cashier.utils.*; +import cn.ysk.cashier.vo.TbProductStockCountVo; import lombok.RequiredArgsConstructor; import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository; import cn.ysk.cashier.cons.service.TbConsInfoFlowService; import cn.ysk.cashier.cons.service.dto.TbConsInfoFlowDto; import cn.ysk.cashier.cons.service.dto.TbConsInfoFlowQueryCriteria; import cn.ysk.cashier.cons.service.mapstruct.TbConsInfoFlowMapper; +import org.apache.commons.lang3.StringUtils; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; @@ -19,6 +30,9 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import java.math.BigDecimal; +import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.*; import java.io.IOException; import javax.servlet.http.HttpServletResponse; @@ -34,7 +48,9 @@ import javax.servlet.http.HttpServletResponse; public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService { private final TbConsInfoFlowRepository tbConsInfoFlowRepository; + private final TbConsInfoRepository consInfoRepository; private final TbConsInfoFlowMapper tbConsInfoFlowMapper; + private final ProductStockCountRepository stockRepository; @Override public Map queryAll(TbConsInfoFlowQueryCriteria criteria, Pageable pageable){ @@ -59,6 +75,111 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService { return tbConsInfoFlowMapper.toDto(tbConsInfoFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); } + + //增加数量addCountNumber; stockIn cancelCart init stockIn checkStockIn + //手动增加addNumber; checkStockIn stockOtherIn + //退货refundNumber; cancelCart + //减少数量subCountNumber; createCart stockout checkStockOut + //手动减少subNumber; checkStockOut + //销售量/消耗saleNumber; createCart + //报损lossNumber; frmLoss + //入库stockInNumber; stockIn + //出库stockOutNumber; stockout + public Map queryPage(TbConsInfoFlowQueryCriteria criteria){ + if(StringUtils.isBlank(criteria.getColumn())){ + throw new BadRequestException("必填参数未填写"); + } + switch (criteria.getColumn()){ + case "addCountNumber": + criteria.setBizCode(Arrays.asList("stockIn","cancelCart","init","stockIn","checkStockIn")); + break; + case "addNumber": + criteria.setBizCode(Arrays.asList("checkStockIn", "stockOtherIn")); + break; + case "refundNumber": + criteria.setBizCode(Arrays.asList("cancelCart")); + break; + case "subCountNumber": + criteria.setBizCode(Arrays.asList("createCart","stockout","checkStockOut")); + break; + case "subNumber": + criteria.setBizCode(Arrays.asList("checkStockOut")); + break; + case "saleNumber": + criteria.setBizCode(Arrays.asList("createCart")); + break; + case "lossNumber": + criteria.setBizCode(Arrays.asList("frmLoss")); + break; + case "stockInNumber": + criteria.setBizCode(Arrays.asList("stockIn")); + break; + case "stockOutNumber": + criteria.setBizCode(Arrays.asList("stockout")); + break; + } + + Sort sort = Sort.by(Sort.Direction.DESC, "id"); + Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort); + + Page page = tbConsInfoFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) + -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page); + } + + @Override + public TbProductStockCountVo stockCount(TbProductStockCountQueryCriteria criteria) throws ParseException { + if (criteria.getStartTime() == null || criteria.getEndTime() == null) { + criteria.setEndTime(new Date());// + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + criteria.setStartTime(sdf.parse("2024-01-01"));//创建2024年1月1日的Date对象 + } + return stockRepository.consStockCount(criteria.getShopId(), criteria.getProductName(), + criteria.getCategoryId(), criteria.getStartTime(), criteria.getEndTime()); + } + + @Override + public Map stockList(TbProductStockCountQueryCriteria criteria) throws ParseException { + Sort sort = Sort.by(Sort.Direction.DESC, "id"); + Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort); + if (criteria.getStartTime() == null || criteria.getEndTime() == null) { + criteria.setEndTime(new Date());// + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + criteria.setStartTime(sdf.parse("2024-01-01"));//创建2024年1月1日的Date对象 + } + Page stockCountDtos = stockRepository.consStock( + criteria.getShopId().toString(), + criteria.getProductName(), + criteria.getCategoryId(), + DateUtil.getStrTime(criteria.getStartTime()), DateUtil.getStrTime(criteria.getEndTime()), pageable); + if (!stockCountDtos.isEmpty()) { + stockCountDtos.getContent().parallelStream().forEach(s->{ + s.setCountNumber(s.getStockNumber().add(s.getSubCountNumber())); + }); + } + return PageUtil.toPage(stockCountDtos); + } + + @Override + public void frmLoss(TbConsInfoFlowDto resources) { + TbConsInfo tbConsInfo = consInfoRepository.findById(resources.getConsId()).orElse(null); + if(Objects.isNull(tbConsInfo)){ + throw new BadRequestException("该耗材不存在"); + } + BigDecimal balance = tbConsInfo.getStockNumber().subtract(resources.getAmount()); + TbConsInfoFlow tbConsInfoFlow = new TbConsInfoFlow(); + cn.hutool.core.bean.BeanUtil.copyProperties(resources,tbConsInfoFlow, CopyOptions.create().setIgnoreNullValue(true)); + tbConsInfoFlow.setConName(tbConsInfo.getConName()); + tbConsInfoFlow.setBalance(balance); + tbConsInfoFlow.setBizCode("frmLoss"); + tbConsInfoFlow.setBizName("报损"); + tbConsInfoFlow.setBizType("-"); + tbConsInfoFlow.setCreateTime(new Timestamp(System.currentTimeMillis())); + tbConsInfoFlowRepository.save(tbConsInfoFlow); + tbConsInfo.setStockNumber(balance); + consInfoRepository.save(tbConsInfo); + } + @Override @Transactional public TbConsInfoFlowDto findById(Integer id) { diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java index cdf39717..4f0a8e04 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java @@ -280,7 +280,8 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { purveyorTransact.setType("cons_in"); object.put("number", conInfos.getStockNumber()); - } else if ("out".equals(resources.getType())) { + } + else if ("out".equals(resources.getType())) { stockOperate.setSubType(-1); if (conInfos.getStockNumber().compareTo(info.getStockNumber()) > 0) { @@ -303,7 +304,8 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())).negate()); purveyorTransact.setType("cons_out"); object.put("number", conInfos.getStockNumber()); - } else { + } + else { throw new BadRequestException("错误操作类型"); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/StockController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/StockController.java index 37c00d0c..61f6cc54 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/StockController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/StockController.java @@ -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 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 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 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 queryTbProductV2(StockQueryDto criteria, - @RequestParam(required = false, defaultValue = "0") Integer page, - @RequestParam(required = false, defaultValue = "10") Integer size){ - Page stockV2Vos = stockService.queryAllV2(criteria, page, size); - Map 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 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 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 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 queryTbProductV2(StockQueryDto criteria, +// @RequestParam(required = false, defaultValue = "0") Integer page, +// @RequestParam(required = false, defaultValue = "10") Integer size){ +// Page stockV2Vos = stockService.queryAllV2(criteria, page, size); +// Map 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 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 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 updateIsHot( - @RequestParam String shopId, - @RequestParam Integer proId, - @RequestParam Integer isStock){ - stockService.updateIsStock(proId,shopId,isStock); - return new ResponseEntity<>(HttpStatus.OK); - } +// @GetMapping("/isStock") +// public ResponseEntity updateIsHot( +// @RequestParam String shopId, +// @RequestParam Integer proId, +// @RequestParam Integer isStock){ +// stockService.updateIsStock(proId,shopId,isStock); +// return new ResponseEntity<>(HttpStatus.OK); +// } // @Log("商品库存 修改商品状态") @PostMapping("updateProductData") diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java index 85e89df6..f7d82a7f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductController.java @@ -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 queryTbProductV2(TbProductQueryV2Criteria criteria){ - return new ResponseEntity<>(tbProductService.queryAllV2(criteria),HttpStatus.OK); + public ResponseEntity queryTbProductV2(TbProductQueryV2Criteria criteria, Pageable pageable){ + return new ResponseEntity<>(tbProductService.queryAllV2(criteria,pageable),HttpStatus.OK); } @GetMapping("/list") diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductStockDetailController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductStockDetailController.java index c8a70c95..fea8556f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductStockDetailController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductStockDetailController.java @@ -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 queryTbProductStockDetail(TbProductStockDetailQueryCriteria criteria, Pageable pageable){ return new ResponseEntity<>(tbProductStockDetailService.queryAll(criteria,pageable),HttpStatus.OK); } @PostMapping("/stock/count") - @ApiOperation("库存统计") + @ApiOperation("商品库存统计") public ResponseEntity stockCount(@RequestBody TbProductStockCountQueryCriteria criteria) throws ParseException { return new ResponseEntity<>(tbProductStockDetailService.stockCount(criteria),HttpStatus.OK); } @PostMapping("/stock/list") - @ApiOperation("库存统计列表") + @ApiOperation("商品库存统计列表") public ResponseEntity stockList(@RequestBody TbProductStockCountQueryCriteria criteria) throws ParseException { return new ResponseEntity<>(tbProductStockDetailService.stockList(criteria),HttpStatus.OK); } @PostMapping("/stock") - @ApiOperation("库存记录列表") + @ApiOperation("商品库存记录列表") public ResponseEntity 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 createTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){ - return new ResponseEntity<>(tbProductStockDetailService.create(resources),HttpStatus.CREATED); + @Log("商品报损") + @PostMapping("frmLoss") + @ApiOperation("商品报损") + public ResponseEntity frmLoss(@Validated @RequestBody TbProductFrmLossDto resources){ + tbProductStockDetailService.frmLoss(resources); + return new ResponseEntity<>(HttpStatus.CREATED); } - @PutMapping - @ApiOperation("修改/product/Stock") - public ResponseEntity updateTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){ - tbProductStockDetailService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @ApiOperation("删除/product/Stock") - public ResponseEntity deleteTbProductStockDetail(@RequestBody Long[] ids) { - tbProductStockDetailService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } +// /** +// * 商品库存记录 +// * @param resources +// * @return +// */ +// @PostMapping +// @Log("报损") +// @ApiOperation("新增商品库存记录") +// public ResponseEntity createTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){ +// return new ResponseEntity<>(tbProductStockDetailService.create(resources),HttpStatus.CREATED); +// } +// +// @PutMapping +// @ApiOperation("修改商品库存记录") +// public ResponseEntity updateTbProductStockDetail(@Validated @RequestBody TbProductStockDetail resources){ +// tbProductStockDetailService.update(resources); +// return new ResponseEntity<>(HttpStatus.NO_CONTENT); +// } +// +// @DeleteMapping +// @ApiOperation("删除商品库存记录") +// public ResponseEntity deleteTbProductStockDetail(@RequestBody Long[] ids) { +// tbProductStockDetailService.deleteAll(ids); +// return new ResponseEntity<>(HttpStatus.OK); +// } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductStockOperateController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductStockOperateController.java index b8ea5c2d..f806bdb8 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductStockOperateController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbProductStockOperateController.java @@ -60,7 +60,7 @@ public class TbProductStockOperateController { } @PostMapping("/outAndOn") - @ApiOperation("新增/product/StockOperate") + @ApiOperation("商品出入库") @Log("商品::#outAndOnDto.type") // @PreAuthorize("@el.check('tbProductStockOperate:add')") public ResponseEntity createOutAndONOperate(@RequestBody OutAndOnDto outAndOnDto){ diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/ShopPrinterController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/ShopPrinterController.java new file mode 100644 index 00000000..da3b52da --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/ShopPrinterController.java @@ -0,0 +1,79 @@ +package cn.ysk.cashier.controller.shop; + +import cn.ysk.cashier.dto.shop.ShopPrinterDTO; +import cn.ysk.cashier.service.shop.ShopPrinterService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * 店铺打印机配置 + * + * @author tankaikai + * @since 2024-09-24 16:56 + */ +@Slf4j +@RestController +@RequiredArgsConstructor +@Api(tags = "店铺配置-打印机设置") +@RequestMapping("/api/shop-config/printer") +public class ShopPrinterController { + + private final ShopPrinterService shopPrinterService; + + @GetMapping("page") + @ApiOperation("分页") + public ResponseEntity page(@RequestParam Map params) { + Map page = shopPrinterService.page(params); + return ResponseEntity.ok().body(page); + } + + @GetMapping("list") + @ApiOperation("列表") + public ResponseEntity list(@RequestParam Map params) { + List list = shopPrinterService.list(params); + return ResponseEntity.ok().body(list); + } + + @GetMapping("{id}") + @ApiOperation("详情") + public ResponseEntity get(@PathVariable("id") Integer id) { + ShopPrinterDTO data = shopPrinterService.get(id); + return ResponseEntity.ok().body(data); + } + + @PostMapping + @ApiOperation("保存") + public ResponseEntity save(@RequestBody ShopPrinterDTO dto) { + shopPrinterService.save(dto); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PutMapping + @ApiOperation("修改") + public ResponseEntity update(@RequestBody ShopPrinterDTO dto) { + shopPrinterService.update(dto); + return new ResponseEntity<>(HttpStatus.OK); + } + + @DeleteMapping("{id}") + @ApiOperation("删除") + public ResponseEntity delete(@PathVariable("id") Integer id) { + shopPrinterService.delete(id); + return new ResponseEntity<>(HttpStatus.OK); + } + + @PostMapping("update-status") + @ApiOperation("停用或启用") + public ResponseEntity updateStatus(@RequestBody ShopPrinterDTO dto) { + shopPrinterService.updateStatus(dto.getId(), dto.getStatus()); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductFrmLossDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductFrmLossDto.java new file mode 100644 index 00000000..19d94133 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductFrmLossDto.java @@ -0,0 +1,20 @@ +package cn.ysk.cashier.dto.product; + +import lombok.Data; +import lombok.NonNull; + +@Data +public class TbProductFrmLossDto { + @NonNull + private String shopId; + @NonNull + private String productId; + @NonNull + private String coverImg; + @NonNull + private Double stockNumber; + private String remark; + private Integer subType = -1; + private String type = "报损"; + +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java index d29a96e6..7ab80b14 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductQueryV2Criteria.java @@ -23,8 +23,7 @@ import java.math.BigDecimal; import java.util.Arrays; import java.util.List; -import static cn.ysk.cashier.annotation.Query.Type.IN; -import static cn.ysk.cashier.annotation.Query.Type.INNER_LIKE; +import static cn.ysk.cashier.annotation.Query.Type.*; /** * @website https://eladmin.vip @@ -59,9 +58,12 @@ public class TbProductQueryV2Criteria { @Query(type = IN) private List typeEnum = Arrays.asList("normal","sku"); - private Integer page; + @Query(type = BETWEEN) + private List createdAt; - private Integer size; +// private Integer page; +// +// private Integer size; public void setType(String type) { if(StringUtils.isNotBlank(type)){ diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockListDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockListDto.java index eb64a09f..b916402f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockListDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockListDto.java @@ -11,8 +11,8 @@ import java.math.BigDecimal; @Entity public class TbProductStockListDto { @Id - private String productId; - private String productName; + private String id; + private String name; // private String specSnap; @Transient private BigDecimal countNumber; @@ -24,4 +24,7 @@ public class TbProductStockListDto { private BigDecimal lossNumber; private BigDecimal refundNumber; + private BigDecimal stockInNumber; + private BigDecimal stockOutNumber; + } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/ShopPrinterDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/ShopPrinterDTO.java new file mode 100644 index 00000000..027342b6 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/ShopPrinterDTO.java @@ -0,0 +1,67 @@ +package cn.ysk.cashier.dto.shop; + +import lombok.Data; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * 店铺打印机配置 + * + * @author tankaikai + * @since 2024-09-24 17:13 + */ +@Data +public class ShopPrinterDTO implements Serializable { + private static final long serialVersionUID = 1L; + + private Integer id; + + private String name; + + private String type; + + private String connectionType; + + private String address; + + private String port; + + private String subType; + + private Integer status; + + private String shopId; + + private String categoryIds; + + private String contentType; + + private String createdAt; + + private String updatedAt; + + private Integer sort; + + private String vendorId; + + private String productId; + private String config; + + public String getCreatedAt() { + if("".equals(createdAt) || createdAt == null){ + return ""; + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return sdf.format(new Date(Long.valueOf(createdAt))); + } + + public String getUpdatedAt() { + if("".equals(updatedAt) || updatedAt == null){ + return ""; + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return sdf.format(new Date(Long.valueOf(updatedAt))); + } +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPrintMachineMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPrintMachineMapper.java new file mode 100644 index 00000000..ed77ce9a --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPrintMachineMapper.java @@ -0,0 +1,14 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.pojo.shop.TbPrintMachineEntity; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 店铺打印机配置 + * @author tankaikai + * @since 2024-09-25 11:47 + */ +@Mapper +public interface TbPrintMachineMapper extends BaseMapper { +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbPrintMachineEntity.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbPrintMachineEntity.java new file mode 100644 index 00000000..710660f5 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbPrintMachineEntity.java @@ -0,0 +1,45 @@ +package cn.ysk.cashier.pojo.shop; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.io.Serializable; + +/** + * 店铺打印机配置 + * + * @author tankaikai + * @since 2024-09-25 11:49 + */ +@Data +@TableName("tb_print_machine") +public class TbPrintMachineEntity implements Serializable { + private static final long serialVersionUID = 1L; + /** + * id + */ + @TableId(type = IdType.AUTO) + private Integer id; + + private String name; + + private String type; + private String connectionType; + private String address; + private String port; + private String subType; + private Integer status; + private String shopId; + private String categoryIds; + private String contentType; + private String config; + private Long createdAt; + private Long updatedAt; + private String categoryList; + private Integer sort; + private String vendorId; + private String productId; + +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/product/ProductStockCountRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/product/ProductStockCountRepository.java index 1b65d0cd..1b46140a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/product/ProductStockCountRepository.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/repository/product/ProductStockCountRepository.java @@ -7,6 +7,8 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; +import java.util.Date; + /** * @author lyf @@ -17,66 +19,149 @@ public interface ProductStockCountRepository extends JpaRepository :startTime " + "AND d.created_at < :endTime " + "GROUP BY " + "d.product_id ", - countQuery = "SELECT count(*)" + + countQuery = "SELECT count(1)" + " FROM " + " tb_product_stock_detail d " + " INNER JOIN tb_product pro ON d.product_id = pro.id " + " and pro.shop_id = :shopId " + " and (:categoryId IS NULL OR pro.category_id = :categoryId) " + + " AND (:productName IS NULL OR d.product_name LIKE %:productName%) " + " WHERE " + " d.shop_id = :shopId " + - " AND (:productName IS NULL OR d.product_name LIKE %:productName%) " + " AND d.created_at > :startTime " + " AND d.created_at < :endTime " + " GROUP BY " + " d.product_id " , nativeQuery = true) - Page stock2(String shopId, + Page productStock(String shopId, String productName, String categoryId, long startTime, long endTime, Pageable pageable); - @Query("SELECT new cn.ysk.cashier.vo.TbProductStockCountVo(" + + + @Query("SELECT new cn.ysk.cashier.vo.TbProductStockCountVo( " + " SUM( pro.stockNumber ) , " + - " SUM( CASE WHEN detail.subType = 1 THEN detail.stockNumber ELSE 0 END ) , " + - " SUM( CASE WHEN detail.subType = - 1 THEN detail.stockNumber ELSE 0 END ) , " + - " SUM( CASE WHEN detail.type IN ( '供应商入库', '盘点入库', '其他入库' ) THEN detail.stockNumber ELSE 0 END ) , " + - " SUM( CASE WHEN detail.type IN ( '供应商出库', '盘点出库', '其他出库' ) THEN detail.stockNumber ELSE 0 END ) , " + - " SUM( CASE WHEN detail.type = '售出记录' THEN detail.stockNumber ELSE 0 END ) , " + - " SUM( CASE WHEN detail.type = '报损' THEN detail.stockNumber ELSE 0 END ) ," + - " SUM( CASE WHEN detail.type = '退单' THEN detail.stockNumber ELSE 0 END ))" + + " SUM( CASE WHEN detail.subType = 1 THEN ABS(detail.stockNumber) ELSE 0 END ) , " + + " SUM( CASE WHEN detail.subType = - 1 THEN ABS(detail.stockNumber) ELSE 0 END ) , " + + " SUM( CASE WHEN detail.type IN ( '供应商入库', '盘点入库', '其他入库' ) THEN ABS(detail.stockNumber) ELSE 0 END ) , " + + " SUM( CASE WHEN detail.type IN ( '供应商出库', '盘点出库', '其他出库' ) THEN ABS(detail.stockNumber) ELSE 0 END ) , " + + " SUM( CASE WHEN detail.type = '售出记录' THEN ABS(detail.stockNumber) ELSE 0 END ) , " + + " SUM( CASE WHEN detail.type = '报损' THEN ABS(detail.stockNumber) ELSE 0 END ) ," + + " SUM( CASE WHEN detail.type = '退单' THEN ABS(detail.stockNumber) ELSE 0 END ))" + "FROM " + " TbProductStockDetail detail " + " INNER JOIN TbProduct pro ON detail.productId = pro.id " + " AND pro.shopId = :shopId " + " AND ( :categoryId IS NULL OR pro.categoryId = :categoryId ) " + + " AND ( :productName IS NULL OR detail.productName LIKE %:productName% ) " + "WHERE " + " detail.shopId = :shopId " + - " AND ( :productName IS NULL OR detail.productName LIKE %:productName% ) " + " AND detail.createdAt > :startTime " + " AND detail.createdAt < :endTime") - TbProductStockCountVo stockCount(String shopId, + TbProductStockCountVo productStockCount(String shopId, String productName, String categoryId, long startTime, long endTime); + + @Query(value = "SELECT " + + " flow.cons_id AS id, " + + " cons.con_name AS `name`, " + + " cons.stock_number AS stock_number, " + + " SUM( CASE WHEN flow.biz_type = - 1 THEN flow.amount ELSE 0 END ) AS sub_count_number, " + + " SUM( CASE WHEN flow.biz_code IN ( 'checkStockIn','stockOtherIn' ) THEN flow.amount ELSE 0 END ) AS add_number, " + + " SUM( CASE WHEN flow.biz_code = 'checkStockOut' THEN flow.amount ELSE 0 END ) AS sub_number, " + + " SUM( CASE WHEN flow.biz_code = 'stockIn' THEN flow.amount ELSE 0 END ) AS stock_in_number, " + + " SUM( CASE WHEN flow.biz_code = 'stockout' THEN flow.amount ELSE 0 END ) AS stock_out_number, " + + " SUM( CASE WHEN flow.biz_code = 'createCart' THEN flow.amount ELSE 0 END ) AS sale_number, " + + " SUM( CASE WHEN flow.biz_code = 'frmLoss' THEN flow.amount ELSE 0 END ) AS loss_number, " + + " SUM( CASE WHEN flow.biz_code = 'cancelCart' THEN flow.amount ELSE 0 END ) AS refund_number " + + "FROM " + + " tb_cons_info_flow flow " + + " INNER JOIN tb_cons_info cons ON flow.cons_id = cons.id " + + " AND cons.shop_id = :shopId " + + " AND (:conTypeId IS NULL OR cons.con_type_id = :conTypeId ) " + + " AND (:conName IS NULL OR flow.con_name LIKE %:conName%) " + + "WHERE " + + " flow.shop_id = :shopId " + + " AND flow.created_at > :startTime " + + " AND flow.created_at < :endTime " + + "GROUP BY " + + " flow.product_id", + countQuery = "SELECT " + + " count(1) " + + "FROM " + + " tb_cons_info_flow flow " + + " INNER JOIN tb_cons_info cons ON flow.cons_id = cons.id " + + " AND cons.shop_id = :shopId " + + " AND (:conTypeId IS NULL OR pro.con_type_id = :conTypeId ) " + + " AND (:conName IS NULL OR flow.con_name LIKE %:conName%) " + + "WHERE " + + " flow.shop_id = :shopId " + + " AND flow.create_time > :startTime " + + " AND flow.create_time < :endTime " + + "GROUP BY " + + " flow.product_id" + , nativeQuery = true) + Page consStock(String shopId, + String conName, + String conTypeId, String startTime, String endTime, Pageable pageable); + + + //现有数量stockNumber; + //增加数量addCountNumber; + //减少数量subCountNumber; + + //手动增加addNumber; checkStockIn stockOtherIn + //手动减少subNumber; checkStockOut + //销售量/消耗saleNumber; createCart + //报损lossNumber; frmLoss + //退货refundNumber; cancelCart + //入库stockInNumber; stockIn + //出库stockOutNumber; stockout + @Query(" SELECT new cn.ysk.cashier.vo.TbProductStockCountVo(" + + " SUM( cons.stockNumber ) , " + + " SUM( CASE WHEN flow.bizType = '+' THEN flow.amount ELSE 0 END ) , " + + " SUM( CASE WHEN flow.bizType = '-' THEN flow.amount ELSE 0 END ) , " + + + " SUM( CASE WHEN flow.bizCode IN ( 'checkStockIn','stockOtherIn' ) THEN flow.amount ELSE 0 END ) , " + + " SUM( CASE WHEN flow.bizCode = 'checkStockOut' THEN flow.amount ELSE 0 END ) , " + + " SUM( CASE WHEN flow.bizCode = 'createCart' THEN flow.amount ELSE 0 END ) , " + + " SUM( CASE WHEN flow.bizCode = 'frmLoss' THEN flow.amount ELSE 0 END ) ," + + " SUM( CASE WHEN flow.bizCode = 'cancelCart' THEN flow.amount ELSE 0 END ) ," + + " SUM( CASE WHEN flow.bizCode = 'stockIn' THEN flow.amount ELSE 0 END ) ," + + " SUM( CASE WHEN flow.bizCode = 'stockout' THEN flow.amount ELSE 0 END )) " + + "FROM " + + " TbConsInfoFlow flow " + + " INNER JOIN TbConsInfo cons ON flow.consId = cons.id " + + " AND cons.shopId = :shopId " + + " AND (:conTypeId IS NULL OR cons.conTypeId = :conTypeId ) " + + " AND (:conName IS NULL OR flow.conName LIKE %:conName%) " + + "WHERE " + + " flow.shopId = :shopId " + + " AND flow.createTime > :startTime " + + " AND flow.createTime < :endTime ") + TbProductStockCountVo consStockCount(Integer shopId, + String conName, + String conTypeId, Date startTime, Date endTime); + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/SummaryServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/SummaryServiceImpl.java index aa91ba33..c9fe4148 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/SummaryServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/SummaryServiceImpl.java @@ -241,7 +241,7 @@ public class SummaryServiceImpl implements SummaryService { List numList = new ArrayList<>(); for (Object[] o : objects) { CountDateVO countDateVO = new CountDateVO(); - BigInteger integers = (BigInteger) o[0]; + BigDecimal integers = (BigDecimal) o[0]; countDateVO.setCount(new BigDecimal(integers.toString())); Date date = (Date) o[2]; countDateVO.setTradeDay(date.toString()); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java index 01771974..4d444143 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductServiceImpl.java @@ -239,9 +239,7 @@ public class TbProductServiceImpl implements TbProductService { } @Override - public Map queryAllV2(TbProductQueryV2Criteria criteria) { - Sort sort = Sort.by(Sort.Direction.ASC, "sort"); - Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort); + public Map queryAllV2(TbProductQueryV2Criteria criteria,Pageable pageable) { //查询商品数据 Page page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); List products = new ArrayList<>(); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java index 0bd63015..44f2c08f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockDetailServiceImpl.java @@ -1,14 +1,19 @@ package cn.ysk.cashier.service.impl.productimpl; +import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.util.StrUtil; import cn.ysk.cashier.dto.product.*; import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mybatis.mapper.TbProducSkutMapper; import cn.ysk.cashier.pojo.order.TbOrderInfo; +import cn.ysk.cashier.pojo.product.TbProduct; import cn.ysk.cashier.pojo.product.TbProductStockDetail; +import cn.ysk.cashier.pojo.shop.TbShopUnit; import cn.ysk.cashier.repository.order.StockCountRepository; import cn.ysk.cashier.repository.order.TbOrderInfoRepository; import cn.ysk.cashier.repository.product.ProductStockCountRepository; +import cn.ysk.cashier.repository.product.TbProductRepository; +import cn.ysk.cashier.repository.shop.TbShopUnitRepository; import cn.ysk.cashier.utils.*; import cn.ysk.cashier.vo.TbProductStockCountVo; import lombok.RequiredArgsConstructor; @@ -46,6 +51,8 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ private final TbProductStockDetailRepository tbProductStockDetailRepository; private final TbProductStockDetailMapper tbProductStockDetailMapper; + private final TbProductRepository tbProductRepository; + private final TbShopUnitRepository shopUnitRepository; private final StockCountRepository stockCountRepository; private final ProductStockCountRepository stockRepository; private final EntityManager entityManager; @@ -122,7 +129,7 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); criteria.setStartTime(sdf.parse("2024-01-01"));//创建2024年1月1日的Date对象 } - return stockRepository.stockCount(criteria.getShopId().toString(), criteria.getProductName(), + return stockRepository.productStockCount(criteria.getShopId().toString(), criteria.getProductName(), criteria.getCategoryId(), criteria.getStartTime().getTime(), criteria.getEndTime().getTime()); } @@ -135,7 +142,7 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); criteria.setStartTime(sdf.parse("2024-01-01"));//创建2024年1月1日的Date对象 } - Page tbProductStockCountDtos = stockRepository.stock2( + Page tbProductStockCountDtos = stockRepository.productStock( criteria.getShopId().toString(), criteria.getProductName(), criteria.getCategoryId(), @@ -170,6 +177,25 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ return map; } + @Override + public void frmLoss(TbProductFrmLossDto resources) { + TbProduct product = tbProductRepository.findById(Integer.valueOf(resources.getProductId())).orElse(null); + if(Objects.isNull(product)){ + throw new BadRequestException("该商品不存在"); + } + TbShopUnit tbShopUnit = shopUnitRepository.findById(product.getUnitId()).orElse(null); + TbProductStockDetail stockDetail = new TbProductStockDetail(); + cn.hutool.core.bean.BeanUtil.copyProperties(resources,stockDetail, CopyOptions.create().setIgnoreNullValue(true)); + stockDetail.setLeftNumber(product.getStockNumber());//原库存 + stockDetail.setStockNumber(-stockDetail.getStockNumber());//变动数量 + stockDetail.setSourcePath("CASHIER-APP"); + stockDetail.setProductName(product.getName()); + stockDetail.setUnitName(tbShopUnit==null?"":tbShopUnit.getName()); + tbProductStockDetailRepository.save(stockDetail); + product.setStockNumber(product.getStockNumber()-stockDetail.getStockNumber().intValue()); + tbProductRepository.save(product); + } + @Override @Transactional(rollbackFor = Exception.class) public TbProductStockDetailDto create(TbProductStockDetail resources) { diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/ShopPrinterServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/ShopPrinterServiceImpl.java new file mode 100644 index 00000000..4f52b5f1 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/ShopPrinterServiceImpl.java @@ -0,0 +1,128 @@ +package cn.ysk.cashier.service.impl.shopimpl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.map.MapProxy; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.ysk.cashier.dto.shop.ShopPrinterDTO; +import cn.ysk.cashier.mybatis.mapper.TbPrintMachineMapper; +import cn.ysk.cashier.pojo.shop.TbPrintMachineEntity; +import cn.ysk.cashier.service.shop.ShopPrinterService; +import cn.ysk.cashier.utils.PageUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * 店铺打印机配置ServiceImpl + * + * @author tankaikai + * @since 2024-09-25 13:53 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class ShopPrinterServiceImpl extends ServiceImpl implements ShopPrinterService { + + private QueryWrapper getWrapper(Map params) { + + MapProxy mapProxy = MapProxy.create(params); + QueryWrapper wrapper = new QueryWrapper<>(); + + String shopId = mapProxy.getStr("shopId"); + wrapper.lambda().eq(StrUtil.isNotEmpty(shopId), TbPrintMachineEntity::getShopId, shopId); + String name = mapProxy.getStr("name"); + wrapper.lambda().likeRight(StrUtil.isNotEmpty(name), TbPrintMachineEntity::getName, name); + String type = mapProxy.getStr("type"); + wrapper.lambda().eq(StrUtil.isNotEmpty(type), TbPrintMachineEntity::getType, type); + String connectionType = mapProxy.getStr("connectionType"); + wrapper.lambda().eq(StrUtil.isNotEmpty(connectionType), TbPrintMachineEntity::getConnectionType, connectionType); + String address = mapProxy.getStr("address"); + wrapper.lambda().eq(StrUtil.isNotEmpty(address), TbPrintMachineEntity::getAddress, address); + String port = mapProxy.getStr("port"); + wrapper.lambda().eq(StrUtil.isNotEmpty(port), TbPrintMachineEntity::getPort, port); + String subType = mapProxy.getStr("subType"); + wrapper.lambda().eq(StrUtil.isNotEmpty(subType), TbPrintMachineEntity::getSubType, subType); + Integer status = mapProxy.getInt("status"); + wrapper.lambda().eq(ObjectUtil.isNotNull(status), TbPrintMachineEntity::getStatus, status); + String categoryIds = mapProxy.getStr("categoryIds"); + wrapper.lambda().eq(StrUtil.isNotEmpty(categoryIds), TbPrintMachineEntity::getCategoryIds, categoryIds); + String contentType = mapProxy.getStr("contentType"); + wrapper.lambda().eq(StrUtil.isNotEmpty(contentType), TbPrintMachineEntity::getContentType, contentType); + String config = mapProxy.getStr("config"); + wrapper.lambda().eq(StrUtil.isNotEmpty(config), TbPrintMachineEntity::getConfig, config); + String categoryList = mapProxy.getStr("categoryList"); + wrapper.lambda().eq(StrUtil.isNotEmpty(categoryList), TbPrintMachineEntity::getCategoryList, categoryList); + String vendorId = mapProxy.getStr("vendorId"); + wrapper.lambda().eq(StrUtil.isNotEmpty(vendorId), TbPrintMachineEntity::getVendorId, vendorId); + String productId = mapProxy.getStr("productId"); + wrapper.lambda().eq(StrUtil.isNotEmpty(productId), TbPrintMachineEntity::getProductId, productId); + + wrapper.lambda().orderByAsc(TbPrintMachineEntity::getSort); + wrapper.lambda().orderByDesc(TbPrintMachineEntity::getId); + + return wrapper; + } + + @Override + public Map page(Map params) { + MapProxy mapProxy = MapProxy.create(params); + int pageNum = mapProxy.getInt("page", 1); + int pageSize = mapProxy.getInt("size", 10); + Page page = baseMapper.selectPage(new Page<>(pageNum, pageSize), getWrapper(params)); + List list = BeanUtil.copyToList(page.getRecords(), ShopPrinterDTO.class); + return PageUtil.toPlusPage(list, Convert.toInt(page.getTotal())); + } + + @Override + public List list(Map params) { + List list = baseMapper.selectList(getWrapper(params)); + return BeanUtil.copyToList(list, ShopPrinterDTO.class); + } + + @Override + public ShopPrinterDTO get(Integer id) { + TbPrintMachineEntity entity = baseMapper.selectById(id); + return BeanUtil.toBean(entity, ShopPrinterDTO.class); + } + + @Override + public void save(ShopPrinterDTO dto) { + CopyOptions options = new CopyOptions(); + options.setIgnoreProperties("createdAt", "updatedAt"); + TbPrintMachineEntity entity = BeanUtil.toBean(dto, TbPrintMachineEntity.class, options); + entity.setCreatedAt(System.currentTimeMillis()); + entity.setUpdatedAt(System.currentTimeMillis()); + baseMapper.insert(entity); + } + + @Override + public void update(ShopPrinterDTO dto) { + TbPrintMachineEntity entity = baseMapper.selectById(dto.getId()); + CopyOptions options = new CopyOptions(); + options.setIgnoreProperties("createdAt", "updatedAt"); + BeanUtil.copyProperties(dto, entity, options); + entity.setUpdatedAt(System.currentTimeMillis()); + baseMapper.updateById(entity); + } + + @Override + public void delete(Integer id) { + baseMapper.deleteById(id); + } + + @Override + public void updateStatus(Integer id, Integer status) { + baseMapper.update(null, new LambdaUpdateWrapper() + .set(TbPrintMachineEntity::getStatus, status).eq(TbPrintMachineEntity::getId, id)); + } +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java index 5b749782..330c43e6 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductService.java @@ -6,6 +6,7 @@ import cn.ysk.cashier.pojo.product.TbProduct; import cn.ysk.cashier.vo.TbProductVo; import cn.ysk.cashier.dto.product.TbProductDto; import cn.ysk.cashier.dto.product.TbProductQueryCriteria; +import org.springframework.data.domain.Pageable; import java.util.Map; import java.util.List; @@ -30,7 +31,7 @@ public interface TbProductService { Map queryAll(TbProductQueryCriteria criteria, boolean isAdmin); - Map queryAllV2(TbProductQueryV2Criteria criteria); + Map queryAllV2(TbProductQueryV2Criteria criteria, Pageable pageable); /** diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductStockDetailService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductStockDetailService.java index ad8ed791..f0280af0 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductStockDetailService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/product/TbProductStockDetailService.java @@ -1,5 +1,6 @@ package cn.ysk.cashier.service.product; +import cn.ysk.cashier.dto.product.TbProductFrmLossDto; import cn.ysk.cashier.dto.product.TbProductStockCountQueryCriteria; import cn.ysk.cashier.dto.rabbit.StockRecordMsg; import cn.ysk.cashier.pojo.product.TbProductStockDetail; @@ -51,6 +52,8 @@ public interface TbProductStockDetailService { TbProductStockDetailDto findById(Long id); HashMap sumStockNumber(String productId); + + void frmLoss(TbProductFrmLossDto resources); /** * 创建 * @param resources / diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/ShopPrinterService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/ShopPrinterService.java new file mode 100644 index 00000000..88d59288 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/ShopPrinterService.java @@ -0,0 +1,31 @@ +package cn.ysk.cashier.service.shop; + +import cn.ysk.cashier.dto.shop.ShopPrinterDTO; +import cn.ysk.cashier.pojo.shop.TbPrintMachineEntity; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; +import java.util.Map; + +/** + * 店铺打印机配置Service + * @author tankaikai + * @since 2024-09-24 17:15 + */ +public interface ShopPrinterService extends IService { + + Map page(Map params); + + List list(Map params); + + ShopPrinterDTO get(Integer id); + + void save(ShopPrinterDTO dto); + + void update(ShopPrinterDTO dto); + + void delete(Integer id); + + void updateStatus(Integer id,Integer status); + +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbProductStockCountVo.java b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbProductStockCountVo.java index 5473b054..ff59ffe8 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbProductStockCountVo.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbProductStockCountVo.java @@ -4,25 +4,31 @@ import lombok.Data; @Data public class TbProductStockCountVo { - //现有 - private Long stockNumber; - //增加 - private Double addCountNumber; - //减少 - private Double subCountNumber; - //增加 - private Double addNumber; - //减少 - private Double subNumber; - //销售量 - private Double saleNumber; + //现有数量 + private Object stockNumber; + //增加数量 + private Object addCountNumber; + //减少数量 + private Object subCountNumber; + //手动增加 + private Object addNumber; + //手动减少 + private Object subNumber; + //销售量/消耗 + private Object saleNumber; //报损 - private Double lossNumber; + private Object lossNumber; //退货 - private Double refundNumber; + private Object refundNumber; + //入库 + private Object stockInNumber; + //出库 + private Object stockOutNumber; - public TbProductStockCountVo(Long stockNumber, Double addCountNumber, Double subCountNumber, Double addNumber, Double subNumber, Double saleNumber, Double lossNumber, Double refundNumber) { + public TbProductStockCountVo( + Object stockNumber, Object addCountNumber, Object subCountNumber, Object addNumber, + Object subNumber, Object saleNumber, Object lossNumber, Object refundNumber) { this.stockNumber = stockNumber; this.addCountNumber = addCountNumber; this.subCountNumber = subCountNumber; @@ -32,4 +38,31 @@ public class TbProductStockCountVo { this.lossNumber = lossNumber; this.refundNumber = refundNumber; } + + + //现有数量stockNumber; + //增加数量addCountNumber; + //减少数量subCountNumber; + //手动增加addNumber; + //手动减少subNumber; + //销售量/消耗saleNumber; + //报损lossNumber; + //退货refundNumber; + //入库stockInNumber; + //出库stockOutNumber; + + public TbProductStockCountVo( + Object stockNumber, Object addCountNumber, Object subCountNumber, Object addNumber, Object subNumber, + Object saleNumber, Object lossNumber, Object refundNumber, Object stockInNumber, Object stockOutNumber) { + this.stockNumber = stockNumber; + this.addCountNumber = addCountNumber; + this.subCountNumber = subCountNumber; + this.addNumber = addNumber; + this.subNumber = subNumber; + this.saleNumber = saleNumber; + this.lossNumber = lossNumber; + this.refundNumber = refundNumber; + this.stockInNumber = stockInNumber; + this.stockOutNumber = stockOutNumber; + } } diff --git a/eladmin-system/src/main/resources/mapper/TbPrintMachineMapper.xml b/eladmin-system/src/main/resources/mapper/TbPrintMachineMapper.xml new file mode 100644 index 00000000..7a8c6eb3 --- /dev/null +++ b/eladmin-system/src/main/resources/mapper/TbPrintMachineMapper.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file