From 61b92e07ba35744f944b3bf9b41bb3badef2b577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Thu, 26 Sep 2024 16:56:36 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=BA=97=E9=93=BA=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E5=BA=97=E9=93=BA=E5=88=97=E8=A1=A8>=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=AE=9D=E5=B0=8F=E7=A8=8B=E5=BA=8Fappid=E5=BD=95=E5=85=A5?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/pojo/shop/TbMerchantThirdApply.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantThirdApply.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantThirdApply.java index f1e2ccfe..56098345 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantThirdApply.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantThirdApply.java @@ -15,11 +15,15 @@ */ package cn.ysk.cashier.pojo.shop; -import lombok.Data; import cn.hutool.core.bean.BeanUtil; -import io.swagger.annotations.ApiModelProperty; import cn.hutool.core.bean.copier.CopyOptions; -import javax.persistence.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; import java.io.Serializable; /** @@ -47,9 +51,13 @@ public class TbMerchantThirdApply implements Serializable { private String appId; @Column(name = "`small_appid`") - @ApiModelProperty(value = "小程序appid") + @ApiModelProperty(value = "微信小程序appid") private String smallAppid; + @Column(name = "`small_appid`") + @ApiModelProperty(value = "支付宝小程序appid") + private String alipaySmallAppid; + @Column(name = "`store_id`") @ApiModelProperty(value = "店铺id") private String storeId; From 3302b8dd246a1072ad9bca2d04dc82a115fd7387 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 26 Sep 2024 17:01:35 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=BA=93=E5=AD=98=E8=AE=B0=E5=BD=95=20?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/cons/domain/TbConsInfoFlow.java | 4 ++++ .../cons/service/dto/TbConsInfoFlowDto.java | 2 +- .../service/impl/TbConCheckServiceImpl.java | 8 ++----- .../impl/TbConsInfoFlowServiceImpl.java | 1 + .../service/impl/TbConsInfoServiceImpl.java | 10 ++++----- .../dto/product/TbProductStockDetailDto.java | 2 ++ .../cashier/dto/rabbit/StockRecordMsg.java | 1 + .../product/TbProductStockDetailMapper.java | 20 +++++------------ .../impl/productimpl/StockServiceImpl.java | 22 +++++++++++++++++++ .../TbProductStockDetailServiceImpl.java | 8 ++----- .../TbProductStockOperateServiceImpl.java | 1 + 11 files changed, 46 insertions(+), 33 deletions(-) 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 461630a3..6c778935 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 @@ -104,6 +104,10 @@ public class TbConsInfoFlow implements Serializable { @ApiModelProperty(value = "备注") private String remark; + @Column(name = "`operator`") + @ApiModelProperty(value = "操作人") + private String operator; + @Transient @TableField(exist = false) private String productName; 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 ebbca0f0..6aa93f5b 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 @@ -53,7 +53,7 @@ public class TbConsInfoFlowDto implements Serializable { private String orderNo; private String coverImg; private String remark; - + private String operator; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java index 00f14d7a..b5658bc3 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java @@ -6,10 +6,7 @@ import cn.ysk.cashier.cons.domain.TbConsInfoFlow; import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository; import cn.ysk.cashier.cons.repository.TbConsInfoRepository; import cn.ysk.cashier.exception.BadRequestException; -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.utils.*; import lombok.RequiredArgsConstructor; import cn.ysk.cashier.cons.repository.TbConCheckRepository; import cn.ysk.cashier.cons.service.TbConCheckService; @@ -97,13 +94,12 @@ public class TbConCheckServiceImpl implements TbConCheckService { - flow.setConsId(consInfo.getId()); flow.setShopId(consInfo.getShopId()); flow.setConName(consInfo.getConName()); flow.setAmount(consInfo.getStockNumber()); flow.setBalance(consInfo.getStockNumber()); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); 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 2aa8d71a..d805947c 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 @@ -175,6 +175,7 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService { tbConsInfoFlow.setBizName("报损"); tbConsInfoFlow.setBizType("-"); tbConsInfoFlow.setCreateTime(new Timestamp(System.currentTimeMillis())); + tbConsInfoFlow.setOperator(SecurityUtils.getCurrentUsername()); tbConsInfoFlowRepository.save(tbConsInfoFlow); tbConsInfo.setStockNumber(balance); consInfoRepository.save(tbConsInfo); 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 4f0a8e04..a4b93b49 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 @@ -136,7 +136,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { flow.setConName(resource.getConName()); flow.setAmount(BigDecimal.ZERO); flow.setBalance(BigDecimal.ZERO); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); @@ -346,7 +346,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { flow.setConName(info.getConName()); flow.setAmount(conInfos.getStockNumber()); flow.setBalance(info.getStockNumber().subtract(info.getStockConsume())); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); } @@ -456,7 +456,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { flow.setConName(consInfo.getConName()); flow.setAmount(consInfo.getStockNumber()); flow.setBalance(consInfo.getStockNumber()); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); @@ -481,7 +481,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { flow.setConName(consInfo.getConName()); flow.setAmount(consInfo.getStockNumber()); flow.setBalance(consInfo.getStockNumber()); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); } @@ -512,7 +512,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { flow.setConName(consInfo.getConName()); flow.setAmount(consInfo.getStockNumber()); flow.setBalance(consInfo.getStockNumber()); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockDetailDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockDetailDto.java index 74336128..9d010b18 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockDetailDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockDetailDto.java @@ -62,6 +62,8 @@ public class TbProductStockDetailDto implements Serializable { /** 关联订单Id */ private String orderId; + private String orderNo; + /** 1入库 -1出库 */ private Integer subType; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/rabbit/StockRecordMsg.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/rabbit/StockRecordMsg.java index 37920b1f..f288b39e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/rabbit/StockRecordMsg.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/rabbit/StockRecordMsg.java @@ -10,5 +10,6 @@ public class StockRecordMsg { private String type; private Integer subType; private Integer number; + private String operator; private String remark; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/product/TbProductStockDetailMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/product/TbProductStockDetailMapper.java index 1192666d..39677862 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/product/TbProductStockDetailMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/product/TbProductStockDetailMapper.java @@ -1,24 +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.mapper.product; import cn.ysk.cashier.base.BaseMapper; import cn.ysk.cashier.pojo.product.TbProductStockDetail; import cn.ysk.cashier.dto.product.TbProductStockDetailDto; import org.mapstruct.Mapper; +import org.mapstruct.Mapping; import org.mapstruct.ReportingPolicy; /** @@ -29,4 +15,8 @@ import org.mapstruct.ReportingPolicy; @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) public interface TbProductStockDetailMapper extends BaseMapper { + + + @Mapping(target = "orderNo", ignore = true) + TbProductStockDetailDto toDto(TbProductStockDetail entity); } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java index cbfe7b46..bac4327d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java @@ -208,6 +208,7 @@ public class StockServiceImpl implements StockService { stockDetail.setUpdatedAt(System.currentTimeMillis()); stockDetail.setSourcePath("SHOP"); stockDetail.setRemark("一次性入库覆盖库存"); + stockDetail.setOperator(SecurityUtils.getCurrentUsername()); if ("sku".equals(productIdStr)) { Optional byId = skuRepository.findById(Double.valueOf(row.getCell(2).toString()).intValue()); if (byId.isPresent()) { @@ -393,6 +394,27 @@ public class StockServiceImpl implements StockService { case "stockNumber"://库存 description.append(" 库存数量修改为:"+updateValueVO.getValue()+" 原库存:"+product.getStockNumber()); sqlQuery.append(" set stock_number = ").append(updateValueVO.getValue()); + TbProductStockDetail detail=new TbProductStockDetail(); + detail.setProductId(product.getId().toString()); + detail.setProductName(product.getName()); + detail.setShopId(product.getShopId()); + detail.setOperator(SecurityUtils.getCurrentUsername()); + detail.setSourcePath("NORMAL"); + detail.setLeftNumber(product.getStockNumber()); + detail.setStockNumber(new Double(Integer.valueOf(updateValueVO.getValue())-product.getStockNumber())); + TbShopUnit tbShopUnit = shopUnitRepository.findById(product.getUnitId()).orElse(null); + if(tbShopUnit!=null){ + detail.setUnitName(tbShopUnit.getName()); + } + if (product.getStockNumber() > Integer.valueOf(updateValueVO.getValue())) { + detail.setSubType(-1); + detail.setType("盘点出库"); + } else { + detail.setSubType(1); + detail.setType("盘点入库"); + } + detail.setCreatedAt(System.currentTimeMillis()); + tbProductStockDetailRepository.save(detail); break; case "salePrice"://价格 description.append("修改价格为" + updateValueVO.getValue()); 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 44f2c08f..81e1fcf3 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 @@ -103,21 +103,17 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); Page map = page.map(tbProductStockDetailMapper::toDto); - ArrayList> contents = new ArrayList<>(); for (TbProductStockDetailDto tbProductStockDetailDto : map.getContent()) { - Map map1 = BeanUtil.transBean2Map(tbProductStockDetailDto); if (StrUtil.isNotBlank(tbProductStockDetailDto.getOrderId())) { TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(Integer.valueOf(tbProductStockDetailDto.getOrderId())).orElse(null); if (tbOrderInfo != null) { - map1.put("orderNo", tbOrderInfo.getOrderNo()); + tbProductStockDetailDto.setOrderNo(tbOrderInfo.getOrderNo()); } } - contents.add(map1); - tbProductStockDetailDto.setTypes(); } Map info = new LinkedHashMap<>(2); - info.put("content",contents); + info.put("content",map.getContent()); info.put("totalElements",page.getTotalElements()); return info; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java index 0fef070b..1bda9746 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java @@ -501,6 +501,7 @@ public class TbProductStockOperateServiceImpl implements TbProductStockOperateSe productStockDetail.setStockSnap(JSONObject.toJSONString(snapItem)); productStockDetail.setSourcePath("CASHIER"); productStockDetail.setRemark(stockRecordMsg.getRemark()); + productStockDetail.setOperator(stockRecordMsg.getOperator()); productStockDetailRepository.save(productStockDetail); } From 1198781b6173c49f67978abac3153fb708ae8439 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 26 Sep 2024 17:01:35 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=BA=93=E5=AD=98=E8=AE=B0=E5=BD=95=20?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/cons/domain/TbConsInfoFlow.java | 4 ++++ .../cons/service/dto/TbConsInfoFlowDto.java | 2 +- .../service/impl/TbConCheckServiceImpl.java | 8 ++----- .../impl/TbConsInfoFlowServiceImpl.java | 1 + .../service/impl/TbConsInfoServiceImpl.java | 10 ++++----- .../dto/product/TbProductStockDetailDto.java | 2 ++ .../cashier/dto/rabbit/StockRecordMsg.java | 1 + .../product/TbProductStockDetailMapper.java | 20 +++++------------ .../impl/productimpl/StockServiceImpl.java | 22 +++++++++++++++++++ .../TbProductStockDetailServiceImpl.java | 8 ++----- .../TbProductStockOperateServiceImpl.java | 1 + 11 files changed, 46 insertions(+), 33 deletions(-) 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 461630a3..6c778935 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 @@ -104,6 +104,10 @@ public class TbConsInfoFlow implements Serializable { @ApiModelProperty(value = "备注") private String remark; + @Column(name = "`operator`") + @ApiModelProperty(value = "操作人") + private String operator; + @Transient @TableField(exist = false) private String productName; 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 ebbca0f0..6aa93f5b 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 @@ -53,7 +53,7 @@ public class TbConsInfoFlowDto implements Serializable { private String orderNo; private String coverImg; private String remark; - + private String operator; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java index 00f14d7a..b5658bc3 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java @@ -6,10 +6,7 @@ import cn.ysk.cashier.cons.domain.TbConsInfoFlow; import cn.ysk.cashier.cons.repository.TbConsInfoFlowRepository; import cn.ysk.cashier.cons.repository.TbConsInfoRepository; import cn.ysk.cashier.exception.BadRequestException; -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.utils.*; import lombok.RequiredArgsConstructor; import cn.ysk.cashier.cons.repository.TbConCheckRepository; import cn.ysk.cashier.cons.service.TbConCheckService; @@ -97,13 +94,12 @@ public class TbConCheckServiceImpl implements TbConCheckService { - flow.setConsId(consInfo.getId()); flow.setShopId(consInfo.getShopId()); flow.setConName(consInfo.getConName()); flow.setAmount(consInfo.getStockNumber()); flow.setBalance(consInfo.getStockNumber()); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); 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 2aa8d71a..d805947c 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 @@ -175,6 +175,7 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService { tbConsInfoFlow.setBizName("报损"); tbConsInfoFlow.setBizType("-"); tbConsInfoFlow.setCreateTime(new Timestamp(System.currentTimeMillis())); + tbConsInfoFlow.setOperator(SecurityUtils.getCurrentUsername()); tbConsInfoFlowRepository.save(tbConsInfoFlow); tbConsInfo.setStockNumber(balance); consInfoRepository.save(tbConsInfo); 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 4f0a8e04..a4b93b49 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 @@ -136,7 +136,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { flow.setConName(resource.getConName()); flow.setAmount(BigDecimal.ZERO); flow.setBalance(BigDecimal.ZERO); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); @@ -346,7 +346,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { flow.setConName(info.getConName()); flow.setAmount(conInfos.getStockNumber()); flow.setBalance(info.getStockNumber().subtract(info.getStockConsume())); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); } @@ -456,7 +456,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { flow.setConName(consInfo.getConName()); flow.setAmount(consInfo.getStockNumber()); flow.setBalance(consInfo.getStockNumber()); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); @@ -481,7 +481,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { flow.setConName(consInfo.getConName()); flow.setAmount(consInfo.getStockNumber()); flow.setBalance(consInfo.getStockNumber()); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); } @@ -512,7 +512,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { flow.setConName(consInfo.getConName()); flow.setAmount(consInfo.getStockNumber()); flow.setBalance(consInfo.getStockNumber()); - + flow.setOperator(SecurityUtils.getCurrentUsername()); flow.setCreateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoFlowRepository.save(flow); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockDetailDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockDetailDto.java index 74336128..9d010b18 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockDetailDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/TbProductStockDetailDto.java @@ -62,6 +62,8 @@ public class TbProductStockDetailDto implements Serializable { /** 关联订单Id */ private String orderId; + private String orderNo; + /** 1入库 -1出库 */ private Integer subType; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/rabbit/StockRecordMsg.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/rabbit/StockRecordMsg.java index 37920b1f..f288b39e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/rabbit/StockRecordMsg.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/rabbit/StockRecordMsg.java @@ -10,5 +10,6 @@ public class StockRecordMsg { private String type; private Integer subType; private Integer number; + private String operator; private String remark; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/product/TbProductStockDetailMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/product/TbProductStockDetailMapper.java index 1192666d..39677862 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/product/TbProductStockDetailMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/product/TbProductStockDetailMapper.java @@ -1,24 +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.mapper.product; import cn.ysk.cashier.base.BaseMapper; import cn.ysk.cashier.pojo.product.TbProductStockDetail; import cn.ysk.cashier.dto.product.TbProductStockDetailDto; import org.mapstruct.Mapper; +import org.mapstruct.Mapping; import org.mapstruct.ReportingPolicy; /** @@ -29,4 +15,8 @@ import org.mapstruct.ReportingPolicy; @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) public interface TbProductStockDetailMapper extends BaseMapper { + + + @Mapping(target = "orderNo", ignore = true) + TbProductStockDetailDto toDto(TbProductStockDetail entity); } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java index cbfe7b46..bac4327d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/StockServiceImpl.java @@ -208,6 +208,7 @@ public class StockServiceImpl implements StockService { stockDetail.setUpdatedAt(System.currentTimeMillis()); stockDetail.setSourcePath("SHOP"); stockDetail.setRemark("一次性入库覆盖库存"); + stockDetail.setOperator(SecurityUtils.getCurrentUsername()); if ("sku".equals(productIdStr)) { Optional byId = skuRepository.findById(Double.valueOf(row.getCell(2).toString()).intValue()); if (byId.isPresent()) { @@ -393,6 +394,27 @@ public class StockServiceImpl implements StockService { case "stockNumber"://库存 description.append(" 库存数量修改为:"+updateValueVO.getValue()+" 原库存:"+product.getStockNumber()); sqlQuery.append(" set stock_number = ").append(updateValueVO.getValue()); + TbProductStockDetail detail=new TbProductStockDetail(); + detail.setProductId(product.getId().toString()); + detail.setProductName(product.getName()); + detail.setShopId(product.getShopId()); + detail.setOperator(SecurityUtils.getCurrentUsername()); + detail.setSourcePath("NORMAL"); + detail.setLeftNumber(product.getStockNumber()); + detail.setStockNumber(new Double(Integer.valueOf(updateValueVO.getValue())-product.getStockNumber())); + TbShopUnit tbShopUnit = shopUnitRepository.findById(product.getUnitId()).orElse(null); + if(tbShopUnit!=null){ + detail.setUnitName(tbShopUnit.getName()); + } + if (product.getStockNumber() > Integer.valueOf(updateValueVO.getValue())) { + detail.setSubType(-1); + detail.setType("盘点出库"); + } else { + detail.setSubType(1); + detail.setType("盘点入库"); + } + detail.setCreatedAt(System.currentTimeMillis()); + tbProductStockDetailRepository.save(detail); break; case "salePrice"://价格 description.append("修改价格为" + updateValueVO.getValue()); 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 44f2c08f..81e1fcf3 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 @@ -103,21 +103,17 @@ public class TbProductStockDetailServiceImpl implements TbProductStockDetailServ -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); Page map = page.map(tbProductStockDetailMapper::toDto); - ArrayList> contents = new ArrayList<>(); for (TbProductStockDetailDto tbProductStockDetailDto : map.getContent()) { - Map map1 = BeanUtil.transBean2Map(tbProductStockDetailDto); if (StrUtil.isNotBlank(tbProductStockDetailDto.getOrderId())) { TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(Integer.valueOf(tbProductStockDetailDto.getOrderId())).orElse(null); if (tbOrderInfo != null) { - map1.put("orderNo", tbOrderInfo.getOrderNo()); + tbProductStockDetailDto.setOrderNo(tbOrderInfo.getOrderNo()); } } - contents.add(map1); - tbProductStockDetailDto.setTypes(); } Map info = new LinkedHashMap<>(2); - info.put("content",contents); + info.put("content",map.getContent()); info.put("totalElements",page.getTotalElements()); return info; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java index 0fef070b..1bda9746 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductStockOperateServiceImpl.java @@ -501,6 +501,7 @@ public class TbProductStockOperateServiceImpl implements TbProductStockOperateSe productStockDetail.setStockSnap(JSONObject.toJSONString(snapItem)); productStockDetail.setSourcePath("CASHIER"); productStockDetail.setRemark(stockRecordMsg.getRemark()); + productStockDetail.setOperator(stockRecordMsg.getOperator()); productStockDetailRepository.save(productStockDetail); } From 2e6518a9751ec5a0a6ea93457b144b66d734b724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Thu, 26 Sep 2024 17:10:08 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=BA=97=E9=93=BA=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E5=BA=97=E9=93=BA=E5=88=97=E8=A1=A8>=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=AE=9D=E5=B0=8F=E7=A8=8B=E5=BA=8Fappid=E5=BD=95=E5=85=A5?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/ysk/cashier/pojo/shop/TbMerchantThirdApply.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantThirdApply.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantThirdApply.java index 56098345..b3ecc666 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantThirdApply.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantThirdApply.java @@ -54,7 +54,7 @@ public class TbMerchantThirdApply implements Serializable { @ApiModelProperty(value = "微信小程序appid") private String smallAppid; - @Column(name = "`small_appid`") + @Column(name = "`alipay_small_appid`") @ApiModelProperty(value = "支付宝小程序appid") private String alipaySmallAppid; From 90382c8f5927d9ec014bea4358288931484e8b0d Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 26 Sep 2024 17:23:55 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E6=9D=BF=E5=9D=97?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/shop/TbShopUserRepository.java | 2 +- .../service/impl/SummaryServiceImpl.java | 20 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopUserRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopUserRepository.java index 03bf7d80..3accd7de 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopUserRepository.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopUserRepository.java @@ -46,7 +46,7 @@ public interface TbShopUserRepository extends JpaRepository List getUserIdByShopId(String shopId); @Query("SELECT count(1) from TbShopUser user where user.shopId = :shopId and user.joinTime BETWEEN :startTime AND :endTime") - Integer newFlow(@Param("shopId") String shopId, @Param("startTime") String startTime, @Param("endTime") String endTime); + Integer newFlow(@Param("shopId") String shopId, @Param("startTime") Date startTime, @Param("endTime") Date endTime); @Query(value = "select IFNULL(sum(amount),0) from tb_shop_user_flow where shop_user_id=:userId and biz_code in ('cashMemberIn','scanMemberIn')",nativeQuery = true) BigDecimal sumAmount(Integer userId); 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 a77d2b73..f9faa898 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 @@ -87,7 +87,7 @@ public class SummaryServiceImpl implements SummaryService { //会员 充值金额 inAmount /退款金额 outAmount /会员消费金额 useAmount /会员消费笔数 useNum Map flowMap = tbShopUserFlowMapper.tradeIndexFlow(param.getShopId(), DateUtil.getStrTime(param.getStartTime()), DateUtil.getStrTime(param.getEndTime())); // 新增会员数 - Integer newFlow = tbShopUserRepository.newFlow(param.getShopId().toString(), DateUtil.getStrTime(param.getStartTime()), DateUtil.getStrTime(param.getEndTime())); + Integer newFlow = tbShopUserRepository.newFlow(param.getShopId().toString(), param.getStartTime(), param.getEndTime()); // Integer newFlow = tbShopUserFlowMapper.tradeIndexNewFlow(param.getShopId(), DateUtil.getStrTime(param.getStartTime()), DateUtil.getStrTime(param.getEndTime())); //台桌数 int tables = tbShopTableRepository.countAllByShopId(param.getShopId()); @@ -121,22 +121,28 @@ public class SummaryServiceImpl implements SummaryService { BigDecimal payAmount = new BigDecimal(payCountVo.getPayAmount().toString()); switch (payCountVo.getPayType()){ case "微信小程序": - payCountVo.setPayAmount(payAmount.add(payCountMap.get("wx_lite"))); + payCountVo.setPayAmount(payCountMap.containsKey("wx_lite")?payAmount.add(payCountMap.get("wx_lite")):payAmount); break; case "支付宝小程序": - payCountVo.setPayAmount(payAmount.add(payCountMap.get("ali_lite"))); + payCountVo.setPayAmount(payCountMap.containsKey("ali_lite")?payAmount.add(payCountMap.get("ali_lite")):payAmount); break; case "主扫收款": - payCountVo.setPayAmount(payAmount.add(payCountMap.get("scanCode"))); + payCountVo.setPayAmount(payCountMap.containsKey("scanCode")?payAmount.add(payCountMap.get("scanCode")):payAmount); break; case "收款码收款": - payCountVo.setPayAmount(payAmount.add(payCountMap.get("ALIPAY")).add(payCountMap.get("WECHAT"))); + if(payCountMap.containsKey("ALIPAY")){ + payAmount = payAmount.add(payCountMap.get("ALIPAY")); + } + if(payCountMap.containsKey("WECHAT")){ + payAmount = payAmount.add(payCountMap.get("WECHAT")); + } + payCountVo.setPayAmount(payAmount); break; case "现金": - payCountVo.setPayAmount(payAmount.add(payCountMap.get("cash"))); + payCountVo.setPayAmount(payCountMap.containsKey("cash")?payAmount.add(payCountMap.get("cash")):payAmount); break; case "会员": - payCountVo.setPayAmount(payAmount.add(payCountMap.get("deposit"))); + payCountVo.setPayAmount(payCountMap.containsKey("deposit")?payAmount.add(payCountMap.get("deposit")):payAmount); break; case "充值": payCountVo.setPayAmount(payAmount.add(vipSaveAmount));