From d1c0708526cc879aaad4732c58dc43d741f60927 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Tue, 22 Oct 2024 09:31:58 +0800 Subject: [PATCH 001/165] =?UTF-8?q?=E9=80=80=E8=8F=9C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/mybatis/mapper/TbOrderInfoMapper.java | 2 +- .../service/impl/shopimpl/TbShopTableServiceImpl.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbOrderInfoMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbOrderInfoMapper.java index c1399b54..47e1eeed 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbOrderInfoMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbOrderInfoMapper.java @@ -37,6 +37,6 @@ public interface TbOrderInfoMapper extends BaseMapper { @Update("update tb_order_info set settlement_amount=settlement_amount-#{priceAmount}, pack_fee=pack_fee-#{packAmount}," + "order_amount=order_amount-#{priceAmount}, amount=amount-#{priceAmount}" + - " where id=#{orderId} and origin_amount-#{priceAmount} >= 0 and order_amount > 0") + " where id=#{orderId} and origin_amount-#{priceAmount} >= 0 and order_amount-#{priceAmount} >= 0") int updateOrderAmount(Integer orderId, BigDecimal priceAmount, BigDecimal packAmount); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index b7888766..341dbb61 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -667,7 +667,8 @@ public class TbShopTableServiceImpl implements TbShopTableService { returnCart.setNumber(removeCartDTO.getNum()); returnCart.setId(null); returnCart.setTotalNumber(removeCartDTO.getNum()); - returnCart.setTotalAmount(returnCart.getSalePrice().multiply(BigDecimal.valueOf(returnCart.getNumber()))); + BigDecimal returnCartAmount = returnCart.getSalePrice().multiply(BigDecimal.valueOf(returnCart.getNumber())); + returnCart.setTotalAmount(returnCartAmount); returnCart.setStatus("return"); cashierCartMapper.insert(returnCart); @@ -691,7 +692,9 @@ public class TbShopTableServiceImpl implements TbShopTableService { if (cashierCart.getOrderId() != null) { // 减少订单金额 - orderInfoMapper.updateOrderAmount(cashierCart.getOrderId(), orderDetail.getPriceAmount(), orderDetail.getPackAmount()); + orderInfoMapper.updateOrderAmount(cashierCart.getOrderId(), orderDetail.getPriceAmount().divide(BigDecimal.valueOf(orderDetail.getNum()), RoundingMode.HALF_UP) + .multiply(BigDecimal.valueOf(removeCartDTO.getNum())), orderDetail.getPackAmount().divide(BigDecimal.valueOf(orderDetail.getNum()), RoundingMode.HALF_UP) + .multiply(BigDecimal.valueOf(removeCartDTO.getNum()))); } From 351b53b4327ecb1ab2a983dcb8de943ebd0c5c45 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Tue, 22 Oct 2024 14:39:36 +0800 Subject: [PATCH 002/165] =?UTF-8?q?=E8=B5=A0=E9=80=81=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=89=93=E5=8C=85=E8=B4=B9=E4=B8=8D=E5=85=8D=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 341dbb61..bb604c06 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -382,7 +382,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { } if (updateCartDTO.getIsGift() != null ) { - tbCashierCart.setTotalAmount(updateCartDTO.getIsGift() ? BigDecimal.ZERO : tbCashierCart.getTotalAmount()); + tbCashierCart.setTotalAmount(updateCartDTO.getIsGift() ? tbCashierCart.getPackFee() : tbCashierCart.getTotalAmount()); tbCashierCart.setIsGift(updateCartDTO.getIsGift() ? "true" : "false"); } From 94b4954c37d65ba99fd3505096b7675abf259907 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Tue, 22 Oct 2024 15:36:10 +0800 Subject: [PATCH 003/165] =?UTF-8?q?=E5=BA=97=E9=93=BA=E9=85=8D=E7=BD=AE=20?= =?UTF-8?q?=E5=BA=97=E9=93=BA=E8=A3=85=E4=BF=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - LICENSE | 191 -------- README.en.md | 36 -- eladmin-generator/pom.xml | 39 -- .../cn/ysk/cashier/domain/ColumnInfo.java | 83 ---- .../java/cn/ysk/cashier/domain/GenConfig.java | 64 --- .../cn/ysk/cashier/domain/vo/TableInfo.java | 34 -- .../repository/ColumnInfoRepository.java | 20 - .../repository/GenConfigRepository.java | 19 - .../ysk/cashier/rest/GenConfigController.java | 37 -- .../ysk/cashier/rest/GeneratorController.java | 93 ---- .../ysk/cashier/service/GenConfigService.java | 26 -- .../ysk/cashier/service/GeneratorService.java | 82 ---- .../service/impl/GenConfigServiceImpl.java | 52 --- .../service/impl/GeneratorServiceImpl.java | 192 --------- .../java/cn/ysk/cashier/utils/ColUtil.java | 40 -- .../java/cn/ysk/cashier/utils/GenUtil.java | 408 ------------------ .../shop/TbMerchantCouponController.java | 92 ---- .../ysk/cashier/dto/shop/TbShopInfoDto.java | 3 + .../cashier/mybatis/entity/TbShopExtend.java | 6 + .../service/impl/TbShopExtendServiceImpl.java | 5 +- .../cn/ysk/cashier/pojo/shop/TbShopInfo.java | 8 + pom.xml | 1 - 23 files changed, 21 insertions(+), 1511 deletions(-) delete mode 100644 LICENSE delete mode 100644 README.en.md delete mode 100644 eladmin-generator/pom.xml delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/domain/ColumnInfo.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/domain/GenConfig.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/domain/vo/TableInfo.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/repository/ColumnInfoRepository.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/repository/GenConfigRepository.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/rest/GenConfigController.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/rest/GeneratorController.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/service/GenConfigService.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/service/GeneratorService.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/service/impl/GenConfigServiceImpl.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/service/impl/GeneratorServiceImpl.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/utils/ColUtil.java delete mode 100644 eladmin-generator/src/main/java/cn/ysk/cashier/utils/GenUtil.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbMerchantCouponController.java diff --git a/.gitignore b/.gitignore index b8080da1..085c5046 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,5 @@ */target/* */*.iml /.gradle/ -/application.pid *.log logs/* \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index ca38718f..00000000 --- a/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and -distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright -owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities -that control, are controlled by, or are under common control with that entity. -For the purposes of this definition, "control" means (i) the power, direct or -indirect, to cause the direction or management of such entity, whether by -contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the -outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising -permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including -but not limited to software source code, documentation source, and configuration -files. - -"Object" form shall mean any form resulting from mechanical transformation or -translation of a Source form, including but not limited to compiled object code, -generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made -available under the License, as indicated by a copyright notice that is included -in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that -is based on (or derived from) the Work and for which the editorial revisions, -annotations, elaborations, or other modifications represent, as a whole, an -original work of authorship. For the purposes of this License, Derivative Works -shall not include works that remain separable from, or merely link (or bind by -name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version -of the Work and any modifications or additions to that Work or Derivative Works -thereof, that is intentionally submitted to Licensor for inclusion in the Work -by the copyright owner or by an individual or Legal Entity authorized to submit -on behalf of the copyright owner. For the purposes of this definition, -"submitted" means any form of electronic, verbal, or written communication sent -to the Licensor or its representatives, including but not limited to -communication on electronic mailing lists, source code control systems, and -issue tracking systems that are managed by, or on behalf of, the Licensor for -the purpose of discussing and improving the Work, but excluding communication -that is conspicuously marked or otherwise designated in writing by the copyright -owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf -of whom a Contribution has been received by Licensor and subsequently -incorporated within the Work. - -2. Grant of Copyright License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable copyright license to reproduce, prepare Derivative Works of, -publicly display, publicly perform, sublicense, and distribute the Work and such -Derivative Works in Source or Object form. - -3. Grant of Patent License. - -Subject to the terms and conditions of this License, each Contributor hereby -grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, -irrevocable (except as stated in this section) patent license to make, have -made, use, offer to sell, sell, import, and otherwise transfer the Work, where -such license applies only to those patent claims licensable by such Contributor -that are necessarily infringed by their Contribution(s) alone or by combination -of their Contribution(s) with the Work to which such Contribution(s) was -submitted. If You institute patent litigation against any entity (including a -cross-claim or counterclaim in a lawsuit) alleging that the Work or a -Contribution incorporated within the Work constitutes direct or contributory -patent infringement, then any patent licenses granted to You under this License -for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. - -You may reproduce and distribute copies of the Work or Derivative Works thereof -in any medium, with or without modifications, and in Source or Object form, -provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of -this License; and -You must cause any modified files to carry prominent notices stating that You -changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, -all copyright, patent, trademark, and attribution notices from the Source form -of the Work, excluding those notices that do not pertain to any part of the -Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any -Derivative Works that You distribute must include a readable copy of the -attribution notices contained within such NOTICE file, excluding those notices -that do not pertain to any part of the Derivative Works, in at least one of the -following places: within a NOTICE text file distributed as part of the -Derivative Works; within the Source form or documentation, if provided along -with the Derivative Works; or, within a display generated by the Derivative -Works, if and wherever such third-party notices normally appear. The contents of -the NOTICE file are for informational purposes only and do not modify the -License. You may add Your own attribution notices within Derivative Works that -You distribute, alongside or as an addendum to the NOTICE text from the Work, -provided that such additional attribution notices cannot be construed as -modifying the License. -You may add Your own copyright statement to Your modifications and may provide -additional or different license terms and conditions for use, reproduction, or -distribution of Your modifications, or for any such Derivative Works as a whole, -provided Your use, reproduction, and distribution of the Work otherwise complies -with the conditions stated in this License. - -5. Submission of Contributions. - -Unless You explicitly state otherwise, any Contribution intentionally submitted -for inclusion in the Work by You to the Licensor shall be under the terms and -conditions of this License, without any additional terms or conditions. -Notwithstanding the above, nothing herein shall supersede or modify the terms of -any separate license agreement you may have executed with Licensor regarding -such Contributions. - -6. Trademarks. - -This License does not grant permission to use the trade names, trademarks, -service marks, or product names of the Licensor, except as required for -reasonable and customary use in describing the origin of the Work and -reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. - -Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, -including, without limitation, any warranties or conditions of TITLE, -NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are -solely responsible for determining the appropriateness of using or -redistributing the Work and assume any risks associated with Your exercise of -permissions under this License. - -8. Limitation of Liability. - -In no event and under no legal theory, whether in tort (including negligence), -contract, or otherwise, unless required by applicable law (such as deliberate -and grossly negligent acts) or agreed to in writing, shall any Contributor be -liable to You for damages, including any direct, indirect, special, incidental, -or consequential damages of any character arising as a result of this License or -out of the use or inability to use the Work (including but not limited to -damages for loss of goodwill, work stoppage, computer failure or malfunction, or -any and all other commercial damages or losses), even if such Contributor has -been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. - -While redistributing the Work or Derivative Works thereof, You may choose to -offer, and charge a fee for, acceptance of support, warranty, indemnity, or -other liability obligations and/or rights consistent with this License. However, -in accepting such obligations, You may act only on Your own behalf and on Your -sole responsibility, not on behalf of any other Contributor, and only if You -agree to indemnify, defend, and hold each Contributor harmless for any liability -incurred by, or claims asserted against, such Contributor by reason of your -accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work - -To apply the Apache License to your work, attach the following boilerplate -notice, with the fields enclosed by brackets "{}" replaced with your own -identifying information. (Don't include the brackets!) The text should be -enclosed in the appropriate comment syntax for the file format. We also -recommend that a file or class name and description of purpose be included on -the same "printed page" as the copyright notice for easier identification within -third-party archives. - - 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. \ No newline at end of file diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 23dc80d7..00000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# cashierAdmin - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/eladmin-generator/pom.xml b/eladmin-generator/pom.xml deleted file mode 100644 index 9a3b4636..00000000 --- a/eladmin-generator/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - eladmin - cn.ysk.cashier - 2.6 - - 4.0.0 - - eladmin-generator - 代码生成模块 - - - 1.10 - - - - - cn.ysk.cashier - eladmin-common - 2.6 - - - - - org.springframework.boot - spring-boot-starter-freemarker - - - - - commons-configuration - commons-configuration - ${configuration.version} - - - \ No newline at end of file diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/domain/ColumnInfo.java b/eladmin-generator/src/main/java/cn/ysk/cashier/domain/ColumnInfo.java deleted file mode 100644 index 26e06feb..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/domain/ColumnInfo.java +++ /dev/null @@ -1,83 +0,0 @@ - -package cn.ysk.cashier.domain; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import cn.ysk.cashier.utils.GenUtil; -import javax.persistence.*; -import java.io.Serializable; - -/** - * 列的数据信息 - * @author Zheng Jie - * @date 2019-01-02 - */ -@Getter -@Setter -@Entity -@NoArgsConstructor -@Table(name = "code_column_config") -public class ColumnInfo implements Serializable { - - @Id - @Column(name = "column_id") - @ApiModelProperty(value = "ID", hidden = true) - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - - @ApiModelProperty(value = "表名") - private String tableName; - - @ApiModelProperty(value = "数据库字段名称") - private String columnName; - - @ApiModelProperty(value = "数据库字段类型") - private String columnType; - - @ApiModelProperty(value = "数据库字段键类型") - private String keyType; - - @ApiModelProperty(value = "字段额外的参数") - private String extra; - - @ApiModelProperty(value = "数据库字段描述") - private String remark; - - @ApiModelProperty(value = "是否必填") - private Boolean notNull; - - @ApiModelProperty(value = "是否在列表显示") - private Boolean listShow; - - @ApiModelProperty(value = "是否表单显示") - private Boolean formShow; - - @ApiModelProperty(value = "表单类型") - private String formType; - - @ApiModelProperty(value = "查询 1:模糊 2:精确") - private String queryType; - - @ApiModelProperty(value = "字典名称") - private String dictName; - - @ApiModelProperty(value = "日期注解") - private String dateAnnotation; - - public ColumnInfo(String tableName, String columnName, Boolean notNull, String columnType, String remark, String keyType, String extra) { - this.tableName = tableName; - this.columnName = columnName; - this.columnType = columnType; - this.keyType = keyType; - this.extra = extra; - this.notNull = notNull; - if(GenUtil.PK.equalsIgnoreCase(keyType) && GenUtil.EXTRA.equalsIgnoreCase(extra)){ - this.notNull = false; - } - this.remark = remark; - this.listShow = true; - this.formShow = true; - } -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/domain/GenConfig.java b/eladmin-generator/src/main/java/cn/ysk/cashier/domain/GenConfig.java deleted file mode 100644 index e8188454..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/domain/GenConfig.java +++ /dev/null @@ -1,64 +0,0 @@ - -package cn.ysk.cashier.domain; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import javax.persistence.*; -import javax.validation.constraints.NotBlank; -import java.io.Serializable; - -/** - * 代码生成配置 - * @author Zheng Jie - * @date 2019-01-03 - */ -@Getter -@Setter -@Entity -@NoArgsConstructor -@Table(name = "code_gen_config") -public class GenConfig implements Serializable { - - public GenConfig(String tableName) { - this.tableName = tableName; - } - - @Id - @Column(name = "config_id") - @ApiModelProperty(value = "ID", hidden = true) - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long id; - - @NotBlank - @ApiModelProperty(value = "表名") - private String tableName; - - @ApiModelProperty(value = "接口名称") - private String apiAlias; - - @NotBlank - @ApiModelProperty(value = "包路径") - private String pack; - - @NotBlank - @ApiModelProperty(value = "模块名") - private String moduleName; - - @NotBlank - @ApiModelProperty(value = "前端文件路径") - private String path; - - @ApiModelProperty(value = "前端文件路径") - private String apiPath; - - @ApiModelProperty(value = "作者") - private String author; - - @ApiModelProperty(value = "表前缀") - private String prefix; - - @ApiModelProperty(value = "是否覆盖") - private Boolean cover = false; -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/domain/vo/TableInfo.java b/eladmin-generator/src/main/java/cn/ysk/cashier/domain/vo/TableInfo.java deleted file mode 100644 index 1144ff4c..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/domain/vo/TableInfo.java +++ /dev/null @@ -1,34 +0,0 @@ - -package cn.ysk.cashier.domain.vo; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * 表的数据信息 - * @author Zheng Jie - * @date 2019-01-02 - */ -@Data -@AllArgsConstructor -@NoArgsConstructor -public class TableInfo { - - /** 表名称 */ - private Object tableName; - - /** 创建日期 */ - private Object createTime; - - /** 数据库引擎 */ - private Object engine; - - /** 编码集 */ - private Object coding; - - /** 备注 */ - private Object remark; - - -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/repository/ColumnInfoRepository.java b/eladmin-generator/src/main/java/cn/ysk/cashier/repository/ColumnInfoRepository.java deleted file mode 100644 index faa0e05c..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/repository/ColumnInfoRepository.java +++ /dev/null @@ -1,20 +0,0 @@ - -package cn.ysk.cashier.repository; - -import cn.ysk.cashier.domain.ColumnInfo; -import org.springframework.data.jpa.repository.JpaRepository; -import java.util.List; - -/** - * @author Zheng Jie - * @date 2019-01-14 - */ -public interface ColumnInfoRepository extends JpaRepository { - - /** - * 查询表信息 - * @param tableName 表格名 - * @return 表信息 - */ - List findByTableNameOrderByIdAsc(String tableName); -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/repository/GenConfigRepository.java b/eladmin-generator/src/main/java/cn/ysk/cashier/repository/GenConfigRepository.java deleted file mode 100644 index e84a5ba6..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/repository/GenConfigRepository.java +++ /dev/null @@ -1,19 +0,0 @@ - -package cn.ysk.cashier.repository; - -import cn.ysk.cashier.domain.GenConfig; -import org.springframework.data.jpa.repository.JpaRepository; - -/** - * @author Zheng Jie - * @date 2019-01-14 - */ -public interface GenConfigRepository extends JpaRepository { - - /** - * 查询表配置 - * @param tableName 表名 - * @return / - */ - GenConfig findByTableName(String tableName); -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/rest/GenConfigController.java b/eladmin-generator/src/main/java/cn/ysk/cashier/rest/GenConfigController.java deleted file mode 100644 index 4655820c..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/rest/GenConfigController.java +++ /dev/null @@ -1,37 +0,0 @@ - -package cn.ysk.cashier.rest; - -import cn.ysk.cashier.domain.GenConfig; -import cn.ysk.cashier.service.GenConfigService; -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.*; - -/** - * @author Zheng Jie - * @date 2019-01-14 - */ -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/genConfig") -@Api(tags = "系统:代码生成器配置管理") -public class GenConfigController { - - private final GenConfigService genConfigService; - - @ApiOperation("查询") - @GetMapping(value = "/{tableName}") - public ResponseEntity queryGenConfig(@PathVariable String tableName){ - return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK); - } - - @PutMapping - @ApiOperation("修改") - public ResponseEntity updateGenConfig(@Validated @RequestBody GenConfig genConfig){ - return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig),HttpStatus.OK); - } -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/rest/GeneratorController.java b/eladmin-generator/src/main/java/cn/ysk/cashier/rest/GeneratorController.java deleted file mode 100644 index 02becca5..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/rest/GeneratorController.java +++ /dev/null @@ -1,93 +0,0 @@ - -package cn.ysk.cashier.rest; - -import cn.ysk.cashier.domain.ColumnInfo; -import cn.ysk.cashier.exception.BadRequestException; -import cn.ysk.cashier.service.GenConfigService; -import cn.ysk.cashier.service.GeneratorService; -import cn.ysk.cashier.utils.PageUtil; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * @author Zheng Jie - * @date 2019-01-02 - */ -@RestController -@RequiredArgsConstructor -@RequestMapping("/api/generator") -@Api(tags = "系统:代码生成管理") -public class GeneratorController { - - private final GeneratorService generatorService; - private final GenConfigService genConfigService; - - @Value("${generator.enabled}") - private Boolean generatorEnabled; - - @ApiOperation("查询数据库数据") - @GetMapping(value = "/tables/all") - public ResponseEntity queryAllTables(){ - return new ResponseEntity<>(generatorService.getTables(), HttpStatus.OK); - } - - @ApiOperation("查询数据库数据") - @GetMapping(value = "/tables") - public ResponseEntity queryTables(@RequestParam(defaultValue = "") String name, - @RequestParam(defaultValue = "0")Integer page, - @RequestParam(defaultValue = "10")Integer size){ - int[] startEnd = PageUtil.transToStartEnd(page, size); - return new ResponseEntity<>(generatorService.getTables(name,startEnd), HttpStatus.OK); - } - - @ApiOperation("查询字段数据") - @GetMapping(value = "/columns") - public ResponseEntity queryColumns(@RequestParam String tableName){ - List columnInfos = generatorService.getColumns(tableName); - return new ResponseEntity<>(PageUtil.toPage(columnInfos,columnInfos.size()), HttpStatus.OK); - } - - @ApiOperation("保存字段数据") - @PutMapping - public ResponseEntity saveColumn(@RequestBody List columnInfos){ - generatorService.save(columnInfos); - return new ResponseEntity<>(HttpStatus.OK); - } - - @ApiOperation("同步字段数据") - @PostMapping(value = "sync") - public ResponseEntity syncColumn(@RequestBody List tables){ - for (String table : tables) { - generatorService.sync(generatorService.getColumns(table), generatorService.query(table)); - } - return new ResponseEntity<>(HttpStatus.OK); - } - - @ApiOperation("生成代码") - @PostMapping(value = "/{tableName}/{type}") - public ResponseEntity generatorCode(@PathVariable String tableName, @PathVariable Integer type, HttpServletRequest request, HttpServletResponse response){ - if(!generatorEnabled && type == 0){ - throw new BadRequestException("此环境不允许生成代码,请选择预览或者下载查看!"); - } - switch (type){ - // 生成代码 - case 0: generatorService.generator(genConfigService.find(tableName), generatorService.getColumns(tableName)); - break; - // 预览 - case 1: return generatorService.preview(genConfigService.find(tableName), generatorService.getColumns(tableName)); - // 打包 - case 2: generatorService.download(genConfigService.find(tableName), generatorService.getColumns(tableName), request, response); - break; - default: throw new BadRequestException("没有这个选项"); - } - return new ResponseEntity<>(HttpStatus.OK); - } -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/service/GenConfigService.java b/eladmin-generator/src/main/java/cn/ysk/cashier/service/GenConfigService.java deleted file mode 100644 index 131c78af..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/service/GenConfigService.java +++ /dev/null @@ -1,26 +0,0 @@ - -package cn.ysk.cashier.service; - -import cn.ysk.cashier.domain.GenConfig; - -/** - * @author Zheng Jie - * @date 2019-01-14 - */ -public interface GenConfigService { - - /** - * 查询表配置 - * @param tableName 表名 - * @return 表配置 - */ - GenConfig find(String tableName); - - /** - * 更新表配置 - * @param tableName 表名 - * @param genConfig 表配置 - * @return 表配置 - */ - GenConfig update(String tableName, GenConfig genConfig); -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/service/GeneratorService.java b/eladmin-generator/src/main/java/cn/ysk/cashier/service/GeneratorService.java deleted file mode 100644 index d582c0da..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/service/GeneratorService.java +++ /dev/null @@ -1,82 +0,0 @@ - -package cn.ysk.cashier.service; - -import cn.ysk.cashier.domain.GenConfig; -import cn.ysk.cashier.domain.ColumnInfo; -import org.springframework.http.ResponseEntity; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.List; - -/** - * @author Zheng Jie - * @date 2019-01-02 - */ -public interface GeneratorService { - - /** - * 查询数据库元数据 - * @param name 表名 - * @param startEnd 分页参数 - * @return / - */ - Object getTables(String name, int[] startEnd); - - /** - * 得到数据表的元数据 - * @param name 表名 - * @return / - */ - List getColumns(String name); - - /** - * 同步表数据 - * @param columnInfos / - * @param columnInfoList / - */ - void sync(List columnInfos, List columnInfoList); - - /** - * 保持数据 - * @param columnInfos / - */ - void save(List columnInfos); - - /** - * 获取所有table - * @return / - */ - Object getTables(); - - /** - * 代码生成 - * @param genConfig 配置信息 - * @param columns 字段信息 - */ - void generator(GenConfig genConfig, List columns); - - /** - * 预览 - * @param genConfig 配置信息 - * @param columns 字段信息 - * @return / - */ - ResponseEntity preview(GenConfig genConfig, List columns); - - /** - * 打包下载 - * @param genConfig 配置信息 - * @param columns 字段信息 - * @param request / - * @param response / - */ - void download(GenConfig genConfig, List columns, HttpServletRequest request, HttpServletResponse response); - - /** - * 查询数据库的表字段数据数据 - * @param table / - * @return / - */ - List query(String table); -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/service/impl/GenConfigServiceImpl.java b/eladmin-generator/src/main/java/cn/ysk/cashier/service/impl/GenConfigServiceImpl.java deleted file mode 100644 index 39be53f5..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/service/impl/GenConfigServiceImpl.java +++ /dev/null @@ -1,52 +0,0 @@ - -package cn.ysk.cashier.service.impl; - -import lombok.RequiredArgsConstructor; -import cn.ysk.cashier.domain.GenConfig; -import cn.ysk.cashier.repository.GenConfigRepository; -import cn.ysk.cashier.service.GenConfigService; -import org.springframework.stereotype.Service; -import java.io.File; - -/** - * @author Zheng Jie - * @date 2019-01-14 - */ -@Service -@RequiredArgsConstructor -public class GenConfigServiceImpl implements GenConfigService { - - private final GenConfigRepository genConfigRepository; - - @Override - public GenConfig find(String tableName) { - GenConfig genConfig = genConfigRepository.findByTableName(tableName); - if(genConfig == null){ - return new GenConfig(tableName); - } - return genConfig; - } - - @Override - public GenConfig update(String tableName, GenConfig genConfig) { - String separator = File.separator; - String[] paths; - String symbol = "\\"; - if (symbol.equals(separator)) { - paths = genConfig.getPath().split("\\\\"); - } else { - paths = genConfig.getPath().split(File.separator); - } - StringBuilder api = new StringBuilder(); - for (String path : paths) { - api.append(path); - api.append(separator); - if ("src".equals(path)) { - api.append("api"); - break; - } - } - genConfig.setApiPath(api.toString()); - return genConfigRepository.save(genConfig); - } -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/service/impl/GeneratorServiceImpl.java b/eladmin-generator/src/main/java/cn/ysk/cashier/service/impl/GeneratorServiceImpl.java deleted file mode 100644 index 0547c4d7..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/service/impl/GeneratorServiceImpl.java +++ /dev/null @@ -1,192 +0,0 @@ - -package cn.ysk.cashier.service.impl; - -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.ZipUtil; -import lombok.RequiredArgsConstructor; -import cn.ysk.cashier.domain.GenConfig; -import cn.ysk.cashier.domain.ColumnInfo; -import cn.ysk.cashier.domain.vo.TableInfo; -import cn.ysk.cashier.exception.BadRequestException; -import cn.ysk.cashier.repository.ColumnInfoRepository; -import cn.ysk.cashier.service.GeneratorService; -import cn.ysk.cashier.utils.FileUtil; -import cn.ysk.cashier.utils.GenUtil; -import cn.ysk.cashier.utils.PageUtil; -import cn.ysk.cashier.utils.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * @author Zheng Jie - * @date 2019-01-02 - */ -@Service -@RequiredArgsConstructor -public class GeneratorServiceImpl implements GeneratorService { - private static final Logger log = LoggerFactory.getLogger(GeneratorServiceImpl.class); - @PersistenceContext - private EntityManager em; - - private final ColumnInfoRepository columnInfoRepository; - - private final String CONFIG_MESSAGE = "请先配置生成器"; - @Override - public Object getTables() { - // 使用预编译防止sql注入 - String sql = "select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables " + - "where table_schema = (select database()) " + - "order by create_time desc"; - Query query = em.createNativeQuery(sql); - return query.getResultList(); - } - - @Override - public Object getTables(String name, int[] startEnd) { - // 使用预编译防止sql注入 - String sql = "select table_name ,create_time , engine, table_collation, table_comment from information_schema.tables " + - "where table_schema = (select database()) " + - "and table_name like :table order by create_time desc"; - Query query = em.createNativeQuery(sql); - query.setFirstResult(startEnd[0]); - query.setMaxResults(startEnd[1] - startEnd[0]); - query.setParameter("table", StringUtils.isNotBlank(name) ? ("%" + name + "%") : "%%"); - List result = query.getResultList(); - List tableInfos = new ArrayList<>(); - for (Object obj : result) { - Object[] arr = (Object[]) obj; - tableInfos.add(new TableInfo(arr[0], arr[1], arr[2], arr[3], ObjectUtil.isNotEmpty(arr[4]) ? arr[4] : "-")); - } - String countSql = "select count(1) from information_schema.tables " + - "where table_schema = (select database()) and table_name like :table"; - Query queryCount = em.createNativeQuery(countSql); - queryCount.setParameter("table", StringUtils.isNotBlank(name) ? ("%" + name + "%") : "%%"); - Object totalElements = queryCount.getSingleResult(); - return PageUtil.toPage(tableInfos, totalElements); - } - - @Override - public List getColumns(String tableName) { - List columnInfos = columnInfoRepository.findByTableNameOrderByIdAsc(tableName); - if (CollectionUtil.isNotEmpty(columnInfos)) { - return columnInfos; - } else { - columnInfos = query(tableName); - return columnInfoRepository.saveAll(columnInfos); - } - } - - @Override - public List query(String tableName) { - // 使用预编译防止sql注入 - String sql = "select column_name, is_nullable, data_type, column_comment, column_key, extra from information_schema.columns " + - "where table_name = ? and table_schema = (select database()) order by ordinal_position"; - Query query = em.createNativeQuery(sql); - query.setParameter(1, tableName); - List result = query.getResultList(); - List columnInfos = new ArrayList<>(); - for (Object obj : result) { - Object[] arr = (Object[]) obj; - columnInfos.add( - new ColumnInfo( - tableName, - arr[0].toString(), - "NO".equals(arr[1]), - arr[2].toString(), - ObjectUtil.isNotNull(arr[3]) ? arr[3].toString() : null, - ObjectUtil.isNotNull(arr[4]) ? arr[4].toString() : null, - ObjectUtil.isNotNull(arr[5]) ? arr[5].toString() : null) - ); - } - return columnInfos; - } - - @Override - public void sync(List columnInfos, List columnInfoList) { - // 第一种情况,数据库类字段改变或者新增字段 - for (ColumnInfo columnInfo : columnInfoList) { - // 根据字段名称查找 - List columns = columnInfos.stream().filter(c -> c.getColumnName().equals(columnInfo.getColumnName())).collect(Collectors.toList()); - // 如果能找到,就修改部分可能被字段 - if (CollectionUtil.isNotEmpty(columns)) { - ColumnInfo column = columns.get(0); - column.setColumnType(columnInfo.getColumnType()); - column.setExtra(columnInfo.getExtra()); - column.setKeyType(columnInfo.getKeyType()); - if (StringUtils.isBlank(column.getRemark())) { - column.setRemark(columnInfo.getRemark()); - } - columnInfoRepository.save(column); - } else { - // 如果找不到,则保存新字段信息 - columnInfoRepository.save(columnInfo); - } - } - // 第二种情况,数据库字段删除了 - for (ColumnInfo columnInfo : columnInfos) { - // 根据字段名称查找 - List columns = columnInfoList.stream().filter(c -> c.getColumnName().equals(columnInfo.getColumnName())).collect(Collectors.toList()); - // 如果找不到,就代表字段被删除了,则需要删除该字段 - if (CollectionUtil.isEmpty(columns)) { - columnInfoRepository.delete(columnInfo); - } - } - } - - @Override - public void save(List columnInfos) { - columnInfoRepository.saveAll(columnInfos); - } - - @Override - public void generator(GenConfig genConfig, List columns) { - if (genConfig.getId() == null) { - throw new BadRequestException(CONFIG_MESSAGE); - } - try { - GenUtil.generatorCode(columns, genConfig); - } catch (IOException e) { - log.error(e.getMessage(), e); - throw new BadRequestException("生成失败,请手动处理已生成的文件"); - } - } - - @Override - public ResponseEntity preview(GenConfig genConfig, List columns) { - if (genConfig.getId() == null) { - throw new BadRequestException(CONFIG_MESSAGE); - } - List> genList = GenUtil.preview(columns, genConfig); - return new ResponseEntity<>(genList, HttpStatus.OK); - } - - @Override - public void download(GenConfig genConfig, List columns, HttpServletRequest request, HttpServletResponse response) { - if (genConfig.getId() == null) { - throw new BadRequestException(CONFIG_MESSAGE); - } - try { - File file = new File(GenUtil.download(columns, genConfig)); - String zipPath = file.getPath() + ".zip"; - ZipUtil.zip(file.getPath(), zipPath); - FileUtil.downloadFile(request, response, new File(zipPath), true); - } catch (IOException e) { - throw new BadRequestException("打包失败"); - } - } -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/utils/ColUtil.java b/eladmin-generator/src/main/java/cn/ysk/cashier/utils/ColUtil.java deleted file mode 100644 index 9683bdd7..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/utils/ColUtil.java +++ /dev/null @@ -1,40 +0,0 @@ - -package cn.ysk.cashier.utils; - -import org.apache.commons.configuration.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * sql字段转java - * - * @author Zheng Jie - * @date 2019-01-03 - */ -public class ColUtil { - private static final Logger log = LoggerFactory.getLogger(ColUtil.class); - - /** - * 转换mysql数据类型为java数据类型 - * - * @param type 数据库字段类型 - * @return String - */ - static String cloToJava(String type) { - Configuration config = getConfig(); - assert config != null; - return config.getString(type, "unknowType"); - } - - /** - * 获取配置信息 - */ - public static PropertiesConfiguration getConfig() { - try { - return new PropertiesConfiguration("generator.properties"); - } catch (ConfigurationException e) { - log.error(e.getMessage(), e); - } - return null; - } -} diff --git a/eladmin-generator/src/main/java/cn/ysk/cashier/utils/GenUtil.java b/eladmin-generator/src/main/java/cn/ysk/cashier/utils/GenUtil.java deleted file mode 100644 index 703a1f89..00000000 --- a/eladmin-generator/src/main/java/cn/ysk/cashier/utils/GenUtil.java +++ /dev/null @@ -1,408 +0,0 @@ - -package cn.ysk.cashier.utils; - -import cn.hutool.core.util.StrUtil; -import cn.hutool.extra.template.*; -import cn.ysk.cashier.domain.ColumnInfo; -import cn.ysk.cashier.domain.GenConfig; -import lombok.extern.slf4j.Slf4j; -import org.springframework.util.ObjectUtils; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; -import java.time.LocalDate; -import java.util.*; - -import static cn.ysk.cashier.utils.FileUtil.SYS_TEM_DIR; - -/** - * 代码生成 - * - * @author Zheng Jie - * @date 2019-01-02 - */ -@Slf4j -@SuppressWarnings({"unchecked", "all"}) -public class GenUtil { - - private static final String TIMESTAMP = "Timestamp"; - - private static final String BIGDECIMAL = "BigDecimal"; - - public static final String PK = "PRI"; - - public static final String EXTRA = "auto_increment"; - - /** - * 获取后端代码模板名称 - * - * @return List - */ - private static List getAdminTemplateNames() { - List templateNames = new ArrayList<>(); - templateNames.add("Entity"); - templateNames.add("Dto"); - templateNames.add("Mapper"); - templateNames.add("Controller"); - templateNames.add("QueryCriteria"); - templateNames.add("Service"); - templateNames.add("ServiceImpl"); - templateNames.add("Repository"); - return templateNames; - } - - /** - * 获取前端代码模板名称 - * - * @return List - */ - private static List getFrontTemplateNames() { - List templateNames = new ArrayList<>(); - templateNames.add("index"); - templateNames.add("api"); - return templateNames; - } - - public static List> preview(List columns, GenConfig genConfig) { - Map genMap = getGenMap(columns, genConfig); - List> genList = new ArrayList<>(); - // 获取后端模版 - List templates = getAdminTemplateNames(); - TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); - for (String templateName : templates) { - Map map = new HashMap<>(1); - Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl"); - map.put("content", template.render(genMap)); - map.put("name", templateName); - genList.add(map); - } - // 获取前端模版 - templates = getFrontTemplateNames(); - for (String templateName : templates) { - Map map = new HashMap<>(1); - Template template = engine.getTemplate("generator/front/" + templateName + ".ftl"); - map.put(templateName, template.render(genMap)); - map.put("content", template.render(genMap)); - map.put("name", templateName); - genList.add(map); - } - return genList; - } - - public static String download(List columns, GenConfig genConfig) throws IOException { - // 拼接的路径:/tmpeladmin-gen-temp/,这个路径在Linux下需要root用户才有权限创建,非root用户会权限错误而失败,更改为: /tmp/eladmin-gen-temp/ - // String tempPath =SYS_TEM_DIR + "eladmin-gen-temp" + File.separator + genConfig.getTableName() + File.separator; - String tempPath = SYS_TEM_DIR + "eladmin-gen-temp" + File.separator + genConfig.getTableName() + File.separator; - Map genMap = getGenMap(columns, genConfig); - TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); - // 生成后端代码 - List templates = getAdminTemplateNames(); - for (String templateName : templates) { - Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl"); - String filePath = getAdminFilePath(templateName, genConfig, genMap.get("className").toString(), tempPath + "eladmin" + File.separator); - assert filePath != null; - File file = new File(filePath); - // 如果非覆盖生成 - if (!genConfig.getCover() && FileUtil.exist(file)) { - continue; - } - // 生成代码 - genFile(file, template, genMap); - } - // 生成前端代码 - templates = getFrontTemplateNames(); - for (String templateName : templates) { - Template template = engine.getTemplate("generator/front/" + templateName + ".ftl"); - String path = tempPath + "eladmin-web" + File.separator; - String apiPath = path + "src" + File.separator + "api" + File.separator; - String srcPath = path + "src" + File.separator + "views" + File.separator + genMap.get("changeClassName").toString() + File.separator; - String filePath = getFrontFilePath(templateName, apiPath, srcPath, genMap.get("changeClassName").toString()); - assert filePath != null; - File file = new File(filePath); - // 如果非覆盖生成 - if (!genConfig.getCover() && FileUtil.exist(file)) { - continue; - } - // 生成代码 - genFile(file, template, genMap); - } - return tempPath; - } - - public static void generatorCode(List columnInfos, GenConfig genConfig) throws IOException { - Map genMap = getGenMap(columnInfos, genConfig); - TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); - // 生成后端代码 - List templates = getAdminTemplateNames(); - for (String templateName : templates) { - Template template = engine.getTemplate("generator/admin/" + templateName + ".ftl"); - String rootPath = System.getProperty("user.dir"); - String filePath = getAdminFilePath(templateName, genConfig, genMap.get("className").toString(), rootPath); - - assert filePath != null; - File file = new File(filePath); - - // 如果非覆盖生成 - if (!genConfig.getCover() && FileUtil.exist(file)) { - continue; - } - // 生成代码 - genFile(file, template, genMap); - } - - // 生成前端代码 - templates = getFrontTemplateNames(); - for (String templateName : templates) { - Template template = engine.getTemplate("generator/front/" + templateName + ".ftl"); - String filePath = getFrontFilePath(templateName, genConfig.getApiPath(), genConfig.getPath(), genMap.get("changeClassName").toString()); - - assert filePath != null; - File file = new File(filePath); - - // 如果非覆盖生成 - if (!genConfig.getCover() && FileUtil.exist(file)) { - continue; - } - // 生成代码 - genFile(file, template, genMap); - } - } - - // 获取模版数据 - private static Map getGenMap(List columnInfos, GenConfig genConfig) { - // 存储模版字段数据 - Map genMap = new HashMap<>(16); - // 接口别名 - genMap.put("apiAlias", genConfig.getApiAlias()); - // 包名称 - genMap.put("package", genConfig.getPack()); - // 模块名称 - genMap.put("moduleName", genConfig.getModuleName()); - // 作者 - genMap.put("author", genConfig.getAuthor()); - // 创建日期 - genMap.put("date", LocalDate.now().toString()); - // 表名 - genMap.put("tableName", genConfig.getTableName()); - // 大写开头的类名 - String className = StringUtils.toCapitalizeCamelCase(genConfig.getTableName()); - // 小写开头的类名 - String changeClassName = StringUtils.toCamelCase(genConfig.getTableName()); - // 判断是否去除表前缀 - if (StringUtils.isNotEmpty(genConfig.getPrefix())) { - className = StringUtils.toCapitalizeCamelCase(StrUtil.removePrefix(genConfig.getTableName(), genConfig.getPrefix())); - changeClassName = StringUtils.toCamelCase(StrUtil.removePrefix(genConfig.getTableName(), genConfig.getPrefix())); - changeClassName = StringUtils.uncapitalize(changeClassName); - } - // 保存类名 - genMap.put("className", className); - // 保存小写开头的类名 - genMap.put("changeClassName", changeClassName); - // 存在 Timestamp 字段 - genMap.put("hasTimestamp", false); - // 查询类中存在 Timestamp 字段 - genMap.put("queryHasTimestamp", false); - // 存在 BigDecimal 字段 - genMap.put("hasBigDecimal", false); - // 查询类中存在 BigDecimal 字段 - genMap.put("queryHasBigDecimal", false); - // 是否需要创建查询 - genMap.put("hasQuery", false); - // 自增主键 - genMap.put("auto", false); - // 存在字典 - genMap.put("hasDict", false); - // 存在日期注解 - genMap.put("hasDateAnnotation", false); - // 保存字段信息 - List> columns = new ArrayList<>(); - // 保存查询字段的信息 - List> queryColumns = new ArrayList<>(); - // 存储字典信息 - List dicts = new ArrayList<>(); - // 存储 between 信息 - List> betweens = new ArrayList<>(); - // 存储不为空的字段信息 - List> isNotNullColumns = new ArrayList<>(); - - for (ColumnInfo column : columnInfos) { - Map listMap = new HashMap<>(16); - // 字段描述 - listMap.put("remark", column.getRemark()); - // 字段类型 - listMap.put("columnKey", column.getKeyType()); - // 主键类型 - String colType = ColUtil.cloToJava(column.getColumnType()); - // 小写开头的字段名 - String changeColumnName = StringUtils.toCamelCase(column.getColumnName()); - // 大写开头的字段名 - String capitalColumnName = StringUtils.toCapitalizeCamelCase(column.getColumnName()); - if (PK.equals(column.getKeyType())) { - // 存储主键类型 - genMap.put("pkColumnType", colType); - // 存储小写开头的字段名 - genMap.put("pkChangeColName", changeColumnName); - // 存储大写开头的字段名 - genMap.put("pkCapitalColName", capitalColumnName); - } - // 是否存在 Timestamp 类型的字段 - if (TIMESTAMP.equals(colType)) { - genMap.put("hasTimestamp", true); - } - // 是否存在 BigDecimal 类型的字段 - if (BIGDECIMAL.equals(colType)) { - genMap.put("hasBigDecimal", true); - } - // 主键是否自增 - if (EXTRA.equals(column.getExtra())) { - genMap.put("auto", true); - } - // 主键存在字典 - if (StringUtils.isNotBlank(column.getDictName())) { - genMap.put("hasDict", true); - if(!dicts.contains(column.getDictName())) - dicts.add(column.getDictName()); - } - - // 存储字段类型 - listMap.put("columnType", colType); - // 存储字原始段名称 - listMap.put("columnName", column.getColumnName()); - // 不为空 - listMap.put("istNotNull", column.getNotNull()); - // 字段列表显示 - listMap.put("columnShow", column.getListShow()); - // 表单显示 - listMap.put("formShow", column.getFormShow()); - // 表单组件类型 - listMap.put("formType", StringUtils.isNotBlank(column.getFormType()) ? column.getFormType() : "Input"); - // 小写开头的字段名称 - listMap.put("changeColumnName", changeColumnName); - //大写开头的字段名称 - listMap.put("capitalColumnName", capitalColumnName); - // 字典名称 - listMap.put("dictName", column.getDictName()); - // 日期注解 - listMap.put("dateAnnotation", column.getDateAnnotation()); - if (StringUtils.isNotBlank(column.getDateAnnotation())) { - genMap.put("hasDateAnnotation", true); - } - // 添加非空字段信息 - if (column.getNotNull()) { - isNotNullColumns.add(listMap); - } - // 判断是否有查询,如有则把查询的字段set进columnQuery - if (!StringUtils.isBlank(column.getQueryType())) { - // 查询类型 - listMap.put("queryType", column.getQueryType()); - // 是否存在查询 - genMap.put("hasQuery", true); - if (TIMESTAMP.equals(colType)) { - // 查询中存储 Timestamp 类型 - genMap.put("queryHasTimestamp", true); - } - if (BIGDECIMAL.equals(colType)) { - // 查询中存储 BigDecimal 类型 - genMap.put("queryHasBigDecimal", true); - } - if ("between".equalsIgnoreCase(column.getQueryType())) { - betweens.add(listMap); - } else { - // 添加到查询列表中 - queryColumns.add(listMap); - } - } - // 添加到字段列表中 - columns.add(listMap); - } - // 保存字段列表 - genMap.put("columns", columns); - // 保存查询列表 - genMap.put("queryColumns", queryColumns); - // 保存字段列表 - genMap.put("dicts", dicts); - // 保存查询列表 - genMap.put("betweens", betweens); - // 保存非空字段信息 - genMap.put("isNotNullColumns", isNotNullColumns); - return genMap; - } - - /** - * 定义后端文件路径以及名称 - */ - private static String getAdminFilePath(String templateName, GenConfig genConfig, String className, String rootPath) { - String projectPath = rootPath + File.separator + genConfig.getModuleName(); - String packagePath = projectPath + File.separator + "src" + File.separator + "main" + File.separator + "java" + File.separator; - if (!ObjectUtils.isEmpty(genConfig.getPack())) { - packagePath += genConfig.getPack().replace(".", File.separator) + File.separator; - } - - if ("Entity".equals(templateName)) { - return packagePath + "domain" + File.separator + className + ".java"; - } - - if ("Controller".equals(templateName)) { - return packagePath + "rest" + File.separator + className + "Controller.java"; - } - - if ("Service".equals(templateName)) { - return packagePath + "service" + File.separator + className + "Service.java"; - } - - if ("ServiceImpl".equals(templateName)) { - return packagePath + "service" + File.separator + "impl" + File.separator + className + "ServiceImpl.java"; - } - - if ("Dto".equals(templateName)) { - return packagePath + "service" + File.separator + "dto" + File.separator + className + "Dto.java"; - } - - if ("QueryCriteria".equals(templateName)) { - return packagePath + "service" + File.separator + "dto" + File.separator + className + "QueryCriteria.java"; - } - - if ("Mapper".equals(templateName)) { - return packagePath + "service" + File.separator + "mapstruct" + File.separator + className + "Mapper.java"; - } - - if ("Repository".equals(templateName)) { - return packagePath + "repository" + File.separator + className + "Repository.java"; - } - - return null; - } - - /** - * 定义前端文件路径以及名称 - */ - private static String getFrontFilePath(String templateName, String apiPath, String path, String apiName) { - - if ("api".equals(templateName)) { - return apiPath + File.separator + apiName + ".js"; - } - - if ("index".equals(templateName)) { - return path + File.separator + "index.vue"; - } - - return null; - } - - private static void genFile(File file, Template template, Map map) throws IOException { - // 生成目标文件 - Writer writer = null; - try { - FileUtil.touch(file); - writer = new FileWriter(file); - template.render(map, writer); - } catch (TemplateException | IOException e) { - throw new RuntimeException(e); - } finally { - assert writer != null; - writer.close(); - } - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbMerchantCouponController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbMerchantCouponController.java deleted file mode 100644 index 00d93cfd..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbMerchantCouponController.java +++ /dev/null @@ -1,92 +0,0 @@ -/* -* 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.controller.shop; - -import cn.ysk.cashier.annotation.Log; -import cn.ysk.cashier.dto.shop.TbMerchantCouponDto; -import cn.ysk.cashier.pojo.shop.TbMerchantCoupon; -import cn.ysk.cashier.pojo.shop.TbPurchaseNotice; -import cn.ysk.cashier.repository.shop.TbPurchaseNoticeRepository; -import cn.ysk.cashier.service.shop.TbMerchantCouponService; -import cn.ysk.cashier.dto.shop.TbMerchantCouponQueryCriteria; -import cn.ysk.cashier.service.shop.TbPurchaseNoticeService; -import org.springframework.data.domain.Pageable; -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 java.util.HashMap; -import java.util.Map; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-03-20 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "/shop/coupon管理") -@RequestMapping("/api/tbMerchantCoupon") -public class TbMerchantCouponController { - - private final TbMerchantCouponService tbMerchantCouponService; - private final TbPurchaseNoticeRepository noticeRepository; - - @ApiOperation("导出数据") - public void exportTbMerchantCoupon(HttpServletResponse response, TbMerchantCouponQueryCriteria criteria) throws IOException { - tbMerchantCouponService.download(tbMerchantCouponService.queryAll(criteria), response); - } - - @GetMapping - public ResponseEntity queryTbMerchantCoupon(TbMerchantCouponQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(tbMerchantCouponService.queryAll(criteria,pageable),HttpStatus.OK); - } - - @GetMapping("/{id}") - @ApiOperation("查询优惠卷") - public ResponseEntity queryTbMerchantCouponById(@PathVariable("id")Integer id){ - Map result=new HashMap<>(); - TbMerchantCouponDto coupon = tbMerchantCouponService.findById(id); - result.put("coupon",coupon); - TbPurchaseNotice notice = noticeRepository.findByCouponId(id); - result.put("notice",notice); - return new ResponseEntity<>(result,HttpStatus.OK); - } - - @PostMapping - @Log("新增商家优惠卷:#resources.title") - public ResponseEntity createTbMerchantCoupon(@Validated @RequestBody TbMerchantCoupon resources){ - return new ResponseEntity<>(tbMerchantCouponService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @Log("修改商家优惠卷:#resources.title") - public ResponseEntity updateTbMerchantCoupon(@Validated @RequestBody TbMerchantCoupon resources){ - tbMerchantCouponService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @Log("删除商家优惠卷:#ids") - public ResponseEntity deleteTbMerchantCoupon(@RequestBody Integer[] ids) { - tbMerchantCouponService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/TbShopInfoDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/TbShopInfoDto.java index a2b667d8..534f40af 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/TbShopInfoDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shop/TbShopInfoDto.java @@ -199,4 +199,7 @@ public class TbShopInfoDto implements Serializable { //程序码(零点八零首页) private String smallQrcode; private String paymentQrcode; + + private Integer isMemberPrice; + private String consumeColony; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopExtend.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopExtend.java index 365b94f5..62c6014b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopExtend.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopExtend.java @@ -150,6 +150,12 @@ public class TbShopExtend extends Model { this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png"; this.title = "商品列表"; break; + case "ticket_logo": + this.name = "小票logo图"; + this.detail="建议尺寸: 417*139"; + this.value = "https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/20241022/eeee8e85c66947e5bcaebf687381b5d6.png"; + this.title = "小票logo"; + break; } } this.type="img"; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopExtendServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopExtendServiceImpl.java index cf85c458..a24244bd 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopExtendServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopExtendServiceImpl.java @@ -86,7 +86,7 @@ public class TbShopExtendServiceImpl extends ServiceImpl checkAndInitialize(Page ipage, Integer shopId) { List newRecords = new ArrayList<>(); - List requiredAutokeys = Arrays.asList("index_bg", "my_bg", "member_bg", "shopinfo_bg"); + List requiredAutokeys = Arrays.asList("index_bg", "my_bg", "member_bg", "shopinfo_bg","ticket_logo"); if (ipage == null || ipage.getRecords() == null || ipage.getRecords().isEmpty()) { // ipage 为空,直接创建包含四种类型数据的新 Page 对象 @@ -114,6 +114,9 @@ public class TbShopExtendServiceImpl extends ServiceImpl existingAutokeys = shopExtends.stream() diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopInfo.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopInfo.java index 3cb60517..5720d7bd 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopInfo.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopInfo.java @@ -260,6 +260,14 @@ public class TbShopInfo implements Serializable { @ApiModelProperty(value = "是否允许用户自定义金额") private String isMemberReturn; + @Column(name = "is_member_price") + @ApiModelProperty(value = "是否启用会员价 0否1是") + private Integer isMemberPrice; + + @Column(name = "consume_colony") + @ApiModelProperty(value = "积分群体 all-所有 vip-仅针对会员") + private String consumeColony; + @Column(name = "is_table_fee") @ApiModelProperty(value = "是否免除桌位费 0否1是") private Integer isTableFee; diff --git a/pom.xml b/pom.xml index 4e5d59af..e6bab1cf 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,6 @@ eladmin-logging eladmin-system eladmin-tools - eladmin-generator ELADMIN 后台管理 From 8fe78a48fd74f24f304976b574e9a07650bdd389 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Tue, 22 Oct 2024 17:21:30 +0800 Subject: [PATCH 004/165] =?UTF-8?q?=E9=9C=B8=E7=8E=8B=E9=A4=90=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TbFreeDineController.java | 39 ++++++++++ .../dto/freedine/UpdateFreeDineConfigDTO.java | 26 +++++++ .../mybatis/entity/TbFreeDineConfig.java | 71 +++++++++++++++++++ .../mapper/TbFreeDineConfigMapper.java | 18 +++++ .../service/TbFreeDineConfigService.java | 27 +++++++ .../impl/TbFreeDineConfigServiceImpl.java | 34 +++++++++ .../service/app/TbFreeDineService.java | 10 +++ .../impl/app/TbFreeDineServiceImpl.java | 50 +++++++++++++ .../mapper/TbFreeDineConfigMapper.xml | 28 ++++++++ 9 files changed, 303 insertions(+) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/TbFreeDineController.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/freedine/UpdateFreeDineConfigDTO.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbFreeDineConfig.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbFreeDineConfigMapper.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbFreeDineConfigService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbFreeDineConfigServiceImpl.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/app/TbFreeDineService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/impl/app/TbFreeDineServiceImpl.java create mode 100644 eladmin-system/src/main/resources/mapper/TbFreeDineConfigMapper.xml diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbFreeDineController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbFreeDineController.java new file mode 100644 index 00000000..0596a176 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbFreeDineController.java @@ -0,0 +1,39 @@ +package cn.ysk.cashier.controller; + +import cn.ysk.cashier.dto.freedine.UpdateFreeDineConfigDTO; +import cn.ysk.cashier.mybatis.entity.TbFreeDineConfig; +import cn.ysk.cashier.service.app.TbFreeDineService; +import lombok.AllArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +/** + * 霸王餐相关接口 + * @author SongZhang + */ +@RestController +@RequestMapping("/freeDine") +@AllArgsConstructor +public class TbFreeDineController { + private final TbFreeDineService freeDineService; + + /** + * 获取当前店铺霸王餐配置信息列表 + * @param shopId 店铺id + * @return 霸王餐配置信息 (不存在会新建) + */ + @GetMapping + public ResponseEntity getConfig(@RequestParam Integer shopId) { + return ResponseEntity.ok(freeDineService.getConfig(shopId)); + } + + /** + * 修改霸王餐配置信息 + * @param updateFreeDineConfigDTO 修改信息 + * @return 霸王餐配置信息 + */ + @PutMapping + public ResponseEntity updateConfig(@RequestBody UpdateFreeDineConfigDTO updateFreeDineConfigDTO) { + return ResponseEntity.ok(freeDineService.updateConfig(updateFreeDineConfigDTO)); + } +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/freedine/UpdateFreeDineConfigDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/freedine/UpdateFreeDineConfigDTO.java new file mode 100644 index 00000000..ad4f3968 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/freedine/UpdateFreeDineConfigDTO.java @@ -0,0 +1,26 @@ +package cn.ysk.cashier.dto.freedine; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.List; + +@Data +public class UpdateFreeDineConfigDTO { + @NotNull + private Integer shopId; + @NotNull + private Integer id; + private Boolean enable; + @Min(1) + private Integer rechargeTimes; + @Min(value = 0) + private BigDecimal rechargeThreshold; + private Boolean withCoupon; + private Boolean withPoints; + private String rechargeDesc; + private List useTypeList; + +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbFreeDineConfig.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbFreeDineConfig.java new file mode 100644 index 00000000..cb2425d0 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbFreeDineConfig.java @@ -0,0 +1,71 @@ +package cn.ysk.cashier.mybatis.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.Getter; +import lombok.Setter; + +import javax.persistence.*; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.math.BigDecimal; +import java.time.Instant; +import java.util.Date; +import java.util.List; + +@Data +public class TbFreeDineConfig { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Integer id; + + @NotNull + @Column(name = "enable", nullable = false) + private Boolean enable = false; + + @NotNull + @Column(name = "recharge_times", nullable = false) + private Integer rechargeTimes; + + @NotNull + @Column(name = "recharge_threshold", nullable = false, precision = 10, scale = 2) + private BigDecimal rechargeThreshold; + + @NotNull + @Column(name = "with_coupon", nullable = false) + private Boolean withCoupon = false; + + @NotNull + @Column(name = "with_points", nullable = false) + private Boolean withPoints = false; + + @Size(max = 500) + @Column(name = "recharge_desc", length = 500) + private String rechargeDesc; + + @Size(max = 255) + @Column(name = "use_type") + private String useType; + + @NotNull + @Column(name = "shop_id", nullable = false) + private Integer shopId; + + @Column(name = "create_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; + + @Column(name = "update_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date updateTime; + + @Size(max = 255) + @Column(name = "child_shop_id_list") + private String childShopIdList; + + @TableField(exist = false) + private List useTypeList; + +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbFreeDineConfigMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbFreeDineConfigMapper.java new file mode 100644 index 00000000..55ca644a --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbFreeDineConfigMapper.java @@ -0,0 +1,18 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.mybatis.entity.TbFreeDineConfig; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** +* @author Administrator +* @description 针对表【tb_free_dine_config(霸王餐配置信息表)】的数据库操作Mapper +* @createDate 2024-10-22 14:49:18 +* @Entity cn.ysk.cashier.mybatis.entity.TbFreeDineConfig +*/ +public interface TbFreeDineConfigMapper extends BaseMapper { + +} + + + + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbFreeDineConfigService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbFreeDineConfigService.java new file mode 100644 index 00000000..210342a0 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbFreeDineConfigService.java @@ -0,0 +1,27 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.mybatis.entity.TbFreeDineConfig; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author Administrator +* @description 针对表【tb_free_dine_config(霸王餐配置信息表)】的数据库操作Service +* @createDate 2024-10-22 14:49:18 +*/ +public interface TbFreeDineConfigService extends IService { + + /** + * 根据店铺id获取霸王餐配置 + * @param shopId 店铺id + * @return 霸王餐配置 + */ + TbFreeDineConfig getByShopId(Integer shopId); + + /** + * 通过shopId和id获取配置 + * @param id 主键 + * @param shopId 店铺 + * @return 信息 + */ + TbFreeDineConfig getByIdAndShopId(Integer id, Integer shopId); +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbFreeDineConfigServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbFreeDineConfigServiceImpl.java new file mode 100644 index 00000000..71dce1e4 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbFreeDineConfigServiceImpl.java @@ -0,0 +1,34 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.ysk.cashier.mybatis.entity.TbFreeDineConfig; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.ysk.cashier.mybatis.service.TbFreeDineConfigService; +import cn.ysk.cashier.mybatis.mapper.TbFreeDineConfigMapper; +import org.springframework.stereotype.Service; + +/** +* @author Administrator +* @description 针对表【tb_free_dine_config(霸王餐配置信息表)】的数据库操作Service实现 +* @createDate 2024-10-22 14:49:18 +*/ +@Service +public class TbFreeDineConfigServiceImpl extends ServiceImpl + implements TbFreeDineConfigService{ + @Override + public TbFreeDineConfig getByShopId(Integer shopId) { + return getOne(new LambdaQueryWrapper() + .eq(TbFreeDineConfig::getShopId, shopId)); + } + + @Override + public TbFreeDineConfig getByIdAndShopId(Integer id, Integer shopId) { + return getOne(new LambdaQueryWrapper() + .eq(TbFreeDineConfig::getId, id) + .eq(TbFreeDineConfig::getShopId, shopId)); + } +} + + + + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/app/TbFreeDineService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/app/TbFreeDineService.java new file mode 100644 index 00000000..d532b172 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/app/TbFreeDineService.java @@ -0,0 +1,10 @@ +package cn.ysk.cashier.service.app; + +import cn.ysk.cashier.dto.freedine.UpdateFreeDineConfigDTO; +import cn.ysk.cashier.mybatis.entity.TbFreeDineConfig; + +public interface TbFreeDineService { + TbFreeDineConfig getConfig(Integer shopId); + + TbFreeDineConfig updateConfig(UpdateFreeDineConfigDTO updateFreeDineConfigDTO); +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/app/TbFreeDineServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/app/TbFreeDineServiceImpl.java new file mode 100644 index 00000000..c61f9626 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/app/TbFreeDineServiceImpl.java @@ -0,0 +1,50 @@ +package cn.ysk.cashier.service.impl.app; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; +import cn.ysk.cashier.dto.freedine.UpdateFreeDineConfigDTO; +import cn.ysk.cashier.exception.BadRequestException; +import cn.ysk.cashier.mybatis.entity.TbFreeDineConfig; +import cn.ysk.cashier.mybatis.service.TbFreeDineConfigService; +import cn.ysk.cashier.service.app.TbFreeDineService; +import com.alibaba.fastjson.JSONObject; +import lombok.AllArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@AllArgsConstructor +public class TbFreeDineServiceImpl implements TbFreeDineService { + private final TbFreeDineConfigService freeDineConfigService; + + @Override + public TbFreeDineConfig getConfig(Integer shopId) { + TbFreeDineConfig freeDineConfig = freeDineConfigService.getByShopId(shopId); + if (freeDineConfig == null) { + freeDineConfig = new TbFreeDineConfig(); + freeDineConfig.setShopId(shopId); + freeDineConfig.setCreateTime(DateUtil.date()); + freeDineConfigService.save(freeDineConfig); + } + + if (StrUtil.isNotBlank(freeDineConfig.getUseType())) { + freeDineConfig.setUseTypeList(JSONObject.parseArray(freeDineConfig.getUseType()).toJavaList(String.class)); + } + return freeDineConfig; + } + + @Override + public TbFreeDineConfig updateConfig(UpdateFreeDineConfigDTO updateFreeDineConfigDTO) { + TbFreeDineConfig config = freeDineConfigService.getByIdAndShopId(updateFreeDineConfigDTO.getId(), updateFreeDineConfigDTO.getShopId()); + if (config == null) { + throw new BadRequestException("霸王餐信息未配置"); + } + BeanUtil.copyProperties(updateFreeDineConfigDTO, config); + config.setUpdateTime(DateUtil.date()); + if (updateFreeDineConfigDTO.getUseTypeList() != null) { + config.setUseType(JSONObject.toJSONString(updateFreeDineConfigDTO.getUseTypeList())); + } + freeDineConfigService.updateById(config); + return config; + } +} diff --git a/eladmin-system/src/main/resources/mapper/TbFreeDineConfigMapper.xml b/eladmin-system/src/main/resources/mapper/TbFreeDineConfigMapper.xml new file mode 100644 index 00000000..164ae54f --- /dev/null +++ b/eladmin-system/src/main/resources/mapper/TbFreeDineConfigMapper.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + id,enable,recharge_times, + recharge_threshold,with_coupon,with_points, + recharge_desc,use_type,shop_id, + create_time,update_time,child_shop_id_list + + From 5ce67b4014941b7cd4bb141336bb89e33f79e171 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 23 Oct 2024 10:22:40 +0800 Subject: [PATCH 005/165] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=A4=9A=E6=AC=A1=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/enums/OrderStatusEnums.java | 15 ++++++ .../mybatis/service/MpOrderDetailService.java | 13 +++++ .../impl/MpOrderDetailServiceImpl.java | 17 ++++++- .../impl/app/TbFreeDineServiceImpl.java | 2 +- .../impl/shopimpl/TbShopTableServiceImpl.java | 51 +++++++++++++++---- 5 files changed, 86 insertions(+), 12 deletions(-) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java b/eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java new file mode 100644 index 00000000..3210e758 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java @@ -0,0 +1,15 @@ +package cn.ysk.cashier.enums; + +import lombok.Getter; + +@Getter +public enum OrderStatusEnums { + REFUNDING("refunding"), + REFUND("refund"), + CLOSED("closed"); + private final String value; + + OrderStatusEnums(String value) { + this.value = value; + } +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java index 2a8eada3..c87d10c5 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java @@ -1,8 +1,12 @@ package cn.ysk.cashier.mybatis.service; +import cn.ysk.cashier.dto.shoptable.ReturnOrderDTO; +import cn.ysk.cashier.enums.OrderStatusEnums; import cn.ysk.cashier.pojo.order.TbOrderDetail; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** * (TbShopPermission)表服务接口 * @@ -11,5 +15,14 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface MpOrderDetailService extends IService { + /** + * 根据orderId和id修改detail状态 + * @param oldOrderStatusEnums 原始订单状态 + * @param orderStatusEnums 状态 + * @param orderId 订单id + * @param orderDetails detailIds + * @return 影响数量 + */ + boolean updateStatusByOrderIdAndIds(OrderStatusEnums oldOrderStatusEnums, OrderStatusEnums orderStatusEnums, Integer orderId, List orderDetails); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java index cf63ae1d..5faf6c07 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java @@ -1,11 +1,16 @@ package cn.ysk.cashier.mybatis.service.impl; +import cn.ysk.cashier.dto.shoptable.ReturnOrderDTO; +import cn.ysk.cashier.enums.OrderStatusEnums; import cn.ysk.cashier.mybatis.mapper.TbOrderDetailMapper; import cn.ysk.cashier.mybatis.service.MpOrderDetailService; import cn.ysk.cashier.pojo.order.TbOrderDetail; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import java.util.List; + /** * (TbShopPermission)表服务实现类 * @@ -14,6 +19,16 @@ import org.springframework.stereotype.Service; */ @Service public class MpOrderDetailServiceImpl extends ServiceImpl implements MpOrderDetailService { - + @Override + public boolean updateStatusByOrderIdAndIds(OrderStatusEnums oldOrderStatusEnums, OrderStatusEnums orderStatusEnums, Integer orderId, List orderDetails) { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper() + .eq(TbOrderDetail::getOrderId, orderId) + .in(TbOrderDetail::getId, orderDetails) + .set(TbOrderDetail::getStatus, orderStatusEnums.getValue()); + if (oldOrderStatusEnums != null) { + wrapper.eq(TbOrderDetail::getStatus, oldOrderStatusEnums.getValue()); + } + return update(wrapper); + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/app/TbFreeDineServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/app/TbFreeDineServiceImpl.java index c61f9626..7287a9c0 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/app/TbFreeDineServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/app/TbFreeDineServiceImpl.java @@ -28,7 +28,7 @@ public class TbFreeDineServiceImpl implements TbFreeDineService { } if (StrUtil.isNotBlank(freeDineConfig.getUseType())) { - freeDineConfig.setUseTypeList(JSONObject.parseArray(freeDineConfig.getUseType()).toJavaList(String.class)); + freeDineConfig.setUseTypeList(JSONObject.parseArray(freeDineConfig.getUseType()).toJavaList(String.class )); } return freeDineConfig; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index bb604c06..12d24d00 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -89,7 +89,6 @@ public class TbShopTableServiceImpl implements TbShopTableService { private final TbProducSkutMapper producSkutMapper; private final RabbitTemplate rabbitTemplate; private final TbShopInfoRepository shopInfoRepository; - private final TbShopOpenIdMapper shopOpenIdMapper; private final WxMsgUtils wxMsgUtils; private final TbShopPayTypeRepository payTypeRepository; private final MpShopTableMapper mpShopTableMapper; @@ -97,8 +96,6 @@ public class TbShopTableServiceImpl implements TbShopTableService { private final MpShopTableService mpShopTableService; private final MpShopUnitMapper mpShopUnitMapper; private final MpProductStockDetailMapper mpProductStockDetailMapper; - @Value("${thirdPay.payType}") - private String thirdPayType; /** @@ -1999,18 +1996,36 @@ public class TbShopTableServiceImpl implements TbShopTableService { .eq(TbOrderDetail::getStatus, "closed") .eq(TbOrderDetail::getOrderId, returnOrderDTO.getOrderId()) .in(TbOrderDetail::getId, detailIds)); - if (detailIds.size() != returnOrderDTO.getOrderDetails().size()) { + if (detailList.size() != returnOrderDTO.getOrderDetails().size()) { throw new BadRequestException("订单明细数量不一致"); } BigDecimal returnAmount = BigDecimal.ZERO; BigDecimal packAMount = BigDecimal.ZERO; BigDecimal saleAmount = BigDecimal.ZERO; - - List returnDetail = new ArrayList<>(); - + ArrayList remainOrderDetailList = new ArrayList<>(); for (TbOrderDetail orderDetail : detailList) { Integer returnNum = returnNumMap.get(orderDetail.getId().toString()); + int remainNum = orderDetail.getNum() - returnNum; + if (remainNum < 0) { + throw new BadRequestException("{}最多可退数量为: {}", orderDetail.getProductName(), orderDetail.getNum()); + } + + // 将未退款的剩余订单详情重新生成记录 + BigDecimal packFee = orderDetail.getPackAmount().divide(BigDecimal.valueOf(orderDetail.getNum()), RoundingMode.HALF_UP); + if (remainNum > 0) { + // 单个打包费 + BigDecimal remainPackFee = packFee.multiply(BigDecimal.valueOf(remainNum)); + TbOrderDetail remainOrderDetail = BeanUtil.copyProperties(orderDetail, TbOrderDetail.class); + remainOrderDetail.setNum(remainNum); + remainOrderDetail.setPriceAmount(BigDecimal.valueOf(remainNum).multiply(orderDetail.getPrice()) + .add(remainPackFee)); + remainOrderDetail.setPackAmount(remainPackFee); + remainOrderDetail.setReturnNum("0"); + remainOrderDetail.setId(null); + remainOrderDetailList.add(remainOrderDetail); + } + returnAmount = returnAmount.add(orderDetail.getPriceAmount() .divide(new BigDecimal(orderDetail.getNum()), 2, RoundingMode.DOWN) .multiply(BigDecimal.valueOf(returnNum))); @@ -2019,10 +2034,20 @@ public class TbShopTableServiceImpl implements TbShopTableService { .divide(new BigDecimal(orderDetail.getNum()), 2, RoundingMode.DOWN) .multiply(BigDecimal.valueOf(returnNum))); + BigDecimal returnPackFee = packFee.multiply(BigDecimal.valueOf(returnNum)); + orderDetail.setNum(returnNum); + orderDetail.setPriceAmount(BigDecimal.valueOf(returnNum).multiply(orderDetail.getPrice()) + .add(returnPackFee)); + orderDetail.setPackAmount(returnPackFee); orderDetail.setRefundNumber(returnNum); orderDetail.setStatus("refunding"); } + // 保存剩余未退款的订单详情 + if (!remainOrderDetailList.isEmpty()) { + mpOrderDetailService.saveBatch(remainOrderDetailList); + } + String orderNo = generateOrderNumber(isOnline ? "OLRO" : "RO"); TbOrderInfo returnOrder = BeanUtil.copyProperties(oldOrderInfo, TbOrderInfo.class); returnOrder.setId(null); @@ -2039,7 +2064,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { orderInfoMapper.insert(returnOrder); updateStockAndRecord(detailList); - + mpOrderDetailService.updateBatchById(detailList); return returnOrder; } @@ -2084,9 +2109,11 @@ public class TbShopTableServiceImpl implements TbShopTableService { public Object returnOrder(ReturnOrderDTO returnOrderDTO) { TbOrderInfo orderInfo = orderInfoMapper.selectOne(new LambdaQueryWrapper() .eq(TbOrderInfo::getId, returnOrderDTO.getOrderId()) - .eq(TbOrderInfo::getStatus, "closed")); + .in(TbOrderInfo::getStatus, OrderStatusEnums.REFUND.getValue(), OrderStatusEnums.CLOSED.getValue()) +// .eq(TbOrderInfo::getStatus, "closed") + ); if (orderInfo == null) { - throw new BadRequestException("订单非完单状态"); + throw new BadRequestException("订单不处于可退款状态"); } TbShopInfo shopInfo = mpShopInfoMapper.selectById(orderInfo.getShopId()); @@ -2112,8 +2139,12 @@ public class TbShopTableServiceImpl implements TbShopTableService { } else if ("deposit".equals(payType)) { orderInfoService.depositReturn(Integer.valueOf(orderInfo.getUserId()), Integer.valueOf(orderInfo.getShopId()), returnOrderInfo.getRefundAmount()); orderInfo.setStatus("refund"); + mpOrderDetailService.updateStatusByOrderIdAndIds(OrderStatusEnums.REFUNDING, OrderStatusEnums.REFUND, + returnOrderDTO.getOrderId(), returnOrderDTO.getOrderDetails().stream().map(ReturnOrderDTO.OrderDetail::getId).collect(Collectors.toList())); } else if ("cash".equals(payType)) { orderInfo.setStatus("refund"); + mpOrderDetailService.updateStatusByOrderIdAndIds(OrderStatusEnums.REFUNDING, OrderStatusEnums.REFUND, + returnOrderDTO.getOrderId(), returnOrderDTO.getOrderDetails().stream().map(ReturnOrderDTO.OrderDetail::getId).collect(Collectors.toList())); } orderInfoMapper.updateById(orderInfo); // 打印退款小票 From f074f45f860fdc51cc27c8395d1a04dc87d13ab9 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 23 Oct 2024 10:52:55 +0800 Subject: [PATCH 006/165] =?UTF-8?q?=E5=A4=9A=E6=AC=A1=E9=80=80=E6=AC=BE?= =?UTF-8?q?=E7=B4=AF=E5=8A=A0=E9=80=80=E6=AC=BE=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/service/MpOrderInfoService.java | 25 ++++++++++++ .../service/impl/MpOrderInfoServiceImpl.java | 28 +++++++++++++ .../impl/shopimpl/TbShopTableServiceImpl.java | 39 ++++++++++++------- 3 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java new file mode 100644 index 00000000..9c3a86ae --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java @@ -0,0 +1,25 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.enums.OrderStatusEnums; +import cn.ysk.cashier.pojo.order.TbOrderDetail; +import cn.ysk.cashier.pojo.order.TbOrderInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * (TbShopPermission)表服务接口 + * + * @author makejava + * @since 2024-09-14 17:08:48 + */ +public interface MpOrderInfoService extends IService { + + /** + * 根据原始订单查询退款订单 + * @param orderId 原始订单id + * @return 对应的退款订单 + */ + TbOrderInfo selectReturnOrderByOrderId(Integer orderId); +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java new file mode 100644 index 00000000..23b95c86 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java @@ -0,0 +1,28 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.ysk.cashier.mybatis.mapper.TbCashierCartMapper; +import cn.ysk.cashier.mybatis.mapper.TbOrderInfoMapper; +import cn.ysk.cashier.mybatis.service.MpCashierCartService; +import cn.ysk.cashier.mybatis.service.MpOrderInfoService; +import cn.ysk.cashier.pojo.order.TbCashierCart; +import cn.ysk.cashier.pojo.order.TbOrderInfo; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * (TbShopPermission)表服务实现类 + * + * @author makejava + * @since 2024-09-14 17:08:49 + */ +@Service +public class MpOrderInfoServiceImpl extends ServiceImpl implements MpOrderInfoService { + @Override + public TbOrderInfo selectReturnOrderByOrderId(Integer orderId) { + return getOne(new LambdaQueryWrapper() + .eq(TbOrderInfo::getSource, orderId) + .eq(TbOrderInfo::getOrderType, "return")); + } +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 12d24d00..5f3ab61c 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -18,6 +18,7 @@ import cn.ysk.cashier.mapper.shop.TbShopTableMapper; import cn.ysk.cashier.mybatis.mapper.*; import cn.ysk.cashier.mybatis.service.MpCashierCartService; import cn.ysk.cashier.mybatis.service.MpOrderDetailService; +import cn.ysk.cashier.mybatis.service.MpOrderInfoService; import cn.ysk.cashier.mybatis.service.MpShopTableService; import cn.ysk.cashier.pojo.TbShopPayType; import cn.ysk.cashier.pojo.order.TbCashierCart; @@ -114,6 +115,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { private final MpMerchantThirdApplyMapper mpMerchantThirdApplyMapper; private final PayService payService; private final TbOrderInfoService orderInfoService; + private final MpOrderInfoService mpOrderInfoService; private TbOrderInfo getCurrentOrder(ShopEatTypeInfoDTO eatTypeInfoDTO) { // 获取当前台桌最新订单,先付款模式不获取 @@ -2048,20 +2050,29 @@ public class TbShopTableServiceImpl implements TbShopTableService { mpOrderDetailService.saveBatch(remainOrderDetailList); } - String orderNo = generateOrderNumber(isOnline ? "OLRO" : "RO"); - TbOrderInfo returnOrder = BeanUtil.copyProperties(oldOrderInfo, TbOrderInfo.class); - returnOrder.setId(null); - returnOrder.setOrderNo(orderNo); - returnOrder.setRefundAmount(returnAmount); - returnOrder.setOrderType("return"); - returnOrder.setStatus("refunding"); - returnOrder.setUpdatedAt(null); - returnOrder.setSystemTime(DateUtil.current()); - returnOrder.setCreatedAt(DateUtil.current()); - returnOrder.setPayOrderNo(null); - returnOrder.setSource(oldOrderInfo.getId()); - returnOrder.setRefundRemark(returnOrderDTO.getNote()); - orderInfoMapper.insert(returnOrder); + TbOrderInfo returnOrder = mpOrderInfoService.selectReturnOrderByOrderId(returnOrderDTO.getOrderId()); + if (returnOrder == null) { + String orderNo = generateOrderNumber(isOnline ? "OLRO" : "RO"); + returnOrder = BeanUtil.copyProperties(oldOrderInfo, TbOrderInfo.class); + returnOrder.setId(null); + returnOrder.setOrderNo(orderNo); + returnOrder.setRefundAmount(returnAmount); + returnOrder.setOrderType("return"); + returnOrder.setStatus("refunding"); + returnOrder.setUpdatedAt(null); + returnOrder.setSystemTime(DateUtil.current()); + returnOrder.setCreatedAt(DateUtil.current()); + returnOrder.setPayOrderNo(null); + returnOrder.setSource(oldOrderInfo.getId()); + returnOrder.setRefundRemark(returnOrderDTO.getNote()); + orderInfoMapper.insert(returnOrder); + }else { + returnOrder.setUpdatedAt(DateUtil.current()); + returnOrder.setRefundRemark(returnOrderDTO.getNote()); + returnOrder.setRefundAmount(returnOrder.getRefundAmount().add(returnAmount)); + orderInfoMapper.updateById(returnOrder); + } + updateStockAndRecord(detailList); mpOrderDetailService.updateBatchById(detailList); From 4d61647e0d2281a2c13558dde10d4cddf26fac2a Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 23 Oct 2024 11:11:40 +0800 Subject: [PATCH 007/165] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A4=90=E4=BD=8D=E8=B4=B9=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/order/TbOrderInfoServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index b116cd5b..65af5131 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -307,6 +307,12 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { .eq(TbCashierCart::getProductId, TableConstant.CART_SEAT_ID) .orderByDesc(TbCashierCart::getId)); TbCashierCart cashierCart = tbCashierCarts.isEmpty() ? null : tbCashierCarts.get(0); + Map map = BeanUtil.beanToMap(cashierCart, false, false); + if (cashierCart != null) { + map.put("cartId", cashierCart.getId()); + TbOrderDetail orderDetail = details.stream().filter(item -> item.getCartId().equals(cashierCart.getId())).findFirst().orElse(null); + map.put("id", orderDetail != null ? orderDetail.getId() : null); + } dto.setSeatInfo(cashierCart); Map data = BeanUtil.beanToMap(tbOrderInfo, false, false); data.putAll(BeanUtil.beanToMap(dto, false, false)); From 82f7bd890efe6f80836f70cc42409cc4fa3b88bc Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 23 Oct 2024 11:12:31 +0800 Subject: [PATCH 008/165] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A4=90=E4=BD=8D=E8=B4=B9=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/ysk/cashier/dto/order/TbOrderInfoDto.java | 2 +- .../ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/TbOrderInfoDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/TbOrderInfoDto.java index 2cc0075d..5b596b59 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/TbOrderInfoDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/TbOrderInfoDto.java @@ -173,7 +173,7 @@ public class TbOrderInfoDto implements Serializable { private Integer seatCount; private BigDecimal seatAmount; private String useType; - private TbCashierCart seatInfo; + private Object seatInfo; private String refundRemark; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index 65af5131..54726f8e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -313,7 +313,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { TbOrderDetail orderDetail = details.stream().filter(item -> item.getCartId().equals(cashierCart.getId())).findFirst().orElse(null); map.put("id", orderDetail != null ? orderDetail.getId() : null); } - dto.setSeatInfo(cashierCart); + dto.setSeatInfo(map); Map data = BeanUtil.beanToMap(tbOrderInfo, false, false); data.putAll(BeanUtil.beanToMap(dto, false, false)); data.put("refundAmount", tbOrderInfo.getRefundAmount()); From 42fcd08d00b2c6dfb92970b0b82082e6df92207c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Wed, 23 Oct 2024 14:51:21 +0800 Subject: [PATCH 009/165] =?UTF-8?q?Pad=E7=82=B9=E9=A4=90=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/TbPadLayoutController.java | 37 +++ .../product/TbPadProductGroupController.java | 76 ++++++ .../dto/product/PadProductGroupDTO.java | 89 +++++++ .../mybatis/mapper/TbPadLayoutMapper.java | 16 ++ .../mapper/TbPadProductGroupDetailMapper.java | 16 ++ .../mapper/TbPadProductGroupMapper.java | 22 ++ .../mybatis/service/TbPadLayoutService.java | 18 ++ .../TbPadProductGroupDetailService.java | 14 ++ .../service/TbPadProductGroupService.java | 32 +++ .../service/impl/TbPadLayoutServiceImpl.java | 40 +++ .../TbPadProductGroupDetailServiceImpl.java | 28 +++ .../impl/TbPadProductGroupServiceImpl.java | 232 ++++++++++++++++++ .../ysk/cashier/pojo/product/TbPadLayout.java | 56 +++++ .../pojo/product/TbPadProductGroup.java | 60 +++++ .../pojo/product/TbPadProductGroupDetail.java | 40 +++ .../src/main/resources/config/application.yml | 4 +- .../resources/mapper/TbActivateMapper.xml | 11 - .../resources/mapper/TbShopMsgStateMapper.xml | 9 - .../mapper/{ => plus}/SysParamsMapper.xml | 0 .../mapper/plus/TbPadProductGroupMapper.xml | 39 +++ 20 files changed, 817 insertions(+), 22 deletions(-) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadLayoutController.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadProductGroupController.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/product/PadProductGroupDTO.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadLayoutMapper.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupDetailMapper.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupMapper.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadLayoutService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupDetailService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadLayoutServiceImpl.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupDetailServiceImpl.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupServiceImpl.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadLayout.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroup.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroupDetail.java rename eladmin-system/src/main/resources/mapper/{ => plus}/SysParamsMapper.xml (100%) create mode 100644 eladmin-system/src/main/resources/mapper/plus/TbPadProductGroupMapper.xml diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadLayoutController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadLayoutController.java new file mode 100644 index 00000000..90d0e081 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadLayoutController.java @@ -0,0 +1,37 @@ +package cn.ysk.cashier.controller.product; + +import cn.ysk.cashier.mybatis.service.TbPadLayoutService; +import cn.ysk.cashier.pojo.product.TbPadLayout; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * Pad商品布局版式 + * @author tankaikai + * @since 2024-10-22 16:38 + */ +@RestController +@RequestMapping("/api/pad/layout") +@Api(tags="Pad商品布局版式") +public class TbPadLayoutController { + + @Resource + private TbPadLayoutService mpPadLayoutService; + + @GetMapping("list") + @ApiOperation("分页") + public ResponseEntity list(@RequestParam Map params) { + List list = mpPadLayoutService.findList(); + return ResponseEntity.ok().body(list); + } + +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadProductGroupController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadProductGroupController.java new file mode 100644 index 00000000..509384d2 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadProductGroupController.java @@ -0,0 +1,76 @@ +package cn.ysk.cashier.controller.product; + +import cn.ysk.cashier.dto.product.PadProductGroupDTO; +import cn.ysk.cashier.mybatis.service.TbPadProductGroupService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +/** + * Pad商品自定义分组 + * @author tankaikai + * @since 2024-10-22 16:38 + */ +@RestController +@RequestMapping("/api/pad/productGroup") +@Api(tags="Pad商品自定义分组") +public class TbPadProductGroupController { + + @Resource + private TbPadProductGroupService mpPadProductGroupService; + + @GetMapping("page") + @ApiOperation("分页") + public ResponseEntity page(@RequestParam Map params) { + Map page = mpPadProductGroupService.findPage(params); + return ResponseEntity.ok().body(page); + } + + @GetMapping("{id}") + @ApiOperation("详情") + public ResponseEntity get(@PathVariable("id") Long id) { + PadProductGroupDTO data = mpPadProductGroupService.get(id); + return ResponseEntity.ok().body(data); + } + + @PostMapping + @ApiOperation("保存") + public ResponseEntity save(@RequestBody PadProductGroupDTO dto) { + mpPadProductGroupService.save(dto); + return ResponseEntity.ok().body(dto.getId()); + } + + @PutMapping + @ApiOperation("修改") + public ResponseEntity update(@RequestBody PadProductGroupDTO dto) { + mpPadProductGroupService.update(dto); + return ResponseEntity.ok().body(dto.getId()); + } + + @DeleteMapping("{id}") + @ApiOperation("删除") + public ResponseEntity delete(@PathVariable("id") Long id) { + mpPadProductGroupService.delete(id); + return ResponseEntity.ok().build(); + } + + @PostMapping("sort") + @ApiOperation("排序") + public ResponseEntity sort(@RequestBody List sortList) { + mpPadProductGroupService.sort(sortList); + return ResponseEntity.ok().build(); + } + + @PostMapping("copy/{id}") + @ApiOperation("复制") + public ResponseEntity copy(@PathVariable("id") Long id) { + mpPadProductGroupService.copy(id); + return ResponseEntity.ok().build(); + } + +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/PadProductGroupDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/PadProductGroupDTO.java new file mode 100644 index 00000000..00b74611 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/PadProductGroupDTO.java @@ -0,0 +1,89 @@ +package cn.ysk.cashier.dto.product; + +import cn.ysk.cashier.pojo.product.TbProduct; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * Pad商品自定义分组 + * + * @author tankaikai + * @since 2024-10-22 17:07 + */ +@Data +public class PadProductGroupDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id + */ + private Long id; + /** + * 布局版式id + */ + private Long padLayoutId; + + /** + * 自定义名称 + */ + private String customName; + /** + * 商品分类id + */ + private Long productGroupId; + /** + * 店铺id + */ + private Long shopId; + /** + * 排序 + */ + private Integer sort; + /** + * 备注 + */ + private String remark; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 商品名称 + */ + private String productNames; + + /** + * 布局版式代码 + */ + private String padLayoutCode; + + /** + * 布局类型 + */ + private String padLayoutName; + + /** + * 布局类型 + */ + private String productGroupName; + + /** + * 商品id列表 + */ + private List productIdList = new ArrayList<>(); + + /** + * 商品列表 + */ + private List productList = new ArrayList<>(); + +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadLayoutMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadLayoutMapper.java new file mode 100644 index 00000000..f01e7879 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadLayoutMapper.java @@ -0,0 +1,16 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.pojo.product.TbPadLayout; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** +* Pad商品布局版式 +* +* @author Tankaikai tankaikai@aliyun.com +* @since 2.0 2024-10-22 +*/ +@Mapper +public interface TbPadLayoutMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupDetailMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupDetailMapper.java new file mode 100644 index 00000000..b9429073 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupDetailMapper.java @@ -0,0 +1,16 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** +* Pad商品自定义分组明细 +* +* @author Tankaikai tankaikai@aliyun.com +* @since 2.0 2024-10-22 +*/ +@Mapper +public interface TbPadProductGroupDetailMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupMapper.java new file mode 100644 index 00000000..5eea4391 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupMapper.java @@ -0,0 +1,22 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.dto.product.PadProductGroupDTO; +import cn.ysk.cashier.pojo.product.TbPadProductGroup; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** +* Pad商品自定义分组 +* +* @author Tankaikai tankaikai@aliyun.com +* @since 2.0 2024-10-22 +*/ +@Mapper +public interface TbPadProductGroupMapper extends BaseMapper { + + List findList(Map params); + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadLayoutService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadLayoutService.java new file mode 100644 index 00000000..9ad903cc --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadLayoutService.java @@ -0,0 +1,18 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.pojo.product.TbPadLayout; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * Pad商品布局版式 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +public interface TbPadLayoutService extends IService { + + List findList(); + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupDetailService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupDetailService.java new file mode 100644 index 00000000..82ee7bf9 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupDetailService.java @@ -0,0 +1,14 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * Pad商品自定义分组明细 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +public interface TbPadProductGroupDetailService extends IService { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupService.java new file mode 100644 index 00000000..cf5a7383 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupService.java @@ -0,0 +1,32 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.dto.product.PadProductGroupDTO; +import cn.ysk.cashier.pojo.product.TbPadProductGroup; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; +import java.util.Map; + +/** + * Pad商品自定义分组 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +public interface TbPadProductGroupService extends IService { + + Map findPage(Map params); + + PadProductGroupDTO get(Long id); + + void save(PadProductGroupDTO dto); + + void update(PadProductGroupDTO dto); + + void sort(List sortList); + + void delete(Long id); + + void copy(Long id); + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadLayoutServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadLayoutServiceImpl.java new file mode 100644 index 00000000..a745baa2 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadLayoutServiceImpl.java @@ -0,0 +1,40 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.ysk.cashier.mybatis.mapper.TbPadLayoutMapper; +import cn.ysk.cashier.mybatis.service.TbPadLayoutService; +import cn.ysk.cashier.pojo.product.TbPadLayout; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Pad商品布局版式 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +@Service +public class TbPadLayoutServiceImpl extends ServiceImpl implements TbPadLayoutService { + + private LambdaQueryWrapper getWrapper(Map params) { + TbPadLayout param = BeanUtil.toBean(params, TbPadLayout.class); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.eq(TbPadLayout::getDelFlag, 0); + wrapper.orderByAsc(TbPadLayout::getSort); + wrapper.orderByAsc(TbPadLayout::getId); + return wrapper; + } + + + + @Override + public List findList() { + return super.list(this.getWrapper(new HashMap<>(1))); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupDetailServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupDetailServiceImpl.java new file mode 100644 index 00000000..c891202b --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupDetailServiceImpl.java @@ -0,0 +1,28 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.ysk.cashier.mybatis.mapper.TbPadProductGroupDetailMapper; +import cn.ysk.cashier.mybatis.service.TbPadProductGroupDetailService; +import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * Pad商品自定义分组明细 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +@Service +public class TbPadProductGroupDetailServiceImpl extends ServiceImpl implements TbPadProductGroupDetailService { + + public QueryWrapper getWrapper(Map params){ + QueryWrapper wrapper = new QueryWrapper<>(); + + wrapper.orderByDesc("id"); + return wrapper; + } + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupServiceImpl.java new file mode 100644 index 00000000..6fe70be0 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupServiceImpl.java @@ -0,0 +1,232 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.map.MapProxy; +import cn.ysk.cashier.dto.product.PadProductGroupDTO; +import cn.ysk.cashier.exception.BadRequestException; +import cn.ysk.cashier.mybatis.mapper.TbPadLayoutMapper; +import cn.ysk.cashier.mybatis.mapper.TbPadProductGroupDetailMapper; +import cn.ysk.cashier.mybatis.mapper.TbPadProductGroupMapper; +import cn.ysk.cashier.mybatis.mapper.TbProductMapper; +import cn.ysk.cashier.mybatis.service.TbPadProductGroupService; +import cn.ysk.cashier.pojo.product.TbPadLayout; +import cn.ysk.cashier.pojo.product.TbPadProductGroup; +import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail; +import cn.ysk.cashier.pojo.product.TbProduct; +import cn.ysk.cashier.utils.PageUtil; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Pad商品自定义分组 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +@Service +public class TbPadProductGroupServiceImpl extends ServiceImpl implements TbPadProductGroupService { + + @Resource + private TbPadLayoutMapper tbPadLayoutMapper; + + @Resource + private TbPadProductGroupDetailMapper tbPadProductGroupDetailMapper; + @Resource + private TbProductMapper tbProductMapper; + + @Override + public Map findPage(Map params) { + MapProxy mapProxy = MapProxy.create(params); + int pageNum = mapProxy.getInt("page", 1); + int pageSize = mapProxy.getInt("size", 10); + Page page = new Page<>(pageNum, pageSize); + page.addOrder(OrderItem.asc("sort")); + params.put("page", page); + List list = baseMapper.findList(params); + return PageUtil.toPlusPage(list, Convert.toInt(page.getTotal())); + } + + @Override + public PadProductGroupDTO get(Long id) { + TbPadProductGroup entity = baseMapper.selectById(id); + if (entity == null) { + throw new BadRequestException("id对应的数据不存在"); + } + TbPadLayout padLayout = tbPadLayoutMapper.selectById(entity.getPadLayoutId()); + if (padLayout == null) { + throw new BadRequestException("引用的布局版式不存在"); + } + Map params = new HashMap<>(2); + params.put("id", id); + params.put("shopId", entity.getShopId()); + List list = baseMapper.findList(params); + PadProductGroupDTO dto = list.get(0); + if(entity.getProductGroupId().longValue() == 0L){ + dto.setProductGroupName("推荐菜"); + } + List subList = tbPadProductGroupDetailMapper.selectList(Wrappers.lambdaQuery().eq(TbPadProductGroupDetail::getPadProductGroupId, entity.getId())); + if(CollUtil.isNotEmpty(subList)){ + List productIdList = subList.stream().map(TbPadProductGroupDetail::getProductId).collect(Collectors.toList()); + dto.setProductIdList(productIdList); + List> splitIdList = CollUtil.split(productIdList, 10); + List productList = dto.getProductList(); + for (List ids : splitIdList) { + List splitList = tbProductMapper.selectList(Wrappers.lambdaQuery().in(TbProduct::getId, ids)); + productList.addAll(splitList); + } + dto.setProductList(productList); + } + return dto; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(PadProductGroupDTO dto) { + Long padLayoutId = dto.getPadLayoutId(); + if (padLayoutId == null) { + throw new BadRequestException("布局版式id不能为空"); + } + Long productGroupId = dto.getProductGroupId(); + if (productGroupId == null) { + throw new BadRequestException("商品分组不能为空"); + } + Long shopId = dto.getShopId(); + if (shopId == null) { + throw new BadRequestException("店铺id不能为空"); + } + Integer sort = dto.getSort(); + if (sort == null) { + throw new BadRequestException("排序码不能为空"); + } + if (sort.intValue() < 0) { + throw new BadRequestException("排序码不能小于0"); + } + List productIdList = dto.getProductIdList(); + if (CollUtil.isEmpty(productIdList)) { + throw new BadRequestException("商品id列表不能为空"); + } + TbPadLayout padLayout = tbPadLayoutMapper.selectById(padLayoutId); + if (padLayout == null) { + throw new BadRequestException("引用的布局版式不存在"); + } + if(padLayout.getDelFlag() == 1) { + throw new BadRequestException("引用的布局版式已停用"); + } + Integer maximum = padLayout.getMaximum(); + if (productIdList.size() > maximum.intValue()) { + throw new BadRequestException("商品数量不能超过布局版式最大限制:" + maximum.intValue()); + } + TbPadProductGroup entity = new TbPadProductGroup(); + BeanUtil.copyProperties(dto, entity); + entity.setCreateTime(new Date()); + super.save(entity); + for (Long productId : productIdList) { + TbPadProductGroupDetail subEntity = new TbPadProductGroupDetail(); + subEntity.setProductId(productId); + subEntity.setPadProductGroupId(entity.getId()); + subEntity.setCreateTime(new Date()); + tbPadProductGroupDetailMapper.insert(subEntity); + } + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(PadProductGroupDTO dto) { + Long id = dto.getId(); + if (id == null) { + throw new BadRequestException("id不能为空"); + } + Long padLayoutId = dto.getPadLayoutId(); + if (padLayoutId == null) { + throw new BadRequestException("布局版式id不能为空"); + } + Long productGroupId = dto.getProductGroupId(); + if (productGroupId == null) { + throw new BadRequestException("商品分组不能为空"); + } + Long shopId = dto.getShopId(); + if (shopId == null) { + throw new BadRequestException("店铺id不能为空"); + } + Integer sort = dto.getSort(); + if (sort == null) { + throw new BadRequestException("排序码不能为空"); + } + if (sort.intValue() < 0) { + throw new BadRequestException("排序码不能小于0"); + } + List productIdList = dto.getProductIdList(); + if (CollUtil.isEmpty(productIdList)) { + throw new BadRequestException("商品id列表不能为空"); + } + TbPadLayout padLayout = tbPadLayoutMapper.selectById(padLayoutId); + if (padLayout == null) { + throw new BadRequestException("引用的布局版式不存在"); + } + if(padLayout.getDelFlag() == 1) { + throw new BadRequestException("引用的布局版式已停用"); + } + Integer maximum = padLayout.getMaximum(); + if (productIdList.size() > maximum.intValue()) { + throw new BadRequestException("商品数量不能超过布局版式最大限制:" + maximum.intValue()); + } + TbPadProductGroup entity = baseMapper.selectById(id); + if (entity == null) { + throw new BadRequestException("id对应的数据不存在"); + } + BeanUtil.copyProperties(dto, entity,"createTime"); + entity.setUpdateTime(new Date()); + super.updateById(entity); + for (Long productId : productIdList) { + tbPadProductGroupDetailMapper.delete(Wrappers.lambdaQuery().eq(TbPadProductGroupDetail::getPadProductGroupId, entity.getId())); + TbPadProductGroupDetail subEntity = new TbPadProductGroupDetail(); + subEntity.setProductId(productId); + subEntity.setPadProductGroupId(entity.getId()); + subEntity.setCreateTime(new Date()); + tbPadProductGroupDetailMapper.insert(subEntity); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void sort(List sortList) { + if(CollUtil.isEmpty(sortList)) { + throw new BadRequestException("排序列表不能为空"); + } + for (PadProductGroupDTO dto : sortList) { + super.update(null, Wrappers.lambdaUpdate().eq(TbPadProductGroup::getId, dto.getId()).set(TbPadProductGroup::getSort, dto.getSort())); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Long id) { + super.removeById(id); + tbPadProductGroupDetailMapper.delete(Wrappers.lambdaQuery().eq(TbPadProductGroupDetail::getPadProductGroupId, id)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void copy(Long id) { + PadProductGroupDTO dto = get(id); + dto.setId(null); + dto.setCreateTime(null); + dto.setUpdateTime(null); + save(dto); + } + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadLayout.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadLayout.java new file mode 100644 index 00000000..5551d65d --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadLayout.java @@ -0,0 +1,56 @@ +package cn.ysk.cashier.pojo.product; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * Pad商品布局版式 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_pad_layout") +public class TbPadLayout { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * 布局版式名称 + */ + private String name; + /** + * 布局版式代码 + */ + private String code; + /** + * 允许展示最大商品数 + */ + private Integer maximum; + /** + * 详细描述 + */ + private String remark; + /** + * 排序号,升序 + */ + private Integer sort; + /** + * 创建时间 + */ + private Date createTime; + /** + * 删除标志 0-正常 1-已删除 + */ + private Integer delFlag; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroup.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroup.java new file mode 100644 index 00000000..bbbcd49f --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroup.java @@ -0,0 +1,60 @@ +package cn.ysk.cashier.pojo.product; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * Pad商品自定义分组 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_pad_product_group") +public class TbPadProductGroup { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * 布局版式id + */ + private Long padLayoutId; + /** + * 自定义名称 + */ + private String customName; + /** + * 商品分类id + */ + private Long productGroupId; + /** + * 店铺id + */ + private Long shopId; + /** + * 排序 + */ + private Integer sort; + /** + * 备注 + */ + private String remark; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroupDetail.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroupDetail.java new file mode 100644 index 00000000..3f1da24e --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroupDetail.java @@ -0,0 +1,40 @@ +package cn.ysk.cashier.pojo.product; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * Pad商品自定义分组明细 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_pad_product_group_detail") +public class TbPadProductGroupDetail { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * Pad商品自定义分组id + */ + private Long padProductGroupId; + /** + * 商品id + */ + private Long productId; + /** + * 创建时间 + */ + private Date createTime; +} \ No newline at end of file diff --git a/eladmin-system/src/main/resources/config/application.yml b/eladmin-system/src/main/resources/config/application.yml index b77a4176..bf5881c8 100644 --- a/eladmin-system/src/main/resources/config/application.yml +++ b/eladmin-system/src/main/resources/config/application.yml @@ -72,8 +72,8 @@ thirdPay: fstReturn: https://admintestpapi.sxczgkj.cn/notify/fstReturn mybatis-plus: - mapper-locations: classpath:/cn/ysk/cashier/mybatis/mapper/*Mapper.xml - type-aliases-package: me.zhengjie.mybatis.entity + mapper-locations: classpath*:/mapper/plus/*.xml + #type-aliases-package: cn.ysk.cashier.pojo,cn.ysk.cashier.pojo.*,cn.ysk.cashier.system.domain.* configuration: map-underscore-to-camel-case: true cache-enabled: true diff --git a/eladmin-system/src/main/resources/mapper/TbActivateMapper.xml b/eladmin-system/src/main/resources/mapper/TbActivateMapper.xml index 77ad900a..13c82e34 100644 --- a/eladmin-system/src/main/resources/mapper/TbActivateMapper.xml +++ b/eladmin-system/src/main/resources/mapper/TbActivateMapper.xml @@ -4,17 +4,6 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - id,shop_id,min_num, max_num,handsel_num,handsel_type, diff --git a/eladmin-system/src/main/resources/mapper/TbShopMsgStateMapper.xml b/eladmin-system/src/main/resources/mapper/TbShopMsgStateMapper.xml index a6ccca7d..728b48b4 100644 --- a/eladmin-system/src/main/resources/mapper/TbShopMsgStateMapper.xml +++ b/eladmin-system/src/main/resources/mapper/TbShopMsgStateMapper.xml @@ -4,15 +4,6 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - id,shop_id,type, state,create_time,update_time diff --git a/eladmin-system/src/main/resources/mapper/SysParamsMapper.xml b/eladmin-system/src/main/resources/mapper/plus/SysParamsMapper.xml similarity index 100% rename from eladmin-system/src/main/resources/mapper/SysParamsMapper.xml rename to eladmin-system/src/main/resources/mapper/plus/SysParamsMapper.xml diff --git a/eladmin-system/src/main/resources/mapper/plus/TbPadProductGroupMapper.xml b/eladmin-system/src/main/resources/mapper/plus/TbPadProductGroupMapper.xml new file mode 100644 index 00000000..2aee8bc6 --- /dev/null +++ b/eladmin-system/src/main/resources/mapper/plus/TbPadProductGroupMapper.xml @@ -0,0 +1,39 @@ + + + + + + \ No newline at end of file From 2efd81be50c13fbca43c2593971730088a2c76dd Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 23 Oct 2024 15:06:51 +0800 Subject: [PATCH 010/165] =?UTF-8?q?=E9=80=80=E6=AC=BE=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 5f3ab61c..46e2d9b5 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -2045,6 +2045,10 @@ public class TbShopTableServiceImpl implements TbShopTableService { orderDetail.setStatus("refunding"); } + if (returnAmount.compareTo(BigDecimal.ZERO) <= 0) { + throw new BadRequestException("退款金额必须大于0"); + } + // 保存剩余未退款的订单详情 if (!remainOrderDetailList.isEmpty()) { mpOrderDetailService.saveBatch(remainOrderDetailList); From bc587c196ddd4be41f582b538b1020a47ca376fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Wed, 23 Oct 2024 16:34:32 +0800 Subject: [PATCH 011/165] =?UTF-8?q?Pad=E7=82=B9=E9=A4=90=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...va => TbPadProductCategoryController.java} | 34 ++++---- ...oupDTO.java => PadProductCategoryDTO.java} | 10 +-- ... => TbPadProductCategoryDetailMapper.java} | 6 +- .../mapper/TbPadProductCategoryMapper.java | 22 +++++ .../mapper/TbPadProductGroupMapper.java | 22 ----- .../TbPadProductCategoryDetailService.java | 14 ++++ .../service/TbPadProductCategoryService.java | 32 ++++++++ .../TbPadProductGroupDetailService.java | 14 ---- .../service/TbPadProductGroupService.java | 32 -------- ...TbPadProductCategoryDetailServiceImpl.java | 28 +++++++ ...a => TbPadProductCategoryServiceImpl.java} | 82 +++++++++---------- .../TbPadProductGroupDetailServiceImpl.java | 28 ------- ...ctGroup.java => TbPadProductCategory.java} | 8 +- ...l.java => TbPadProductCategoryDetail.java} | 10 +-- ...per.xml => TbPadProductCategoryMapper.xml} | 16 ++-- 15 files changed, 179 insertions(+), 179 deletions(-) rename eladmin-system/src/main/java/cn/ysk/cashier/controller/product/{TbPadProductGroupController.java => TbPadProductCategoryController.java} (58%) rename eladmin-system/src/main/java/cn/ysk/cashier/dto/product/{PadProductGroupDTO.java => PadProductCategoryDTO.java} (87%) rename eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/{TbPadProductGroupDetailMapper.java => TbPadProductCategoryDetailMapper.java} (53%) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductCategoryMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupMapper.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductCategoryDetailService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductCategoryService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupDetailService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryDetailServiceImpl.java rename eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/{TbPadProductGroupServiceImpl.java => TbPadProductCategoryServiceImpl.java} (69%) delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupDetailServiceImpl.java rename eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/{TbPadProductGroup.java => TbPadProductCategory.java} (86%) rename eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/{TbPadProductGroupDetail.java => TbPadProductCategoryDetail.java} (76%) rename eladmin-system/src/main/resources/mapper/plus/{TbPadProductGroupMapper.xml => TbPadProductCategoryMapper.xml} (70%) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadProductGroupController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadProductCategoryController.java similarity index 58% rename from eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadProductGroupController.java rename to eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadProductCategoryController.java index 509384d2..39a739ff 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadProductGroupController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPadProductCategoryController.java @@ -1,7 +1,7 @@ package cn.ysk.cashier.controller.product; -import cn.ysk.cashier.dto.product.PadProductGroupDTO; -import cn.ysk.cashier.mybatis.service.TbPadProductGroupService; +import cn.ysk.cashier.dto.product.PadProductCategoryDTO; +import cn.ysk.cashier.mybatis.service.TbPadProductCategoryService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.http.ResponseEntity; @@ -12,64 +12,64 @@ import java.util.List; import java.util.Map; /** - * Pad商品自定义分组 + * Pad商品自定义分类 * @author tankaikai * @since 2024-10-22 16:38 */ @RestController -@RequestMapping("/api/pad/productGroup") -@Api(tags="Pad商品自定义分组") -public class TbPadProductGroupController { +@RequestMapping("/api/pad/productCategory") +@Api(tags="Pad商品自定义分类") +public class TbPadProductCategoryController { @Resource - private TbPadProductGroupService mpPadProductGroupService; + private TbPadProductCategoryService mpPadProductCategoryService; @GetMapping("page") @ApiOperation("分页") public ResponseEntity page(@RequestParam Map params) { - Map page = mpPadProductGroupService.findPage(params); + Map page = mpPadProductCategoryService.findPage(params); return ResponseEntity.ok().body(page); } @GetMapping("{id}") @ApiOperation("详情") public ResponseEntity get(@PathVariable("id") Long id) { - PadProductGroupDTO data = mpPadProductGroupService.get(id); + PadProductCategoryDTO data = mpPadProductCategoryService.get(id); return ResponseEntity.ok().body(data); } @PostMapping @ApiOperation("保存") - public ResponseEntity save(@RequestBody PadProductGroupDTO dto) { - mpPadProductGroupService.save(dto); + public ResponseEntity save(@RequestBody PadProductCategoryDTO dto) { + mpPadProductCategoryService.save(dto); return ResponseEntity.ok().body(dto.getId()); } @PutMapping @ApiOperation("修改") - public ResponseEntity update(@RequestBody PadProductGroupDTO dto) { - mpPadProductGroupService.update(dto); + public ResponseEntity update(@RequestBody PadProductCategoryDTO dto) { + mpPadProductCategoryService.update(dto); return ResponseEntity.ok().body(dto.getId()); } @DeleteMapping("{id}") @ApiOperation("删除") public ResponseEntity delete(@PathVariable("id") Long id) { - mpPadProductGroupService.delete(id); + mpPadProductCategoryService.delete(id); return ResponseEntity.ok().build(); } @PostMapping("sort") @ApiOperation("排序") - public ResponseEntity sort(@RequestBody List sortList) { - mpPadProductGroupService.sort(sortList); + public ResponseEntity sort(@RequestBody List sortList) { + mpPadProductCategoryService.sort(sortList); return ResponseEntity.ok().build(); } @PostMapping("copy/{id}") @ApiOperation("复制") public ResponseEntity copy(@PathVariable("id") Long id) { - mpPadProductGroupService.copy(id); + mpPadProductCategoryService.copy(id); return ResponseEntity.ok().build(); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/PadProductGroupDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/PadProductCategoryDTO.java similarity index 87% rename from eladmin-system/src/main/java/cn/ysk/cashier/dto/product/PadProductGroupDTO.java rename to eladmin-system/src/main/java/cn/ysk/cashier/dto/product/PadProductCategoryDTO.java index 00b74611..6868a2ce 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/PadProductGroupDTO.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/product/PadProductCategoryDTO.java @@ -9,13 +9,13 @@ import java.util.Date; import java.util.List; /** - * Pad商品自定义分组 + * Pad商品自定义分类 * * @author tankaikai * @since 2024-10-22 17:07 */ @Data -public class PadProductGroupDTO implements Serializable { +public class PadProductCategoryDTO implements Serializable { private static final long serialVersionUID = 1L; /** @@ -34,7 +34,7 @@ public class PadProductGroupDTO implements Serializable { /** * 商品分类id */ - private Long productGroupId; + private Long productCategoryId; /** * 店铺id */ @@ -72,9 +72,9 @@ public class PadProductGroupDTO implements Serializable { private String padLayoutName; /** - * 布局类型 + * 分类名称 */ - private String productGroupName; + private String productCategoryName; /** * 商品id列表 diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupDetailMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductCategoryDetailMapper.java similarity index 53% rename from eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupDetailMapper.java rename to eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductCategoryDetailMapper.java index b9429073..bae5b410 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupDetailMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductCategoryDetailMapper.java @@ -1,16 +1,16 @@ package cn.ysk.cashier.mybatis.mapper; -import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail; +import cn.ysk.cashier.pojo.product.TbPadProductCategoryDetail; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; /** -* Pad商品自定义分组明细 +* Pad商品自定义分类明细 * * @author Tankaikai tankaikai@aliyun.com * @since 2.0 2024-10-22 */ @Mapper -public interface TbPadProductGroupDetailMapper extends BaseMapper { +public interface TbPadProductCategoryDetailMapper extends BaseMapper { } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductCategoryMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductCategoryMapper.java new file mode 100644 index 00000000..ea45da32 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductCategoryMapper.java @@ -0,0 +1,22 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.dto.product.PadProductCategoryDTO; +import cn.ysk.cashier.pojo.product.TbPadProductCategory; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** +* Pad商品自定义分类 +* +* @author Tankaikai tankaikai@aliyun.com +* @since 2.0 2024-10-22 +*/ +@Mapper +public interface TbPadProductCategoryMapper extends BaseMapper { + + List findList(Map params); + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupMapper.java deleted file mode 100644 index 5eea4391..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPadProductGroupMapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.ysk.cashier.mybatis.mapper; - -import cn.ysk.cashier.dto.product.PadProductGroupDTO; -import cn.ysk.cashier.pojo.product.TbPadProductGroup; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; -import java.util.Map; - -/** -* Pad商品自定义分组 -* -* @author Tankaikai tankaikai@aliyun.com -* @since 2.0 2024-10-22 -*/ -@Mapper -public interface TbPadProductGroupMapper extends BaseMapper { - - List findList(Map params); - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductCategoryDetailService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductCategoryDetailService.java new file mode 100644 index 00000000..fddc4fa7 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductCategoryDetailService.java @@ -0,0 +1,14 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.pojo.product.TbPadProductCategoryDetail; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * Pad商品自定义分类明细 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +public interface TbPadProductCategoryDetailService extends IService { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductCategoryService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductCategoryService.java new file mode 100644 index 00000000..10dcd1bc --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductCategoryService.java @@ -0,0 +1,32 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.dto.product.PadProductCategoryDTO; +import cn.ysk.cashier.pojo.product.TbPadProductCategory; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; +import java.util.Map; + +/** + * Pad商品自定义分类 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +public interface TbPadProductCategoryService extends IService { + + Map findPage(Map params); + + PadProductCategoryDTO get(Long id); + + void save(PadProductCategoryDTO dto); + + void update(PadProductCategoryDTO dto); + + void sort(List sortList); + + void delete(Long id); + + void copy(Long id); + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupDetailService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupDetailService.java deleted file mode 100644 index 82ee7bf9..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupDetailService.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.ysk.cashier.mybatis.service; - -import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail; -import com.baomidou.mybatisplus.extension.service.IService; - -/** - * Pad商品自定义分组明细 - * - * @author Tankaikai tankaikai@aliyun.com - * @since 2.0 2024-10-22 - */ -public interface TbPadProductGroupDetailService extends IService { - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupService.java deleted file mode 100644 index cf5a7383..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPadProductGroupService.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.ysk.cashier.mybatis.service; - -import cn.ysk.cashier.dto.product.PadProductGroupDTO; -import cn.ysk.cashier.pojo.product.TbPadProductGroup; -import com.baomidou.mybatisplus.extension.service.IService; - -import java.util.List; -import java.util.Map; - -/** - * Pad商品自定义分组 - * - * @author Tankaikai tankaikai@aliyun.com - * @since 2.0 2024-10-22 - */ -public interface TbPadProductGroupService extends IService { - - Map findPage(Map params); - - PadProductGroupDTO get(Long id); - - void save(PadProductGroupDTO dto); - - void update(PadProductGroupDTO dto); - - void sort(List sortList); - - void delete(Long id); - - void copy(Long id); - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryDetailServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryDetailServiceImpl.java new file mode 100644 index 00000000..50b9c13f --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryDetailServiceImpl.java @@ -0,0 +1,28 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.ysk.cashier.mybatis.mapper.TbPadProductCategoryDetailMapper; +import cn.ysk.cashier.mybatis.service.TbPadProductCategoryDetailService; +import cn.ysk.cashier.pojo.product.TbPadProductCategoryDetail; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * Pad商品自定义分类明细 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-22 + */ +@Service +public class TbPadProductCategoryDetailServiceImpl extends ServiceImpl implements TbPadProductCategoryDetailService { + + public QueryWrapper getWrapper(Map params){ + QueryWrapper wrapper = new QueryWrapper<>(); + + wrapper.orderByDesc("id"); + return wrapper; + } + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryServiceImpl.java similarity index 69% rename from eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupServiceImpl.java rename to eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryServiceImpl.java index 6fe70be0..bd0deb64 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryServiceImpl.java @@ -4,16 +4,16 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.map.MapProxy; -import cn.ysk.cashier.dto.product.PadProductGroupDTO; +import cn.ysk.cashier.dto.product.PadProductCategoryDTO; import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mybatis.mapper.TbPadLayoutMapper; -import cn.ysk.cashier.mybatis.mapper.TbPadProductGroupDetailMapper; -import cn.ysk.cashier.mybatis.mapper.TbPadProductGroupMapper; +import cn.ysk.cashier.mybatis.mapper.TbPadProductCategoryDetailMapper; +import cn.ysk.cashier.mybatis.mapper.TbPadProductCategoryMapper; import cn.ysk.cashier.mybatis.mapper.TbProductMapper; -import cn.ysk.cashier.mybatis.service.TbPadProductGroupService; +import cn.ysk.cashier.mybatis.service.TbPadProductCategoryService; import cn.ysk.cashier.pojo.product.TbPadLayout; -import cn.ysk.cashier.pojo.product.TbPadProductGroup; -import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail; +import cn.ysk.cashier.pojo.product.TbPadProductCategory; +import cn.ysk.cashier.pojo.product.TbPadProductCategoryDetail; import cn.ysk.cashier.pojo.product.TbProduct; import cn.ysk.cashier.utils.PageUtil; import com.baomidou.mybatisplus.core.metadata.OrderItem; @@ -31,19 +31,19 @@ import java.util.Map; import java.util.stream.Collectors; /** - * Pad商品自定义分组 + * Pad商品自定义分类 * * @author Tankaikai tankaikai@aliyun.com * @since 2.0 2024-10-22 */ @Service -public class TbPadProductGroupServiceImpl extends ServiceImpl implements TbPadProductGroupService { +public class TbPadProductCategoryServiceImpl extends ServiceImpl implements TbPadProductCategoryService { @Resource private TbPadLayoutMapper tbPadLayoutMapper; @Resource - private TbPadProductGroupDetailMapper tbPadProductGroupDetailMapper; + private TbPadProductCategoryDetailMapper tbPadProductCategoryDetailMapper; @Resource private TbProductMapper tbProductMapper; @@ -52,16 +52,16 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl page = new Page<>(pageNum, pageSize); + Page page = new Page<>(pageNum, pageSize); page.addOrder(OrderItem.asc("sort")); params.put("page", page); - List list = baseMapper.findList(params); + List list = baseMapper.findList(params); return PageUtil.toPlusPage(list, Convert.toInt(page.getTotal())); } @Override - public PadProductGroupDTO get(Long id) { - TbPadProductGroup entity = baseMapper.selectById(id); + public PadProductCategoryDTO get(Long id) { + TbPadProductCategory entity = baseMapper.selectById(id); if (entity == null) { throw new BadRequestException("id对应的数据不存在"); } @@ -72,14 +72,14 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl params = new HashMap<>(2); params.put("id", id); params.put("shopId", entity.getShopId()); - List list = baseMapper.findList(params); - PadProductGroupDTO dto = list.get(0); - if(entity.getProductGroupId().longValue() == 0L){ - dto.setProductGroupName("推荐菜"); + List list = baseMapper.findList(params); + PadProductCategoryDTO dto = list.get(0); + if(entity.getProductCategoryId().longValue() == 0L){ + dto.setProductCategoryName("推荐菜"); } - List subList = tbPadProductGroupDetailMapper.selectList(Wrappers.lambdaQuery().eq(TbPadProductGroupDetail::getPadProductGroupId, entity.getId())); + List subList = tbPadProductCategoryDetailMapper.selectList(Wrappers.lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId())); if(CollUtil.isNotEmpty(subList)){ - List productIdList = subList.stream().map(TbPadProductGroupDetail::getProductId).collect(Collectors.toList()); + List productIdList = subList.stream().map(TbPadProductCategoryDetail::getProductId).collect(Collectors.toList()); dto.setProductIdList(productIdList); List> splitIdList = CollUtil.split(productIdList, 10); List productList = dto.getProductList(); @@ -94,14 +94,14 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl maximum.intValue()) { throw new BadRequestException("商品数量不能超过布局版式最大限制:" + maximum.intValue()); } - TbPadProductGroup entity = new TbPadProductGroup(); + TbPadProductCategory entity = new TbPadProductCategory(); BeanUtil.copyProperties(dto, entity); entity.setCreateTime(new Date()); super.save(entity); for (Long productId : productIdList) { - TbPadProductGroupDetail subEntity = new TbPadProductGroupDetail(); + TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail(); subEntity.setProductId(productId); - subEntity.setPadProductGroupId(entity.getId()); + subEntity.setPadProductCategoryId(entity.getId()); subEntity.setCreateTime(new Date()); - tbPadProductGroupDetailMapper.insert(subEntity); + tbPadProductCategoryDetailMapper.insert(subEntity); } } @Override @Transactional(rollbackFor = Exception.class) - public void update(PadProductGroupDTO dto) { + public void update(PadProductCategoryDTO dto) { Long id = dto.getId(); if (id == null) { throw new BadRequestException("id不能为空"); @@ -154,9 +154,9 @@ public class TbPadProductGroupServiceImpl extends ServiceImpl maximum.intValue()) { throw new BadRequestException("商品数量不能超过布局版式最大限制:" + maximum.intValue()); } - TbPadProductGroup entity = baseMapper.selectById(id); + TbPadProductCategory entity = baseMapper.selectById(id); if (entity == null) { throw new BadRequestException("id对应的数据不存在"); } @@ -192,23 +192,23 @@ public class TbPadProductGroupServiceImpl extends ServiceImpllambdaQuery().eq(TbPadProductGroupDetail::getPadProductGroupId, entity.getId())); - TbPadProductGroupDetail subEntity = new TbPadProductGroupDetail(); + tbPadProductCategoryDetailMapper.delete(Wrappers.lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId())); + TbPadProductCategoryDetail subEntity = new TbPadProductCategoryDetail(); subEntity.setProductId(productId); - subEntity.setPadProductGroupId(entity.getId()); + subEntity.setPadProductCategoryId(entity.getId()); subEntity.setCreateTime(new Date()); - tbPadProductGroupDetailMapper.insert(subEntity); + tbPadProductCategoryDetailMapper.insert(subEntity); } } @Override @Transactional(rollbackFor = Exception.class) - public void sort(List sortList) { + public void sort(List sortList) { if(CollUtil.isEmpty(sortList)) { throw new BadRequestException("排序列表不能为空"); } - for (PadProductGroupDTO dto : sortList) { - super.update(null, Wrappers.lambdaUpdate().eq(TbPadProductGroup::getId, dto.getId()).set(TbPadProductGroup::getSort, dto.getSort())); + for (PadProductCategoryDTO dto : sortList) { + super.update(null, Wrappers.lambdaUpdate().eq(TbPadProductCategory::getId, dto.getId()).set(TbPadProductCategory::getSort, dto.getSort())); } } @@ -216,13 +216,13 @@ public class TbPadProductGroupServiceImpl extends ServiceImpllambdaQuery().eq(TbPadProductGroupDetail::getPadProductGroupId, id)); + tbPadProductCategoryDetailMapper.delete(Wrappers.lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, id)); } @Override @Transactional(rollbackFor = Exception.class) public void copy(Long id) { - PadProductGroupDTO dto = get(id); + PadProductCategoryDTO dto = get(id); dto.setId(null); dto.setCreateTime(null); dto.setUpdateTime(null); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupDetailServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupDetailServiceImpl.java deleted file mode 100644 index c891202b..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductGroupDetailServiceImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.ysk.cashier.mybatis.service.impl; - -import cn.ysk.cashier.mybatis.mapper.TbPadProductGroupDetailMapper; -import cn.ysk.cashier.mybatis.service.TbPadProductGroupDetailService; -import cn.ysk.cashier.pojo.product.TbPadProductGroupDetail; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; - -import java.util.Map; - -/** - * Pad商品自定义分组明细 - * - * @author Tankaikai tankaikai@aliyun.com - * @since 2.0 2024-10-22 - */ -@Service -public class TbPadProductGroupDetailServiceImpl extends ServiceImpl implements TbPadProductGroupDetailService { - - public QueryWrapper getWrapper(Map params){ - QueryWrapper wrapper = new QueryWrapper<>(); - - wrapper.orderByDesc("id"); - return wrapper; - } - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroup.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductCategory.java similarity index 86% rename from eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroup.java rename to eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductCategory.java index bbbcd49f..bf990170 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroup.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductCategory.java @@ -9,15 +9,15 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * Pad商品自定义分组 + * Pad商品自定义分类 * * @author Tankaikai tankaikai@aliyun.com * @since 2.0 2024-10-22 */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("tb_pad_product_group") -public class TbPadProductGroup { +@TableName("tb_pad_product_category") +public class TbPadProductCategory { private static final long serialVersionUID = 1L; /** @@ -36,7 +36,7 @@ public class TbPadProductGroup { /** * 商品分类id */ - private Long productGroupId; + private Long productCategoryId; /** * 店铺id */ diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroupDetail.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductCategoryDetail.java similarity index 76% rename from eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroupDetail.java rename to eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductCategoryDetail.java index 3f1da24e..51248a3f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductGroupDetail.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbPadProductCategoryDetail.java @@ -9,15 +9,15 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * Pad商品自定义分组明细 + * Pad商品自定义分类明细 * * @author Tankaikai tankaikai@aliyun.com * @since 2.0 2024-10-22 */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("tb_pad_product_group_detail") -public class TbPadProductGroupDetail { +@TableName("tb_pad_product_category_detail") +public class TbPadProductCategoryDetail { private static final long serialVersionUID = 1L; /** @@ -26,9 +26,9 @@ public class TbPadProductGroupDetail { @TableId(type = IdType.AUTO) private Long id; /** - * Pad商品自定义分组id + * Pad商品自定义分类id */ - private Long padProductGroupId; + private Long padProductCategoryId; /** * 商品id */ diff --git a/eladmin-system/src/main/resources/mapper/plus/TbPadProductGroupMapper.xml b/eladmin-system/src/main/resources/mapper/plus/TbPadProductCategoryMapper.xml similarity index 70% rename from eladmin-system/src/main/resources/mapper/plus/TbPadProductGroupMapper.xml rename to eladmin-system/src/main/resources/mapper/plus/TbPadProductCategoryMapper.xml index 2aee8bc6..5f921c14 100644 --- a/eladmin-system/src/main/resources/mapper/plus/TbPadProductGroupMapper.xml +++ b/eladmin-system/src/main/resources/mapper/plus/TbPadProductCategoryMapper.xml @@ -1,18 +1,18 @@ - + - SELECT t1.*, - t3.name as productGroupName, + t3.name as productCategoryName, GROUP_CONCAT(t4.name) as productNames, t5.code as padLayoutCode, t5.name as padLayoutName FROM - tb_pad_product_group t1 - LEFT JOIN tb_pad_product_group_detail t2 on t1.id = t2.pad_product_group_id - LEFT JOIN tb_product_group t3 on t1.product_group_id = t3.id + tb_pad_product_category t1 + LEFT JOIN tb_pad_product_category_detail t2 on t1.id = t2.pad_product_category_id + LEFT JOIN tb_shop_category t3 on t1.product_category_id = t3.id LEFT JOIN tb_product t4 on t2.product_id = t4.id LEFT JOIN tb_pad_layout t5 on t1.pad_layout_id = t5.id @@ -23,8 +23,8 @@ and t1.custom_name like concat(#{customName},'%') - - and t1.product_group_id = #{productGroupId} + + and t1.product_category_id = #{productCategoryId} and t1.pad_layout_id = #{padLayoutId} From e663ebc8b995aa8c226537252acd9a71b42bf8ff Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 23 Oct 2024 16:49:47 +0800 Subject: [PATCH 012/165] =?UTF-8?q?=E5=8F=96=E9=A4=90=E7=A0=81=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/controller/product/TbPlaceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java index cfca0c7b..4e562b86 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java @@ -136,7 +136,7 @@ public class TbPlaceController { @GetMapping("/masterId") @ApiOperation("代客下单 ") public ResponseEntity getMasterId(@RequestParam Integer shopId, - @RequestParam String tableId, + @RequestParam(required = false) String tableId, @RequestParam(required = false) Integer orderId, @RequestParam(defaultValue = "") String useType) { return ResponseEntity.ok(tbShopTableService.getMasterId(shopId, tableId, useType, orderId)); From c17326ffbeb0cee6d3ac8ba41317b74a48cd59c7 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 23 Oct 2024 17:32:45 +0800 Subject: [PATCH 013/165] =?UTF-8?q?=E6=97=A0=E5=8F=B0=E6=A1=8C=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E9=80=89=E6=8B=A9=E5=8F=B0=E6=A1=8C=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/product/TbPlaceController.java | 15 ++--- .../cashier/dto/shoptable/ChoseTableDTO.java | 14 ++-- .../mybatis/service/MpCashierCartService.java | 9 +++ .../mybatis/service/MpOrderDetailService.java | 9 +++ .../mybatis/service/MpOrderInfoService.java | 8 +++ .../mybatis/service/MpShopTableService.java | 16 +++++ .../impl/MpCashierCartServiceImpl.java | 15 ++++- .../impl/MpOrderDetailServiceImpl.java | 8 +++ .../service/impl/MpOrderInfoServiceImpl.java | 9 +++ .../service/impl/MpShopTableServiceImpl.java | 18 +++++ .../impl/shopimpl/TbShopTableServiceImpl.java | 66 ++++++++----------- 11 files changed, 130 insertions(+), 57 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java index 4e562b86..803689f2 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java @@ -62,7 +62,7 @@ public class TbPlaceController { return new ResponseEntity<>(tbProductService.activateProduct(page, size, categoryId, shopId, productId), HttpStatus.OK); } - public TbPlaceController(TbShopTableService tbShopTableService, TbProductService tbProductService,RabbitMsgUtils rabbitMsgUtils) { + public TbPlaceController(TbShopTableService tbShopTableService, TbProductService tbProductService, RabbitMsgUtils rabbitMsgUtils) { this.tbShopTableService = tbShopTableService; this.tbProductService = tbProductService; this.rabbitMsgUtils = rabbitMsgUtils; @@ -144,7 +144,7 @@ public class TbPlaceController { @PostMapping("/order") @ApiOperation("代客下单 查询购物车 /shop/table") - public ResponseEntity createOrder(@RequestBody CreateOrderDTO createOrderDTO ) { + public ResponseEntity createOrder(@RequestBody CreateOrderDTO createOrderDTO) { return ResponseEntity.ok(tbShopTableService.createOrder(createOrderDTO, !createOrderDTO.isPostPay(), true)); } @@ -170,7 +170,7 @@ public class TbPlaceController { @ApiOperation("代客下单 支付订单") public ResponseEntity pay(HttpServletRequest request, @Validated @RequestBody PayDTO payDTO) { String token = tokenProvider.getToken(request); - JSONObject userInfo = JSON.parseObject(JSON.toJSONString(redisUtils.get("online-token-"+token))); + JSONObject userInfo = JSON.parseObject(JSON.toJSONString(redisUtils.get("online-token-" + token))); String userName = userInfo.getString("userName"); String shopId = userInfo.getString("shopId"); TbPlussShopStaff shopStaff = staffRepository.queryByAccount(userName, shopId); @@ -191,10 +191,7 @@ public class TbPlaceController { @PutMapping("/choseTable") @ApiOperation("代客下单 选择台桌") - public ResponseEntity choseTable( - @Validated @RequestBody ChoseTableDTO choseTableDTO - ) { - + public ResponseEntity choseTable(@Validated @RequestBody ChoseTableDTO choseTableDTO) { return ResponseEntity.ok(tbShopTableService.choseTable(choseTableDTO)); } @@ -213,9 +210,7 @@ public class TbPlaceController { @PostMapping("/printOrder") @ApiOperation("代客下单 打印订单") - public ResponseEntity printOrder( - @Validated @RequestBody BaseTableDTO baseTableDTO - ) { + public ResponseEntity printOrder(@Validated @RequestBody BaseTableDTO baseTableDTO) { return ResponseEntity.ok(tbShopTableService.printOrder(baseTableDTO)); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/ChoseTableDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/ChoseTableDTO.java index c0ebb40a..d96950cf 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/ChoseTableDTO.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/ChoseTableDTO.java @@ -2,19 +2,15 @@ package cn.ysk.cashier.dto.shoptable; import lombok.Data; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; +import javax.validation.constraints.*; @Data public class ChoseTableDTO { @NotNull private Integer shopId; - private Integer orderId; - @NotNull - private String newTableId; - @NotEmpty - private String oldTableId; + @NotBlank + private String masterId; + @NotBlank + private String tableId; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java index 3270653b..7d0d193a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java @@ -4,6 +4,8 @@ import cn.ysk.cashier.pojo.order.TbCashierCart; import cn.ysk.cashier.pojo.order.TbOrderDetail; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** * (TbShopPermission)表服务接口 * @@ -12,5 +14,12 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface MpCashierCartService extends IService { + /** + * 根据取餐码获取购物车信息 + * @param masterId 取餐码 + * @param shopId 店铺id + * @return 购物车信息 + */ + List selectTakeoutCart(String masterId, Integer shopId); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java index c87d10c5..23d352fa 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java @@ -5,6 +5,7 @@ import cn.ysk.cashier.enums.OrderStatusEnums; import cn.ysk.cashier.pojo.order.TbOrderDetail; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.ArrayList; import java.util.List; /** @@ -24,5 +25,13 @@ public interface MpOrderDetailService extends IService { * @return 影响数量 */ boolean updateStatusByOrderIdAndIds(OrderStatusEnums oldOrderStatusEnums, OrderStatusEnums orderStatusEnums, Integer orderId, List orderDetails); + + /** + * 根据购物车id修改用餐类型 + * @param cartIds 购物车ids + * @param useType 用餐类型 + * @return 是否成功 + */ + boolean updateUseTypeByCartIds(ArrayList cartIds, String useType); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java index 9c3a86ae..d20c67d3 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java @@ -21,5 +21,13 @@ public interface MpOrderInfoService extends IService { * @return 对应的退款订单 */ TbOrderInfo selectReturnOrderByOrderId(Integer orderId); + + /** + * 修改订单的就餐类型和tableId + * @param orderId 订单id + * @param useType 就餐类型 + * @return 是否成功 + */ + boolean updateTableIdAndUseTypeById(Integer orderId, String useType, String tableId); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpShopTableService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpShopTableService.java index 65ee8e88..ab357efb 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpShopTableService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpShopTableService.java @@ -1,7 +1,23 @@ package cn.ysk.cashier.mybatis.service; +import cn.ysk.cashier.enums.TableStateEnum; import cn.ysk.cashier.pojo.shop.TbShopTable; import com.baomidou.mybatisplus.extension.service.IService; public interface MpShopTableService extends IService { + /** + * 根据qrcode修改台桌状态 + * @param tableStateEnum 状态枚举 + * @param tableId qrcode + * @return 是否成功 + */ + boolean updateStateByTableId(TableStateEnum tableStateEnum, String tableId); + + /** + * 根据状态和id获取台桌信息 + * @param tableStateEnum 台桌状态 + * @param tableId 台桌id + * @return 台桌信息 + */ + TbShopTable selectByStateAndTableId(TableStateEnum tableStateEnum, String tableId, Integer shopId); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java index d26d9573..bfea7ef9 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java @@ -1,14 +1,20 @@ package cn.ysk.cashier.mybatis.service.impl; +import cn.hutool.core.date.DateUtil; +import cn.ysk.cashier.enums.OrderUseTypeEnum; import cn.ysk.cashier.mybatis.mapper.TbCashierCartMapper; import cn.ysk.cashier.mybatis.mapper.TbOrderDetailMapper; import cn.ysk.cashier.mybatis.service.MpCashierCartService; import cn.ysk.cashier.mybatis.service.MpOrderDetailService; import cn.ysk.cashier.pojo.order.TbCashierCart; import cn.ysk.cashier.pojo.order.TbOrderDetail; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import java.util.Collections; +import java.util.List; + /** * (TbShopPermission)表服务实现类 * @@ -17,6 +23,13 @@ import org.springframework.stereotype.Service; */ @Service public class MpCashierCartServiceImpl extends ServiceImpl implements MpCashierCartService { - + @Override + public List selectTakeoutCart(String masterId, Integer shopId) { + return list(new LambdaQueryWrapper() + .eq(TbCashierCart::getShopId, shopId) + .eq(TbCashierCart::getMasterId, masterId) + .eq(TbCashierCart::getUseType, OrderUseTypeEnum.TAKEOUT.getValue()) + .gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime())); + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java index 5faf6c07..9be766b1 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /** @@ -30,5 +31,12 @@ public class MpOrderDetailServiceImpl extends ServiceImpl cartIds, String useType) { + return update(new LambdaUpdateWrapper() + .in(TbOrderDetail::getCartId, cartIds) + .set(TbOrderDetail::getUseType, useType)); + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java index 23b95c86..ea67276a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java @@ -7,6 +7,7 @@ import cn.ysk.cashier.mybatis.service.MpOrderInfoService; import cn.ysk.cashier.pojo.order.TbCashierCart; import cn.ysk.cashier.pojo.order.TbOrderInfo; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; @@ -24,5 +25,13 @@ public class MpOrderInfoServiceImpl extends ServiceImpl() + .eq(TbOrderInfo::getId, orderId) + .set(TbOrderInfo::getUseType, useType) + .set(TbOrderInfo::getTableId, tableId)); + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpShopTableServiceImpl.java index 986aa570..93d3904a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpShopTableServiceImpl.java @@ -1,5 +1,6 @@ package cn.ysk.cashier.mybatis.service.impl; +import cn.ysk.cashier.enums.TableStateEnum; import cn.ysk.cashier.mapper.shop.TbShopTableMapper; import cn.ysk.cashier.mybatis.entity.TagProductDepts; import cn.ysk.cashier.mybatis.mapper.MpShopTableMapper; @@ -7,9 +8,26 @@ import cn.ysk.cashier.mybatis.mapper.TagProductDeptsMapper; import cn.ysk.cashier.mybatis.service.MpShopTableService; import cn.ysk.cashier.mybatis.service.TagProductDeptsService; import cn.ysk.cashier.pojo.shop.TbShopTable; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; @Service public class MpShopTableServiceImpl extends ServiceImpl implements MpShopTableService { + + @Override + public boolean updateStateByTableId(TableStateEnum tableStateEnum, String tableId) { + return update(new LambdaUpdateWrapper() + .eq(TbShopTable::getQrcode, tableId) + .set(TbShopTable::getStatus, tableStateEnum.getState())); + } + + @Override + public TbShopTable selectByStateAndTableId(TableStateEnum tableStateEnum, String tableId, Integer shopId) { + return getOne(new LambdaQueryWrapper() + .eq(TbShopTable::getShopId, shopId) + .eq(TbShopTable::getStatus, tableStateEnum.getState()) + .eq(TbShopTable::getQrcode, tableId)); + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 46e2d9b5..4840ffcd 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1098,6 +1098,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { List cashierCarts = cashierCartMapper .selectList(queryWrapper); + if (cashierCarts.isEmpty() || (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && cashierCarts.size() < 2)) { throw new BadRequestException("购物车为空或未选择餐位费,请先添加商品或选择餐位费"); } @@ -1728,50 +1729,41 @@ public class TbShopTableServiceImpl implements TbShopTableService { @Override public Object choseTable(ChoseTableDTO choseTableDTO) { - String masterId = getMasterId(choseTableDTO.getShopId(), choseTableDTO.getNewTableId(), null, null).getString("masterId"); - - TbShopTable shopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper() - .eq(TbShopTable::getQrcode, choseTableDTO.getNewTableId()) - .eq(TbShopTable::getStatus, "idle")); + TbShopTable shopTable = mpShopTableService.selectByStateAndTableId(TableStateEnum.IDLE, choseTableDTO.getTableId(), choseTableDTO.getShopId()); if (shopTable == null) { - throw new BadRequestException("台桌不存在或非空闲状态"); + throw new BadRequestException("台桌不存在或不处于空闲状态"); } - ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(choseTableDTO.getShopId(), choseTableDTO.getNewTableId()); - TbOrderInfo currentOrder = getCurrentOrder(shopEatTypeInfoDTO); - Integer currentOrderId = currentOrder == null ? null : currentOrder.getId(); + List tbCashierCarts = mpCashierCartService.selectTakeoutCart(choseTableDTO.getMasterId(), choseTableDTO.getShopId()); + if (tbCashierCarts.isEmpty()) { + throw new BadRequestException("购物车为空"); + } + ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(choseTableDTO.getShopId(), choseTableDTO.getTableId()); - cashierCartMapper.update(null, new LambdaUpdateWrapper() - .eq(TbCashierCart::getTableId, choseTableDTO.getOldTableId()) - .in(TbCashierCart::getStatus, "create", "return") - .eq(TbCashierCart::getShopId, choseTableDTO.getShopId()) - .and(q -> q.isNull(TbCashierCart::getOrderId) - .or() - .eq(TbCashierCart::getOrderId, currentOrderId)) - .and(query2 -> query2.or(query3 -> query3.eq(TbCashierCart::getTradeDay, DateUtils.getDay()) - .isNotNull(TbCashierCart::getMasterId)) - .or((query4 -> query4.isNull(TbCashierCart::getTradeDay) - .isNull(TbCashierCart::getMasterId)))) - .set(TbCashierCart::getMasterId, masterId) - .set(TbCashierCart::getTableId, choseTableDTO.getNewTableId())); + ArrayList cartIds = new ArrayList<>(); + Integer orderId = null; + for (TbCashierCart item : tbCashierCarts) { + item.setTableId(choseTableDTO.getTableId()); + item.setUseType(shopEatTypeInfoDTO.getUseType()); + cartIds.add(item.getId()); + if (item.getOrderId() != null) { + orderId = item.getOrderId(); + } + } + mpCashierCartService.updateBatchById(tbCashierCarts); + // 修改detail的用餐类型 + mpOrderDetailService.updateUseTypeByCartIds(cartIds, shopEatTypeInfoDTO.getUseType()); - mpShopTableMapper.update(null, new LambdaUpdateWrapper() - .eq(TbShopTable::getQrcode, choseTableDTO.getNewTableId()) - .set(TbShopTable::getStatus, TableStateEnum.USING.getState())); - mpShopTableMapper.update(null, new LambdaUpdateWrapper() - .eq(TbShopTable::getQrcode, choseTableDTO.getOldTableId()) - .set(TbShopTable::getStatus, TableStateEnum.IDLE.getState())); - - // 将台桌redis数据迁移 - String orderId = removeCurrentOrderId(choseTableDTO.getOldTableId(), choseTableDTO.getShopId().toString()); - setCurrentOrderId(choseTableDTO.getNewTableId(), choseTableDTO.getShopId().toString(), orderId); - - return orderInfoMapper.update(null, new LambdaUpdateWrapper() - .eq(TbOrderInfo::getId, currentOrderId) - .set(TbOrderInfo::getMasterId, masterId) - .set(TbOrderInfo::getTableId, choseTableDTO.getNewTableId())); + // 修改订单表台桌信息 + if(orderId != null) { + mpOrderInfoService.updateTableIdAndUseTypeById(orderId, shopEatTypeInfoDTO.getUseType(), choseTableDTO.getTableId()); + mpShopTableService.updateStateByTableId(TableStateEnum.USING, choseTableDTO.getTableId()); + // 将台桌redis数据迁移 + setCurrentOrderId(choseTableDTO.getTableId(), choseTableDTO.getShopId().toString(), orderId.toString()); + } + return true; } From b2f01ed45353fa0fda539335fd0b709f8429c0ad Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 24 Oct 2024 09:24:58 +0800 Subject: [PATCH 014/165] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A4=90=E4=BD=8D=E8=B4=B9=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/enums/OrderStatusEnums.java | 2 +- .../impl/shopimpl/TbShopTableServiceImpl.java | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java b/eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java index 3210e758..34d6a451 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java @@ -6,7 +6,7 @@ import lombok.Getter; public enum OrderStatusEnums { REFUNDING("refunding"), REFUND("refund"), - CLOSED("closed"); + CLOSED("closed"), CREATE("create"); private final String value; OrderStatusEnums(String value) { diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 4840ffcd..83721100 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -8,6 +8,7 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.ysk.cashier.config.security.security.TokenProvider; import cn.ysk.cashier.cons.RedisConstant; +import cn.ysk.cashier.cons.TableConstant; import cn.ysk.cashier.cons.rabbit.RabbitConstants; import cn.ysk.cashier.dto.shop.TbShopTableDto; import cn.ysk.cashier.dto.shop.TbShopTableQueryCriteria; @@ -1075,7 +1076,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() .eq(TbCashierCart::getShopId, createOrderDTO.getShopId()) .eq(TbCashierCart::getUseType, createOrderDTO.getUseType()) - .in(TbCashierCart::getStatus, "create") + .in(TbCashierCart::getStatus, "create", "return") .gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime()) .and(q -> q.eq(TbCashierCart::getMasterId, createOrderDTO.getMasterId()).or().isNull(TbCashierCart::getMasterId)); @@ -1096,10 +1097,21 @@ public class TbShopTableServiceImpl implements TbShopTableService { queryWrapper.eq(TbCashierCart::getTableId, createOrderDTO.getTableId()); } - List cashierCarts = cashierCartMapper + List allCashierCarts = cashierCartMapper .selectList(queryWrapper); - if (cashierCarts.isEmpty() || (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && cashierCarts.size() < 2)) { + List cashierCarts = new ArrayList<>(); + TbCashierCart seatCart = null; + for (TbCashierCart allCashierCart : allCashierCarts) { + if (TableConstant.CART_SEAT_ID.equals(allCashierCart.getProductId())) { + seatCart = allCashierCart; + }else if (OrderStatusEnums.CREATE.getValue().equals(allCashierCart.getStatus())) { + cashierCarts.add(allCashierCart); + } + } + + if (allCashierCarts.isEmpty() || (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart != null && allCashierCarts.size() < 2) + || (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart == null)) { throw new BadRequestException("购物车为空或未选择餐位费,请先添加商品或选择餐位费"); } From 4cdc0b5738e4db57ed23cfeb98c470bce4ea18c4 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 24 Oct 2024 09:31:35 +0800 Subject: [PATCH 015/165] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A4=90=E4=BD=8D=E8=B4=B9=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/shopimpl/TbShopTableServiceImpl.java | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 83721100..88315472 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1151,14 +1151,9 @@ public class TbShopTableServiceImpl implements TbShopTableService { List addOrderDetails = new ArrayList<>(); - BigDecimal mealAmount = null; - Integer mealNum = null; + boolean hasNewInfo = false; for (TbCashierCart cashierCart : cashierCarts) { - if ("-999".equals(cashierCart.getProductId())) { - mealAmount = cashierCart.getTotalAmount(); - mealNum = cashierCart.getNumber(); - } if (!"return".equals(cashierCart.getStatus())) { totalAmount = totalAmount.add(cashierCart.getTotalAmount()); packAMount = packAMount.add(cashierCart.getPackFee()); @@ -1203,11 +1198,6 @@ public class TbShopTableServiceImpl implements TbShopTableService { orderDetails.add(orderDetail); } - if (shopInfo.getIsTableFee() != null && shopInfo.getIsTableFee() == 0 - && !shopEatTypeInfoDTO.isTakeout() - && mealAmount == null) { - throw new BadRequestException("请选择用餐人数"); - } // 查询订单 TbOrderInfo orderInfo = null; @@ -1232,8 +1222,10 @@ public class TbShopTableServiceImpl implements TbShopTableService { orderInfo.setTradeDay(DateUtils.getDay()); orderInfo.setUseType(createOrderDTO.getUseType()); orderInfo.setCreatedAt(DateUtil.current()); - orderInfo.setSeatAmount(mealAmount); - orderInfo.setSeatCount(mealNum); + if (seatCart != null) { + orderInfo.setSeatAmount(seatCart.getTotalAmount()); + orderInfo.setSeatCount(seatCart.getNumber()); + } if (StrUtil.isNotBlank(createOrderDTO.getVipUserId())) { orderInfo.setUserId(createOrderDTO.getVipUserId()); } @@ -1272,8 +1264,10 @@ public class TbShopTableServiceImpl implements TbShopTableService { if (StrUtil.isNotBlank(createOrderDTO.getVipUserId())) { orderInfo.setUserId(createOrderDTO.getVipUserId()); } - orderInfo.setSeatAmount(mealAmount); - orderInfo.setSeatCount(mealNum); + if (seatCart != null) { + orderInfo.setSeatAmount(seatCart.getTotalAmount()); + orderInfo.setSeatCount(seatCart.getNumber()); + } orderInfo.setSendType(shopEatTypeInfoDTO.getSendType()); TbMerchantAccount merchantAccount = merchantAccountMapper.selectOne(new LambdaQueryWrapper() .eq(TbMerchantAccount::getShopId, createOrderDTO.getShopId()) @@ -1371,7 +1365,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { .set(TbShopTable::getProductNum, cashierCarts.size()) .set(TbShopTable::getTotalAmount, orderInfo.getOrderAmount()) .set(TbShopTable::getRealAmount, orderInfo.getOrderAmount()) - .set(TbShopTable::getUseNum, mealNum) + .set(TbShopTable::getUseNum, seatCart != null ? seatCart.getNumber() : null) .set(TbShopTable::getStatus, TableStateEnum.USING.getState()); if (isFirst) { wrapper.set(TbShopTable::getUseTime, DateUtil.date()); From d2eae1734ef4beae379ea990a9d9990b0f51a931 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 24 Oct 2024 09:33:42 +0800 Subject: [PATCH 016/165] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A4=90=E4=BD=8D=E8=B4=B9=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 88315472..0f6e0dcd 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1105,7 +1105,9 @@ public class TbShopTableServiceImpl implements TbShopTableService { for (TbCashierCart allCashierCart : allCashierCarts) { if (TableConstant.CART_SEAT_ID.equals(allCashierCart.getProductId())) { seatCart = allCashierCart; - }else if (OrderStatusEnums.CREATE.getValue().equals(allCashierCart.getStatus())) { + } + + if (OrderStatusEnums.CREATE.getValue().equals(allCashierCart.getStatus())) { cashierCarts.add(allCashierCart); } } From bc90c47f2c26b55f9bea0186a4ea13d9ab71b594 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 24 Oct 2024 09:43:05 +0800 Subject: [PATCH 017/165] =?UTF-8?q?=E5=AE=A2=E5=BA=A7=E8=B4=B9=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java | 2 +- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java b/eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java index 34d6a451..637f3f2c 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/enums/OrderStatusEnums.java @@ -6,7 +6,7 @@ import lombok.Getter; public enum OrderStatusEnums { REFUNDING("refunding"), REFUND("refund"), - CLOSED("closed"), CREATE("create"); + CLOSED("closed"), CREATE("create"), RETURN("return"); private final String value; OrderStatusEnums(String value) { diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 0f6e0dcd..cb167d41 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1801,7 +1801,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { .eq(TbCashierCart::getSkuId, "-999") .eq(TbCashierCart::getUseType, choseCountDTO.getUseType()) .gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime()) - .eq(TbCashierCart::getStatus, "create") + .in(TbCashierCart::getStatus, OrderStatusEnums.CREATE.getValue(), OrderStatusEnums.RETURN.getValue()) .eq(TbCashierCart::getTableId, choseCountDTO.getTableId()); TbCashierCart tbCashierCart = cashierCartMapper.selectOne(query); From db0e01ecf77ad3896cd5cf84eded821243490215 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 24 Oct 2024 11:42:37 +0800 Subject: [PATCH 018/165] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A0=E6=A1=8C?= =?UTF-8?q?=E5=8F=B0=E5=B0=B1=E9=A4=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/shoptable/ShopEatTypeInfoDTO.java | 7 ++++ .../impl/shopimpl/TbShopTableServiceImpl.java | 33 +++++++++++++++---- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/ShopEatTypeInfoDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/ShopEatTypeInfoDTO.java index 13db70d2..6926a8aa 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/ShopEatTypeInfoDTO.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/ShopEatTypeInfoDTO.java @@ -7,11 +7,18 @@ import lombok.Data; @Data @AllArgsConstructor public class ShopEatTypeInfoDTO { + // 是否外带 private boolean isTakeout; + // 是否快餐 private boolean isMunchies; + // 是否后付费 private boolean isDineInAfter; + // 是否先付费 private boolean isDineInBefore; + // 是否需要餐位费 private boolean needSeatFee; + // 是否无桌台下单 + private boolean isNoneTable; private TbShopInfo shopInfo; private String useType; private Object shopId; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index cb167d41..0b91d414 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -151,7 +151,26 @@ public class TbShopTableServiceImpl implements TbShopTableService { return getShopEatTypeInfoDTO(shopId, eatModel, tableId); } + /** + * 校验就餐模式是否存在并返回就餐类型信息 + * + * @param tableId 台桌id + * @param shopId 店铺id + * @return 就餐类型信息 + */ + public ShopEatTypeInfoDTO checkEatModel(Object shopId, String tableId, String useType) { + String eatModel = OrderUseTypeEnum.TAKEOUT.getValue().equals(useType) ? ShopInfoEatModelEnum.TAKE_OUT.getValue() : ShopInfoEatModelEnum.DINE_IN.getValue(); + return getShopEatTypeInfoDTO(shopId, eatModel, tableId); + } + /** + * 通过店铺id和就餐模式获取当前店铺的就餐类型信息 + * + * @param shopId 店铺id + * @param eatModel 就餐模式 + * @param tableId 台桌id + * @return just餐类型信息 + * */ private ShopEatTypeInfoDTO getShopEatTypeInfoDTO(Object shopId, String eatModel, String tableId) { TbShopInfo shopInfo = mpShopInfoMapper.selectOne(new LambdaQueryWrapper() .eq(TbShopInfo::getId, shopId) @@ -172,8 +191,9 @@ public class TbShopTableServiceImpl implements TbShopTableService { boolean isDineInBefore = isMunchies && !isTakeout; boolean needSeatFee = shopInfo.getIsTableFee() == null || shopInfo.getIsTableFee() == 0; + boolean isNoneTable = StrUtil.isBlank(tableId) && !isTakeout; - return new ShopEatTypeInfoDTO(isTakeout, isMunchies, isDineInAfter, isDineInBefore, needSeatFee, shopInfo, isTakeout ? OrderUseTypeEnum.TAKEOUT.getValue() : + return new ShopEatTypeInfoDTO(isTakeout, isMunchies, isDineInAfter, isDineInBefore, needSeatFee, isNoneTable, shopInfo, isTakeout ? OrderUseTypeEnum.TAKEOUT.getValue() : isMunchies ? OrderUseTypeEnum.DINE_IN_BEFORE.getValue() : OrderUseTypeEnum.DINE_IN_AFTER.getValue(), shopId, tableId, isTakeout ? OrderSendTypeEnums.TAKE_SELF.getValue() : OrderSendTypeEnums.TABLE.getValue()); } @@ -1797,8 +1817,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { LambdaQueryWrapper query = new LambdaQueryWrapper() .eq(TbCashierCart::getShopId, choseCountDTO.getShopId()) .and(q -> q.eq(TbCashierCart::getMasterId, choseCountDTO.getMasterId()).or().isNull(TbCashierCart::getMasterId).or().eq(TbCashierCart::getMasterId, "")) - .eq(TbCashierCart::getProductId, "-999") - .eq(TbCashierCart::getSkuId, "-999") + .eq(TbCashierCart::getProductId, TableConstant.CART_SEAT_ID) .eq(TbCashierCart::getUseType, choseCountDTO.getUseType()) .gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime()) .in(TbCashierCart::getStatus, OrderStatusEnums.CREATE.getValue(), OrderStatusEnums.RETURN.getValue()) @@ -1925,10 +1944,10 @@ public class TbShopTableServiceImpl implements TbShopTableService { @Override public Object choseModel(ChoseModelDTO choseModelDTO) { - if (!OrderUseTypeEnum.TAKEOUT.getValue().equals(choseModelDTO.getUseType()) && StrUtil.isBlank(choseModelDTO.getTableId())) { - throw new BadRequestException("堂食tableId必须传递"); - // 外带设置餐位费 - } +// if (!OrderUseTypeEnum.TAKEOUT.getValue().equals(choseModelDTO.getUseType()) && StrUtil.isBlank(choseModelDTO.getTableId())) { +// throw new BadRequestException("堂食tableId必须传递"); +// // 外带设置餐位费 +// } List cashierCarts = cashierCartMapper.selectList(new LambdaQueryWrapper() .eq(TbCashierCart::getShopId, choseModelDTO.getShopId()) From 824985a6ad87a32b5ab47b89f5cd9a4e5d51e9b4 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 24 Oct 2024 15:28:15 +0800 Subject: [PATCH 019/165] =?UTF-8?q?=E5=A4=9A=E4=BD=99=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E5=88=A0=E9=99=A4=20=E6=B4=BB=E5=8A=A8=E9=87=8D=E5=86=99=20?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E9=87=8D=E5=86=99=20=E5=BA=97?= =?UTF-8?q?=E9=93=BA=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .../controller/BotButtonConfigController.java | 82 --- .../controller/BotConfigController.java | 82 --- .../cashier/controller/BotUserController.java | 82 --- .../controller/BotUserFlowController.java | 82 --- .../TbRenewalsPayLogController.java | 82 --- .../controller/TbShopCouponController.java | 78 +++ .../controller/shop/ShopPayApiController.java | 4 - .../shop/TbReceiptSalesController.java | 91 ---- .../shop/TbShopCashSpreadController.java | 95 ---- .../shop/TbShopCurrencyController.java | 83 ---- .../dto/TbActivateProductQueryCriteria.java | 2 +- .../dto/TbShopCouponQueryCriteria.java | 17 + .../cashier/mapper/BotButtonConfigMapper.java | 32 -- .../ysk/cashier/mapper/BotConfigMapper.java | 32 -- .../ysk/cashier/mapper/BotUserFlowMapper.java | 32 -- .../cn/ysk/cashier/mapper/BotUserMapper.java | 32 -- .../mapper/TbRenewalsPayLogMapper.java | 32 -- .../mapper/shop/TbMerchantCouponMapper.java | 32 -- .../mapper/shop/TbReceiptSalesMapper.java | 32 -- .../mapper/shop/TbShopCashSpreadMapper.java | 32 -- .../mapper/shop/TbShopCurrencyMapper.java | 32 -- .../ysk/cashier/mybatis/entity/Activate.java | 31 -- .../cashier/mybatis/entity/TbActivate.java | 117 +++-- .../mybatis/entity/TbActivateInRecord.java | 68 ++- .../mybatis/entity/TbActivateOutRecord.java | 63 ++- .../mybatis/entity/TbActivateProduct.java | 83 ---- .../mybatis/entity/TbCouponProduct.java | 40 ++ .../cashier/mybatis/entity/TbShopCoupon.java | 253 ++++++++++ .../cashier/mybatis/entity/TbUserStorage.java | 33 -- .../mybatis/mapper/ActivateMapper.java | 9 - ...Mapper.java => TbCouponProductMapper.java} | 4 +- .../mybatis/mapper/TbShopCouponMapper.java | 15 + .../mybatis/mapper/TbUserStorageMapper.java | 9 - .../mybatis/rest/StorageController.java | 26 +- .../cashier/mybatis/service/ShopService.java | 30 -- .../mybatis/service/TbActivateService.java | 4 + ...rvice.java => TbCouponProductService.java} | 5 +- .../mybatis/service/TbShopCouponService.java | 31 ++ .../mybatis/service/impl/ShopServiceImpl.java | 186 ------- .../impl/TbActivateProductServiceImpl.java | 27 - .../service/impl/TbActivateServiceImpl.java | 31 +- .../impl/TbCouponProductServiceImpl.java | 19 + .../service/impl/TbShopCouponServiceImpl.java | 130 +++++ .../cashier/mybatis/vo/ActivateProsVo.java | 17 - .../cashier/mybatis/vo/TbShopCouponVo.java | 14 + .../cn/ysk/cashier/pojo/BotButtonConfig.java | 53 -- .../java/cn/ysk/cashier/pojo/BotConfig.java | 57 --- .../java/cn/ysk/cashier/pojo/BotUser.java | 123 ----- .../java/cn/ysk/cashier/pojo/BotUserFlow.java | 75 --- .../cn/ysk/cashier/pojo/TbRenewalsPayLog.java | 100 ---- .../cashier/pojo/shop/TbMerchantCoupon.java | 467 ------------------ .../ysk/cashier/pojo/shop/TbReceiptSales.java | 120 ----- .../cashier/pojo/shop/TbShopCashSpread.java | 72 --- .../ysk/cashier/pojo/shop/TbShopCurrency.java | 130 ----- .../repository/BotButtonConfigRepository.java | 28 -- .../repository/BotConfigRepository.java | 28 -- .../repository/BotUserFlowRepository.java | 28 -- .../cashier/repository/BotUserRepository.java | 28 -- .../TbRenewalsPayLogRepository.java | 28 -- .../shop/TbMerchantCouponRepository.java | 28 -- .../shop/TbReceiptSalesRepository.java | 28 -- .../shop/TbShopCashSpreadRepository.java | 43 -- .../shop/TbShopCurrencyRepository.java | 33 -- .../service/BotButtonConfigService.java | 83 ---- .../ysk/cashier/service/BotConfigService.java | 68 --- .../cashier/service/BotUserFlowService.java | 83 ---- .../ysk/cashier/service/BotUserService.java | 83 ---- .../service/TbRenewalsPayLogService.java | 83 ---- .../impl/BotButtonConfigServiceImpl.java | 105 ---- .../service/impl/BotConfigServiceImpl.java | 106 ---- .../service/impl/BotUserFlowServiceImpl.java | 110 ----- .../service/impl/BotUserServiceImpl.java | 122 ----- .../impl/TbRenewalsPayLogServiceImpl.java | 116 ----- .../impl/order/TbOrderInfoServiceImpl.java | 4 - .../productimpl/TbProductServiceImpl.java | 6 +- .../shopimpl/TbMerchantCouponServiceImpl.java | 180 ------- .../shopimpl/TbReceiptSalesServiceImpl.java | 122 ----- .../shopimpl/TbShopCashSpreadServiceImpl.java | 115 ----- .../shopimpl/TbShopCurrencyServiceImpl.java | 130 ----- .../service/shop/TbMerchantCouponService.java | 83 ---- .../service/shop/TbReceiptSalesService.java | 83 ---- .../service/shop/TbShopCashSpreadService.java | 84 ---- .../service/shop/TbShopCurrencyService.java | 90 ---- .../cashier/system/rest/ParamsController.java | 5 - .../resources/mapper/TbActivateMapper.xml | 23 - 86 files changed, 846 insertions(+), 4821 deletions(-) delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/BotButtonConfigController.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/BotConfigController.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/BotUserController.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/BotUserFlowController.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/TbRenewalsPayLogController.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbReceiptSalesController.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopCashSpreadController.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopCurrencyController.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/TbShopCouponQueryCriteria.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotButtonConfigMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotConfigMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotUserFlowMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotUserMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mapper/TbRenewalsPayLogMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbMerchantCouponMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbReceiptSalesMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbShopCashSpreadMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbShopCurrencyMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/Activate.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateProduct.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbCouponProduct.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopCoupon.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbUserStorage.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ActivateMapper.java rename eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/{TbActivateProductMapper.java => TbCouponProductMapper.java} (61%) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbUserStorageMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/ShopService.java rename eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/{TbActivateProductService.java => TbCouponProductService.java} (62%) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/ShopServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateProductServiceImpl.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbCouponProductServiceImpl.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/vo/ActivateProsVo.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/vo/TbShopCouponVo.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotButtonConfig.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotConfig.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotUser.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotUserFlow.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/TbRenewalsPayLog.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantCoupon.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbReceiptSales.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopCashSpread.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopCurrency.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/repository/BotButtonConfigRepository.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/repository/BotConfigRepository.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/repository/BotUserFlowRepository.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/repository/BotUserRepository.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/repository/TbRenewalsPayLogRepository.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbMerchantCouponRepository.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbReceiptSalesRepository.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopCashSpreadRepository.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopCurrencyRepository.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/BotButtonConfigService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/BotConfigService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/BotUserFlowService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/BotUserService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/TbRenewalsPayLogService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotButtonConfigServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotConfigServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotUserFlowServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotUserServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbRenewalsPayLogServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbMerchantCouponServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbReceiptSalesServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopCashSpreadServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopCurrencyServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbMerchantCouponService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbReceiptSalesService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopCashSpreadService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopCurrencyService.java delete mode 100644 eladmin-system/src/main/resources/mapper/TbActivateMapper.xml diff --git a/.gitignore b/.gitignore index 085c5046..b8080da1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ */target/* */*.iml /.gradle/ +/application.pid *.log logs/* \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotButtonConfigController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotButtonConfigController.java deleted file mode 100644 index 0d0fb7ce..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotButtonConfigController.java +++ /dev/null @@ -1,82 +0,0 @@ -/* -* 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.controller; - -import cn.ysk.cashier.annotation.Log; -import cn.ysk.cashier.pojo.BotButtonConfig; -import cn.ysk.cashier.service.BotButtonConfigService; -import cn.ysk.cashier.dto.BotButtonConfigQueryCriteria; -import org.springframework.data.domain.Pageable; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -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; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-31 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "buttonConfig管理") -@RequestMapping("/api/botButtonConfig") -public class BotButtonConfigController { - - private final BotButtonConfigService botButtonConfigService; - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('botButtonConfig:list')") - public void exportBotButtonConfig(HttpServletResponse response, BotButtonConfigQueryCriteria criteria) throws IOException { - botButtonConfigService.download(botButtonConfigService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询buttonConfig") - @PreAuthorize("@el.check('botButtonConfig:list')") - public ResponseEntity queryBotButtonConfig(BotButtonConfigQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(botButtonConfigService.queryAll(criteria,pageable),HttpStatus.OK); - } - - @PostMapping - @ApiOperation("新增buttonConfig") - @PreAuthorize("@el.check('botButtonConfig:add')") - public ResponseEntity createBotButtonConfig(@Validated @RequestBody BotButtonConfig resources){ - return new ResponseEntity<>(botButtonConfigService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @ApiOperation("修改buttonConfig") - @PreAuthorize("@el.check('botButtonConfig:edit')") - public ResponseEntity updateBotButtonConfig(@Validated @RequestBody BotButtonConfig resources){ - botButtonConfigService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @ApiOperation("删除buttonConfig") - @PreAuthorize("@el.check('botButtonConfig:del')") - public ResponseEntity deleteBotButtonConfig(@RequestBody Integer[] ids) { - botButtonConfigService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotConfigController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotConfigController.java deleted file mode 100644 index f7fc86ce..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotConfigController.java +++ /dev/null @@ -1,82 +0,0 @@ -/* -* 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.controller; - -import cn.ysk.cashier.annotation.Log; -import cn.ysk.cashier.pojo.BotConfig; -import cn.ysk.cashier.service.BotConfigService; -import cn.ysk.cashier.dto.BotConfigQueryCriteria; -import org.springframework.data.domain.Pageable; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -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; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-31 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "botConfig管理") -@RequestMapping("/api/botConfig") -public class BotConfigController { - - private final BotConfigService botConfigService; - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('botConfig:list')") - public void exportBotConfig(HttpServletResponse response, BotConfigQueryCriteria criteria) throws IOException { - botConfigService.download(botConfigService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询botConfig") - @PreAuthorize("@el.check('botConfig:list')") - public ResponseEntity queryBotConfig(BotConfigQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(botConfigService.queryAll(criteria,pageable),HttpStatus.OK); - } - - @PostMapping - @ApiOperation("新增botConfig") - @PreAuthorize("@el.check('botConfig:add')") - public ResponseEntity createBotConfig(@Validated @RequestBody BotConfig resources){ - return new ResponseEntity<>(botConfigService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @ApiOperation("修改botConfig") - @PreAuthorize("@el.check('botConfig:edit')") - public ResponseEntity updateBotConfig(@Validated @RequestBody BotConfig resources){ - botConfigService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @ApiOperation("删除botConfig") - @PreAuthorize("@el.check('botConfig:del')") - public ResponseEntity deleteBotConfig(@RequestBody Integer[] ids) { - botConfigService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotUserController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotUserController.java deleted file mode 100644 index 40d1d5cc..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotUserController.java +++ /dev/null @@ -1,82 +0,0 @@ -/* -* 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.controller; - -import cn.ysk.cashier.annotation.Log; -import cn.ysk.cashier.pojo.BotUser; -import cn.ysk.cashier.service.BotUserService; -import cn.ysk.cashier.dto.BotUserQueryCriteria; -import org.springframework.data.domain.Pageable; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -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; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-30 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "BotUserController管理") -@RequestMapping("/api/botUser") -public class BotUserController { - - private final BotUserService botUserService; - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('botUser:list')") - public void exportBotUser(HttpServletResponse response, BotUserQueryCriteria criteria) throws IOException { - botUserService.download(botUserService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询BotUserController") - @PreAuthorize("@el.check('botUser:list')") - public ResponseEntity queryBotUser(BotUserQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(botUserService.queryAll(criteria,pageable),HttpStatus.OK); - } - - @PostMapping - @ApiOperation("新增BotUserController") - @PreAuthorize("@el.check('botUser:add')") - public ResponseEntity createBotUser(@Validated @RequestBody BotUser resources){ - return new ResponseEntity<>(botUserService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @ApiOperation("修改BotUserController") - @PreAuthorize("@el.check('botUser:edit')") - public ResponseEntity updateBotUser(@Validated @RequestBody BotUser resources){ - botUserService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @ApiOperation("删除BotUserController") - @PreAuthorize("@el.check('botUser:del')") - public ResponseEntity deleteBotUser(@RequestBody Integer[] ids) { - botUserService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotUserFlowController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotUserFlowController.java deleted file mode 100644 index e41c7998..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/BotUserFlowController.java +++ /dev/null @@ -1,82 +0,0 @@ -/* -* 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.controller; - -import cn.ysk.cashier.annotation.Log; -import cn.ysk.cashier.pojo.BotUserFlow; -import cn.ysk.cashier.service.BotUserFlowService; -import cn.ysk.cashier.dto.BotUserFlowQueryCriteria; -import org.springframework.data.domain.Pageable; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -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; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-30 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "accountFlow管理") -@RequestMapping("/api/botUserFlow") -public class BotUserFlowController { - - private final BotUserFlowService botUserFlowService; - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('botUserFlow:list')") - public void exportBotUserFlow(HttpServletResponse response, BotUserFlowQueryCriteria criteria) throws IOException { - botUserFlowService.download(botUserFlowService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询accountFlow") - @PreAuthorize("@el.check('botUserFlow:list')") - public ResponseEntity queryBotUserFlow(BotUserFlowQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(botUserFlowService.queryAll(criteria,pageable),HttpStatus.OK); - } - - @PostMapping - @ApiOperation("新增accountFlow") - @PreAuthorize("@el.check('botUserFlow:add')") - public ResponseEntity createBotUserFlow(@Validated @RequestBody BotUserFlow resources){ - return new ResponseEntity<>(botUserFlowService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @ApiOperation("修改accountFlow") - @PreAuthorize("@el.check('botUserFlow:edit')") - public ResponseEntity updateBotUserFlow(@Validated @RequestBody BotUserFlow resources){ - botUserFlowService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @ApiOperation("删除accountFlow") - @PreAuthorize("@el.check('botUserFlow:del')") - public ResponseEntity deleteBotUserFlow(@RequestBody Integer[] ids) { - botUserFlowService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbRenewalsPayLogController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbRenewalsPayLogController.java deleted file mode 100644 index 7821f3ec..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbRenewalsPayLogController.java +++ /dev/null @@ -1,82 +0,0 @@ -/* -* 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.controller; - -import cn.ysk.cashier.annotation.Log; -import cn.ysk.cashier.pojo.TbRenewalsPayLog; -import cn.ysk.cashier.service.TbRenewalsPayLogService; -import cn.ysk.cashier.dto.TbRenewalsPayLogQueryCriteria; -import org.springframework.data.domain.Pageable; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -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; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2023-11-07 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "/shop/renewals管理") -@RequestMapping("/api/tbRenewalsPayLog") -public class TbRenewalsPayLogController { - - private final TbRenewalsPayLogService tbRenewalsPayLogService; - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('tbRenewalsPayLog:list')") - public void exportTbRenewalsPayLog(HttpServletResponse response, TbRenewalsPayLogQueryCriteria criteria) throws IOException { - tbRenewalsPayLogService.download(tbRenewalsPayLogService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询/shop/renewals") - @PreAuthorize("@el.check('tbRenewalsPayLog:list')") - public ResponseEntity queryTbRenewalsPayLog(TbRenewalsPayLogQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(tbRenewalsPayLogService.queryAll(criteria,pageable),HttpStatus.OK); - } - - @PostMapping - @ApiOperation("新增/shop/renewals") - @PreAuthorize("@el.check('tbRenewalsPayLog:add')") - public ResponseEntity createTbRenewalsPayLog(@Validated @RequestBody TbRenewalsPayLog resources){ - return new ResponseEntity<>(tbRenewalsPayLogService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @ApiOperation("修改/shop/renewals") - @PreAuthorize("@el.check('tbRenewalsPayLog:edit')") - public ResponseEntity updateTbRenewalsPayLog(@Validated @RequestBody TbRenewalsPayLog resources){ - tbRenewalsPayLogService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @ApiOperation("删除/shop/renewals") - @PreAuthorize("@el.check('tbRenewalsPayLog:del')") - public ResponseEntity deleteTbRenewalsPayLog(@RequestBody Integer[] ids) { - tbRenewalsPayLogService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java new file mode 100644 index 00000000..2ab2bf99 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java @@ -0,0 +1,78 @@ +package cn.ysk.cashier.controller; + +import cn.ysk.cashier.exception.BadRequestException; +import cn.ysk.cashier.mybatis.entity.TbShopCoupon; +import cn.ysk.cashier.mybatis.service.TbShopCouponService; +import cn.ysk.cashier.mybatis.vo.TbShopCouponVo; +import cn.ysk.cashier.utils.SecurityUtils; +import io.swagger.annotations.Api; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import cn.ysk.cashier.dto.TbShopCouponQueryCriteria; + +import javax.annotation.Resource; + +/** + * 优惠券(TbShopCoupon)表控制层 + * + * @author ww + * @since 2024-10-22 15:43:24 + */ +@Api(tags = "优惠券管理") +@RestController +@RequestMapping("/api/tbShopCoupon") +public class TbShopCouponController { + /** + * 服务对象 + */ + @Resource + private TbShopCouponService tbShopCouponService; + + @GetMapping + @ApiOperation("分页查询") + public ResponseEntity selectAll(TbShopCouponQueryCriteria criteria) { + return new ResponseEntity<>(tbShopCouponService.queryAll(criteria), HttpStatus.OK); + } + + @GetMapping("{id}") + @ApiOperation("通过Id查询详情") + public TbShopCoupon selectOne(@PathVariable Integer id) { + return tbShopCouponService.findById(id); + } + + @GetMapping("/product/{couponId}") + @ApiOperation("查询赠送的商品") + public ResponseEntity queryActivatePros(@PathVariable("couponId") Integer couponId){ + return new ResponseEntity<>(tbShopCouponService.findActivatePros(couponId),HttpStatus.OK); + } + + @PostMapping + @ApiOperation("新增") + public ResponseEntity insert(@RequestBody TbShopCouponVo tbShopCoupon) { + if (tbShopCoupon.getType().equals(2) && CollectionUtils.isEmpty(tbShopCoupon.getProducts())) { + throw new BadRequestException("赠送商品不可为空"); + } + tbShopCoupon.setEditor(SecurityUtils.getCurrentUserNickName()); + return new ResponseEntity<>(tbShopCouponService.update(tbShopCoupon), HttpStatus.CREATED); + } + + @PutMapping + @ApiOperation("通过id修改") + public ResponseEntity update(@RequestBody TbShopCouponVo tbShopCoupon) { + if (tbShopCoupon.getType().equals(2) && CollectionUtils.isEmpty(tbShopCoupon.getProducts())) + throw new BadRequestException("赠送商品不可为空"); + tbShopCouponService.update(tbShopCoupon); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @ApiOperation("删除") + public ResponseEntity delete(@RequestParam("id") Integer id) { + tbShopCouponService.delete(id); + return new ResponseEntity<>(HttpStatus.OK); + } +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/ShopPayApiController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/ShopPayApiController.java index 409d34ea..205169ac 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/ShopPayApiController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/ShopPayApiController.java @@ -38,10 +38,6 @@ public class ShopPayApiController { @GetMapping("getOrderPayUrl") @ApiOperation("获取店铺订单支付URL") - @ApiImplicitParams({ - @ApiImplicitParam(name = "orderId", value = "订单id", paramType = "query", required = true, dataType = "String"), - @ApiImplicitParam(name = "shopId", value = "店铺id", paramType = "query", required = true, dataType = "String"), - }) public ResponseEntity url(@RequestParam Map params) { MapProxy mapProxy = MapProxy.create(params); String shopId = mapProxy.getStr("shopId"); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbReceiptSalesController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbReceiptSalesController.java deleted file mode 100644 index 9681be81..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbReceiptSalesController.java +++ /dev/null @@ -1,91 +0,0 @@ -/* -* 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.controller.shop; - -import cn.ysk.cashier.annotation.Log; -import cn.ysk.cashier.pojo.shop.TbReceiptSales; -import cn.ysk.cashier.dto.shop.TbReceiptSalesQueryCriteria; -import cn.ysk.cashier.service.shop.TbReceiptSalesService; -import org.springframework.data.domain.Pageable; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -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; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-01-08 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "/shop/receiptSales管理") -@RequestMapping("/api/tbReceiptSales") -public class TbReceiptSalesController { - - private final TbReceiptSalesService tbReceiptSalesService; - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('tbReceiptSales:list')") - public void exportTbReceiptSales(HttpServletResponse response, TbReceiptSalesQueryCriteria criteria) throws IOException { - tbReceiptSalesService.download(tbReceiptSalesService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询/shop/receiptSales") - @PreAuthorize("@el.check('tbReceiptSales:list')") - public ResponseEntity queryTbReceiptSales(TbReceiptSalesQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(tbReceiptSalesService.queryAll(criteria,pageable),HttpStatus.OK); - } - - @GetMapping("/{shopId}") - @ApiOperation("查询/shop/receiptSales") - @PreAuthorize("@el.check('tbReceiptSales:info')") - public Object queryTbReceiptSalesInfo(@PathVariable("shopId")Integer shopId){ - - return tbReceiptSalesService.findById(shopId); - } - - - @PostMapping - @ApiOperation("新增/shop/receiptSales") - @PreAuthorize("@el.check('tbReceiptSales:add')") - public ResponseEntity createTbReceiptSales(@Validated @RequestBody TbReceiptSales resources){ - return new ResponseEntity<>(tbReceiptSalesService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @ApiOperation("修改/shop/receiptSales") - @PreAuthorize("@el.check('tbReceiptSales:edit')") - public ResponseEntity updateTbReceiptSales(@Validated @RequestBody TbReceiptSales resources){ - tbReceiptSalesService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @ApiOperation("删除/shop/receiptSales") - @PreAuthorize("@el.check('tbReceiptSales:del')") - public ResponseEntity deleteTbReceiptSales(@RequestBody Integer[] ids) { - tbReceiptSalesService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopCashSpreadController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopCashSpreadController.java deleted file mode 100644 index 5fa647ef..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopCashSpreadController.java +++ /dev/null @@ -1,95 +0,0 @@ -/* -* 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.controller.shop; - -import cn.ysk.cashier.annotation.Log; -import cn.ysk.cashier.pojo.shop.TbShopCashSpread; -import cn.ysk.cashier.service.shop.TbShopCashSpreadService; -import cn.ysk.cashier.dto.shop.TbShopCashSpreadQueryCriteria; -import cn.ysk.cashier.utils.StringUtils; -import org.springframework.data.domain.Pageable; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -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; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-01-05 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "/shop/spread管理") -@RequestMapping("/api/tbShopCashSpread") -public class TbShopCashSpreadController { - - private final TbShopCashSpreadService tbShopCashSpreadService; - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('tbShopCashSpread:list')") - public void exportTbShopCashSpread(HttpServletResponse response, TbShopCashSpreadQueryCriteria criteria) throws IOException { - tbShopCashSpreadService.download(tbShopCashSpreadService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询/shop/spread") - @PreAuthorize("@el.check('tbShopCashSpread:list')") - public ResponseEntity queryTbShopCashSpread(TbShopCashSpreadQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(tbShopCashSpreadService.queryAll(criteria,pageable),HttpStatus.OK); - } - @GetMapping("/{shopId}") - @ApiOperation("查询/shop/spread/info") - @PreAuthorize("@el.check('tbShopCashSpread:info')") - public Object queryTbShopCashSpreadInfo(@PathVariable("shopId") Integer shopId){ - TbShopCashSpread byShopId = tbShopCashSpreadService.findByShopId(shopId); - String screenConfig = byShopId.getScreenConfig(); - return StringUtils.stringChangeMap(screenConfig); - } - @PostMapping - @ApiOperation("新增/shop/spread") - @PreAuthorize("@el.check('tbShopCashSpread:add')") - public ResponseEntity createTbShopCashSpread(@Validated @RequestBody TbShopCashSpread resources){ - return new ResponseEntity<>(tbShopCashSpreadService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @ApiOperation("修改/shop/spread") - @PreAuthorize("@el.check('tbShopCashSpread:edit')") - public ResponseEntity updateTbShopCashSpread(@Validated @RequestBody TbShopCashSpread resources){ - Integer update = tbShopCashSpreadService.update(resources); - if (update>0){ - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - - } - return new ResponseEntity<>(HttpStatus.BAD_REQUEST); - - } - - @DeleteMapping - @ApiOperation("删除/shop/spread") - @PreAuthorize("@el.check('tbShopCashSpread:del')") - public ResponseEntity deleteTbShopCashSpread(@RequestBody String[] ids) { - tbShopCashSpreadService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopCurrencyController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopCurrencyController.java deleted file mode 100644 index 83a579e5..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopCurrencyController.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -* 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.controller.shop; - -import cn.ysk.cashier.pojo.shop.TbShopCurrency; -import cn.ysk.cashier.service.shop.TbShopCurrencyService; -import cn.ysk.cashier.dto.shop.TbShopCurrencyQueryCriteria; -import org.springframework.data.domain.Pageable; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.security.access.prepost.PreAuthorize; -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; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-01-05 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "/shop/currency管理") -@RequestMapping("/api/tbShopCurrency") -public class TbShopCurrencyController { - - private final TbShopCurrencyService tbShopCurrencyService; - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('tbShopCurrency:list')") - public void exportTbShopCurrency(HttpServletResponse response, TbShopCurrencyQueryCriteria criteria) throws IOException { - tbShopCurrencyService.download(tbShopCurrencyService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询/shop/currency") - public ResponseEntity queryTbShopCurrency(TbShopCurrencyQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(tbShopCurrencyService.queryAll(criteria,pageable),HttpStatus.OK); - } - - @GetMapping("/{shopId}") - @ApiOperation("查询/shop/currency/info") - public Object queryTbShopCurrencyInfo(@PathVariable("shopId") String shopId){ - return tbShopCurrencyService.findByShopId(shopId); - } - - @PostMapping - @ApiOperation("新增/shop/currency") - public ResponseEntity createTbShopCurrency(@Validated @RequestBody TbShopCurrency resources){ - return new ResponseEntity<>(tbShopCurrencyService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @ApiOperation("修改/shop/currency") - public ResponseEntity updateTbShopCurrency(@Validated @RequestBody TbShopCurrency resources){ - tbShopCurrencyService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @ApiOperation("删除/shop/currency") - public ResponseEntity deleteTbShopCurrency(@RequestBody Integer[] ids) { - tbShopCurrencyService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/TbActivateProductQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/TbActivateProductQueryCriteria.java index b6f4b3a3..30e6ea53 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/TbActivateProductQueryCriteria.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/TbActivateProductQueryCriteria.java @@ -5,7 +5,7 @@ import java.util.Date; import lombok.Data; /** - * 活动赠送商品表(TbActivateProduct)表查询类 + * 活动赠送商品表(TbCouponProduct)表查询类 * * @author ww * @since 2024-08-20 11:27:40 diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/TbShopCouponQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/TbShopCouponQueryCriteria.java new file mode 100644 index 00000000..3f5de2e0 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/TbShopCouponQueryCriteria.java @@ -0,0 +1,17 @@ +package cn.ysk.cashier.dto; + +import lombok.Data; + +/** + * 优惠券(TbShopCoupon)表查询类 + * + * @author ww + * @since 2024-10-22 15:43:25 + */ +@Data +public class TbShopCouponQueryCriteria { + private Integer shopId; + private long page; + private long size; +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotButtonConfigMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotButtonConfigMapper.java deleted file mode 100644 index 73775b83..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotButtonConfigMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* -* 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; - -import cn.ysk.cashier.base.BaseMapper; -import cn.ysk.cashier.pojo.BotButtonConfig; -import cn.ysk.cashier.dto.BotButtonConfigDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-31 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface BotButtonConfigMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotConfigMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotConfigMapper.java deleted file mode 100644 index c7ec730b..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotConfigMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* -* 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; - -import cn.ysk.cashier.base.BaseMapper; -import cn.ysk.cashier.pojo.BotConfig; -import cn.ysk.cashier.dto.BotConfigDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-31 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface BotConfigMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotUserFlowMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotUserFlowMapper.java deleted file mode 100644 index bd547896..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotUserFlowMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* -* 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; - -import cn.ysk.cashier.base.BaseMapper; -import cn.ysk.cashier.pojo.BotUserFlow; -import cn.ysk.cashier.dto.BotUserFlowDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-30 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface BotUserFlowMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotUserMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotUserMapper.java deleted file mode 100644 index 40cbe449..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/BotUserMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* -* 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; - -import cn.ysk.cashier.base.BaseMapper; -import cn.ysk.cashier.pojo.BotUser; -import cn.ysk.cashier.dto.BotUserDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-30 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface BotUserMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/TbRenewalsPayLogMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/TbRenewalsPayLogMapper.java deleted file mode 100644 index 63945c57..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/TbRenewalsPayLogMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* -* 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; - -import cn.ysk.cashier.base.BaseMapper; -import cn.ysk.cashier.pojo.TbRenewalsPayLog; -import cn.ysk.cashier.dto.TbRenewalsPayLogDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2023-11-07 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface TbRenewalsPayLogMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbMerchantCouponMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbMerchantCouponMapper.java deleted file mode 100644 index 34b786c9..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbMerchantCouponMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* -* 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.shop; - -import cn.ysk.cashier.base.BaseMapper; -import cn.ysk.cashier.pojo.shop.TbMerchantCoupon; -import cn.ysk.cashier.dto.shop.TbMerchantCouponDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-03-20 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface TbMerchantCouponMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbReceiptSalesMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbReceiptSalesMapper.java deleted file mode 100644 index febd2c34..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbReceiptSalesMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* -* 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.shop; - -import cn.ysk.cashier.base.BaseMapper; -import cn.ysk.cashier.pojo.shop.TbReceiptSales; -import cn.ysk.cashier.dto.shop.TbReceiptSalesDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-01-08 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface TbReceiptSalesMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbShopCashSpreadMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbShopCashSpreadMapper.java deleted file mode 100644 index aabf892a..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbShopCashSpreadMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* -* 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.shop; - -import cn.ysk.cashier.base.BaseMapper; -import cn.ysk.cashier.pojo.shop.TbShopCashSpread; -import cn.ysk.cashier.dto.shop.TbShopCashSpreadDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-01-05 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface TbShopCashSpreadMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbShopCurrencyMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbShopCurrencyMapper.java deleted file mode 100644 index 6ad1878c..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mapper/shop/TbShopCurrencyMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/* -* 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.shop; - -import cn.ysk.cashier.base.BaseMapper; -import cn.ysk.cashier.pojo.shop.TbShopCurrency; -import cn.ysk.cashier.dto.shop.TbShopCurrencyDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-01-05 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface TbShopCurrencyMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/Activate.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/Activate.java deleted file mode 100644 index 214a96ee..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/Activate.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.ysk.cashier.mybatis.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; -import java.util.List; - -@Data -@EqualsAndHashCode(callSuper = true) -@TableName("tb_activate") -public class Activate extends Model { - private static final long serialVersionUID = 1L; - @TableId(type = IdType.AUTO) - private Integer id; - private Integer shopId; - private Integer minNum; - private Integer maxNum; - private BigDecimal handselNum; - private String handselType; - private String isDel; - //是否赠送商品 0否 1是 - private Integer isGiftPro; - @TableField(exist = false) - private List products; -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivate.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivate.java index 68a4c144..efb93be9 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivate.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivate.java @@ -1,44 +1,103 @@ package cn.ysk.cashier.mybatis.entity; -import lombok.Getter; -import lombok.Setter; +import java.util.Date; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.extension.activerecord.Model; -import javax.persistence.*; -import javax.validation.constraints.Size; -import java.math.BigDecimal; +@SuppressWarnings("serial") +public class TbActivate extends Model { -@Getter -@Setter -@Entity -@Table(name = "tb_activate") -public class TbActivate { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id", nullable = false) private Integer id; - @Column(name = "shop_id") private Integer shopId; + //充值金额 + private Integer amount; + //赠送金额 + private Integer giftAmount; + //是否使用优惠卷 0否 1是 + private Integer isUseCoupon; + //优惠卷id + private Integer couponId; + //优惠卷数量 + private Integer num; - @Column(name = "min_num") - private Integer minNum; + @TableField(fill = FieldFill.INSERT) + private Date createTime; + @TableField(fill = FieldFill.UPDATE) + private Date updateTime; - @Column(name = "max_num") - private Integer maxNum; - @Column(name = "handsel_num", precision = 10, scale = 2) - private BigDecimal handselNum; + public Integer getId() { + return id; + } - @Size(max = 20) - @Column(name = "handsel_type", length = 20) - private String handselType; + public void setId(Integer id) { + this.id = id; + } - @Size(max = 20) - @Column(name = "is_del", length = 20) - private String isDel; + public Integer getShopId() { + return shopId; + } - @Size(max = 255) - @Column(name = "is_user") - private String isUser; + public void setShopId(Integer shopId) { + this.shopId = shopId; + } + public Integer getAmount() { + return amount; + } + + public void setAmount(Integer amount) { + this.amount = amount; + } + + public Integer getGiftAmount() { + return giftAmount; + } + + public void setGiftAmount(Integer giftAmount) { + this.giftAmount = giftAmount; + } + + public Integer getIsUseCoupon() { + return isUseCoupon; + } + + public void setIsUseCoupon(Integer isUseCoupon) { + this.isUseCoupon = isUseCoupon; + } + + public Integer getCouponId() { + return couponId; + } + + public void setCouponId(Integer couponId) { + this.couponId = couponId; + } + + public Integer getNum() { + return num; + } + + public void setNum(Integer num) { + this.num = num; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } } + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateInRecord.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateInRecord.java index 06e25bcc..d688ef29 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateInRecord.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateInRecord.java @@ -2,15 +2,17 @@ package cn.ysk.cashier.mybatis.entity; import java.util.Date; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.extension.activerecord.Model; import java.io.Serializable; /** - * 活动商品赠送表(TbActivateInRecord)表实体类 + * 活动商品赠送记录表(TbActivateInRecord)表实体类 * * @author ww - * @since 2024-08-22 14:50:16 + * @since 2024-10-23 09:49:59 */ @SuppressWarnings("serial") public class TbActivateInRecord extends Model { @@ -18,8 +20,18 @@ public class TbActivateInRecord extends Model { private Integer id; //会员id private Integer vipUserId; + //卷Id (校验是否可用) + private Integer couponId; + //卷描述 满10减2/商品卷 + private String name; + //1-满减 2-商品 + private Integer type; //商品id private Integer proId; + //满多少金额 + private Integer fullAmount; + //减多少金额 + private Integer discountAmount; //赠送数量 private Integer num; //未使用数量 @@ -32,9 +44,11 @@ public class TbActivateInRecord extends Model { private Integer sourceFlowId; private Date createTime; - + @TableField(fill = FieldFill.UPDATE) private Date updateTime; + private String couponJson; + public Integer getId() { return id; @@ -52,6 +66,30 @@ public class TbActivateInRecord extends Model { this.vipUserId = vipUserId; } + public Integer getCouponId() { + return couponId; + } + + public void setCouponId(Integer couponId) { + this.couponId = couponId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + public Integer getProId() { return proId; } @@ -60,6 +98,22 @@ public class TbActivateInRecord extends Model { this.proId = proId; } + public Integer getFullAmount() { + return fullAmount; + } + + public void setFullAmount(Integer fullAmount) { + this.fullAmount = fullAmount; + } + + public Integer getDiscountAmount() { + return discountAmount; + } + + public void setDiscountAmount(Integer discountAmount) { + this.discountAmount = discountAmount; + } + public Integer getNum() { return num; } @@ -115,5 +169,13 @@ public class TbActivateInRecord extends Model { public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } + + public String getCouponJson() { + return couponJson; + } + + public void setCouponJson(String couponJson) { + this.couponJson = couponJson; + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateOutRecord.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateOutRecord.java index fc57add8..f050b14a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateOutRecord.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateOutRecord.java @@ -2,6 +2,8 @@ package cn.ysk.cashier.mybatis.entity; import java.util.Date; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.extension.activerecord.Model; import java.io.Serializable; @@ -10,27 +12,32 @@ import java.io.Serializable; * 活动赠送商品使用记录表(TbActivateOutRecord)表实体类 * * @author ww - * @since 2024-08-22 14:53:52 + * @since 2024-10-23 09:50:40 */ @SuppressWarnings("serial") public class TbActivateOutRecord extends Model { private Integer id; - //商品赠送Id + + private Integer shopId; + //订单id + private String orderId; + //商品赠送Id tb_activate_in_record的id private Integer giveId; - //商品id - private Integer proId; - //未使用数量 + //会员id + private Integer vipUserId; + //1-满减 2-商品 + private Integer type; + //使用数量 private Integer useNum; //退单量 private Integer refNum; - //订单id - private String orderId; //新建: create, 完成: closed, 取消:cancel, private String status; + @TableField(fill = FieldFill.INSERT) private Date createTime; - + @TableField(fill = FieldFill.UPDATE) private Date updateTime; @@ -42,6 +49,22 @@ public class TbActivateOutRecord extends Model { this.id = id; } + public Integer getShopId() { + return shopId; + } + + public void setShopId(Integer shopId) { + this.shopId = shopId; + } + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + public Integer getGiveId() { return giveId; } @@ -50,12 +73,20 @@ public class TbActivateOutRecord extends Model { this.giveId = giveId; } - public Integer getProId() { - return proId; + public Integer getVipUserId() { + return vipUserId; } - public void setProId(Integer proId) { - this.proId = proId; + public void setVipUserId(Integer vipUserId) { + this.vipUserId = vipUserId; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; } public Integer getUseNum() { @@ -74,14 +105,6 @@ public class TbActivateOutRecord extends Model { this.refNum = refNum; } - public String getOrderId() { - return orderId; - } - - public void setOrderId(String orderId) { - this.orderId = orderId; - } - public String getStatus() { return status; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateProduct.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateProduct.java deleted file mode 100644 index 952423a4..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivateProduct.java +++ /dev/null @@ -1,83 +0,0 @@ -package cn.ysk.cashier.mybatis.entity; - -import java.util.Date; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.extension.activerecord.Model; - -import java.io.Serializable; - -/** - * 活动赠送商品表(TbActivateProduct)表实体类 - * - * @author ww - * @since 2024-08-20 11:27:40 - */ -@SuppressWarnings("serial") -public class TbActivateProduct extends Model { - - private Integer id; - //活动Id - private Integer activateId; - //商品id - private Integer productId; - //数量 - private Integer num; - - @TableField(fill = FieldFill.INSERT) - private Date createTime; - - @TableField(fill = FieldFill.UPDATE) - private Date updateTime; - - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getActivateId() { - return activateId; - } - - public void setActivateId(Integer activateId) { - this.activateId = activateId; - } - - public Integer getProductId() { - return productId; - } - - public void setProductId(Integer productId) { - this.productId = productId; - } - - public Integer getNum() { - return num; - } - - public void setNum(Integer num) { - this.num = num; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } -} - diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbCouponProduct.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbCouponProduct.java new file mode 100644 index 00000000..9a3273f3 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbCouponProduct.java @@ -0,0 +1,40 @@ +package cn.ysk.cashier.mybatis.entity; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.Data; + +import java.io.Serializable; + +/** + * 活动赠送商品表(TbActivateProduct)表实体类 + * + * @author ww + * @since 2024-08-20 11:27:40 + */ +@Data +@SuppressWarnings("serial") +public class TbCouponProduct extends Model { + private Integer id; + //活动Id + private Integer couponId; + //商品id + private Integer productId; + //数量 + private Integer num; + @TableField(exist = false) + private String name; + @TableField(exist = false) + private String coverImg; + + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + @TableField(fill = FieldFill.UPDATE) + private Date updateTime; + +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopCoupon.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopCoupon.java new file mode 100644 index 00000000..06ba5ee3 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopCoupon.java @@ -0,0 +1,253 @@ +package cn.ysk.cashier.mybatis.entity; + +import java.time.LocalTime; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.io.Serializable; + +/** + * 优惠券(TbShopCoupon)表实体类 + * + * @author ww + * @since 2024-10-24 13:54:34 + */ +@SuppressWarnings("serial") +public class TbShopCoupon extends Model { + //自增 + private Integer id; + + private String shopId; + //名称(无意义) + private String title; + //1-满减 2-商品 + private Integer type; + //满多少金额 + private Integer fullAmount; + //减多少金额 + private Integer discountAmount; + //描述 + private String description; + //发放数量 + private Integer number; + //剩余数量 + private Integer leftNumber; + //有效期类型,可选值为 fixed(固定时间)/custom(自定义时间) + private String validityType; + //有效天数 + private Integer validDays; + //隔多少天生效 + private Integer daysToTakeEffect; + //有效开始时间 + private Date validStartTime; + //有效结束时间 + private Date validEndTime; + //周 数组["周一","周二"] + private String userDays; + //all-全时段 custom-指定时段 + private String useTimeType; + //可用开始时间 + private LocalTime useStartTime; + //可用结束时间 + private LocalTime useEndTime; + //已使用数量 + private Integer useNumber; + //发放人 + private String editor; + //状态0-关闭 1 正常 + private Integer status; + + @TableField(fill = FieldFill.INSERT) + private Date createTime; + @TableField(fill = FieldFill.UPDATE) + private Date updateTime; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getShopId() { + return shopId; + } + + public void setShopId(String shopId) { + this.shopId = shopId; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public Integer getFullAmount() { + return fullAmount; + } + + public void setFullAmount(Integer fullAmount) { + this.fullAmount = fullAmount; + } + + public Integer getDiscountAmount() { + return discountAmount; + } + + public void setDiscountAmount(Integer discountAmount) { + this.discountAmount = discountAmount; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public Integer getLeftNumber() { + return leftNumber; + } + + public void setLeftNumber(Integer leftNumber) { + this.leftNumber = leftNumber; + } + + public String getValidityType() { + return validityType; + } + + public void setValidityType(String validityType) { + this.validityType = validityType; + } + + public Integer getValidDays() { + return validDays; + } + + public void setValidDays(Integer validDays) { + this.validDays = validDays; + } + + public Integer getDaysToTakeEffect() { + return daysToTakeEffect; + } + + public void setDaysToTakeEffect(Integer daysToTakeEffect) { + this.daysToTakeEffect = daysToTakeEffect; + } + + public Date getValidStartTime() { + return validStartTime; + } + + public void setValidStartTime(Date validStartTime) { + this.validStartTime = validStartTime; + } + + public Date getValidEndTime() { + return validEndTime; + } + + public void setValidEndTime(Date validEndTime) { + this.validEndTime = validEndTime; + } + + public String getUserDays() { + return userDays; + } + + public void setUserDays(String userDays) { + this.userDays = userDays; + } + + public String getUseTimeType() { + return useTimeType; + } + + public void setUseTimeType(String useTimeType) { + this.useTimeType = useTimeType; + } + + public LocalTime getUseStartTime() { + return useStartTime; + } + + public void setUseStartTime(LocalTime useStartTime) { + this.useStartTime = useStartTime; + } + + public LocalTime getUseEndTime() { + return useEndTime; + } + + public void setUseEndTime(LocalTime useEndTime) { + this.useEndTime = useEndTime; + } + + public Integer getUseNumber() { + return useNumber; + } + + public void setUseNumber(Integer useNumber) { + this.useNumber = useNumber; + } + + public String getEditor() { + return editor; + } + + public void setEditor(String editor) { + this.editor = editor; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbUserStorage.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbUserStorage.java deleted file mode 100644 index 1fc09db8..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbUserStorage.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.ysk.cashier.mybatis.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.Date; - -@Data -@EqualsAndHashCode(callSuper = true) -@TableName("tb_user_storage") -public class TbUserStorage extends Model { - private static final long serialVersionUID = 1L; - @TableId(type = IdType.ASSIGN_UUID) - private String id; // 记录ID - private Integer userId; // 用户ID - private String shopId; // 用户ID - private Integer productId; - private Integer num; - private Integer outNum; - private Integer inNum; - private Date createTime; - private String account; - private String unit; - private String productName; - private Integer skuId; - private String skuName; - private String imgUrl; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ActivateMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ActivateMapper.java deleted file mode 100644 index cadddeab..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ActivateMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.ysk.cashier.mybatis.mapper; - -import cn.ysk.cashier.mybatis.entity.Activate; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -public interface ActivateMapper extends BaseMapper { - - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateProductMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCouponProductMapper.java similarity index 61% rename from eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateProductMapper.java rename to eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCouponProductMapper.java index 71e3d676..7e900b4b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateProductMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbCouponProductMapper.java @@ -1,6 +1,6 @@ package cn.ysk.cashier.mybatis.mapper; -import cn.ysk.cashier.mybatis.entity.TbActivateProduct; +import cn.ysk.cashier.mybatis.entity.TbCouponProduct; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** @@ -9,7 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @author ww * @since 2024-08-20 11:27:40 */ -public interface TbActivateProductMapper extends BaseMapper { +public interface TbCouponProductMapper extends BaseMapper { } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java new file mode 100644 index 00000000..b56eae0d --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java @@ -0,0 +1,15 @@ +package cn.ysk.cashier.mybatis.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import cn.ysk.cashier.mybatis.entity.TbShopCoupon; + +/** + * 优惠券(TbShopCoupon)表数据库访问层 + * + * @author ww + * @since 2024-10-22 15:43:25 + */ +public interface TbShopCouponMapper extends BaseMapper { + +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbUserStorageMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbUserStorageMapper.java deleted file mode 100644 index 2e175574..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbUserStorageMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.ysk.cashier.mybatis.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import cn.ysk.cashier.mybatis.entity.TbUserStorage; - -public interface TbUserStorageMapper extends BaseMapper { - - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java index 09d2d775..ee640996 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java @@ -2,14 +2,12 @@ package cn.ysk.cashier.mybatis.rest; import cn.ysk.cashier.annotation.Log; import cn.ysk.cashier.exception.BadRequestException; -import cn.ysk.cashier.mybatis.entity.Activate; -import cn.ysk.cashier.mybatis.service.ShopService; +import cn.ysk.cashier.mybatis.entity.TbActivate; +import cn.ysk.cashier.mybatis.service.TbActivateService; import cn.ysk.cashier.service.WxService; import cn.ysk.cashier.utils.CacheKey; import cn.ysk.cashier.utils.RedisUtils; -import cn.ysk.cashier.utils.SecurityUtils; import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; @@ -25,31 +23,23 @@ import java.util.Map; @Api(tags = "/shop/storage") @RequestMapping("/shop/storage") public class StorageController { - private final ShopService shopService; + + private final TbActivateService tbActivateService; private final RedisUtils redisUtils; private final WxService wxService; @GetMapping("/findActivate") public ResponseEntity findActivate(@RequestParam String shopId){ - String userName = SecurityUtils.getCurrentUsername(); - return new ResponseEntity<>(shopService.findActivate(shopId), HttpStatus.OK); + return new ResponseEntity<>(tbActivateService.findActivate(shopId), HttpStatus.OK); } @Log("修改活动数据") - @PostMapping("/modityActivate") - public ResponseEntity modityActivate(@RequestBody Activate activate){ - if (activate.getIsGiftPro() != null && activate.getIsGiftPro() == 1 && CollectionUtils.isEmpty(activate.getProducts())) - throw new BadRequestException("赠送商品不可为空"); - String userName = SecurityUtils.getCurrentUsername(); - shopService.modityActivate(activate); + @PostMapping("/upActivate") + public ResponseEntity upActivate(@RequestBody TbActivate activate){ + tbActivateService.modifyActivate(activate); return new ResponseEntity<>(HttpStatus.OK); } - @GetMapping("/activate/{activateId}") - @ApiOperation("查询活动赠送商品") - public ResponseEntity queryActivatePros(@PathVariable("activateId") Integer activateId){ - return new ResponseEntity<>(shopService.findActivatePros(activateId),HttpStatus.OK); - } /** * @param params diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/ShopService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/ShopService.java deleted file mode 100644 index a0588b83..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/ShopService.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.ysk.cashier.mybatis.service; - -import cn.ysk.cashier.mybatis.entity.Activate; -import cn.ysk.cashier.mybatis.entity.StorageVo; -import cn.ysk.cashier.mybatis.vo.ActivateProsVo; -import cn.ysk.cashier.pojo.product.TbProduct; -import org.springframework.data.domain.Pageable; - -import java.util.List; - -/** -* @website https://eladmin.vip -* @description 服务接口 -* @author admin -* @date 2023-10-30 -**/ -public interface ShopService { - Object findStorage(Integer shopId, String account, Pageable pageable); - - void outStorage(Integer id, String userName, Integer num); - - - void inStorage(StorageVo storageVo, String userName); - - Object findActivate(String shopId); - - void modityActivate(Activate activate); - - List findActivatePros(Integer activate); -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbActivateService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbActivateService.java index 0ef72d70..1cbca06b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbActivateService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbActivateService.java @@ -10,4 +10,8 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface TbActivateService extends IService { + + Object findActivate(String shopId); + + void modifyActivate(TbActivate activate); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbActivateProductService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbCouponProductService.java similarity index 62% rename from eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbActivateProductService.java rename to eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbCouponProductService.java index 14781817..caecd8a9 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbActivateProductService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbCouponProductService.java @@ -1,6 +1,6 @@ package cn.ysk.cashier.mybatis.service; -import cn.ysk.cashier.mybatis.entity.TbActivateProduct; +import cn.ysk.cashier.mybatis.entity.TbCouponProduct; import com.baomidou.mybatisplus.extension.service.IService; @@ -10,7 +10,8 @@ import com.baomidou.mybatisplus.extension.service.IService; * @author ww * @since 2024-08-20 11:27:40 */ -public interface TbActivateProductService extends IService { +public interface TbCouponProductService extends IService { + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java new file mode 100644 index 00000000..fb793a27 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java @@ -0,0 +1,31 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.mybatis.entity.TbCouponProduct; +import cn.ysk.cashier.mybatis.vo.TbShopCouponVo; +import com.baomidou.mybatisplus.extension.service.IService; +import cn.ysk.cashier.mybatis.entity.TbShopCoupon; +import cn.ysk.cashier.dto.TbShopCouponQueryCriteria; + +import java.util.List; +import java.util.Map; + +/** + * 优惠券(TbShopCoupon)表服务接口 + * + * @author ww + * @since 2024-10-22 15:43:25 + */ +public interface TbShopCouponService extends IService { + + Map queryAll(TbShopCouponQueryCriteria criteria); + + + TbShopCoupon findById (Integer id); + + + boolean update(TbShopCouponVo param); + boolean delete(Integer id); + + List findActivatePros(Integer couponId); +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/ShopServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/ShopServiceImpl.java deleted file mode 100644 index d39b2c62..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/ShopServiceImpl.java +++ /dev/null @@ -1,186 +0,0 @@ -package cn.ysk.cashier.mybatis.service.impl; - -import cn.ysk.cashier.mybatis.entity.Activate; -import cn.ysk.cashier.mybatis.entity.TbActivateProduct; -import cn.ysk.cashier.mybatis.mapper.*; -import cn.ysk.cashier.mybatis.service.TbActivateProductService; -import cn.ysk.cashier.mybatis.vo.ActivateProsVo; -import cn.ysk.cashier.pojo.product.TbProduct; -import cn.ysk.cashier.pojo.product.TbProductSku; -import cn.ysk.cashier.pojo.shop.TbMerchantAccount; -import cn.ysk.cashier.repository.product.TbProductRepository; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import cn.ysk.cashier.exception.NewBadRequestException; -import cn.ysk.cashier.mybatis.entity.StorageVo; -import cn.ysk.cashier.mybatis.entity.TbUserStorage; -import cn.ysk.cashier.mybatis.service.ShopService; -import cn.ysk.cashier.utils.*; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.domain.Pageable; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import javax.annotation.Resource; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author admin - * @website https://eladmin.vip - * @description 服务实现 - * @date 2023-10-30 - **/ -@Service -public class ShopServiceImpl implements ShopService { - - @Autowired - private TbUserStorageMapper userStorageMapper; - @Autowired - private TbMerchantAccountMapper tbMerchantAccountMapper; - @Autowired - private TbProducSkutMapper producSkutMapper; - @Autowired - private ActivateMapper activateMapper; - @Autowired - private TbProductRepository tbProductRepository; - @Resource - private TbActivateProductService actProductService; - @Override - public Object findStorage(Integer shopId, String account, Pageable pageable) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("shop_id", shopId); - if (StringUtils.isNotEmpty(account)) { - queryWrapper.eq("account", account); - } - IPage iPage = userStorageMapper.selectPage(new Page<>(pageable.getPageNumber(), pageable.getPageSize()), queryWrapper); - return PageUtil.toPage(iPage.getRecords(), iPage.getTotal()); - } - - @Override - public void outStorage(Integer id, String userName, Integer num) { - if (Objects.isNull(num) || num < 0) { - throw new NewBadRequestException("请输入出库数量"); - } - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("account", userName); - TbMerchantAccount merchantAccount = tbMerchantAccountMapper.selectOne(wrapper); - - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("id", id); - queryWrapper.eq("shop_id", merchantAccount.getShopId()); - TbUserStorage userStorage = userStorageMapper.selectOne(queryWrapper); - if (Objects.isNull(userStorage)) { - throw new NewBadRequestException("存储商品在该店铺不存在"); - } - if (userStorage.getNum() < num) { - throw new NewBadRequestException("库存不足"); - } - userStorage.setNum(userStorage.getNum() - num); - userStorage.setOutNum(userStorage.getOutNum() + num); - userStorageMapper.updateById(userStorage); - } - - @Override - public void inStorage(StorageVo storageVo, String userName) { - if (Objects.isNull(storageVo.getNum()) || storageVo.getNum() < 0) { - throw new NewBadRequestException("请输入出库数量"); - } - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("account", userName); - TbMerchantAccount merchantAccount = tbMerchantAccountMapper.selectOne(wrapper); - - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("product_name", storageVo.getProductName()); - queryWrapper.eq("account", storageVo.getAccount()); - queryWrapper.eq("shop_id", merchantAccount.getShopId()); - TbUserStorage userStorage = userStorageMapper.selectOne(queryWrapper); - if (Objects.nonNull(userStorage)) { - userStorage.setNum(userStorage.getNum() + storageVo.getNum()); - userStorage.setInNum(userStorage.getInNum() + storageVo.getNum()); - userStorageMapper.updateById(userStorage); - }else { - userStorage = new TbUserStorage(); - userStorage.setAccount(storageVo.getAccount()); - userStorage.setCreateTime(new Date()); - userStorage.setShopId(merchantAccount.getShopId()); - userStorage.setNum(storageVo.getNum()); - userStorage.setOutNum(0); - userStorage.setInNum(storageVo.getNum()); - userStorage.setImgUrl(storageVo.getImg()); - userStorage.setProductName(storageVo.getImg()); - userStorage.setUnit(storageVo.getUnit()); - userStorageMapper.insert(userStorage); - } - } - - @Override - public Object findActivate(String shopId) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("shop_id",shopId); - queryWrapper.orderByDesc("id"); - List list = activateMapper.selectList(queryWrapper); - return list; - } - - @Override - public void modityActivate(Activate activate) { - if (Objects.nonNull(activate.getId()) && activate.getId() > 0){ - activate.setHandselType("GD"); - activate.setMaxNum(activate.getMinNum()); - activateMapper.updateById(activate); - }else { - activate.setHandselType("GD"); - activate.setMaxNum(activate.getMinNum()); - activateMapper.insert(activate); - } - if(!CollectionUtils.isEmpty(activate.getProducts())){ - List collect = new ArrayList<>(); - for (TbActivateProduct product : activate.getProducts()) { - product.setActivateId(activate.getId()); - if (product.getId() != null) collect.add(product.getId()); - } - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("activate_id",activate.getId()); - List actProducts = actProductService.list(queryWrapper); - for (TbActivateProduct actProduct : actProducts) { - if (!collect.contains(actProduct.getId())) { - actProductService.removeById(actProduct.getId()); - } - } - actProductService.saveOrUpdateBatch(activate.getProducts()); - }else { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(TbActivateProduct::getActivateId, activate.getId()); // 条件:年龄等于30 - actProductService.remove(queryWrapper); - } - } - - @Override - public List findActivatePros(Integer activateId) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("activate_id", activateId); - List actProducts = actProductService.list(queryWrapper); - if (!CollectionUtils.isEmpty(actProducts)) { - Map map = actProducts.stream().collect( - Collectors.toMap( - TbActivateProduct::getProductId, - TbActivateProduct::getNum, - (existing, replacement) -> existing)); - if (!CollectionUtils.isEmpty(map)) { - List products = tbProductRepository.findByIds(new ArrayList<>(map.keySet())); - List results= new ArrayList<>(); - for (TbProduct product : products) { - ActivateProsVo pro =new ActivateProsVo(product.getId(),product.getName(),product.getCoverImg()); - pro.setNum(map.get(pro.getId())); - results.add(pro); - } - return results; - } - } - return new ArrayList<>(); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateProductServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateProductServiceImpl.java deleted file mode 100644 index ec780b6c..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateProductServiceImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.ysk.cashier.mybatis.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import cn.ysk.cashier.mybatis.mapper.TbActivateProductMapper; -import cn.ysk.cashier.mybatis.entity.TbActivateProduct; -import cn.ysk.cashier.mybatis.service.TbActivateProductService; -import org.springframework.stereotype.Service; -import org.apache.commons.lang3.StringUtils; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import cn.ysk.cashier.dto.TbActivateProductQueryCriteria; -import org.springframework.beans.factory.annotation.Autowired; -import cn.ysk.cashier.utils.PageUtil; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; - -import java.util.Map; - -/** - * 活动赠送商品表(TbActivateProduct)表服务实现类 - * - * @author ww - * @since 2024-08-20 11:27:40 - */ -@Service("tbActivateProductService") -public class TbActivateProductServiceImpl extends ServiceImpl implements TbActivateProductService { - -} - diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java index afd2b452..d910fd55 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java @@ -1,10 +1,18 @@ package cn.ysk.cashier.mybatis.service.impl; import cn.ysk.cashier.mybatis.entity.TbActivate; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import cn.ysk.cashier.mybatis.service.TbActivateService; import cn.ysk.cashier.mybatis.mapper.TbActivateMapper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; /** * @author Administrator @@ -12,9 +20,28 @@ import org.springframework.stereotype.Service; * @createDate 2024-09-03 14:08:30 */ @Service -public class TbActivateServiceImpl extends ServiceImpl - implements TbActivateService{ +public class TbActivateServiceImpl extends ServiceImpl implements TbActivateService{ + @Autowired + private TbActivateMapper activateMapper; + + @Override + public Object findActivate(String shopId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("shop_id",shopId); + queryWrapper.orderByDesc("id"); + List list = activateMapper.selectList(queryWrapper); + return list; + } + + @Override + public void modifyActivate(TbActivate activate) { + if (Objects.nonNull(activate.getId()) && activate.getId() > 0){ + activateMapper.updateById(activate); + }else { + activateMapper.insert(activate); + } + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbCouponProductServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbCouponProductServiceImpl.java new file mode 100644 index 00000000..fcf2a09d --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbCouponProductServiceImpl.java @@ -0,0 +1,19 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.ysk.cashier.mybatis.entity.TbCouponProduct; +import cn.ysk.cashier.mybatis.mapper.TbCouponProductMapper; +import cn.ysk.cashier.mybatis.service.TbCouponProductService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * 活动赠送商品表(TbActivateProduct)表服务实现类 + * + * @author ww + * @since 2024-08-20 11:27:40 + */ +@Service("tbCouponProductService") +public class TbCouponProductServiceImpl extends ServiceImpl implements TbCouponProductService { + +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java new file mode 100644 index 00000000..4e466b3f --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -0,0 +1,130 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import cn.hutool.core.collection.CollectionUtil; +import cn.ysk.cashier.dto.TbShopCouponQueryCriteria; +import cn.ysk.cashier.mybatis.entity.TbCouponProduct; +import cn.ysk.cashier.mybatis.entity.TbShopCoupon; +import cn.ysk.cashier.mybatis.mapper.TbShopCouponMapper; +import cn.ysk.cashier.mybatis.service.TbCouponProductService; +import cn.ysk.cashier.mybatis.service.TbShopCouponService; +import cn.ysk.cashier.mybatis.vo.TbShopCouponVo; +import cn.ysk.cashier.pojo.product.TbProduct; +import cn.ysk.cashier.repository.product.TbProductRepository; +import cn.ysk.cashier.utils.PageUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 优惠券(TbShopCoupon)表服务实现类 + * + * @author ww + * @since 2024-10-22 15:43:25 + */ +@Service("tbShopCouponService") +public class TbShopCouponServiceImpl extends ServiceImpl implements TbShopCouponService { + + @Autowired + private TbShopCouponMapper tbShopCouponmapper; + @Autowired + private TbCouponProductService couProductService; + @Autowired + private TbProductRepository tbProductRepository; + + @Override + public Map queryAll(TbShopCouponQueryCriteria criteria) { + Page page = new Page<>(criteria.getPage(), criteria.getSize()); + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq("shop_id", criteria.getShopId()); +// if (StringUtils.isNotBlank(criteria.getName())) { +// wrapper.and(w -> w.like("name", criteria.getName()) +// .or() +// .like("singer", criteria.getName()) +// .or() +// .like("origin_singer", criteria.getName())); +// } + wrapper.orderByDesc("create_time"); + Page ipage = tbShopCouponmapper.selectPage(page, wrapper); + return PageUtil.toPage(ipage.getRecords(), ipage.getTotal()); + } + + @Override + public TbShopCouponVo findById(Integer id) { + TbShopCouponVo tbShopCouponVo = new TbShopCouponVo(); + TbShopCoupon tbShopCoupon = tbShopCouponmapper.selectById(id); + BeanUtil.copyProperties(tbShopCoupon,tbShopCouponVo, CopyOptions.create().setIgnoreNullValue(true)); + if(tbShopCoupon.getType()==2){ + List activatePros = findActivatePros(id); + tbShopCouponVo.setProducts(activatePros); + } + return tbShopCouponVo; + } + + + @Override + public boolean update(TbShopCouponVo param) { + if (param.getId() == null) { + tbShopCouponmapper.insert(param); + } else { + tbShopCouponmapper.updateById(param); + } + if (CollectionUtil.isNotEmpty(param.getProducts())) { + List collect = new ArrayList<>(); + for (TbCouponProduct product : param.getProducts()) { + product.setCouponId(param.getId()); + if (product.getId() != null) collect.add(product.getId()); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("coupon_id", param.getId()); + List actProducts = couProductService.list(queryWrapper); + for (TbCouponProduct actProduct : actProducts) { + if (!collect.contains(actProduct.getId())) { + couProductService.removeById(actProduct.getId()); + } + } + couProductService.saveOrUpdateBatch(param.getProducts()); + } else { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TbCouponProduct::getCouponId, param.getId()); + couProductService.remove(queryWrapper); + } + return true; + } + + @Override + public boolean delete(Integer id) { + tbShopCouponmapper.deleteById(id); + couProductService.remove(new LambdaQueryWrapper().eq(TbCouponProduct::getCouponId, id)); + return true; + } + + + public List findActivatePros(Integer couponId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("coupon_id", couponId); + List actProducts = couProductService.list(queryWrapper); + if (!CollectionUtils.isEmpty(actProducts)) { + for (TbCouponProduct actProduct : actProducts) { + TbProduct product = tbProductRepository.findById(actProduct.getProductId()).orElse(null); + if (product != null) { + actProduct.setName(product.getName()); + actProduct.setCoverImg(product.getCoverImg()); + } + } + return actProducts; + } + return new ArrayList<>(); + } +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/vo/ActivateProsVo.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/vo/ActivateProsVo.java deleted file mode 100644 index 2292ce20..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/vo/ActivateProsVo.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.ysk.cashier.mybatis.vo; - -import lombok.Data; - -@Data -public class ActivateProsVo { - private Integer id; - private String name; - private String coverImg; - private Integer num; - - public ActivateProsVo(Integer id, String name, String coverImg) { - this.id = id; - this.name = name; - this.coverImg = coverImg; - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/vo/TbShopCouponVo.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/vo/TbShopCouponVo.java new file mode 100644 index 00000000..f5eb8c80 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/vo/TbShopCouponVo.java @@ -0,0 +1,14 @@ +package cn.ysk.cashier.mybatis.vo; + +import cn.ysk.cashier.mybatis.entity.TbCouponProduct; +import cn.ysk.cashier.mybatis.entity.TbShopCoupon; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class TbShopCouponVo extends TbShopCoupon { + + private List products = new ArrayList<>(); +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotButtonConfig.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotButtonConfig.java deleted file mode 100644 index 80314174..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotButtonConfig.java +++ /dev/null @@ -1,53 +0,0 @@ -/* -* 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.pojo; - -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 java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author admin -* @date 2023-10-31 -**/ -@Entity -@Data -@Table(name="bot_button_config") -public class BotButtonConfig implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "`id`") - @ApiModelProperty(value = "id") - private Integer id; - - @Column(name = "`button_name`") - @ApiModelProperty(value = "按钮名称") - private String buttonName; - - @Column(name = "`button_value`") - @ApiModelProperty(value = "按钮值") - private String buttonValue; - - public void copy(BotButtonConfig source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotConfig.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotConfig.java deleted file mode 100644 index c1cebb1b..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotConfig.java +++ /dev/null @@ -1,57 +0,0 @@ -/* -* 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.pojo; - -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 java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author admin -* @date 2023-10-31 -**/ -@Entity -@Data -@Table(name="bot_config") -public class BotConfig implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "`id`") - @ApiModelProperty(value = "id") - private Integer id; - - @Column(name = "`config_key`") - @ApiModelProperty(value = "元素键值") - private String configKey; - - @Column(name = "`config_value`") - @ApiModelProperty(value = "元素值") - private String configValue; - - @Column(name = "`remark`") - @ApiModelProperty(value = "描述") - private String remark; - - public void copy(BotConfig source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotUser.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotUser.java deleted file mode 100644 index 0b6b799d..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotUser.java +++ /dev/null @@ -1,123 +0,0 @@ -/* -* 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.pojo; - -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 java.sql.Timestamp; -import java.math.BigDecimal; -import java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author admin -* @date 2023-10-30 -**/ -@Entity -@Data -@Table(name="bot_user") -public class BotUser implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "`id`") - @ApiModelProperty(value = "id") - private Integer id; - - @Column(name = "`father_id`") - @ApiModelProperty(value = "fatherId") - private Integer fatherId; - - @Column(name = "`father_telegram_id`") - @ApiModelProperty(value = "父级电报号") - private String fatherTelegramId; - - @Column(name = "`user_telegram_id`") - @ApiModelProperty(value = "电报号") - private String userTelegramId; - - @Column(name = "`user_name`") - @ApiModelProperty(value = "用户名称") - private String userName; - - @Column(name = "`group_telegram_id`") - @ApiModelProperty(value = "组电报号") - private String groupTelegramId; - - @Column(name = "`user_code`") - @ApiModelProperty(value = "用户代码") - private String userCode; - - @Column(name = "`user_pay_pass`") - @ApiModelProperty(value = "userPayPass") - private String userPayPass; - - @Column(name = "`bomb_status`") - @ApiModelProperty(value = "bombStatus") - private String bombStatus; - - @Column(name = "`bot_status`") - @ApiModelProperty(value = "用户状态") - private String botStatus; - - @Column(name = "`usdt_recharge_total`") - @ApiModelProperty(value = "总充值") - private BigDecimal usdtRechargeTotal; - - @Column(name = "`usdt_withdraw_total`") - @ApiModelProperty(value = "总提现") - private BigDecimal usdtWithdrawTotal; - - @Column(name = "`balance`") - @ApiModelProperty(value = "总资金") - private BigDecimal balance; - - @Column(name = "`freeze_balance`") - @ApiModelProperty(value = "冻结资金") - private BigDecimal freezeBalance; - - @Column(name = "`version`") - @ApiModelProperty(value = "版本号") - private Integer version; - - @Column(name = "`create_time`") - @ApiModelProperty(value = "创建时间") - private Timestamp createTime; - - @Column(name = "`update_time`") - @ApiModelProperty(value = "更新时间") - private Timestamp updateTime; - - @Column(name = "`user_language`") - @ApiModelProperty(value = "语言") - private String userLanguage; - - @Column(name = "`chip_balance`") - @ApiModelProperty(value = "质押资金") - private BigDecimal chipBalance; - - @Column(name = "`father_bind_time`") - @ApiModelProperty(value = "绑定时间") - private Timestamp fatherBindTime; - - public void copy(BotUser source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotUserFlow.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotUserFlow.java deleted file mode 100644 index 729eb26b..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/BotUserFlow.java +++ /dev/null @@ -1,75 +0,0 @@ -/* -* 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.pojo; - -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 java.sql.Timestamp; -import java.math.BigDecimal; -import java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author admin -* @date 2023-10-30 -**/ -@Entity -@Data -@Table(name="bot_user_flow") -public class BotUserFlow implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "`id`") - @ApiModelProperty(value = "id") - private Integer id; - - @Column(name = "`user_telegram_id`") - @ApiModelProperty(value = "电报号") - private String userTelegramId; - - @Column(name = "`user_name`") - @ApiModelProperty(value = "用户名称") - private String userName; - - @Column(name = "`biz_code`") - @ApiModelProperty(value = "业务代码") - private String bizCode; - - @Column(name = "`amount`") - @ApiModelProperty(value = "变动金额") - private BigDecimal amount; - - @Column(name = "`old_balance`") - @ApiModelProperty(value = "变动前金额") - private BigDecimal oldBalance; - - @Column(name = "`new_balance`") - @ApiModelProperty(value = "变动后金额") - private BigDecimal newBalance; - - @Column(name = "`create_time`") - @ApiModelProperty(value = "创建时间") - private Timestamp createTime; - - public void copy(BotUserFlow source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/TbRenewalsPayLog.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/TbRenewalsPayLog.java deleted file mode 100644 index 14823320..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/TbRenewalsPayLog.java +++ /dev/null @@ -1,100 +0,0 @@ -/* -* 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.pojo; - -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 javax.validation.constraints.*; -import java.math.BigDecimal; -import java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author lyf -* @date 2023-11-07 -**/ -@Entity -@Data -@Table(name="tb_renewals_pay_log") -public class TbRenewalsPayLog implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "`id`") - @ApiModelProperty(value = "id") - private Integer id; - - @Column(name = "`pay_type`") - @ApiModelProperty(value = "支付方式") - private String payType; - - @Column(name = "`shop_id`") - @ApiModelProperty(value = "店铺Id") - private String shopId; - - @Column(name = "`order_id`") - @ApiModelProperty(value = "订单Id") - private String orderId; - - @Column(name = "`open_id`") - @ApiModelProperty(value = "openId") - private String openId; - - @Column(name = "`user_id`") - @ApiModelProperty(value = "用户Id") - private String userId; - - @Column(name = "`transaction_id`") - @ApiModelProperty(value = "交易单号(第三方交易单号)") - private String transactionId; - - @Column(name = "`amount`",nullable = false) - @NotNull - @ApiModelProperty(value = "金额") - private BigDecimal amount; - - @Column(name = "`status`") - @ApiModelProperty(value = "状态 ") - private Integer status; - - @Column(name = "`remark`") - @ApiModelProperty(value = "备注") - private String remark; - - @Column(name = "`attach`") - @ApiModelProperty(value = "用户自定义参数") - private String attach; - - @Column(name = "`expired_at`") - @ApiModelProperty(value = "到期时间") - private Long expiredAt; - - @Column(name = "`created_at`") - @ApiModelProperty(value = "创建时间") - private Long createdAt; - - @Column(name = "`updated_at`") - @ApiModelProperty(value = "updatedAt") - private Long updatedAt; - - public void copy(TbRenewalsPayLog source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantCoupon.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantCoupon.java deleted file mode 100644 index 4c01b1d9..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbMerchantCoupon.java +++ /dev/null @@ -1,467 +0,0 @@ - -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 javax.validation.constraints.*; -import java.math.BigDecimal; -import java.io.Serializable; -import java.sql.Timestamp; - -/** - * @author lyf - * @website https://eladmin.vip - * @description / - * @date 2024-03-20 - **/ -@Entity -@Table(name = "tb_merchant_coupon") -public class TbMerchantCoupon implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "`id`") - @ApiModelProperty(value = "自增") - private Integer id; - - @Column(name = "`status`") - @ApiModelProperty(value = "状态0-关闭 1 正常") - private Integer status; - - @Column(name = "`title`") - @ApiModelProperty(value = " 优惠券名称") - private String title; - - @Column(name = "`template_id`", nullable = false) - @NotBlank - @ApiModelProperty(value = "templateId") - private String templateId = "0"; - - @Column(name = "`shop_id`") - @ApiModelProperty(value = "shopId") - private String shopId; - - @Column(name = "`shop_snap`") - @ApiModelProperty(value = "shopSnap") - private String shopSnap; - - @Column(name = "`from_time`") - @ApiModelProperty(value = "开始时间") - private Timestamp fromTime; - - @Column(name = "`to_time`") - @ApiModelProperty(value = "到期时间") - private Timestamp toTime; - - @Column(name = "`limit_number`") - @ApiModelProperty(value = "限领数量") - private Integer limitNumber; - - @Column(name = "`number`") - @ApiModelProperty(value = "发放数量") - private Integer number; - - @Column(name = "`use_number`") - @ApiModelProperty(value = "已核销数量") - private Integer useNumber; - - @Column(name = "`left_number`", nullable = false) - @ApiModelProperty(value = "剩余数量") - private Integer leftNumber; - - @Column(name = "`amount`") - @ApiModelProperty(value = "优惠金额") - private BigDecimal amount; - - @Column(name = "`limit_amount`") - @ApiModelProperty(value = "订单满赠金额") - private BigDecimal limitAmount; - - @Column(name = "`is_show`") - @ApiModelProperty(value = "是否显示0-不显示 1显示") - private Integer isShow; - - @Column(name = "`pic`") - @ApiModelProperty(value = "图标") - private String pic; - - @Column(name = "`type`") - @ApiModelProperty(value = "0-满减 1-折扣") - private Integer type; - - @Column(name = "`ratio`") - @ApiModelProperty(value = "折扣 ,一位小数") - private Float ratio; - - @Column(name = "`max_ratio_amount`") - @ApiModelProperty(value = "最大折扣金额") - private BigDecimal maxRatioAmount; - - @Column(name = "`track`") - @ApiModelProperty(value = "优惠券途径,首充|分销") - private String track; - - @Column(name = "`class_type`") - @ApiModelProperty(value = "品类product 商品券 ---cateogry 品类券common -通用券") - @NotNull - private String classType; - - @Column(name = "`effect_type`") - @ApiModelProperty(value = "有效期类型:0-toTime有效 1-effectDays有效") - @NotNull - private Integer effectType; - - @Column(name = "`effect_days`") - @ApiModelProperty(value = "领取之日有效天数") - private Integer effectDays; - - @Column(name = "`relation_ids`") - @ApiModelProperty(value = "关联商品Id") - private String relationIds; - - @Column(name = "`relation_list`") - @ApiModelProperty(value = "relationList") - private String relationList; - - @Column(name = "`editor`") - @ApiModelProperty(value = "发放人") - private String editor; - - @Column(name = "`note`") - @ApiModelProperty(value = "说明") - private String note; - - @Column(name = "`created_at`", nullable = false) - @NotNull - @ApiModelProperty(value = "createdAt") - private Long createdAt; - - @Column(name = "`updated_at`", nullable = false) - @NotNull - @ApiModelProperty(value = "updatedAt") - private Long updatedAt; - - @Column(name = "`furnish_meal`") - @ApiModelProperty(value = "支持堂食") - private Integer furnishMeal; - - @Column(name = "`furnish_express`") - @ApiModelProperty(value = "支持配送") - private Integer furnishExpress; - - @Column(name = "`furnish_draw`") - @ApiModelProperty(value = "支持自提") - private Integer furnishDraw; - - @Column(name = "`furnish_vir`") - @ApiModelProperty(value = "支持虚拟") - private Integer furnishVir; - - @Column(name = "`disable_distribute`") - @ApiModelProperty(value = "disableDistribute") - private Integer disableDistribute; - - @Column(name = "`merchant_id`") - @ApiModelProperty(value = "商户Id") - private String merchantId; - - @Column(name = "`category_id`") - @ApiModelProperty(value = "分类id") - private String categoryId; - - public void copy(TbMerchantCoupon source) { - BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getTemplateId() { - return templateId; - } - - public void setTemplateId(String templateId) { - this.templateId = templateId; - } - - public String getShopId() { - return shopId; - } - - public void setShopId(String shopId) { - this.shopId = shopId; - } - - public String getShopSnap() { - return shopSnap; - } - - public void setShopSnap(String shopSnap) { - this.shopSnap = shopSnap; - } - - public Timestamp getFromTime() { - return fromTime; - } - - public void setFromTime(Timestamp fromTime) { - this.fromTime = fromTime; - } - - public Timestamp getToTime() { - return toTime; - } - - public void setToTime(Timestamp toTime) { - this.toTime = toTime; - } - - public Integer getLimitNumber() { - return limitNumber; - } - - public void setLimitNumber(Integer limitNumber) { - this.limitNumber = limitNumber; - } - - public Integer getNumber() { - return number; - } - - public void setNumber(Integer number) { - this.number = number; - } - - public Integer getUseNumber() { - return useNumber; - } - - public void setUseNumber(Integer useNumber) { - this.useNumber = useNumber; - } - - public Integer getLeftNumber() { - return leftNumber; - } - - public void setLeftNumber(Integer leftNumber) { - this.leftNumber = leftNumber; - } - - public BigDecimal getAmount() { - return amount; - } - - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - public BigDecimal getLimitAmount() { - return limitAmount; - } - - public void setLimitAmount(BigDecimal limitAmount) { - this.limitAmount = limitAmount; - } - - public Integer getIsShow() { - return isShow; - } - - public void setIsShow(Integer isShow) { - this.isShow = isShow; - } - - public String getPic() { - return pic; - } - - public void setPic(String pic) { - this.pic = pic; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public Float getRatio() { - return ratio; - } - - public void setRatio(Float ratio) { - this.ratio = ratio; - } - - public BigDecimal getMaxRatioAmount() { - return maxRatioAmount; - } - - public void setMaxRatioAmount(BigDecimal maxRatioAmount) { - this.maxRatioAmount = maxRatioAmount; - } - - public String getTrack() { - return track; - } - - public void setTrack(String track) { - this.track = track; - } - - public String getClassType() { - return classType; - } - - public void setClassType(String classType) { - this.classType = classType; - } - - public Integer getEffectType() { - return effectType; - } - - public void setEffectType(Integer effectType) { - this.effectType = effectType; - } - - public Integer getEffectDays() { - return effectDays; - } - - public void setEffectDays(Integer effectDays) { - this.effectDays = effectDays; - } - - public String getRelationIds() { - return relationIds; - } - - public void setRelationIds(String relationIds) { - this.relationIds = relationIds; - } - - public String getRelationList() { - return relationList; - } - - public void setRelationList(String relationList) { - this.relationList = relationList; - } - - public String getEditor() { - return editor; - } - - public void setEditor(String editor) { - this.editor = editor; - } - - public String getNote() { - return note; - } - - public void setNote(String note) { - this.note = note; - } - - public Long getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(Long createdAt) { - this.createdAt = createdAt; - } - - public Long getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(Long updatedAt) { - this.updatedAt = updatedAt; - } - - public Integer getFurnishMeal() { - return furnishMeal; - } - - public void setFurnishMeal(Integer furnishMeal) { - this.furnishMeal = furnishMeal; - } - - public Integer getFurnishExpress() { - return furnishExpress; - } - - public void setFurnishExpress(Integer furnishExpress) { - this.furnishExpress = furnishExpress; - } - - public Integer getFurnishDraw() { - return furnishDraw; - } - - public void setFurnishDraw(Integer furnishDraw) { - this.furnishDraw = furnishDraw; - } - - public Integer getFurnishVir() { - return furnishVir; - } - - public void setFurnishVir(Integer furnishVir) { - this.furnishVir = furnishVir; - } - - public Integer getDisableDistribute() { - return disableDistribute; - } - - public void setDisableDistribute(Integer disableDistribute) { - this.disableDistribute = disableDistribute; - } - - public String getMerchantId() { - return merchantId; - } - - public void setMerchantId(String merchantId) { - this.merchantId = merchantId; - } - - public String getCategoryId() { - return categoryId; - } - - public void setCategoryId(String categoryId) { - this.categoryId = categoryId; - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbReceiptSales.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbReceiptSales.java deleted file mode 100644 index 9469bda7..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbReceiptSales.java +++ /dev/null @@ -1,120 +0,0 @@ -/* -* 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.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 java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author lyf -* @date 2024-01-08 -**/ -@Entity -@Data -@Table(name="tb_receipt_sales") -public class TbReceiptSales implements Serializable { - - @Id - @Column(name = "`id`") - @ApiModelProperty(value = "shopId") - private Integer id; - - @Column(name = "`title`") - @ApiModelProperty(value = "标题") - private String title=""; - - @Column(name = "`logo`") - @ApiModelProperty(value = "是否显示公司Logo") - private String logo=""; - - @Column(name = "`show_contact_info`") - @ApiModelProperty(value = "打印联系电话等信息") - private Integer showContactInfo=0; - - @Column(name = "`show_member`") - @ApiModelProperty(value = "打印会员开关 0?1") - private Integer showMember=0; - - @Column(name = "`show_member_code`") - @ApiModelProperty(value = "打印会员编号开关") - private Integer showMemberCode=0; - - @Column(name = "`show_member_score`") - @ApiModelProperty(value = "打印会员积分") - private Integer showMemberScore=0; - - @Column(name = "`show_member_wallet`") - @ApiModelProperty(value = "打印会员余额开关 0?1") - private Integer showMemberWallet=0; - - @Column(name = "`footer_remark`") - @ApiModelProperty(value = "店铺Id") - private String footerRemark=""; - - @Column(name = "`show_cash_charge`") - @ApiModelProperty(value = "打印找零") - private Integer showCashCharge=0; - - @Column(name = "`show_serial_no`") - @ApiModelProperty(value = "流水号") - private Integer showSerialNo=0; - - @Column(name = "`big_serial_no`") - @ApiModelProperty(value = "用大号字打印流水号 在showSerialNo可用前提下") - private Integer bigSerialNo; - - @Column(name = "`header_text`") - @ApiModelProperty(value = "头部文字") - private String headerText; - - @Column(name = "`header_text_align`") - @ApiModelProperty(value = "文字 对齐方式") - private String headerTextAlign; - - @Column(name = "`footer_text`") - @ApiModelProperty(value = "尾部文字") - private String footerText=""; - - @Column(name = "`footer_text_align`") - @ApiModelProperty(value = "文字 对齐方式") - private String footerTextAlign; - - @Column(name = "`footer_image`") - @ApiModelProperty(value = "尾部图像") - private String footerImage=""; - - @Column(name = "`pre_print`") - @ApiModelProperty(value = "预打印,YES开启 NO不开启") - private String prePrint; - - @Column(name = "`created_at`") - @ApiModelProperty(value = "createdAt") - private Long createdAt; - - @Column(name = "`updated_at`") - @ApiModelProperty(value = "updatedAt") - private Long updatedAt; - - public void copy(TbReceiptSales source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopCashSpread.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopCashSpread.java deleted file mode 100644 index 0dac0c58..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopCashSpread.java +++ /dev/null @@ -1,72 +0,0 @@ -/* -* 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.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 java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author lyf -* @date 2024-01-05 -**/ -@Entity -@Data -@Table(name="tb_shop_cash_spread") -public class TbShopCashSpread implements Serializable { - - @Id - @Column(name = "`id`") - @ApiModelProperty(value = "shopId") - private Integer id; - - @Column(name = "`sale_receipt`") - @ApiModelProperty(value = "登陆密码") - private String saleReceipt; - - @Column(name = "`triplicate_receipt`") - @ApiModelProperty(value = "状态") - private String triplicateReceipt; - - @Column(name = "`screen_config`") - @ApiModelProperty(value = "到期提醒时间") - private String screenConfig; - - @Column(name = "`tag_config`") - @ApiModelProperty(value = "tagConfig") - private String tagConfig; - - @Column(name = "`scale_config`") - @ApiModelProperty(value = "scaleConfig") - private String scaleConfig; - - @Column(name = "`created_at`") - @ApiModelProperty(value = "createdAt") - private Long createdAt; - - @Column(name = "`updated_at`") - @ApiModelProperty(value = "updatedAt") - private Long updatedAt; - - public void copy(TbShopCashSpread source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopCurrency.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopCurrency.java deleted file mode 100644 index 35e9a5a1..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopCurrency.java +++ /dev/null @@ -1,130 +0,0 @@ -/* -* 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.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 java.math.BigDecimal; -import java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author lyf -* @date 2024-01-05 -**/ -@Entity -@Data -@Table(name="tb_shop_currency") -public class TbShopCurrency implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "`id`") - @ApiModelProperty(value = "自增id") - private Integer id; - - @Column(name = "`shop_id`") - @ApiModelProperty(value = "店铺Id") - private String shopId; - - @Column(name = "`prepare_amount`") - @ApiModelProperty(value = "备用金") - private BigDecimal prepareAmount; - - @Column(name = "`currency`") - @ApiModelProperty(value = "货币单位 ¥,$") - private String currency; - - @Column(name = "`decimals_digits`") - @ApiModelProperty(value = "小数位,0,1,2,无,元,角,分") - private Integer decimalsDigits; - - @Column(name = "`discount_round`") - @ApiModelProperty(value = "无,四舍五入,五舍六入none,round4up5,round5up6,round12up34") - private String discountRound; - - @Column(name = "`merchant_id`") - @ApiModelProperty(value = "商户Id") - private String merchantId; - - @Column(name = "`small_change`") - @ApiModelProperty(value = "订单抹零 -1无,0元 1角2分 0.5=0.5元") - private Integer smallChange; - - @Column(name = "`enable_custom_discount`") - @ApiModelProperty(value = "使折扣生效") - private Integer enableCustomDiscount; - - @Column(name = "`max_discount`") - @ApiModelProperty(value = "最大抹零金额(100)") - private BigDecimal maxDiscount; - - @Column(name = "`max_percent`") - @ApiModelProperty(value = "最大折扣百分比,,优先级高于max_discount") - private Double maxPercent; - - @Column(name = "`discount_configs`") - @ApiModelProperty(value = "折扣显示详情") - private String discountConfigs; - - @Column(name = "`biz_duration`") - @ApiModelProperty(value = "营业时间(弃用)") - private String bizDuration; - - @Column(name = "`allow_web_pay`") - @ApiModelProperty(value = "允许网络支付") - private Integer allowWebPay; - - @Column(name = "`is_auto_to_zero`") - @ApiModelProperty(value = "自动抹零,开启时,系统自动抹零") - private Integer isAutoToZero; - - @Column(name = "`is_include_tax_price`") - @ApiModelProperty(value = "商品含税") - private Integer isIncludeTaxPrice; - - @Column(name = "`service_charge`") - @ApiModelProperty(value = "服务费配置(小费)") - private String serviceCharge; - - @Column(name = "`tax_number`") - @ApiModelProperty(value = "税号") - private String taxNumber; - - @Column(name = "`created_at`") - @ApiModelProperty(value = "createdAt") - private Long createdAt; - - @Column(name = "`updated_at`") - @ApiModelProperty(value = "updatedAt") - private Long updatedAt; - - @Column(name = "`auto_lock_screen`") - @ApiModelProperty(value = "自动锁屏") - private Integer autoLockScreen; - - @Column(name = "`voice_notification`") - @ApiModelProperty(value = "语音通知") - private Integer voiceNotification; - - public void copy(TbShopCurrency source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotButtonConfigRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotButtonConfigRepository.java deleted file mode 100644 index 6f95aff4..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotButtonConfigRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -* 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.repository; - -import cn.ysk.cashier.pojo.BotButtonConfig; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-31 -**/ -public interface BotButtonConfigRepository extends JpaRepository, JpaSpecificationExecutor { -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotConfigRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotConfigRepository.java deleted file mode 100644 index ec9eb050..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotConfigRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -* 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.repository; - -import cn.ysk.cashier.pojo.BotConfig; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-31 -**/ -public interface BotConfigRepository extends JpaRepository, JpaSpecificationExecutor { -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotUserFlowRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotUserFlowRepository.java deleted file mode 100644 index 5e156606..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotUserFlowRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -* 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.repository; - -import cn.ysk.cashier.pojo.BotUserFlow; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-30 -**/ -public interface BotUserFlowRepository extends JpaRepository, JpaSpecificationExecutor { -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotUserRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotUserRepository.java deleted file mode 100644 index 170dad0f..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/BotUserRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -* 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.repository; - -import cn.ysk.cashier.pojo.BotUser; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-30 -**/ -public interface BotUserRepository extends JpaRepository, JpaSpecificationExecutor { -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/TbRenewalsPayLogRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/TbRenewalsPayLogRepository.java deleted file mode 100644 index 7f85f4da..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/TbRenewalsPayLogRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -* 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.repository; - -import cn.ysk.cashier.pojo.TbRenewalsPayLog; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2023-11-07 -**/ -public interface TbRenewalsPayLogRepository extends JpaRepository, JpaSpecificationExecutor { -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbMerchantCouponRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbMerchantCouponRepository.java deleted file mode 100644 index 5afb22c3..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbMerchantCouponRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -* 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.repository.shop; - -import cn.ysk.cashier.pojo.shop.TbMerchantCoupon; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-03-20 -**/ -public interface TbMerchantCouponRepository extends JpaRepository, JpaSpecificationExecutor { -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbReceiptSalesRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbReceiptSalesRepository.java deleted file mode 100644 index 492f7815..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbReceiptSalesRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -/* -* 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.repository.shop; - -import cn.ysk.cashier.pojo.shop.TbReceiptSales; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-01-08 -**/ -public interface TbReceiptSalesRepository extends JpaRepository, JpaSpecificationExecutor { -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopCashSpreadRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopCashSpreadRepository.java deleted file mode 100644 index e65fccdb..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopCashSpreadRepository.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -* 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.repository.shop; - -import cn.ysk.cashier.pojo.shop.TbShopCashSpread; -import org.apache.ibatis.annotations.Param; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; -import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.jpa.repository.Query; - -import javax.transaction.Transactional; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-01-05 -**/ -public interface TbShopCashSpreadRepository extends JpaRepository, JpaSpecificationExecutor { - @Query("select spread from TbShopCashSpread spread where spread.id = :shopId") - TbShopCashSpread findByShopId(@Param("shopId")Integer shopId); - - @Modifying - @Transactional - @Query("update TbShopCashSpread spread set spread.screenConfig = :screenConfig, spread.updatedAt = :updatedTime where spread.id = :shopId") - Integer updateConfig(@Param("shopId")Integer shopId, @Param("screenConfig")String screenConfig, - @Param("updatedTime")Long updatedTime); - - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopCurrencyRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopCurrencyRepository.java deleted file mode 100644 index 8da567d0..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopCurrencyRepository.java +++ /dev/null @@ -1,33 +0,0 @@ -/* -* 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.repository.shop; - -import cn.ysk.cashier.pojo.shop.TbShopCurrency; -import org.apache.ibatis.annotations.Param; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; -import org.springframework.data.jpa.repository.Query; - -/** -* @website https://eladmin.vip -* @author lyf -* @date 2024-01-05 -**/ -public interface TbShopCurrencyRepository extends JpaRepository, JpaSpecificationExecutor { - - @Query("SELECT currency from TbShopCurrency currency where currency.shopId = :shopId") - TbShopCurrency findByShopId(@Param("shopId")String shopId); -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/BotButtonConfigService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/BotButtonConfigService.java deleted file mode 100644 index 991da2b8..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/BotButtonConfigService.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -* 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.service; - -import cn.ysk.cashier.pojo.BotButtonConfig; -import cn.ysk.cashier.dto.BotButtonConfigDto; -import cn.ysk.cashier.dto.BotButtonConfigQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @description 服务接口 -* @author admin -* @date 2023-10-31 -**/ -public interface BotButtonConfigService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(BotButtonConfigQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(BotButtonConfigQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return BotButtonConfigDto - */ - BotButtonConfigDto findById(Integer id); - - /** - * 创建 - * @param resources / - * @return BotButtonConfigDto - */ - BotButtonConfigDto create(BotButtonConfig resources); - - /** - * 编辑 - * @param resources / - */ - void update(BotButtonConfig resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Integer[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/BotConfigService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/BotConfigService.java deleted file mode 100644 index 02c20cf6..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/BotConfigService.java +++ /dev/null @@ -1,68 +0,0 @@ -package cn.ysk.cashier.service; - -import cn.ysk.cashier.pojo.BotConfig; -import cn.ysk.cashier.dto.BotConfigDto; -import cn.ysk.cashier.dto.BotConfigQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @description 服务接口 -* @author admin -* @date 2023-10-31 -**/ -public interface BotConfigService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(BotConfigQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(BotConfigQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return BotConfigDto - */ - BotConfigDto findById(Integer id); - - /** - * 创建 - * @param resources / - * @return BotConfigDto - */ - BotConfigDto create(BotConfig resources); - - /** - * 编辑 - * @param resources / - */ - void update(BotConfig resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Integer[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/BotUserFlowService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/BotUserFlowService.java deleted file mode 100644 index 9d5c70d5..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/BotUserFlowService.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -* 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.service; - -import cn.ysk.cashier.pojo.BotUserFlow; -import cn.ysk.cashier.dto.BotUserFlowDto; -import cn.ysk.cashier.dto.BotUserFlowQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @description 服务接口 -* @author admin -* @date 2023-10-30 -**/ -public interface BotUserFlowService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(BotUserFlowQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(BotUserFlowQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return BotUserFlowDto - */ - BotUserFlowDto findById(Integer id); - - /** - * 创建 - * @param resources / - * @return BotUserFlowDto - */ - BotUserFlowDto create(BotUserFlow resources); - - /** - * 编辑 - * @param resources / - */ - void update(BotUserFlow resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Integer[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/BotUserService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/BotUserService.java deleted file mode 100644 index af565bad..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/BotUserService.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -* 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.service; - -import cn.ysk.cashier.pojo.BotUser; -import cn.ysk.cashier.dto.BotUserDto; -import cn.ysk.cashier.dto.BotUserQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @description 服务接口 -* @author admin -* @date 2023-10-30 -**/ -public interface BotUserService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(BotUserQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(BotUserQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return BotUserDto - */ - BotUserDto findById(Integer id); - - /** - * 创建 - * @param resources / - * @return BotUserDto - */ - BotUserDto create(BotUser resources); - - /** - * 编辑 - * @param resources / - */ - void update(BotUser resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Integer[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/TbRenewalsPayLogService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/TbRenewalsPayLogService.java deleted file mode 100644 index 68ed47f6..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/TbRenewalsPayLogService.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -* 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.service; - -import cn.ysk.cashier.pojo.TbRenewalsPayLog; -import cn.ysk.cashier.dto.TbRenewalsPayLogDto; -import cn.ysk.cashier.dto.TbRenewalsPayLogQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @description 服务接口 -* @author lyf -* @date 2023-11-07 -**/ -public interface TbRenewalsPayLogService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(TbRenewalsPayLogQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(TbRenewalsPayLogQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return TbRenewalsPayLogDto - */ - TbRenewalsPayLogDto findById(Integer id); - - /** - * 创建 - * @param resources / - * @return TbRenewalsPayLogDto - */ - TbRenewalsPayLogDto create(TbRenewalsPayLog resources); - - /** - * 编辑 - * @param resources / - */ - void update(TbRenewalsPayLog resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Integer[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotButtonConfigServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotButtonConfigServiceImpl.java deleted file mode 100644 index 26fbb9ed..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotButtonConfigServiceImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -/* -* 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.service.impl; - -import cn.ysk.cashier.pojo.BotButtonConfig; -import cn.ysk.cashier.utils.ValidationUtil; -import cn.ysk.cashier.utils.FileUtil; -import lombok.RequiredArgsConstructor; -import cn.ysk.cashier.repository.BotButtonConfigRepository; -import cn.ysk.cashier.service.BotButtonConfigService; -import cn.ysk.cashier.dto.BotButtonConfigDto; -import cn.ysk.cashier.dto.BotButtonConfigQueryCriteria; -import cn.ysk.cashier.mapper.BotButtonConfigMapper; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import cn.ysk.cashier.utils.PageUtil; -import cn.ysk.cashier.utils.QueryHelp; -import java.util.List; -import java.util.Map; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.LinkedHashMap; - -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author admin -* @date 2023-10-31 -**/ -@Service -@RequiredArgsConstructor -public class BotButtonConfigServiceImpl implements BotButtonConfigService { - - private final BotButtonConfigRepository botButtonConfigRepository; - private final BotButtonConfigMapper botButtonConfigMapper; - - @Override - public Map queryAll(BotButtonConfigQueryCriteria criteria, Pageable pageable){ - Page page = botButtonConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(botButtonConfigMapper::toDto)); - } - - @Override - public List queryAll(BotButtonConfigQueryCriteria criteria){ - return botButtonConfigMapper.toDto(botButtonConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public BotButtonConfigDto findById(Integer id) { - BotButtonConfig botButtonConfig = botButtonConfigRepository.findById(id).orElseGet(BotButtonConfig::new); - ValidationUtil.isNull(botButtonConfig.getId(),"BotButtonConfig","id",id); - return botButtonConfigMapper.toDto(botButtonConfig); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public BotButtonConfigDto create(BotButtonConfig resources) { - return botButtonConfigMapper.toDto(botButtonConfigRepository.save(resources)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(BotButtonConfig resources) { - BotButtonConfig botButtonConfig = botButtonConfigRepository.findById(resources.getId()).orElseGet(BotButtonConfig::new); - ValidationUtil.isNull( botButtonConfig.getId(),"BotButtonConfig","id",resources.getId()); - botButtonConfig.copy(resources); - botButtonConfigRepository.save(botButtonConfig); - } - - @Override - public void deleteAll(Integer[] ids) { - for (Integer id : ids) { - botButtonConfigRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (BotButtonConfigDto botButtonConfig : all) { - Map map = new LinkedHashMap<>(); - map.put("按钮名称", botButtonConfig.getButtonName()); - map.put("按钮值", botButtonConfig.getButtonValue()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotConfigServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotConfigServiceImpl.java deleted file mode 100644 index cbae7949..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotConfigServiceImpl.java +++ /dev/null @@ -1,106 +0,0 @@ -/* -* 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.service.impl; - -import cn.ysk.cashier.pojo.BotConfig; -import cn.ysk.cashier.utils.ValidationUtil; -import cn.ysk.cashier.utils.FileUtil; -import lombok.RequiredArgsConstructor; -import cn.ysk.cashier.repository.BotConfigRepository; -import cn.ysk.cashier.service.BotConfigService; -import cn.ysk.cashier.dto.BotConfigDto; -import cn.ysk.cashier.dto.BotConfigQueryCriteria; -import cn.ysk.cashier.mapper.BotConfigMapper; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import cn.ysk.cashier.utils.PageUtil; -import cn.ysk.cashier.utils.QueryHelp; -import java.util.List; -import java.util.Map; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.LinkedHashMap; - -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author admin -* @date 2023-10-31 -**/ -@Service -@RequiredArgsConstructor -public class BotConfigServiceImpl implements BotConfigService { - - private final BotConfigRepository botConfigRepository; - private final BotConfigMapper botConfigMapper; - - @Override - public Map queryAll(BotConfigQueryCriteria criteria, Pageable pageable){ - Page page = botConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(botConfigMapper::toDto)); - } - - @Override - public List queryAll(BotConfigQueryCriteria criteria){ - return botConfigMapper.toDto(botConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public BotConfigDto findById(Integer id) { - BotConfig botConfig = botConfigRepository.findById(id).orElseGet(BotConfig::new); - ValidationUtil.isNull(botConfig.getId(),"BotConfig","id",id); - return botConfigMapper.toDto(botConfig); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public BotConfigDto create(BotConfig resources) { - return botConfigMapper.toDto(botConfigRepository.save(resources)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(BotConfig resources) { - BotConfig botConfig = botConfigRepository.findById(resources.getId()).orElseGet(BotConfig::new); - ValidationUtil.isNull( botConfig.getId(),"BotConfig","id",resources.getId()); - botConfig.copy(resources); - botConfigRepository.save(botConfig); - } - - @Override - public void deleteAll(Integer[] ids) { - for (Integer id : ids) { - botConfigRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (BotConfigDto botConfig : all) { - Map map = new LinkedHashMap<>(); - map.put("元素键值", botConfig.getConfigKey()); - map.put("元素值", botConfig.getConfigValue()); - map.put("描述", botConfig.getRemark()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotUserFlowServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotUserFlowServiceImpl.java deleted file mode 100644 index e59a548d..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotUserFlowServiceImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -/* -* 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.service.impl; - -import cn.ysk.cashier.pojo.BotUserFlow; -import cn.ysk.cashier.repository.BotUserFlowRepository; -import cn.ysk.cashier.service.BotUserFlowService; -import cn.ysk.cashier.dto.BotUserFlowDto; -import cn.ysk.cashier.dto.BotUserFlowQueryCriteria; -import cn.ysk.cashier.utils.ValidationUtil; -import cn.ysk.cashier.utils.FileUtil; -import lombok.RequiredArgsConstructor; -import cn.ysk.cashier.mapper.BotUserFlowMapper; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import cn.ysk.cashier.utils.PageUtil; -import cn.ysk.cashier.utils.QueryHelp; -import java.util.List; -import java.util.Map; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.LinkedHashMap; - -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author admin -* @date 2023-10-30 -**/ -@Service -@RequiredArgsConstructor -public class BotUserFlowServiceImpl implements BotUserFlowService { - - private final BotUserFlowRepository botUserFlowRepository; - private final BotUserFlowMapper botUserFlowMapper; - - @Override - public Map queryAll(BotUserFlowQueryCriteria criteria, Pageable pageable){ - Page page = botUserFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(botUserFlowMapper::toDto)); - } - - @Override - public List queryAll(BotUserFlowQueryCriteria criteria){ - return botUserFlowMapper.toDto(botUserFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public BotUserFlowDto findById(Integer id) { - BotUserFlow botUserFlow = botUserFlowRepository.findById(id).orElseGet(BotUserFlow::new); - ValidationUtil.isNull(botUserFlow.getId(),"BotUserFlow","id",id); - return botUserFlowMapper.toDto(botUserFlow); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public BotUserFlowDto create(BotUserFlow resources) { - return botUserFlowMapper.toDto(botUserFlowRepository.save(resources)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(BotUserFlow resources) { - BotUserFlow botUserFlow = botUserFlowRepository.findById(resources.getId()).orElseGet(BotUserFlow::new); - ValidationUtil.isNull( botUserFlow.getId(),"BotUserFlow","id",resources.getId()); - botUserFlow.copy(resources); - botUserFlowRepository.save(botUserFlow); - } - - @Override - public void deleteAll(Integer[] ids) { - for (Integer id : ids) { - botUserFlowRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (BotUserFlowDto botUserFlow : all) { - Map map = new LinkedHashMap<>(); - map.put("电报号", botUserFlow.getUserTelegramId()); - map.put("用户名称", botUserFlow.getUserName()); - map.put("业务代码", botUserFlow.getBizCode()); - map.put("变动金额", botUserFlow.getAmount()); - map.put("变动前金额", botUserFlow.getOldBalance()); - map.put("变动后金额", botUserFlow.getNewBalance()); - map.put("创建时间", botUserFlow.getCreateTime()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotUserServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotUserServiceImpl.java deleted file mode 100644 index b442eb48..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/BotUserServiceImpl.java +++ /dev/null @@ -1,122 +0,0 @@ -/* -* 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.service.impl; - -import cn.ysk.cashier.pojo.BotUser; -import cn.ysk.cashier.utils.ValidationUtil; -import cn.ysk.cashier.utils.FileUtil; -import lombok.RequiredArgsConstructor; -import cn.ysk.cashier.repository.BotUserRepository; -import cn.ysk.cashier.service.BotUserService; -import cn.ysk.cashier.dto.BotUserDto; -import cn.ysk.cashier.dto.BotUserQueryCriteria; -import cn.ysk.cashier.mapper.BotUserMapper; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import cn.ysk.cashier.utils.PageUtil; -import cn.ysk.cashier.utils.QueryHelp; -import java.util.List; -import java.util.Map; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.LinkedHashMap; - -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author admin -* @date 2023-10-30 -**/ -@Service -@RequiredArgsConstructor -public class BotUserServiceImpl implements BotUserService { - - private final BotUserRepository botUserRepository; - private final BotUserMapper botUserMapper; - - @Override - public Map queryAll(BotUserQueryCriteria criteria, Pageable pageable){ - Page page = botUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(botUserMapper::toDto)); - } - - @Override - public List queryAll(BotUserQueryCriteria criteria){ - return botUserMapper.toDto(botUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public BotUserDto findById(Integer id) { - BotUser botUser = botUserRepository.findById(id).orElseGet(BotUser::new); - ValidationUtil.isNull(botUser.getId(),"BotUser","id",id); - return botUserMapper.toDto(botUser); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public BotUserDto create(BotUser resources) { - return botUserMapper.toDto(botUserRepository.save(resources)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(BotUser resources) { - BotUser botUser = botUserRepository.findById(resources.getId()).orElseGet(BotUser::new); - ValidationUtil.isNull( botUser.getId(),"BotUser","id",resources.getId()); - botUser.copy(resources); - botUserRepository.save(botUser); - } - - @Override - public void deleteAll(Integer[] ids) { - for (Integer id : ids) { - botUserRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (BotUserDto botUser : all) { - Map map = new LinkedHashMap<>(); - map.put(" fatherId", botUser.getFatherId()); - map.put("父级电报号", botUser.getFatherTelegramId()); - map.put("电报号", botUser.getUserTelegramId()); - map.put("用户名称", botUser.getUserName()); - map.put("组电报号", botUser.getGroupTelegramId()); - map.put("用户代码", botUser.getUserCode()); - map.put(" userPayPass", botUser.getUserPayPass()); - map.put(" bombStatus", botUser.getBombStatus()); - map.put("用户状态", botUser.getBotStatus()); - map.put("总充值", botUser.getUsdtRechargeTotal()); - map.put("总提现", botUser.getUsdtWithdrawTotal()); - map.put("总资金", botUser.getBalance()); - map.put("冻结资金", botUser.getFreezeBalance()); - map.put("版本号", botUser.getVersion()); - map.put("创建时间", botUser.getCreateTime()); - map.put("更新时间", botUser.getUpdateTime()); - map.put("语言", botUser.getUserLanguage()); - map.put("质押资金", botUser.getChipBalance()); - map.put("绑定时间", botUser.getFatherBindTime()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbRenewalsPayLogServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbRenewalsPayLogServiceImpl.java deleted file mode 100644 index 7ecdd84f..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbRenewalsPayLogServiceImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/* -* 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.service.impl; - -import cn.ysk.cashier.pojo.TbRenewalsPayLog; -import cn.ysk.cashier.utils.ValidationUtil; -import cn.ysk.cashier.utils.FileUtil; -import lombok.RequiredArgsConstructor; -import cn.ysk.cashier.repository.TbRenewalsPayLogRepository; -import cn.ysk.cashier.service.TbRenewalsPayLogService; -import cn.ysk.cashier.dto.TbRenewalsPayLogDto; -import cn.ysk.cashier.dto.TbRenewalsPayLogQueryCriteria; -import cn.ysk.cashier.mapper.TbRenewalsPayLogMapper; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import cn.ysk.cashier.utils.PageUtil; -import cn.ysk.cashier.utils.QueryHelp; -import java.util.List; -import java.util.Map; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.LinkedHashMap; - -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author lyf -* @date 2023-11-07 -**/ -@Service -@RequiredArgsConstructor -public class TbRenewalsPayLogServiceImpl implements TbRenewalsPayLogService { - - private final TbRenewalsPayLogRepository tbRenewalsPayLogRepository; - private final TbRenewalsPayLogMapper tbRenewalsPayLogMapper; - - @Override - public Map queryAll(TbRenewalsPayLogQueryCriteria criteria, Pageable pageable){ - Page page = tbRenewalsPayLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(tbRenewalsPayLogMapper::toDto)); - } - - @Override - public List queryAll(TbRenewalsPayLogQueryCriteria criteria){ - return tbRenewalsPayLogMapper.toDto(tbRenewalsPayLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public TbRenewalsPayLogDto findById(Integer id) { - TbRenewalsPayLog tbRenewalsPayLog = tbRenewalsPayLogRepository.findById(id).orElseGet(TbRenewalsPayLog::new); - ValidationUtil.isNull(tbRenewalsPayLog.getId(),"TbRenewalsPayLog","id",id); - return tbRenewalsPayLogMapper.toDto(tbRenewalsPayLog); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public TbRenewalsPayLogDto create(TbRenewalsPayLog resources) { - return tbRenewalsPayLogMapper.toDto(tbRenewalsPayLogRepository.save(resources)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(TbRenewalsPayLog resources) { - TbRenewalsPayLog tbRenewalsPayLog = tbRenewalsPayLogRepository.findById(resources.getId()).orElseGet(TbRenewalsPayLog::new); - ValidationUtil.isNull( tbRenewalsPayLog.getId(),"TbRenewalsPayLog","id",resources.getId()); - tbRenewalsPayLog.copy(resources); - tbRenewalsPayLogRepository.save(tbRenewalsPayLog); - } - - @Override - public void deleteAll(Integer[] ids) { - for (Integer id : ids) { - tbRenewalsPayLogRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (TbRenewalsPayLogDto tbRenewalsPayLog : all) { - Map map = new LinkedHashMap<>(); - map.put("支付方式", tbRenewalsPayLog.getPayType()); - map.put("店铺Id", tbRenewalsPayLog.getShopId()); - map.put("订单Id", tbRenewalsPayLog.getOrderId()); - map.put(" openId", tbRenewalsPayLog.getOpenId()); - map.put("用户Id", tbRenewalsPayLog.getUserId()); - map.put("交易单号(第三方交易单号)", tbRenewalsPayLog.getTransactionId()); - map.put("金额", tbRenewalsPayLog.getAmount()); - map.put("状态 ", tbRenewalsPayLog.getStatus()); - map.put("备注", tbRenewalsPayLog.getRemark()); - map.put("用户自定义参数", tbRenewalsPayLog.getAttach()); - map.put("到期时间", tbRenewalsPayLog.getExpiredAt()); - map.put("创建时间", tbRenewalsPayLog.getCreatedAt()); - map.put(" updatedAt", tbRenewalsPayLog.getUpdatedAt()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index b116cd5b..eeae7adf 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -417,16 +417,12 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { outRecordService.update(lambdaUpdateWrapper); List details = tbOrderDetailRepository.searchDetailByOrderId(tbOrderInfo.getId()); - Set keys = new HashSet<>(); for (TbOrderDetail detail : details) { detail.setStatus("cancelled"); // 返还库存 productService.returnStockByPro(detail.getProductId(), detail.getProductSkuId(), detail.getNum()); tbOrderDetailRepository.save(detail); - keys.add(CacheKey.PRODUCT_SKU + detail.getShopId() + ":" + detail.getId()); } - String[] keysArray = keys.toArray(new String[keys.size()]); - redisUtils.del(keysArray); } @Override 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 46fdf887..10bb2257 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 @@ -251,7 +251,11 @@ public class TbProductServiceImpl implements TbProductService { if ("sku".equals(product.getTypeEnum())){ if(tbProductSkus.size() > 1){ BigDecimal maxPrice = tbProductSkus.stream().map(TbProductSku::getSalePrice).max(BigDecimal::compareTo).get(); - productNewVo.setLowPrice("¥" +productNewVo.getLowPrice() + "~¥" + maxPrice); + if (maxPrice.compareTo(new BigDecimal(productNewVo.getLowPrice())) == 0) { + productNewVo.setLowPrice("¥" +productNewVo.getLowPrice()); + }else { + productNewVo.setLowPrice("¥" +productNewVo.getLowPrice() + "~¥" + maxPrice); + } }else { productNewVo.setLowPrice("¥" +productNewVo.getLowPrice()); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbMerchantCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbMerchantCouponServiceImpl.java deleted file mode 100644 index 889d8ca9..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbMerchantCouponServiceImpl.java +++ /dev/null @@ -1,180 +0,0 @@ -/* -* 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.service.impl.shopimpl; - -import cn.hutool.core.bean.BeanUtil; -import cn.ysk.cashier.exception.BadRequestException; -import cn.ysk.cashier.pojo.product.TbProduct; -import cn.ysk.cashier.pojo.shop.TbMerchantCoupon; -import cn.ysk.cashier.repository.product.TbProductRepository; -import cn.ysk.cashier.utils.ValidationUtil; -import cn.ysk.cashier.utils.FileUtil; -import cn.ysk.cashier.vo.CouponVO; -import lombok.RequiredArgsConstructor; -import cn.ysk.cashier.repository.shop.TbMerchantCouponRepository; -import cn.ysk.cashier.service.shop.TbMerchantCouponService; -import cn.ysk.cashier.dto.shop.TbMerchantCouponDto; -import cn.ysk.cashier.dto.shop.TbMerchantCouponQueryCriteria; -import cn.ysk.cashier.mapper.shop.TbMerchantCouponMapper; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import cn.ysk.cashier.utils.PageUtil; -import cn.ysk.cashier.utils.QueryHelp; - -import java.sql.Timestamp; -import java.time.Instant; -import java.util.*; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author lyf -* @date 2024-03-20 -**/ -@Service -@RequiredArgsConstructor -public class TbMerchantCouponServiceImpl implements TbMerchantCouponService { - - private final TbMerchantCouponRepository tbMerchantCouponRepository; - private final TbMerchantCouponMapper tbMerchantCouponMapper; - private final TbProductRepository tbProductRepository; - - @Override - public Map queryAll(TbMerchantCouponQueryCriteria criteria, Pageable pageable){ - Page page = tbMerchantCouponRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - List objects = new ArrayList<>(); - for (TbMerchantCoupon o :page.getContent()) { - CouponVO couponVO = new CouponVO(); - BeanUtils.copyProperties(o,couponVO); - if (!o.getRelationIds().isEmpty()) { - List integers = new ArrayList<>(); - integers.add(Integer.valueOf(o.getRelationIds())); - List byIds = tbProductRepository.findByIds(integers); - couponVO.setName(byIds.get(0).getName()); - couponVO.setCoverImg(byIds.get(0).getCoverImg()); - } - objects.add(couponVO); - } - HashMap couponvoMap = new HashMap<>(); - couponvoMap.put("content", objects); - couponvoMap.put("totalElements", page.getTotalElements()); - return couponvoMap; -// return PageUtil.toPage(page.map(tbMerchantCouponMapper::toDto)); - } - @Override - public List queryAll(TbMerchantCouponQueryCriteria criteria){ - return tbMerchantCouponMapper.toDto(tbMerchantCouponRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public TbMerchantCouponDto findById(Integer id) { - TbMerchantCoupon tbMerchantCoupon = tbMerchantCouponRepository.findById(id).orElseGet(TbMerchantCoupon::new); - ValidationUtil.isNull(tbMerchantCoupon.getId(),"TbMerchantCoupon","id",id); - return tbMerchantCouponMapper.toDto(tbMerchantCoupon); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public TbMerchantCoupon create(TbMerchantCoupon resources) { - resources.setCreatedAt(Instant.now().toEpochMilli()); - resources.setUpdatedAt(Instant.now().toEpochMilli()); - if (resources.getEffectType() == 1){ - if (resources.getToTime() == null && resources.getFromTime() == null){ - throw new BadRequestException("开始时间结束时间为空"); - } - }else { - resources.setToTime(null); - resources.setFromTime(null); - } - - if ("product".equals(resources.getClassType())){ - if (resources.getRelationIds() == null){ - throw new BadRequestException("商品不能为空"); - } - } - if (resources.getNumber() == 0){ - resources.setLeftNumber(0); - }else { - resources.setLeftNumber(resources.getNumber()); - } - return tbMerchantCouponRepository.save(resources); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(TbMerchantCoupon resources) { - TbMerchantCoupon tbMerchantCoupon = tbMerchantCouponRepository.findById(resources.getId()).orElseGet(TbMerchantCoupon::new); - ValidationUtil.isNull( tbMerchantCoupon.getId(),"TbMerchantCoupon","id",resources.getId()); - tbMerchantCoupon.copy(resources); - tbMerchantCouponRepository.save(tbMerchantCoupon); - } - - @Override - public void deleteAll(Integer[] ids) { - for (Integer id : ids) { - tbMerchantCouponRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (TbMerchantCouponDto tbMerchantCoupon : all) { - Map map = new LinkedHashMap<>(); - map.put("状态0-关闭 1 正常", tbMerchantCoupon.getStatus()); - map.put(" 优惠券名称", tbMerchantCoupon.getTitle()); - map.put(" templateId", tbMerchantCoupon.getTemplateId()); - map.put(" shopId", tbMerchantCoupon.getShopId()); - map.put(" shopSnap", tbMerchantCoupon.getShopSnap()); - map.put("开始时间", tbMerchantCoupon.getFromTime()); - map.put("到期时间", tbMerchantCoupon.getToTime()); - map.put("限领数量", tbMerchantCoupon.getLimitNumber()); - map.put("发放数量", tbMerchantCoupon.getNumber()); - map.put("剩余数量", tbMerchantCoupon.getLeftNumber()); - map.put("优惠金额", tbMerchantCoupon.getAmount()); - map.put("订单满赠金额", tbMerchantCoupon.getLimitAmount()); - map.put("是否显示0-不显示 1显示", tbMerchantCoupon.getIsShow()); - map.put("图标", tbMerchantCoupon.getPic()); - map.put("0-满减 1-折扣", tbMerchantCoupon.getType()); - map.put("折扣 ,一位小数", tbMerchantCoupon.getRatio()); - map.put("最大折扣金额", tbMerchantCoupon.getMaxRatioAmount()); - map.put("优惠券途径,首充|分销", tbMerchantCoupon.getTrack()); - map.put("品类product 商品券 ---cateogry 品类券common -通 用券", tbMerchantCoupon.getClassType()); - map.put("有效期类型:0-toTime有效 1-effectDays有效", tbMerchantCoupon.getEffectType()); - map.put("领取之日有效天数", tbMerchantCoupon.getEffectDays()); - map.put("关联商品Id", tbMerchantCoupon.getRelationIds()); - map.put(" relationList", tbMerchantCoupon.getRelationList()); - map.put("发放人", tbMerchantCoupon.getEditor()); - map.put("说明", tbMerchantCoupon.getNote()); - map.put(" createdAt", tbMerchantCoupon.getCreatedAt()); - map.put(" updatedAt", tbMerchantCoupon.getUpdatedAt()); - map.put("支持堂食", tbMerchantCoupon.getFurnishMeal()); - map.put("支持配送", tbMerchantCoupon.getFurnishExpress()); - map.put("支持自提", tbMerchantCoupon.getFurnishDraw()); - map.put("支持虚拟", tbMerchantCoupon.getFurnishVir()); - map.put(" disableDistribute", tbMerchantCoupon.getDisableDistribute()); - map.put("商户Id", tbMerchantCoupon.getMerchantId()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbReceiptSalesServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbReceiptSalesServiceImpl.java deleted file mode 100644 index a6b3889c..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbReceiptSalesServiceImpl.java +++ /dev/null @@ -1,122 +0,0 @@ -/* -* 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.service.impl.shopimpl; - -import cn.ysk.cashier.pojo.shop.TbReceiptSales; -import cn.ysk.cashier.mapper.shop.TbReceiptSalesMapper; -import cn.ysk.cashier.utils.ValidationUtil; -import cn.ysk.cashier.utils.FileUtil; -import lombok.RequiredArgsConstructor; -import cn.ysk.cashier.repository.shop.TbReceiptSalesRepository; -import cn.ysk.cashier.service.shop.TbReceiptSalesService; -import cn.ysk.cashier.dto.shop.TbReceiptSalesDto; -import cn.ysk.cashier.dto.shop.TbReceiptSalesQueryCriteria; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import cn.ysk.cashier.utils.PageUtil; -import cn.ysk.cashier.utils.QueryHelp; -import java.util.List; -import java.util.Map; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.LinkedHashMap; - -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author lyf -* @date 2024-01-08 -**/ -@Service -@RequiredArgsConstructor -public class TbReceiptSalesServiceImpl implements TbReceiptSalesService { - - private final TbReceiptSalesRepository tbReceiptSalesRepository; - private final TbReceiptSalesMapper tbReceiptSalesMapper; - - @Override - public Map queryAll(TbReceiptSalesQueryCriteria criteria, Pageable pageable){ - Page page = tbReceiptSalesRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(tbReceiptSalesMapper::toDto)); - } - - @Override - public List queryAll(TbReceiptSalesQueryCriteria criteria){ - return tbReceiptSalesMapper.toDto(tbReceiptSalesRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public TbReceiptSalesDto findById(Integer id) { - TbReceiptSales tbReceiptSales = tbReceiptSalesRepository.findById(id).orElseGet(TbReceiptSales::new); - - return tbReceiptSalesMapper.toDto(tbReceiptSales); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public TbReceiptSalesDto create(TbReceiptSales resources) { - return tbReceiptSalesMapper.toDto(tbReceiptSalesRepository.save(resources)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(TbReceiptSales resources) { - TbReceiptSales tbReceiptSales = tbReceiptSalesRepository.findById(resources.getId()).orElseGet(TbReceiptSales::new); - ValidationUtil.isNull( tbReceiptSales.getId(),"TbReceiptSales","id",resources.getId()); - tbReceiptSales.copy(resources); - tbReceiptSalesRepository.save(tbReceiptSales); - } - - @Override - public void deleteAll(Integer[] ids) { - for (Integer id : ids) { - tbReceiptSalesRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (TbReceiptSalesDto tbReceiptSales : all) { - Map map = new LinkedHashMap<>(); - map.put("标题", tbReceiptSales.getTitle()); - map.put("是否显示公司Logo", tbReceiptSales.getLogo()); - map.put("打印联系电话等信息", tbReceiptSales.getShowContactInfo()); - map.put("打印会员开关 0?1", tbReceiptSales.getShowMember()); - map.put("打印会员编号开关", tbReceiptSales.getShowMemberCode()); - map.put("打印会员积分", tbReceiptSales.getShowMemberScore()); - map.put("打印会员余额开关 0?1", tbReceiptSales.getShowMemberWallet()); - map.put("店铺Id", tbReceiptSales.getFooterRemark()); - map.put("打印找零", tbReceiptSales.getShowCashCharge()); - map.put("流水号", tbReceiptSales.getShowSerialNo()); - map.put("用大号字打印流水号 在showSerialNo可用前提下", tbReceiptSales.getBigSerialNo()); - map.put("头部文字", tbReceiptSales.getHeaderText()); - map.put("文字 对齐方式", tbReceiptSales.getHeaderTextAlign()); - map.put("尾部文字", tbReceiptSales.getFooterText()); - map.put("文字 对齐方式", tbReceiptSales.getFooterTextAlign()); - map.put("尾部图像", tbReceiptSales.getFooterImage()); - map.put("预打印,YES开启 NO不开启", tbReceiptSales.getPrePrint()); - map.put(" createdAt", tbReceiptSales.getCreatedAt()); - map.put(" updatedAt", tbReceiptSales.getUpdatedAt()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopCashSpreadServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopCashSpreadServiceImpl.java deleted file mode 100644 index ed790ae3..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopCashSpreadServiceImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -/* -* 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.service.impl.shopimpl; - -import cn.ysk.cashier.pojo.shop.TbShopCashSpread; -import cn.ysk.cashier.service.shop.TbShopCashSpreadService; -import cn.ysk.cashier.dto.shop.TbShopCashSpreadDto; -import cn.ysk.cashier.mapper.shop.TbShopCashSpreadMapper; -import cn.ysk.cashier.utils.ValidationUtil; -import cn.ysk.cashier.utils.FileUtil; -import lombok.RequiredArgsConstructor; -import cn.ysk.cashier.repository.shop.TbShopCashSpreadRepository; -import cn.ysk.cashier.dto.shop.TbShopCashSpreadQueryCriteria; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import cn.ysk.cashier.utils.PageUtil; -import cn.ysk.cashier.utils.QueryHelp; - -import java.time.Instant; -import java.util.List; -import java.util.Map; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.LinkedHashMap; - -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author lyf -* @date 2024-01-05 -**/ -@Service -@RequiredArgsConstructor -public class TbShopCashSpreadServiceImpl implements TbShopCashSpreadService { - - private final TbShopCashSpreadRepository tbShopCashSpreadRepository; - private final TbShopCashSpreadMapper tbShopCashSpreadMapper; - - @Override - public Map queryAll(TbShopCashSpreadQueryCriteria criteria, Pageable pageable){ - Page page = tbShopCashSpreadRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(tbShopCashSpreadMapper::toDto)); - } - - @Override - public List queryAll(TbShopCashSpreadQueryCriteria criteria){ - return tbShopCashSpreadMapper.toDto(tbShopCashSpreadRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public TbShopCashSpreadDto findById(String id) { - TbShopCashSpread tbShopCashSpread = tbShopCashSpreadRepository.findById(id).orElseGet(TbShopCashSpread::new); - ValidationUtil.isNull(tbShopCashSpread.getId(),"TbShopCashSpread","id",id); - return tbShopCashSpreadMapper.toDto(tbShopCashSpread); - } - - @Override - public TbShopCashSpread findByShopId(Integer id) { - TbShopCashSpread byShopId = tbShopCashSpreadRepository.findByShopId(id); - return byShopId; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public TbShopCashSpreadDto create(TbShopCashSpread resources) { - return tbShopCashSpreadMapper.toDto(tbShopCashSpreadRepository.save(resources)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public Integer update(TbShopCashSpread resources) { - return tbShopCashSpreadRepository.updateConfig(resources.getId(), resources.getScreenConfig().trim(), Instant.now().toEpochMilli()); - } - - @Override - public void deleteAll(String[] ids) { - for (String id : ids) { - tbShopCashSpreadRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (TbShopCashSpreadDto tbShopCashSpread : all) { - Map map = new LinkedHashMap<>(); - map.put("登陆密码", tbShopCashSpread.getSaleReceipt()); - map.put("状态", tbShopCashSpread.getTriplicateReceipt()); - map.put("到期提醒时间", tbShopCashSpread.getScreenConfig()); - map.put(" tagConfig", tbShopCashSpread.getTagConfig()); - map.put(" scaleConfig", tbShopCashSpread.getScaleConfig()); - map.put(" createdAt", tbShopCashSpread.getCreatedAt()); - map.put(" updatedAt", tbShopCashSpread.getUpdatedAt()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopCurrencyServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopCurrencyServiceImpl.java deleted file mode 100644 index 936412ee..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopCurrencyServiceImpl.java +++ /dev/null @@ -1,130 +0,0 @@ -/* -* 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.service.impl.shopimpl; - -import cn.ysk.cashier.pojo.shop.TbShopCurrency; -import cn.ysk.cashier.utils.ValidationUtil; -import cn.ysk.cashier.utils.FileUtil; -import lombok.RequiredArgsConstructor; -import cn.ysk.cashier.repository.shop.TbShopCurrencyRepository; -import cn.ysk.cashier.service.shop.TbShopCurrencyService; -import cn.ysk.cashier.dto.shop.TbShopCurrencyDto; -import cn.ysk.cashier.dto.shop.TbShopCurrencyQueryCriteria; -import cn.ysk.cashier.mapper.shop.TbShopCurrencyMapper; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import cn.ysk.cashier.utils.PageUtil; -import cn.ysk.cashier.utils.QueryHelp; -import java.util.List; -import java.util.Map; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.LinkedHashMap; - -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author lyf -* @date 2024-01-05 -**/ -@Service -@RequiredArgsConstructor -public class TbShopCurrencyServiceImpl implements TbShopCurrencyService { - - private final TbShopCurrencyRepository tbShopCurrencyRepository; - private final TbShopCurrencyMapper tbShopCurrencyMapper; - - @Override - public Map queryAll(TbShopCurrencyQueryCriteria criteria, Pageable pageable){ - Page page = tbShopCurrencyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(tbShopCurrencyMapper::toDto)); - } - - @Override - public List queryAll(TbShopCurrencyQueryCriteria criteria){ - return tbShopCurrencyMapper.toDto(tbShopCurrencyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public TbShopCurrencyDto findById(Integer id) { - TbShopCurrency tbShopCurrency = tbShopCurrencyRepository.findById(id).orElseGet(TbShopCurrency::new); - ValidationUtil.isNull(tbShopCurrency.getId(),"TbShopCurrency","id",id); - return tbShopCurrencyMapper.toDto(tbShopCurrency); - } - - @Override - public TbShopCurrency findByShopId(String id) { - TbShopCurrency byShopId = tbShopCurrencyRepository.findByShopId(id); - return byShopId; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public TbShopCurrencyDto create(TbShopCurrency resources) { - return tbShopCurrencyMapper.toDto(tbShopCurrencyRepository.save(resources)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(TbShopCurrency resources) { - TbShopCurrency tbShopCurrency = tbShopCurrencyRepository.findById(resources.getId()).orElseGet(TbShopCurrency::new); - ValidationUtil.isNull( tbShopCurrency.getId(),"TbShopCurrency","id",resources.getId()); - tbShopCurrency.copy(resources); - tbShopCurrencyRepository.save(tbShopCurrency); - } - - @Override - public void deleteAll(Integer[] ids) { - for (Integer id : ids) { - tbShopCurrencyRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (TbShopCurrencyDto tbShopCurrency : all) { - Map map = new LinkedHashMap<>(); - map.put("店铺Id", tbShopCurrency.getShopId()); - map.put("备用金", tbShopCurrency.getPrepareAmount()); - map.put("货币单位 ¥,$", tbShopCurrency.getCurrency()); - map.put("小数位,0,1,2,无,元,角,分", tbShopCurrency.getDecimalsDigits()); - map.put("无,四舍五入,五舍六入none,round4up5,round5up6,round12up34", tbShopCurrency.getDiscountRound()); - map.put("商户Id", tbShopCurrency.getMerchantId()); - map.put("订单抹零 -1无,0元 1角2分 0.5=0.5元", tbShopCurrency.getSmallChange()); - map.put("使折扣生效", tbShopCurrency.getEnableCustomDiscount()); - map.put("最大抹零金额(100)", tbShopCurrency.getMaxDiscount()); - map.put("最大折扣百分比,,优先级高于max_discount", tbShopCurrency.getMaxPercent()); - map.put("折扣显示详情", tbShopCurrency.getDiscountConfigs()); - map.put("营业时间(弃用)", tbShopCurrency.getBizDuration()); - map.put("允许网络支付", tbShopCurrency.getAllowWebPay()); - map.put("自动抹零,开启时,系统自动抹零", tbShopCurrency.getIsAutoToZero()); - map.put("商品含税", tbShopCurrency.getIsIncludeTaxPrice()); - map.put("服务费配置(小费)", tbShopCurrency.getServiceCharge()); - map.put("税号", tbShopCurrency.getTaxNumber()); - map.put(" createdAt", tbShopCurrency.getCreatedAt()); - map.put(" updatedAt", tbShopCurrency.getUpdatedAt()); - map.put("自动锁屏", tbShopCurrency.getAutoLockScreen()); - map.put("语音通知", tbShopCurrency.getVoiceNotification()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbMerchantCouponService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbMerchantCouponService.java deleted file mode 100644 index 8450783d..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbMerchantCouponService.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -* 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.service.shop; - -import cn.ysk.cashier.pojo.shop.TbMerchantCoupon; -import cn.ysk.cashier.dto.shop.TbMerchantCouponDto; -import cn.ysk.cashier.dto.shop.TbMerchantCouponQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @description 服务接口 -* @author lyf -* @date 2024-03-20 -**/ -public interface TbMerchantCouponService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(TbMerchantCouponQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(TbMerchantCouponQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return TbMerchantCouponDto - */ - TbMerchantCouponDto findById(Integer id); - - /** - * 创建 - * @param resources / - * @return TbMerchantCouponDto - */ - TbMerchantCoupon create(TbMerchantCoupon resources); - - /** - * 编辑 - * @param resources / - */ - void update(TbMerchantCoupon resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Integer[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbReceiptSalesService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbReceiptSalesService.java deleted file mode 100644 index 304e84b3..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbReceiptSalesService.java +++ /dev/null @@ -1,83 +0,0 @@ -/* -* 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.service.shop; - -import cn.ysk.cashier.pojo.shop.TbReceiptSales; -import cn.ysk.cashier.dto.shop.TbReceiptSalesDto; -import cn.ysk.cashier.dto.shop.TbReceiptSalesQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @description 服务接口 -* @author lyf -* @date 2024-01-08 -**/ -public interface TbReceiptSalesService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(TbReceiptSalesQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(TbReceiptSalesQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return TbReceiptSalesDto - */ - TbReceiptSalesDto findById(Integer id); - - /** - * 创建 - * @param resources / - * @return TbReceiptSalesDto - */ - TbReceiptSalesDto create(TbReceiptSales resources); - - /** - * 编辑 - * @param resources / - */ - void update(TbReceiptSales resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Integer[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopCashSpreadService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopCashSpreadService.java deleted file mode 100644 index 97dfc581..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopCashSpreadService.java +++ /dev/null @@ -1,84 +0,0 @@ -/* -* 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.service.shop; - -import cn.ysk.cashier.pojo.shop.TbShopCashSpread; -import cn.ysk.cashier.dto.shop.TbShopCashSpreadDto; -import cn.ysk.cashier.dto.shop.TbShopCashSpreadQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @description 服务接口 -* @author lyf -* @date 2024-01-05 -**/ -public interface TbShopCashSpreadService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(TbShopCashSpreadQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(TbShopCashSpreadQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return TbShopCashSpreadDto - */ - TbShopCashSpreadDto findById(String id); - TbShopCashSpread findByShopId(Integer id); - - /** - * 创建 - * @param resources / - * @return TbShopCashSpreadDto - */ - TbShopCashSpreadDto create(TbShopCashSpread resources); - - /** - * 编辑 - * @param resources / - */ - Integer update(TbShopCashSpread resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(String[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopCurrencyService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopCurrencyService.java deleted file mode 100644 index 3ffad699..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopCurrencyService.java +++ /dev/null @@ -1,90 +0,0 @@ -/* -* 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.service.shop; - -import cn.ysk.cashier.pojo.shop.TbShopCurrency; -import cn.ysk.cashier.dto.shop.TbShopCurrencyDto; -import cn.ysk.cashier.dto.shop.TbShopCurrencyQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @description 服务接口 -* @author lyf -* @date 2024-01-05 -**/ -public interface TbShopCurrencyService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(TbShopCurrencyQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(TbShopCurrencyQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return TbShopCurrencyDto - */ - TbShopCurrencyDto findById(Integer id); - - /** - * 根据ID查询 - * @param id ID - * @return TbShopCurrencyDto - */ - TbShopCurrency findByShopId(String id); - - /** - * 创建 - * @param resources / - * @return TbShopCurrencyDto - */ - TbShopCurrencyDto create(TbShopCurrency resources); - - /** - * 编辑 - * @param resources / - */ - void update(TbShopCurrency resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Integer[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/system/rest/ParamsController.java b/eladmin-system/src/main/java/cn/ysk/cashier/system/rest/ParamsController.java index 19eeadee..420c0a7f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/system/rest/ParamsController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/system/rest/ParamsController.java @@ -36,11 +36,6 @@ public class ParamsController { @GetMapping("page") @ApiOperation("分页") - @ApiImplicitParams({ - @ApiImplicitParam(name = "page", value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , - @ApiImplicitParam(name = "size", value = "每页显示记录数", paramType = "query",required = true, dataType="int") , - @ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataType="String") - }) public ResponseEntity page(@ApiIgnore @RequestParam Map params){ Map page = paramsService.page(params); return ResponseEntity.ok().body(page); diff --git a/eladmin-system/src/main/resources/mapper/TbActivateMapper.xml b/eladmin-system/src/main/resources/mapper/TbActivateMapper.xml deleted file mode 100644 index 77ad900a..00000000 --- a/eladmin-system/src/main/resources/mapper/TbActivateMapper.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - id,shop_id,min_num, - max_num,handsel_num,handsel_type, - is_del,is_user - - From b1e709535777b2b0c132045e0c955f3a50fe0c90 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 24 Oct 2024 18:06:44 +0800 Subject: [PATCH 020/165] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8F=AF=E7=94=A8?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=20/shop/storage/find?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/ysk/cashier/dto/CouponDto.java | 12 ++ .../mapper/TbActivateInRecordMapper.java | 26 +++++ .../mybatis/rest/StorageController.java | 9 ++ .../mybatis/service/TbShopCouponService.java | 3 + .../service/impl/TbShopCouponServiceImpl.java | 109 +++++++++++++++++- .../repository/shop/TbShopUserRepository.java | 2 + .../cn/ysk/cashier/vo/TbUserCouponVo.java | 30 +++++ 7 files changed, 186 insertions(+), 5 deletions(-) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/CouponDto.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/CouponDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/CouponDto.java new file mode 100644 index 00000000..4fae54c4 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/CouponDto.java @@ -0,0 +1,12 @@ +package cn.ysk.cashier.dto; + +import lombok.Data; + +@Data +public class CouponDto { + private Integer shopId; + private Integer userId; + //-1已过期 1未使用 2已使用 + private Integer status; + private Integer orderId; +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java index 3aa1b730..0151d766 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java @@ -1,7 +1,12 @@ package cn.ysk.cashier.mybatis.mapper; +import cn.ysk.cashier.vo.TbUserCouponVo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.ysk.cashier.mybatis.entity.TbActivateInRecord; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; /** * 活动商品赠送表(TbActivateInRecord)表数据库访问层 @@ -11,5 +16,26 @@ import cn.ysk.cashier.mybatis.entity.TbActivateInRecord; */ public interface TbActivateInRecordMapper extends BaseMapper { + @Select("SELECT" + + " inRecord.coupon_id as couponId," + + " pro.id as proId," + + " CASE" + + " WHEN inRecord.type = 1 THEN inRecord.NAME" + + " WHEN inRecord.type = 2 THEN pro.NAME" + + " END AS `name`," + + " inRecord.type," + + " inRecord.over_num as num," + + " inRecord.use_end_time as endTime" + + " FROM" + + " tb_activate_in_record inRecord" + + " LEFT JOIN tb_product pro ON inRecord.pro_id = pro.id and pro.shop_id = #{shopId}" + + " WHERE" + + " inRecord.vip_user_id = #{vipUserId}" + + " and inRecord.shop_id = #{shopId}" + + " and inRecord.over_num != 0" + + " and inRecord.use_start_time < now()" + + " and inRecord.use_end_time > now()" + + " order by inRecord.use_end_time asc") + List queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java index ee640996..22259154 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/rest/StorageController.java @@ -1,9 +1,11 @@ package cn.ysk.cashier.mybatis.rest; import cn.ysk.cashier.annotation.Log; +import cn.ysk.cashier.dto.CouponDto; import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mybatis.entity.TbActivate; import cn.ysk.cashier.mybatis.service.TbActivateService; +import cn.ysk.cashier.mybatis.service.TbShopCouponService; import cn.ysk.cashier.service.WxService; import cn.ysk.cashier.utils.CacheKey; import cn.ysk.cashier.utils.RedisUtils; @@ -15,6 +17,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; import java.util.Map; @Slf4j @@ -24,6 +27,7 @@ import java.util.Map; @RequestMapping("/shop/storage") public class StorageController { + private final TbShopCouponService tbShopCouponService; private final TbActivateService tbActivateService; private final RedisUtils redisUtils; private final WxService wxService; @@ -40,6 +44,11 @@ public class StorageController { return new ResponseEntity<>(HttpStatus.OK); } + //获取订单可用优惠券 + @RequestMapping("find") + public ResponseEntity find(@RequestBody CouponDto param) { + return tbShopCouponService.find(param); + } /** * @param params diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java index fb793a27..397fd91d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java @@ -1,10 +1,12 @@ package cn.ysk.cashier.mybatis.service; +import cn.ysk.cashier.dto.CouponDto; import cn.ysk.cashier.mybatis.entity.TbCouponProduct; import cn.ysk.cashier.mybatis.vo.TbShopCouponVo; import com.baomidou.mybatisplus.extension.service.IService; import cn.ysk.cashier.mybatis.entity.TbShopCoupon; import cn.ysk.cashier.dto.TbShopCouponQueryCriteria; +import org.springframework.http.ResponseEntity; import java.util.List; import java.util.Map; @@ -22,6 +24,7 @@ public interface TbShopCouponService extends IService { TbShopCoupon findById (Integer id); + ResponseEntity find(CouponDto param); boolean update(TbShopCouponVo param); boolean delete(Integer id); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index 4e466b3f..de232083 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -3,27 +3,44 @@ package cn.ysk.cashier.mybatis.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import cn.ysk.cashier.dto.CouponDto; import cn.ysk.cashier.dto.TbShopCouponQueryCriteria; import cn.ysk.cashier.mybatis.entity.TbCouponProduct; import cn.ysk.cashier.mybatis.entity.TbShopCoupon; +import cn.ysk.cashier.mybatis.mapper.TbActivateInRecordMapper; import cn.ysk.cashier.mybatis.mapper.TbShopCouponMapper; +import cn.ysk.cashier.mybatis.service.TbActivateInRecordService; import cn.ysk.cashier.mybatis.service.TbCouponProductService; import cn.ysk.cashier.mybatis.service.TbShopCouponService; import cn.ysk.cashier.mybatis.vo.TbShopCouponVo; +import cn.ysk.cashier.pojo.order.TbOrderDetail; +import cn.ysk.cashier.pojo.order.TbOrderInfo; import cn.ysk.cashier.pojo.product.TbProduct; +import cn.ysk.cashier.pojo.shop.TbShopUser; +import cn.ysk.cashier.repository.order.TbOrderDetailRepository; +import cn.ysk.cashier.repository.order.TbOrderInfoRepository; import cn.ysk.cashier.repository.product.TbProductRepository; +import cn.ysk.cashier.repository.shop.TbShopUserRepository; +import cn.ysk.cashier.service.shop.TbShopUserService; import cn.ysk.cashier.utils.PageUtil; +import cn.ysk.cashier.vo.TbUserCouponVo; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.gson.JsonObject; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import java.math.BigDecimal; +import java.time.LocalTime; +import java.time.format.DateTimeFormatter; +import java.util.*; import java.util.stream.Collectors; /** @@ -41,6 +58,15 @@ public class TbShopCouponServiceImpl extends ServiceImpl queryAll(TbShopCouponQueryCriteria criteria) { @@ -63,14 +89,87 @@ public class TbShopCouponServiceImpl extends ServiceImpl activatePros = findActivatePros(id); tbShopCouponVo.setProducts(activatePros); } return tbShopCouponVo; } + @Override + public ResponseEntity find(CouponDto param) { + TbShopUser tbShopUser = shopUserRepository.selectByUserIdAndShopId(param.getUserId().toString(), param.getShopId().toString()); + if (param.getOrderId() != null) { + TbOrderInfo tbOrderInfo = orderInfoRepository.findById(param.getOrderId()).orElse(null); + if (tbOrderInfo != null) { + List tbOrderDetails = orderDetailRepository.searchDetailByOrderId(param.getOrderId()); + Set pros = tbOrderDetails.stream().map(TbOrderDetail::getProductId).collect(Collectors.toSet()); + if (CollectionUtil.isNotEmpty(tbOrderDetails)) { + List tbUserCouponVos = inRecordMapper.queryByVipIdAndShopId(tbShopUser.getId(), param.getShopId()); + if (CollectionUtil.isNotEmpty(tbUserCouponVos)) { + String week = DateUtil.dayOfWeekEnum(new Date()).toChinese("周"); + LocalTime now = LocalTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); + + //券id 券使用描述 + Map coupons = new HashMap<>(); + for (TbUserCouponVo tbUserCouponVo : tbUserCouponVos) { + if (!coupons.containsKey(tbUserCouponVo.getCouponId())) { + JsonObject json = new JsonObject(); + boolean isUse = true; + TbShopCoupon tbShopCoupon = tbShopCouponmapper.selectById(tbUserCouponVo.getCouponId()); + StringBuilder useRestrictions = new StringBuilder("每天 "); + if (tbShopCoupon.getType().equals(1)) { + if (tbOrderInfo.getOrderAmount().compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) { + isUse = false; + } + } + if (StringUtils.isNotBlank(tbShopCoupon.getUserDays())) { + String[] split = tbShopCoupon.getUserDays().split(","); + if (split.length != 7) { + useRestrictions = new StringBuilder(tbShopCoupon.getUserDays() + " "); + } + if (!tbShopCoupon.getUserDays().contains(week)) { + isUse = false; + } + } + if (tbShopCoupon.getUseTimeType().equals("custom")) { + if (now.isBefore(tbShopCoupon.getUseStartTime()) || now.isAfter(tbShopCoupon.getUseEndTime())) { + isUse = false; + } + useRestrictions.append( + tbShopCoupon.getUseStartTime().format(formatter) + + "-" + + tbShopCoupon.getUseEndTime().format(formatter)); + } else { + useRestrictions.append("全时段"); + } + useRestrictions.append(" 可用"); + json.addProperty("isUse", isUse); + json.addProperty("useRestrictions", useRestrictions.toString()); + + coupons.put(tbUserCouponVo.getCouponId(), json); + } + JsonObject couponJson = coupons.get(tbUserCouponVo.getCouponId()); + tbUserCouponVo.setUseRestrictions(couponJson.get("useRestrictions").toString()); + if (tbUserCouponVo.getType().equals(1)) { + tbUserCouponVo.setUse(couponJson.get("isUse").getAsBoolean()); + } else if (tbUserCouponVo.getType().equals(2) && couponJson.get("isUse").getAsBoolean()) { + if (!pros.contains(tbUserCouponVo.getProId())) { + tbUserCouponVo.setUse(false); + } + } + } + tbUserCouponVos.sort(Comparator.comparing(TbUserCouponVo::isUse).reversed().thenComparing(TbUserCouponVo::getExpireTime)); + return new ResponseEntity<>(tbUserCouponVos, HttpStatus.OK); + } + } + } + } + return new ResponseEntity<>(HttpStatus.OK); + } + @Override public boolean update(TbShopCouponVo param) { 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 3accd7de..e50ce11e 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 @@ -51,4 +51,6 @@ public interface TbShopUserRepository extends JpaRepository @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); + @Query("SELECT user from TbShopUser user where user.shopId = :shopId and user.userId = :userId") + TbShopUser selectByUserIdAndShopId(@Param("userId") String userId,@Param("shopId") String shopId); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java new file mode 100644 index 00000000..f13b5211 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java @@ -0,0 +1,30 @@ +package cn.ysk.cashier.vo; + +import lombok.Data; + +import java.util.Date; + +@Data +public class TbUserCouponVo { + private Integer couponId; + private Integer proId; + //优惠券名称 + private String name; + //优惠券类型 1 满减 2 商品券 + private Integer type; + //数量 + private Integer num; + //到期时间 + private Date endTime; + private Long expireTime; + private String useRestrictions; + private boolean isUse = false; + + + public void setEndTime(Date endTime) { + this.endTime = endTime; + if(endTime!=null){ + expireTime=endTime.getTime(); + } + } +} From 84a2007b26bf0e1f458f0377dfe0193ba79aef05 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 25 Oct 2024 11:19:25 +0800 Subject: [PATCH 021/165] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=20=E4=BB=A5=E5=8F=8A=20=E9=80=80=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/TbActivateInRecordMapper.java | 6 + .../mapper/TbActivateOutRecordMapper.java | 6 + .../mybatis/service/TbShopCouponService.java | 9 +- .../service/impl/TbShopCouponServiceImpl.java | 106 +++++++++++++----- .../impl/order/TbOrderInfoServiceImpl.java | 16 --- .../cn/ysk/cashier/vo/TbUserCouponVo.java | 1 + 6 files changed, 97 insertions(+), 47 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java index 0151d766..4401388e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java @@ -17,6 +17,7 @@ import java.util.List; public interface TbActivateInRecordMapper extends BaseMapper { @Select("SELECT" + + " inRecord.coupon_id as id," + " inRecord.coupon_id as couponId," + " pro.id as proId," + " CASE" + @@ -37,5 +38,10 @@ public interface TbActivateInRecordMapper extends BaseMapper " and inRecord.use_end_time > now()" + " order by inRecord.use_end_time asc") List queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId); + + @Select("update tb_activate_in_record" + + " set over_num = #{overNum}" + + " where id = #{id}") + int updateOverNum(@Param("id") Integer id, @Param("overNum") Integer overNum); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateOutRecordMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateOutRecordMapper.java index a66d9579..ba81e80a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateOutRecordMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateOutRecordMapper.java @@ -2,6 +2,8 @@ package cn.ysk.cashier.mybatis.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; /** * 活动赠送商品使用记录表(TbActivateOutRecord)表数据库访问层 @@ -11,5 +13,9 @@ import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord; */ public interface TbActivateOutRecordMapper extends BaseMapper { + @Select("update tb_activate_out_record" + + " set ref_num = ref_num + #{refNum}" + + " where id = #{id}") + int updateRefNum(@Param("id") Integer id, @Param("refNum") Integer refNum); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java index 397fd91d..616211dd 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java @@ -1,6 +1,7 @@ package cn.ysk.cashier.mybatis.service; import cn.ysk.cashier.dto.CouponDto; +import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord; import cn.ysk.cashier.mybatis.entity.TbCouponProduct; import cn.ysk.cashier.mybatis.vo.TbShopCouponVo; import com.baomidou.mybatisplus.extension.service.IService; @@ -24,11 +25,15 @@ public interface TbShopCouponService extends IService { TbShopCoupon findById (Integer id); - ResponseEntity find(CouponDto param); - boolean update(TbShopCouponVo param); boolean delete(Integer id); + ResponseEntity find(CouponDto param); + + boolean use(Integer shopId,Integer orderId,Integer vipUserId,List param); + + boolean refund(List param); + List findActivatePros(Integer couponId); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index de232083..9b7f08b5 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -6,9 +6,12 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; import cn.ysk.cashier.dto.CouponDto; import cn.ysk.cashier.dto.TbShopCouponQueryCriteria; +import cn.ysk.cashier.mybatis.entity.TbActivateInRecord; +import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord; import cn.ysk.cashier.mybatis.entity.TbCouponProduct; import cn.ysk.cashier.mybatis.entity.TbShopCoupon; import cn.ysk.cashier.mybatis.mapper.TbActivateInRecordMapper; +import cn.ysk.cashier.mybatis.mapper.TbActivateOutRecordMapper; import cn.ysk.cashier.mybatis.mapper.TbShopCouponMapper; import cn.ysk.cashier.mybatis.service.TbActivateInRecordService; import cn.ysk.cashier.mybatis.service.TbCouponProductService; @@ -66,6 +69,8 @@ public class TbShopCouponServiceImpl extends ServiceImpl collect = new ArrayList<>(); + for (TbCouponProduct product : param.getProducts()) { + product.setCouponId(param.getId()); + if (product.getId() != null) collect.add(product.getId()); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("coupon_id", param.getId()); + List actProducts = couProductService.list(queryWrapper); + for (TbCouponProduct actProduct : actProducts) { + if (!collect.contains(actProduct.getId())) { + couProductService.removeById(actProduct.getId()); + } + } + couProductService.saveOrUpdateBatch(param.getProducts()); + } else { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TbCouponProduct::getCouponId, param.getId()); + couProductService.remove(queryWrapper); + } + return true; + } + + @Override + public boolean delete(Integer id) { + tbShopCouponmapper.deleteById(id); + couProductService.remove(new LambdaQueryWrapper().eq(TbCouponProduct::getCouponId, id)); + return true; + } + @Override public ResponseEntity find(CouponDto param) { TbShopUser tbShopUser = shopUserRepository.selectByUserIdAndShopId(param.getUserId().toString(), param.getShopId().toString()); @@ -170,45 +212,51 @@ public class TbShopCouponServiceImpl extends ServiceImpl(HttpStatus.OK); } - + /** + * 使用券 + * @param shopId + * @param orderId + * @param vipUserId + * @param param giveId 和 useNum 必传 + * @return + */ @Override - public boolean update(TbShopCouponVo param) { - if (param.getId() == null) { - tbShopCouponmapper.insert(param); - } else { - tbShopCouponmapper.updateById(param); - } - if (CollectionUtil.isNotEmpty(param.getProducts())) { - List collect = new ArrayList<>(); - for (TbCouponProduct product : param.getProducts()) { - product.setCouponId(param.getId()); - if (product.getId() != null) collect.add(product.getId()); - } - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("coupon_id", param.getId()); - List actProducts = couProductService.list(queryWrapper); - for (TbCouponProduct actProduct : actProducts) { - if (!collect.contains(actProduct.getId())) { - couProductService.removeById(actProduct.getId()); - } - } - couProductService.saveOrUpdateBatch(param.getProducts()); - } else { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(TbCouponProduct::getCouponId, param.getId()); - couProductService.remove(queryWrapper); + public boolean use(Integer shopId,Integer orderId,Integer vipUserId,List param) { + for (TbActivateOutRecord outRecord : param) { + TbActivateInRecord inRecord = inRecordMapper.selectById(outRecord.getGiveId()); + inRecord.setOverNum(inRecord.getOverNum() - outRecord.getUseNum()); + inRecordMapper.updateOverNum(inRecord.getId(), inRecord.getOverNum()); + + outRecord.setType(inRecord.getType()); + outRecord.setShopId(shopId); + outRecord.setOrderId(orderId.toString()); + outRecord.setVipUserId(vipUserId); + outRecord.setStatus("closed"); + outRecord.setCreateTime(new Date()); + outRecordMapper.insert(outRecord); } return true; } + /** + * 退还券 + * @param param giveId和 refNum 必传 + * @return + */ @Override - public boolean delete(Integer id) { - tbShopCouponmapper.deleteById(id); - couProductService.remove(new LambdaQueryWrapper().eq(TbCouponProduct::getCouponId, id)); + public boolean refund(List param) { + for (TbActivateOutRecord outRecord : param) { + outRecord.setUpdateTime(new Date()); + outRecordMapper.updateRefNum(outRecord.getId(),outRecord.getRefNum()); + TbActivateInRecord inRecord = inRecordMapper.selectById(outRecord.getGiveId()); + inRecord.setOverNum(inRecord.getOverNum() + outRecord.getRefNum()); + inRecordMapper.updateOverNum(inRecord.getId(), inRecord.getOverNum()); + } return true; } + @Override public List findActivatePros(Integer couponId) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("coupon_id", couponId); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index eeae7adf..d0161535 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -400,22 +400,6 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { @Transactional(rollbackFor = Exception.class) public void upOrderStatus(TbOrderInfo tbOrderInfo) { tbOrderInfo.setStatus("cancelled"); - //订单取消 赠送商品数量返回 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("order_id", tbOrderInfo.getId()); - queryWrapper.eq("status", "create"); - List outRecords = outRecordService.list(queryWrapper); - for (TbActivateOutRecord outRecord : outRecords) { - TbActivateInRecord inRecord = inRecordService.getById(outRecord.getGiveId()); - inRecord.setOverNum(inRecord.getOverNum() + outRecord.getUseNum()); - inRecordService.updateById(inRecord); - } - LambdaUpdateWrapper lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); - lambdaUpdateWrapper.eq(TbActivateOutRecord::getOrderId, tbOrderInfo.getId()) - .eq(TbActivateOutRecord::getStatus, "create") - .set(TbActivateOutRecord::getStatus, "cancel"); - outRecordService.update(lambdaUpdateWrapper); - List details = tbOrderDetailRepository.searchDetailByOrderId(tbOrderInfo.getId()); for (TbOrderDetail detail : details) { detail.setStatus("cancelled"); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java index f13b5211..459ac51c 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java @@ -6,6 +6,7 @@ import java.util.Date; @Data public class TbUserCouponVo { + private Integer id; private Integer couponId; private Integer proId; //优惠券名称 From 065772c2c304e3d14f3ab8667e28410177d1f31b Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Sat, 26 Oct 2024 11:23:50 +0800 Subject: [PATCH 022/165] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/controller/TbShopCouponController.java | 4 ++-- .../ysk/cashier/mybatis/service/TbShopCouponService.java | 2 +- .../mybatis/service/impl/TbShopCouponServiceImpl.java | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java index 2ab2bf99..fb1b0a2f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java @@ -70,8 +70,8 @@ public class TbShopCouponController { @DeleteMapping @ApiOperation("删除") - public ResponseEntity delete(@RequestParam("id") Integer id) { - tbShopCouponService.delete(id); + public ResponseEntity delete(@RequestBody Integer[] ids) { + tbShopCouponService.delete(ids); return new ResponseEntity<>(HttpStatus.OK); } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java index 616211dd..e239be2d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java @@ -26,7 +26,7 @@ public interface TbShopCouponService extends IService { TbShopCoupon findById (Integer id); boolean update(TbShopCouponVo param); - boolean delete(Integer id); + boolean delete(Integer[] ids); ResponseEntity find(CouponDto param); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index 9b7f08b5..f8a61b6f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -133,9 +133,11 @@ public class TbShopCouponServiceImpl extends ServiceImpl().eq(TbCouponProduct::getCouponId, id)); + public boolean delete(Integer[] ids) { + tbShopCouponmapper.deleteBatchIds(Arrays.asList(ids)); + for (Integer id : ids) { + couProductService.remove(new LambdaQueryWrapper().eq(TbCouponProduct::getCouponId, id)); + } return true; } From 25ded0b4f8f26b87cfb5977d1845828e66ef45ee Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Sat, 26 Oct 2024 11:40:58 +0800 Subject: [PATCH 023/165] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=20=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/dto/TbShopCouponQueryCriteria.java | 1 + .../mybatis/service/impl/TbShopCouponServiceImpl.java | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/TbShopCouponQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/TbShopCouponQueryCriteria.java index 3f5de2e0..352ba64b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/TbShopCouponQueryCriteria.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/TbShopCouponQueryCriteria.java @@ -11,6 +11,7 @@ import lombok.Data; @Data public class TbShopCouponQueryCriteria { private Integer shopId; + private Integer type; private long page; private long size; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index f8a61b6f..7e9f0c9e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -78,13 +78,9 @@ public class TbShopCouponServiceImpl extends ServiceImpl page = new Page<>(criteria.getPage(), criteria.getSize()); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("shop_id", criteria.getShopId()); -// if (StringUtils.isNotBlank(criteria.getName())) { -// wrapper.and(w -> w.like("name", criteria.getName()) -// .or() -// .like("singer", criteria.getName()) -// .or() -// .like("origin_singer", criteria.getName())); -// } + if (criteria.getType()!=null) { + wrapper.eq("type", criteria.getType()); + } wrapper.orderByDesc("create_time"); Page ipage = tbShopCouponmapper.selectPage(page, wrapper); return PageUtil.toPage(ipage.getRecords(), ipage.getTotal()); From c7187fe1ab46b2f6655c5ff6f1333bc1aaea589d Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Sat, 26 Oct 2024 17:04:41 +0800 Subject: [PATCH 024/165] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=20=E9=A2=86?= =?UTF-8?q?=E5=8F=96=E8=AF=A6=E6=83=85=20=E4=BB=A5=E5=8F=8A=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TbShopCouponController.java | 18 ++++++++- .../cn/ysk/cashier/dto/QueryReceiveDto.java | 19 ++++++++++ .../mybatis/mapper/TbShopCouponMapper.java | 37 +++++++++++++++++++ .../mybatis/service/TbShopCouponService.java | 6 ++- .../service/impl/TbShopCouponServiceImpl.java | 21 +++++++++-- .../cn/ysk/cashier/vo/QueryReceiveVo.java | 24 ++++++++++++ 6 files changed, 119 insertions(+), 6 deletions(-) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/QueryReceiveDto.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/vo/QueryReceiveVo.java diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java index fb1b0a2f..bae5fed1 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java @@ -1,5 +1,6 @@ package cn.ysk.cashier.controller; +import cn.ysk.cashier.dto.QueryReceiveDto; import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mybatis.entity.TbShopCoupon; import cn.ysk.cashier.mybatis.service.TbShopCouponService; @@ -7,6 +8,7 @@ import cn.ysk.cashier.mybatis.vo.TbShopCouponVo; import cn.ysk.cashier.utils.SecurityUtils; import io.swagger.annotations.Api; import org.springframework.util.CollectionUtils; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import io.swagger.annotations.ApiOperation; import org.springframework.http.HttpStatus; @@ -69,10 +71,24 @@ public class TbShopCouponController { } @DeleteMapping - @ApiOperation("删除") + @ApiOperation("删除优惠券") public ResponseEntity delete(@RequestBody Integer[] ids) { tbShopCouponService.delete(ids); return new ResponseEntity<>(HttpStatus.OK); } + + + @PostMapping("/queryReceive") + @ApiOperation("领取详情") + public ResponseEntity queryReceive(@Validated @RequestBody QueryReceiveDto param) { + return new ResponseEntity<>(tbShopCouponService.queryReceive(param), HttpStatus.OK); + } + + @DeleteMapping("receive") + @ApiOperation("删除用户的券") + public ResponseEntity deleteReceive(@RequestBody Integer[] ids) { + tbShopCouponService.deleteReceive(ids); + return new ResponseEntity<>(HttpStatus.OK); + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/QueryReceiveDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/QueryReceiveDto.java new file mode 100644 index 00000000..de0dee0c --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/QueryReceiveDto.java @@ -0,0 +1,19 @@ +package cn.ysk.cashier.dto; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class QueryReceiveDto extends BaseQueryDto{ + @NotBlank(message = "优惠券id 不可为空") + private String couponId; + //用户昵称 手机号 模糊 + private String value; + //状态 0 未使用 1 已使用 + private Integer status; + + private Integer page = 1; + + private Integer size = 10; +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java index b56eae0d..8f67d9d4 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java @@ -1,7 +1,15 @@ package cn.ysk.cashier.mybatis.mapper; +import cn.ysk.cashier.dto.QueryReceiveDto; +import cn.ysk.cashier.pojo.shop.TbFullShopId; +import cn.ysk.cashier.vo.QueryReceiveVo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.ysk.cashier.mybatis.entity.TbShopCoupon; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; /** * 优惠券(TbShopCoupon)表数据库访问层 @@ -11,5 +19,34 @@ import cn.ysk.cashier.mybatis.entity.TbShopCoupon; */ public interface TbShopCouponMapper extends BaseMapper { + @Select("") + Page queryReceive(QueryReceiveDto param ,Page page); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java index e239be2d..a635fb40 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java @@ -1,9 +1,12 @@ package cn.ysk.cashier.mybatis.service; import cn.ysk.cashier.dto.CouponDto; +import cn.ysk.cashier.dto.QueryReceiveDto; import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord; import cn.ysk.cashier.mybatis.entity.TbCouponProduct; import cn.ysk.cashier.mybatis.vo.TbShopCouponVo; +import cn.ysk.cashier.vo.QueryReceiveVo; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import cn.ysk.cashier.mybatis.entity.TbShopCoupon; import cn.ysk.cashier.dto.TbShopCouponQueryCriteria; @@ -22,11 +25,12 @@ public interface TbShopCouponService extends IService { Map queryAll(TbShopCouponQueryCriteria criteria); - + Map queryReceive(QueryReceiveDto param); TbShopCoupon findById (Integer id); boolean update(TbShopCouponVo param); boolean delete(Integer[] ids); + boolean deleteReceive(Integer[] ids); ResponseEntity find(CouponDto param); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index 7e9f0c9e..ce4b3b1a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -5,11 +5,9 @@ import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; import cn.ysk.cashier.dto.CouponDto; +import cn.ysk.cashier.dto.QueryReceiveDto; import cn.ysk.cashier.dto.TbShopCouponQueryCriteria; -import cn.ysk.cashier.mybatis.entity.TbActivateInRecord; -import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord; -import cn.ysk.cashier.mybatis.entity.TbCouponProduct; -import cn.ysk.cashier.mybatis.entity.TbShopCoupon; +import cn.ysk.cashier.mybatis.entity.*; import cn.ysk.cashier.mybatis.mapper.TbActivateInRecordMapper; import cn.ysk.cashier.mybatis.mapper.TbActivateOutRecordMapper; import cn.ysk.cashier.mybatis.mapper.TbShopCouponMapper; @@ -27,6 +25,7 @@ import cn.ysk.cashier.repository.product.TbProductRepository; import cn.ysk.cashier.repository.shop.TbShopUserRepository; import cn.ysk.cashier.service.shop.TbShopUserService; import cn.ysk.cashier.utils.PageUtil; +import cn.ysk.cashier.vo.QueryReceiveVo; import cn.ysk.cashier.vo.TbUserCouponVo; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -86,6 +85,13 @@ public class TbShopCouponServiceImpl extends ServiceImpl queryReceive(QueryReceiveDto param) { + Page page = new Page<>(param.getPage(), param.getSize()); + Page ipage = tbShopCouponmapper.queryReceive(param, page); + return PageUtil.toPage(ipage.getRecords(), ipage.getTotal()); + } + @Override public TbShopCouponVo findById(Integer id) { TbShopCouponVo tbShopCouponVo = new TbShopCouponVo(); @@ -128,6 +134,12 @@ public class TbShopCouponServiceImpl extends ServiceImpl find(CouponDto param) { TbShopUser tbShopUser = shopUserRepository.selectByUserIdAndShopId(param.getUserId().toString(), param.getShopId().toString()); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/vo/QueryReceiveVo.java b/eladmin-system/src/main/java/cn/ysk/cashier/vo/QueryReceiveVo.java new file mode 100644 index 00000000..8db77f94 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/vo/QueryReceiveVo.java @@ -0,0 +1,24 @@ +package cn.ysk.cashier.vo; + +import lombok.Data; + +import java.util.Date; + +@Data +public class QueryReceiveVo { + + private Integer id; + private Integer userId; + private String name; + private String phone; + private Date receiveTime; + private Date useTime; + private String num; + private String overNum; + private String source; + private String status; + + + + +} From 8ef1894a472f2239de60337ea55f3cb5d723a66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Sat, 26 Oct 2024 17:29:20 +0800 Subject: [PATCH 025/165] =?UTF-8?q?Pad=E7=82=B9=E9=A4=90=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/TbPadProductCategoryServiceImpl.java | 118 +++++++++++++++--- .../ysk/cashier/pojo/product/TbProduct.java | 21 +++- 2 files changed, 114 insertions(+), 25 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryServiceImpl.java index bd0deb64..85aa89cd 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPadProductCategoryServiceImpl.java @@ -4,18 +4,17 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.map.MapProxy; +import cn.hutool.core.util.StrUtil; import cn.ysk.cashier.dto.product.PadProductCategoryDTO; import cn.ysk.cashier.exception.BadRequestException; -import cn.ysk.cashier.mybatis.mapper.TbPadLayoutMapper; -import cn.ysk.cashier.mybatis.mapper.TbPadProductCategoryDetailMapper; -import cn.ysk.cashier.mybatis.mapper.TbPadProductCategoryMapper; -import cn.ysk.cashier.mybatis.mapper.TbProductMapper; +import cn.ysk.cashier.mybatis.mapper.*; import cn.ysk.cashier.mybatis.service.TbPadProductCategoryService; -import cn.ysk.cashier.pojo.product.TbPadLayout; -import cn.ysk.cashier.pojo.product.TbPadProductCategory; -import cn.ysk.cashier.pojo.product.TbPadProductCategoryDetail; -import cn.ysk.cashier.pojo.product.TbProduct; +import cn.ysk.cashier.pojo.product.*; +import cn.ysk.cashier.repository.product.TbProductSkuResultRepository; import cn.ysk.cashier.utils.PageUtil; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -24,10 +23,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -46,6 +42,10 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpl findPage(Map params) { @@ -69,29 +69,107 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpl params = new HashMap<>(2); + Map params = new HashMap<>(2); params.put("id", id); params.put("shopId", entity.getShopId()); List list = baseMapper.findList(params); PadProductCategoryDTO dto = list.get(0); - if(entity.getProductCategoryId().longValue() == 0L){ + if (entity.getProductCategoryId().longValue() == 0L) { dto.setProductCategoryName("推荐菜"); } List subList = tbPadProductCategoryDetailMapper.selectList(Wrappers.lambdaQuery().eq(TbPadProductCategoryDetail::getPadProductCategoryId, entity.getId())); - if(CollUtil.isNotEmpty(subList)){ + if (CollUtil.isNotEmpty(subList)) { List productIdList = subList.stream().map(TbPadProductCategoryDetail::getProductId).collect(Collectors.toList()); dto.setProductIdList(productIdList); List> splitIdList = CollUtil.split(productIdList, 10); List productList = dto.getProductList(); for (List ids : splitIdList) { List splitList = tbProductMapper.selectList(Wrappers.lambdaQuery().in(TbProduct::getId, ids)); - productList.addAll(splitList); + for (TbProduct item : splitList) { + TbProductSkuResult skuResult = productSkuResultRepository.findById(item.getId()).orElse(null); + item.setSkuResult(skuResult); + List> maps = buildSpecList(skuResult, item); + item.setSpecList(maps); + productList.add(item); + } } dto.setProductList(productList); } return dto; } + private List> buildSpecList(TbProductSkuResult skuResult, TbProduct item) { + List> specList = new ArrayList<>(); + List tbProductSkus = producSkutMapper.selectList(new LambdaQueryWrapper().eq(TbProductSku::getIsDel, 0) + .eq(TbProductSku::getIsPauseSale, 0) + .eq(TbProductSku::getProductId, item.getId()) + .eq(TbProductSku::getIsGrounding, 1) + .select(TbProductSku::getId, TbProductSku::getSpecSnap, TbProductSku::getStockNumber, TbProductSku::getSalePrice, TbProductSku::getSuit)); + + String tagSnap = null; + if (skuResult != null) { + tagSnap = skuResult.getTagSnap(); + } + List result = new ArrayList<>(); + + if (StrUtil.isNotBlank(tagSnap)) { + JSONArray tagSnaps = JSONObject.parseArray(tagSnap); + List> valuesList = new ArrayList<>(); + + // 提取所有 value 的列表 + for (int i = 0; i < tagSnaps.size(); i++) { + JSONObject jsonObject = tagSnaps.getJSONObject(i); + String[] values = jsonObject.getString("value").split(","); + valuesList.add(Arrays.asList(values)); + } + // 生成所有可能的排列组合 + generateCombinations(valuesList, 0, new ArrayList<>(), result); + + } + + tbProductSkus.forEach(item2 -> { + Map itemMap = BeanUtil.beanToMap(item2, false, true); + + itemMap.put("stockNumber", item.getStockNumber()); + + specList.add(itemMap); + }); + + ArrayList> otherVal = new ArrayList<>(); + for (String res : result) { + boolean found = false; + for (Map spec : specList) { + if (spec.get("specSnap") != null && res.equals(spec.get("specSnap").toString())) { + spec.put("isGrounding", true); + found = true; + break; + } + } + if (!found) { + HashMap itemMap = new HashMap<>(); + itemMap.put("specSnap", res); + itemMap.put("skuId", null); + itemMap.put("isGrounding", false); + otherVal.add(itemMap); + } + } + specList.addAll(otherVal); + return specList; + } + + private static void generateCombinations(List> valuesList, int index, List current, List result) { + if (index == valuesList.size()) { + result.add(String.join(",", current)); + return; + } + + for (String value : valuesList.get(index)) { + current.add(value); + generateCombinations(valuesList, index + 1, current, result); + current.remove(current.size() - 1); // 回溯 + } + } + @Override @Transactional(rollbackFor = Exception.class) public void save(PadProductCategoryDTO dto) { @@ -122,7 +200,7 @@ public class TbPadProductCategoryServiceImpl extends ServiceImpl sortList) { - if(CollUtil.isEmpty(sortList)) { + if (CollUtil.isEmpty(sortList)) { throw new BadRequestException("排序列表不能为空"); } for (PadProductCategoryDTO dto : sortList) { diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbProduct.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbProduct.java index 391b1c5e..9a7adb1e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbProduct.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/product/TbProduct.java @@ -15,18 +15,21 @@ */ package cn.ysk.cashier.pojo.product; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import cn.hutool.core.bean.BeanUtil; import io.swagger.annotations.ApiModelProperty; -import cn.hutool.core.bean.copier.CopyOptions; +import lombok.Data; import javax.persistence.*; -import javax.validation.constraints.*; -import java.math.BigDecimal; +import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; /** * @website https://eladmin.vip @@ -329,6 +332,14 @@ public class TbProduct implements Serializable { @ApiModelProperty("库存警戒线") private Integer warnLine = 0; + @Transient + @TableField(exist = false) + private TbProductSkuResult skuResult; + + @Transient + @TableField(exist = false) + private List> specList; + public void copy(TbProduct source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); From 77483676954f1e9de94bad1ce38105a58e419f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Sat, 26 Oct 2024 17:34:48 +0800 Subject: [PATCH 026/165] =?UTF-8?q?Pad=E7=82=B9=E9=A4=90=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eladmin-system/src/main/resources/config/application-dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/resources/config/application-dev.yml b/eladmin-system/src/main/resources/config/application-dev.yml index 86fd03fa..81fa474f 100644 --- a/eladmin-system/src/main/resources/config/application-dev.yml +++ b/eladmin-system/src/main/resources/config/application-dev.yml @@ -4,9 +4,9 @@ spring: druid: db-type: com.alibaba.druid.pool.DruidDataSource # driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy -# url: jdbc:p6spy:mysql://rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com:3306/fycashier_test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true + url: jdbc:p6spy:mysql://rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com:3306/fycashier_test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true # url: jdbc:mysql://127.0.0.1:3306/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true - url: jdbc:p6spy:mysql://rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com:3306/fycashier_pre?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true +# url: jdbc:p6spy:mysql://rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com:3306/fycashier_pre?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true username: cashier password: Cashier@1@ # driver-class-name: com.mysql.cj.jdbc.Driver From d54471ec3c01f7942704d041af9f19377817a108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Tue, 29 Oct 2024 09:09:28 +0800 Subject: [PATCH 027/165] =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../points/TbMemberPointsController.java | 88 ++++++ .../points/TbMemberPointsLogController.java | 36 +++ .../TbPointsBasicSettingController.java | 42 +++ .../TbPointsExchangeRecordController.java | 62 ++++ .../TbPointsGoodsSettingController.java | 55 ++++ .../dto/points/OrderDeductionPointsDTO.java | 61 ++++ .../mybatis/entity/TbMemberPoints.java | 64 ++++ .../mybatis/entity/TbMemberPointsLog.java | 68 ++++ .../mybatis/entity/TbPointsBasicSetting.java | 69 +++++ .../entity/TbPointsExchangeRecord.java | 97 ++++++ .../mybatis/entity/TbPointsGoodsSetting.java | 77 +++++ .../mapper/TbMemberPointsLogMapper.java | 16 + .../mybatis/mapper/TbMemberPointsMapper.java | 16 + .../mapper/TbPointsBasicSettingMapper.java | 16 + .../mapper/TbPointsExchangeRecordMapper.java | 16 + .../mapper/TbPointsGoodsSettingMapper.java | 16 + .../service/TbMemberPointsLogService.java | 18 ++ .../service/TbMemberPointsService.java | 99 ++++++ .../service/TbPointsBasicSettingService.java | 16 + .../TbPointsExchangeRecordService.java | 25 ++ .../service/TbPointsGoodsSettingService.java | 22 ++ .../impl/TbMemberPointsLogServiceImpl.java | 60 ++++ .../impl/TbMemberPointsServiceImpl.java | 292 ++++++++++++++++++ .../impl/TbPointsBasicSettingServiceImpl.java | 51 +++ .../TbPointsExchangeRecordServiceImpl.java | 195 ++++++++++++ .../impl/TbPointsGoodsSettingServiceImpl.java | 94 ++++++ .../mapper/plus/TbMemberPointsDao.xml | 6 + .../mapper/plus/TbMemberPointsLogDao.xml | 6 + .../mapper/plus/TbPointsBasicSettingDao.xml | 6 + .../mapper/plus/TbPointsExchangeRecordDao.xml | 6 + .../mapper/plus/TbPointsGoodsSettingDao.xml | 6 + 31 files changed, 1701 insertions(+) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbMemberPointsController.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbMemberPointsLogController.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsBasicSettingController.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsExchangeRecordController.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsGoodsSettingController.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/points/OrderDeductionPointsDTO.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPointsLog.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsBasicSetting.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsExchangeRecord.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMemberPointsLogMapper.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMemberPointsMapper.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsBasicSettingMapper.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsExchangeRecordMapper.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsGoodsSettingMapper.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbMemberPointsLogService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbMemberPointsService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsBasicSettingService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsExchangeRecordService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsGoodsSettingService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsLogServiceImpl.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsServiceImpl.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsBasicSettingServiceImpl.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsGoodsSettingServiceImpl.java create mode 100644 eladmin-system/src/main/resources/mapper/plus/TbMemberPointsDao.xml create mode 100644 eladmin-system/src/main/resources/mapper/plus/TbMemberPointsLogDao.xml create mode 100644 eladmin-system/src/main/resources/mapper/plus/TbPointsBasicSettingDao.xml create mode 100644 eladmin-system/src/main/resources/mapper/plus/TbPointsExchangeRecordDao.xml create mode 100644 eladmin-system/src/main/resources/mapper/plus/TbPointsGoodsSettingDao.xml diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbMemberPointsController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbMemberPointsController.java new file mode 100644 index 00000000..9b9d0d3e --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbMemberPointsController.java @@ -0,0 +1,88 @@ +package cn.ysk.cashier.controller.points; + +import cn.hutool.core.map.MapProxy; +import cn.ysk.cashier.dto.points.OrderDeductionPointsDTO; +import cn.ysk.cashier.mybatis.entity.TbMemberPoints; +import cn.ysk.cashier.mybatis.service.TbMemberPointsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.Map; + + +/** + * 会员积分 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@RestController +@RequestMapping("/api/points/member-points") +@Api(tags = "会员积分") +public class TbMemberPointsController { + + @Resource + private TbMemberPointsService tbMemberPointsService; + + @GetMapping("page") + @ApiOperation("分页") + public ResponseEntity page(@RequestParam Map params) { + Map page = tbMemberPointsService.page(params); + return ResponseEntity.ok().body(page); + } + + @GetMapping("{memberId}") + @ApiOperation("获取会员积分等信息") + public ResponseEntity getMemberPoints(@PathVariable("memberId") Long memberId) { + TbMemberPoints memberPoints = tbMemberPointsService.getMemberPoints(memberId); + return ResponseEntity.ok().body(memberPoints); + } + + @GetMapping("calc-usable-points") + @ApiOperation("获取订单可用积分及抵扣金额") + public ResponseEntity getMemberUsablePoints(@RequestParam Long memberId, @RequestParam BigDecimal orderAmount) { + OrderDeductionPointsDTO usablePoints = tbMemberPointsService.getMemberUsablePoints(memberId, orderAmount); + return ResponseEntity.ok().body(usablePoints); + } + + @GetMapping("calc-used-points") + @ApiOperation("根据抵扣金额计算所需积分") + public ResponseEntity calcUsedPoints(@RequestParam Long memberId, @RequestParam BigDecimal orderAmount, @RequestParam BigDecimal deductionAmount) { + int points = tbMemberPointsService.calcUsedPoints(memberId, orderAmount, deductionAmount); + return ResponseEntity.ok().body(points); + } + + @GetMapping("calc-deduction-amount") + @ApiOperation("根据积分计算可抵扣金额") + public ResponseEntity calcDeductionAmount(@RequestParam Long memberId, @RequestParam BigDecimal orderAmount, @RequestParam Integer points) { + BigDecimal deductionAmount = tbMemberPointsService.calcDeductionAmount(memberId, orderAmount, points); + return ResponseEntity.ok().body(deductionAmount); + } + + @PostMapping("payed-deduct-points") + @ApiOperation("支付完成扣减积分(支付成功回调中使用)") + public ResponseEntity deductPoints(@RequestBody Map params) { + MapProxy proxy = MapProxy.create(params); + Long memberId = proxy.getLong("memberId"); + Integer points = proxy.getInt("points"); + String content = proxy.getStr("content"); + Long orderId = proxy.getLong("orderId"); + boolean ret = tbMemberPointsService.deductPoints(memberId, points, content, orderId); + return ResponseEntity.ok().body(ret); + } + + @PostMapping("consume-award-points") + @ApiOperation("消费赠送积分(支付成功回调中使用)") + public ResponseEntity consumeAwardPoints(@RequestBody Map params) { + MapProxy proxy = MapProxy.create(params); + Long memberId = proxy.getLong("memberId"); + Long orderId = proxy.getLong("orderId"); + tbMemberPointsService.consumeAwardPoints(memberId, orderId); + return ResponseEntity.ok().build(); + } + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbMemberPointsLogController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbMemberPointsLogController.java new file mode 100644 index 00000000..b03bc21b --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbMemberPointsLogController.java @@ -0,0 +1,36 @@ +package cn.ysk.cashier.controller.points; + +import cn.ysk.cashier.mybatis.service.TbMemberPointsLogService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.Map; + + +/** + * 会员积分变动记录 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@RestController +@RequestMapping("/api/points/member-points-log") +@Api(tags = "会员积分变动记录") +public class TbMemberPointsLogController { + + @Resource + private TbMemberPointsLogService tbMemberPointsLogService; + + @GetMapping("page") + @ApiOperation("分页") + public ResponseEntity page(@RequestParam Map params) { + Map page = tbMemberPointsLogService.page(params); + return ResponseEntity.ok().body(page); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsBasicSettingController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsBasicSettingController.java new file mode 100644 index 00000000..2f5104bb --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsBasicSettingController.java @@ -0,0 +1,42 @@ +package cn.ysk.cashier.controller.points; + +import cn.ysk.cashier.mybatis.entity.TbPointsBasicSetting; +import cn.ysk.cashier.mybatis.service.TbPointsBasicSettingService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + + +/** + * 积分基本设置 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@RestController +@RequestMapping("/api/points/basic-setting") +@Api(tags = "积分基本设置") +public class TbPointsBasicSettingController { + + @Resource + private TbPointsBasicSettingService tbPointsBasicSettingService; + + @GetMapping("{shopId}") + @ApiOperation("信息") + public ResponseEntity get(@PathVariable("shopId") Long shopId) { + TbPointsBasicSetting data = tbPointsBasicSettingService.getByShopId(shopId); + return ResponseEntity.ok().body(data); + } + + @PostMapping + @ApiOperation("保存") + public ResponseEntity save(@RequestBody TbPointsBasicSetting entity) { + tbPointsBasicSettingService.save(entity); + return ResponseEntity.ok().build(); + } + + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsExchangeRecordController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsExchangeRecordController.java new file mode 100644 index 00000000..2ce213f2 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsExchangeRecordController.java @@ -0,0 +1,62 @@ +package cn.ysk.cashier.controller.points; + +import cn.ysk.cashier.mybatis.entity.TbPointsExchangeRecord; +import cn.ysk.cashier.mybatis.service.TbPointsExchangeRecordService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Map; + + +/** + * 积分兑换记录 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@RestController +@RequestMapping("/api/points/exchange-record") +@Api(tags = "积分兑换记录") +public class TbPointsExchangeRecordController { + + @Resource + private TbPointsExchangeRecordService tbPointsExchangeRecordService; + + @GetMapping("page") + @ApiOperation("分页") + public ResponseEntity page(@RequestParam Map params) { + Map data = tbPointsExchangeRecordService.page(params); + return ResponseEntity.ok().body(data); + } + + @GetMapping("{id}") + @ApiOperation("信息") + public ResponseEntity get(@PathVariable("id") Long id) { + TbPointsExchangeRecord data = tbPointsExchangeRecordService.get(id); + return ResponseEntity.ok().body(data); + } + + @PostMapping("checkout") + @ApiOperation("核销") + public ResponseEntity checkout(@RequestBody TbPointsExchangeRecord record) { + tbPointsExchangeRecordService.checkout(record.getCouponCode()); + return ResponseEntity.ok().build(); + } + + @PostMapping("exchange") + @ApiOperation("兑换") + public ResponseEntity exchange(@RequestBody TbPointsExchangeRecord record) { + TbPointsExchangeRecord data = tbPointsExchangeRecordService.exchange(record); + return ResponseEntity.ok().body(data); + } + + @GetMapping("total") + @ApiOperation("统计") + public ResponseEntity total(@RequestParam Map params) { + Map data = tbPointsExchangeRecordService.total(params); + return ResponseEntity.ok().body(data); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsGoodsSettingController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsGoodsSettingController.java new file mode 100644 index 00000000..96017cfb --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsGoodsSettingController.java @@ -0,0 +1,55 @@ +package cn.ysk.cashier.controller.points; + +import cn.ysk.cashier.mybatis.entity.TbPointsGoodsSetting; +import cn.ysk.cashier.mybatis.service.TbPointsGoodsSettingService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Map; + + +/** + * 积分商品设置 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@RestController +@RequestMapping("/api/points/goods-setting") +@Api(tags = "积分商品设置") +public class TbPointsGoodsSettingController { + + @Resource + private TbPointsGoodsSettingService tbPointsGoodsSettingService; + + @GetMapping("page") + @ApiOperation("分页") + public ResponseEntity page(@RequestParam Map params) { + Map data = tbPointsGoodsSettingService.page(params); + return ResponseEntity.ok().body(data); + } + + @GetMapping("{id}") + @ApiOperation("信息") + public ResponseEntity get(@PathVariable("id") Integer id) { + TbPointsGoodsSetting data = tbPointsGoodsSettingService.getById(id); + return ResponseEntity.ok().body(data); + } + + @PostMapping + @ApiOperation("保存") + public ResponseEntity save(@RequestBody TbPointsGoodsSetting entity) { + boolean ret = tbPointsGoodsSettingService.save(entity); + return ResponseEntity.ok().body(ret); + } + + @PutMapping + @ApiOperation("修改") + public ResponseEntity update(@RequestBody TbPointsGoodsSetting dto) { + boolean ret = tbPointsGoodsSettingService.update(dto); + return ResponseEntity.ok().body(ret); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/points/OrderDeductionPointsDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/points/OrderDeductionPointsDTO.java new file mode 100644 index 00000000..6ac6ebda --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/points/OrderDeductionPointsDTO.java @@ -0,0 +1,61 @@ +package cn.ysk.cashier.dto.points; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 获取会员可用积分 + * @author tankaikai + * @since 2024-10-26 11:40 + */ +@Data +public class OrderDeductionPointsDTO { + + /** + * 本单最多可抵扣多少积分 + */ + private Integer maxUsablePoints; + /** + * 根据策略计算出的最少可以抵扣的金额 + */ + private BigDecimal minDeductionAmount; + /** + * 根据策略计算出的最多可以抵扣的金额 + */ + private BigDecimal maxDeductionAmount; + /** + * 下单积分抵扣门槛(每次使用不低于这个值) + */ + private Integer minDeductionPoints; + /** + * 会员账户积分 + */ + private Integer accountPoints; + /** + * 订单金额 (扣除各类折扣) + */ + private BigDecimal orderAmount; + /** + * 使用的积分数量 + */ + private Integer usedPoints; + /** + * 实际抵扣的金额 + */ + private Integer deductionAmount; + /** + * 下单抵扣积分比例 1元=?积分 + */ + private Integer equivalentPoints; + /** + * 不可抵扣原因 + */ + private String unusableReason; + /** + * 是否可用 + */ + private Boolean usable; + + +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java new file mode 100644 index 00000000..db2d0286 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java @@ -0,0 +1,64 @@ +package cn.ysk.cashier.mybatis.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 会员积分 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_member_points") +public class TbMemberPoints { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * 店铺id + */ + private Long shopId; + /** + * 会员id + */ + private Long memberId; + /** + * 会员名称 + */ + private String memberName; + /** + * 会员头像 + */ + private String avatarUrl; + /** + * 手机号码 + */ + private String mobile; + /** + * 账户积分 + */ + private Integer accountPoints; + /** + * 创建时间 + */ + private Date createTime; + /** + * 最近一次积分变动时间 + */ + private Date lastPointsChangeTime; + /** + * 最近一次浮动积分 + */ + private Integer lastFloatPoints; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPointsLog.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPointsLog.java new file mode 100644 index 00000000..ac430835 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPointsLog.java @@ -0,0 +1,68 @@ +package cn.ysk.cashier.mybatis.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 会员积分变动记录 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_member_points_log") +public class TbMemberPointsLog { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * 店铺id + */ + private Long shopId; + /** + * 会员id + */ + private Long memberId; + /** + * 会员名称 + */ + private String memberName; + /** + * 会员头像 + */ + private String avatarUrl; + /** + * 摘要信息(如:兑换某个商品/消费多少钱/充值多少钱/新会员赠送积分等) + */ + private String content; + /** + * 订单编号 + */ + private String orderNo; + /** + * 手机号码 + */ + private String mobile; + /** + * 浮动类型 add-累加 subtract-扣减 + */ + private String floatType; + /** + * 浮动积分(非0正负数) + */ + private Integer floatPoints; + /** + * 创建时间 + */ + private Date createTime; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsBasicSetting.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsBasicSetting.java new file mode 100644 index 00000000..b9b5432a --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsBasicSetting.java @@ -0,0 +1,69 @@ +package cn.ysk.cashier.mybatis.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 积分基本设置 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_points_basic_setting") +public class TbPointsBasicSetting { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * 店铺id + */ + private Long shopId; + /** + * 开启消费赠送积分 1-开启 0-关闭 + */ + private Integer enableRewards; + /** + * 每消费xx元赠送1积分 + */ + private BigDecimal consumeAmount; + /** + * 开启下单积分抵扣 1-开启 0-关闭 + */ + private Integer enableDeduction; + /** + * 下单积分抵扣门槛 + */ + private Integer minDeductionPoint; + /** + * 下单最高抵扣比例 + */ + private BigDecimal maxDeductionRatio; + /** + * 下单抵扣积分比例 1元=?积分 + */ + private Integer equivalentPoints; + /** + * 开启积分商城 1-开启 0-关闭 + */ + private Integer enablePointsMall; + /** + * 浏览模式 list-列表 grid-宫格 + */ + private String browseMode; + /** + * 创建时间 + */ + private Date createTime; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsExchangeRecord.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsExchangeRecord.java new file mode 100644 index 00000000..dfd5fc3a --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsExchangeRecord.java @@ -0,0 +1,97 @@ +package cn.ysk.cashier.mybatis.entity; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 积分兑换记录 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_points_exchange_record") +public class TbPointsExchangeRecord { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * 订单编号 + */ + private String orderNo; + /** + * 店铺id + */ + private Long shopId; + /** + * 积分商品id + */ + private Long pointsGoodsId; + /** + * 积分商品名称 + */ + private String pointsGoodsName; + /** + * 商品图片URL + */ + private String goodsImageUrl; + /** + * 领取方式 self-自取 post-邮寄 + */ + private String pickupMethod; + /** + * 会员id + */ + private Long memberId; + /** + * 会员名称 + */ + private String memberName; + /** + * 手机号码 + */ + private String mobile; + /** + * 会员头像 + */ + private String avatarUrl; + /** + * 消耗积分 + */ + private Integer spendPoints; + /** + * 额外支付 + */ + private BigDecimal extraPaymentAmount; + /** + * 兑换券券码 + */ + private String couponCode; + /** + * 状态 waiting-待自取 done-已完成 + */ + private String status; + /** + * 创建时间(下单时间) + */ + private Date createTime; + /** + * 更新时间(核销时间) + */ + private Date updateTime; + + @TableField(value = "count(*)", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER) + private Long count; + + @TableField(value = "sum(extra_payment_amount)", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER) + private BigDecimal totalAmount; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java new file mode 100644 index 00000000..d3292cfe --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java @@ -0,0 +1,77 @@ +package cn.ysk.cashier.mybatis.entity; + +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 积分商品设置 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("tb_points_goods_setting") +public class TbPointsGoodsSetting { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * 店铺id + */ + private Long shopId; + /** + * 商品类型 physical-实物 coupon-优惠劵 + */ + private String goodsCategory; + /** + * 商品名称 + */ + private String goodsName; + /** + * 商品图片URL + */ + @TableField(updateStrategy = FieldStrategy.ALWAYS) + private String goodsImageUrl; + /** + * 所需积分 + */ + private Integer requiredPoints; + /** + * 额外价格 + */ + private BigDecimal extraPrice; + /** + * 排序(权重),数字越高,显示约靠前 + */ + private Integer sort; + /** + * 数量 + */ + private Integer quantity; + /** + * 商品详情 + */ + @TableField(updateStrategy = FieldStrategy.ALWAYS) + private String goodsDescription; + /** + * 是否上架 1-是 0-否 + */ + private Integer status; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMemberPointsLogMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMemberPointsLogMapper.java new file mode 100644 index 00000000..b8d16e6d --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMemberPointsLogMapper.java @@ -0,0 +1,16 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.mybatis.entity.TbMemberPointsLog; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 会员积分变动记录 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Mapper +public interface TbMemberPointsLogMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMemberPointsMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMemberPointsMapper.java new file mode 100644 index 00000000..141b564b --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMemberPointsMapper.java @@ -0,0 +1,16 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.mybatis.entity.TbMemberPoints; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 会员积分 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Mapper +public interface TbMemberPointsMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsBasicSettingMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsBasicSettingMapper.java new file mode 100644 index 00000000..ea144fd2 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsBasicSettingMapper.java @@ -0,0 +1,16 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.mybatis.entity.TbPointsBasicSetting; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 积分基本设置 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Mapper +public interface TbPointsBasicSettingMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsExchangeRecordMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsExchangeRecordMapper.java new file mode 100644 index 00000000..64d627f8 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsExchangeRecordMapper.java @@ -0,0 +1,16 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.mybatis.entity.TbPointsExchangeRecord; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 积分兑换记录 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Mapper +public interface TbPointsExchangeRecordMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsGoodsSettingMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsGoodsSettingMapper.java new file mode 100644 index 00000000..e22a76e7 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbPointsGoodsSettingMapper.java @@ -0,0 +1,16 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.mybatis.entity.TbPointsGoodsSetting; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 积分商品设置 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Mapper +public interface TbPointsGoodsSettingMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbMemberPointsLogService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbMemberPointsLogService.java new file mode 100644 index 00000000..abc42438 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbMemberPointsLogService.java @@ -0,0 +1,18 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.mybatis.entity.TbMemberPointsLog; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.Map; + +/** + * 会员积分变动记录 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +public interface TbMemberPointsLogService extends IService { + + Map page(Map params); + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbMemberPointsService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbMemberPointsService.java new file mode 100644 index 00000000..9ada495c --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbMemberPointsService.java @@ -0,0 +1,99 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.dto.points.OrderDeductionPointsDTO; +import cn.ysk.cashier.mybatis.entity.TbMemberPoints; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.math.BigDecimal; +import java.util.Map; + +/** + * 会员积分 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +public interface TbMemberPointsService extends IService { + + /** + * 会员积分分页 + * + * @param params + * @return + */ + Map page(Map params); + + /** + * 获取会员积分等信息 + * + * @param memberId 会员id + * @return + */ + TbMemberPoints getMemberPoints(Long memberId); + + /** + * 初始化会员积分 + * + * @param memberId 会员id + * @return + */ + TbMemberPoints initMemberPoints(Long memberId); + + /** + * 根据会员id及订单金额计算可抵扣积分及可抵扣金额 + * + * @param memberId 会员id + * @param orderAmount 订单金额 + * @return + */ + OrderDeductionPointsDTO getMemberUsablePoints(Long memberId, BigDecimal orderAmount); + + /** + * 根据抵扣金额计算抵扣积分 + * + * @param memberId 会员id + * @param orderAmount 订单金额 + * @param deductionAmount 抵扣金额 + */ + int calcUsedPoints(Long memberId, BigDecimal orderAmount, BigDecimal deductionAmount); + + /** + * 根据抵扣积分计算抵扣金额 + * + * @param memberId 会员id + * @param orderAmount 订单金额 + * @param points 抵扣积分 + */ + BigDecimal calcDeductionAmount(Long memberId, BigDecimal orderAmount, int points); + + /** + * 扣除积分 + * + * @param memberId 会员id + * @param points 积分 + * @param content 摘要信息(如:兑换积分商品/积分抵扣账单/消费赠送积分/新会员送积分/储值赠送积分) + * @param orderId 订单id,可以为空 + * @throws Exception + */ + boolean deductPoints(Long memberId, int points, String content, Long orderId); + + /** + * 追加积分 + * + * @param memberId 会员id + * @param points 积分 + * @param content 摘要信息(如:兑换积分商品/积分抵扣账单/消费赠送积分/新会员送积分/储值赠送积分) + * @param orderId 订单id,可以为空 + * @throws Exception + */ + boolean addPoints(Long memberId, int points, String content, Long orderId); + + /** + * 消费赠送积分 + * + * @param memberId 会员id + * @param orderId 订单id + * @throws Exception + */ + void consumeAwardPoints(Long memberId, Long orderId); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsBasicSettingService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsBasicSettingService.java new file mode 100644 index 00000000..66acb836 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsBasicSettingService.java @@ -0,0 +1,16 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.mybatis.entity.TbPointsBasicSetting; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * 积分基本设置 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +public interface TbPointsBasicSettingService extends IService { + boolean save(TbPointsBasicSetting entity); + + TbPointsBasicSetting getByShopId(Long shopId); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsExchangeRecordService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsExchangeRecordService.java new file mode 100644 index 00000000..af21f22e --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsExchangeRecordService.java @@ -0,0 +1,25 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.mybatis.entity.TbPointsExchangeRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.Map; + +/** + * 积分兑换记录 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +public interface TbPointsExchangeRecordService extends IService { + + Map page(Map params); + + TbPointsExchangeRecord get(Long id); + + void checkout(String couponCode); + + TbPointsExchangeRecord exchange(TbPointsExchangeRecord record); + + Map total(Map params); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsGoodsSettingService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsGoodsSettingService.java new file mode 100644 index 00000000..d0422283 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsGoodsSettingService.java @@ -0,0 +1,22 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.mybatis.entity.TbPointsGoodsSetting; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.Map; + +/** + * 积分商品设置 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +public interface TbPointsGoodsSettingService extends IService { + + Map page(Map params); + + boolean save(TbPointsGoodsSetting entity); + + boolean update(TbPointsGoodsSetting dto); + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsLogServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsLogServiceImpl.java new file mode 100644 index 00000000..0c9009d9 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsLogServiceImpl.java @@ -0,0 +1,60 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.map.MapProxy; +import cn.hutool.core.util.StrUtil; +import cn.ysk.cashier.mybatis.entity.TbMemberPointsLog; +import cn.ysk.cashier.mybatis.mapper.TbMemberPointsLogMapper; +import cn.ysk.cashier.mybatis.service.TbMemberPointsLogService; +import cn.ysk.cashier.utils.PageUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + * 会员积分变动记录 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Service +public class TbMemberPointsLogServiceImpl extends ServiceImpl implements TbMemberPointsLogService { + + private LambdaQueryWrapper getWrapper(Map params) { + MapProxy mapProxy = MapProxy.create(params); + String beginDate = mapProxy.getStr("beginDate"); + String endDate = mapProxy.getStr("endDate"); + TbMemberPointsLog param = BeanUtil.toBean(params, TbMemberPointsLog.class); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.eq(TbMemberPointsLog::getShopId, param.getShopId()); + wrapper.like(StrUtil.isNotEmpty(param.getMemberName()), TbMemberPointsLog::getMemberName, param.getMemberName()); + wrapper.like(StrUtil.isNotEmpty(param.getMobile()), TbMemberPointsLog::getMobile, param.getMobile()); + wrapper.like(StrUtil.isNotEmpty(param.getContent()), TbMemberPointsLog::getContent, param.getContent()); + wrapper.eq(StrUtil.isNotEmpty(param.getFloatType()), TbMemberPointsLog::getFloatType, param.getFloatType()); + wrapper.eq(StrUtil.isNotEmpty(param.getOrderNo()), TbMemberPointsLog::getOrderNo, param.getOrderNo()); + if (StrUtil.isNotEmpty(beginDate)) { + wrapper.apply("create_time >= str_to_date({0}, '%Y-%m-%d %H:%i:%s')", beginDate + " 00:00:00"); + } + if (StrUtil.isNotEmpty(endDate)) { + wrapper.apply("create_time <= str_to_date({0}, '%Y-%m-%d %H:%i:%s')", endDate + " 23:59:59"); + } + wrapper.orderByDesc(TbMemberPointsLog::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); + LambdaQueryWrapper wrapper = getWrapper(params); + Page page = super.page(new Page<>(pageNum, pageSize), wrapper); + return PageUtil.toPlusPage(page.getRecords(), Convert.toInt(page.getTotal())); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsServiceImpl.java new file mode 100644 index 00000000..7b33ca11 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsServiceImpl.java @@ -0,0 +1,292 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.map.MapProxy; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import cn.ysk.cashier.dto.points.OrderDeductionPointsDTO; +import cn.ysk.cashier.exception.BadRequestException; +import cn.ysk.cashier.mybatis.entity.TbMemberPoints; +import cn.ysk.cashier.mybatis.entity.TbMemberPointsLog; +import cn.ysk.cashier.mybatis.entity.TbPointsBasicSetting; +import cn.ysk.cashier.mybatis.mapper.*; +import cn.ysk.cashier.mybatis.service.TbMemberPointsService; +import cn.ysk.cashier.mybatis.service.TbPointsBasicSettingService; +import cn.ysk.cashier.pojo.order.TbOrderInfo; +import cn.ysk.cashier.pojo.shop.TbShopUser; +import cn.ysk.cashier.utils.PageUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Date; +import java.util.Map; + +/** + * 会员积分 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Service +public class TbMemberPointsServiceImpl extends ServiceImpl implements TbMemberPointsService { + + @Resource + private TbMemberPointsLogMapper tbMemberPointsLogMapper; + @Resource + private TbPointsBasicSettingMapper tbPointsBasicSettingMapper; + @Resource + private TbShopUserMapper tbShopUserMapper; + @Resource + private TbOrderInfoMapper tbOrderInfoMapper; + @Resource + private TbPointsBasicSettingService tbPointsBasicSettingService; + + private LambdaQueryWrapper getWrapper(Map params) { + //MapProxy mapProxy = MapProxy.create(params); + TbMemberPoints param = BeanUtil.toBean(params, TbMemberPoints.class); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.eq(TbMemberPoints::getShopId, param.getShopId()); + wrapper.like(StrUtil.isNotEmpty(param.getMemberName()), TbMemberPoints::getMemberName, param.getMemberName()); + wrapper.like(StrUtil.isNotEmpty(param.getMobile()), TbMemberPoints::getMobile, param.getMobile()); + + wrapper.orderByDesc(TbMemberPoints::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); + LambdaQueryWrapper wrapper = getWrapper(params); + Page page = super.page(new Page<>(pageNum, pageSize), wrapper); + return PageUtil.toPlusPage(page.getRecords(), Convert.toInt(page.getTotal())); + } + + @Override + public TbMemberPoints getMemberPoints(Long memberId) { + return initMemberPoints(memberId); + } + + @Override + public TbMemberPoints initMemberPoints(Long memberId) { + TbShopUser shopUser = tbShopUserMapper.selectById(memberId); + if (shopUser == null) { + throw new BadRequestException("会员信息不存在"); + } + TbMemberPoints entity = super.getOne(Wrappers.lambdaQuery().eq(TbMemberPoints::getMemberId, memberId)); + if (entity == null) { + entity = new TbMemberPoints(); + entity.setCreateTime(new Date()); + entity.setAccountPoints(0); + } + entity.setShopId(Long.valueOf(shopUser.getShopId())); + entity.setMemberId(Long.valueOf(shopUser.getId())); + entity.setMemberName(shopUser.getName()); + entity.setAvatarUrl(shopUser.getHeadImg()); + entity.setMobile(shopUser.getTelephone()); + super.saveOrUpdate(entity); + return entity; + } + + @Override + public OrderDeductionPointsDTO getMemberUsablePoints(Long memberId, BigDecimal orderAmount) { + TbMemberPoints entity = initMemberPoints(memberId); + Long shopId = entity.getShopId(); + Integer accountPoints = entity.getAccountPoints(); + OrderDeductionPointsDTO dto = new OrderDeductionPointsDTO(); + dto.setAccountPoints(accountPoints); + dto.setUsable(false); + dto.setMaxDeductionAmount(BigDecimal.ZERO); + dto.setMinDeductionAmount(BigDecimal.ZERO); + TbPointsBasicSetting basic = tbPointsBasicSettingMapper.selectOne(Wrappers.lambdaQuery().eq(TbPointsBasicSetting::getShopId, shopId)); + if (basic == null) { + dto.setUnusableReason("商家未启用积分抵扣功能"); + return dto; + } + if (basic.getEnableDeduction() == 0) { + dto.setUnusableReason("商家未启用积分抵扣功能"); + return dto; + } + dto.setMinDeductionPoints(basic.getMinDeductionPoint()); + if (accountPoints == 0 || accountPoints < basic.getMinDeductionPoint()) { + dto.setUnusableReason("积分不足或小于最低使用门槛" + basic.getMinDeductionPoint()); + return dto; + } + // 下单抵扣积分比例 1元=?积分 + Integer equivalentPoints = basic.getEquivalentPoints(); + // 计算账户积分=?元 + BigDecimal accountYuan = NumberUtil.div(accountPoints, equivalentPoints); + // 下单最高抵扣比例 + BigDecimal maxDeductionRatio = basic.getMaxDeductionRatio(); + // 计算订单最多可以抵扣多少元 + BigDecimal orderYuan = NumberUtil.mul(orderAmount, NumberUtil.div(maxDeductionRatio, new BigDecimal("100"))); + // 积分余额足够 + if (NumberUtil.isGreaterOrEqual(accountYuan, orderYuan)) { + dto.setMaxDeductionAmount(orderYuan); + } else { + dto.setMaxDeductionAmount(NumberUtil.roundDown(accountYuan, 2)); + } + if (NumberUtil.isLess(dto.getMaxDeductionAmount(), new BigDecimal("0.01"))) { + dto.setUnusableReason("积分不足0.01元,无法进行抵扣"); + return dto; + } + // 计算抵扣门槛=?元 + BigDecimal minYuan = NumberUtil.div(basic.getMinDeductionPoint(), equivalentPoints); + if (NumberUtil.isLess(minYuan, new BigDecimal("0.01"))) { + dto.setMinDeductionAmount(new BigDecimal("0.01")); + } else { + dto.setMinDeductionAmount(NumberUtil.roundDown(minYuan, 2)); + } + dto.setEquivalentPoints(equivalentPoints); + dto.setOrderAmount(orderAmount); + dto.setUsable(true); + // 计算最多可抵扣的积分 + BigDecimal mul = NumberUtil.mul(dto.getMaxDeductionAmount(), equivalentPoints); + BigDecimal round = NumberUtil.round(mul, 0, RoundingMode.CEILING); + dto.setMaxUsablePoints(round.intValue()); + return dto; + } + + @Override + public int calcUsedPoints(Long memberId, BigDecimal orderAmount, BigDecimal deductionAmount) { + OrderDeductionPointsDTO core = getMemberUsablePoints(memberId, orderAmount); + if (!core.getUsable()) { + throw new BadRequestException(core.getUnusableReason()); + } + if (NumberUtil.isGreater(deductionAmount, core.getMaxDeductionAmount())) { + throw new BadRequestException(StrUtil.format("抵扣金额不能超过最大抵扣金额{}元", core.getMaxDeductionAmount())); + } + if (NumberUtil.isGreater(deductionAmount, orderAmount)) { + throw new BadRequestException(StrUtil.format("抵扣金额不能超过订单金额{}元", orderAmount)); + } + // 计算可抵扣的积分 + BigDecimal mul = NumberUtil.mul(deductionAmount, core.getEquivalentPoints()); + BigDecimal round = NumberUtil.round(mul, 0, RoundingMode.CEILING); + return round.intValue(); + } + + @Override + public BigDecimal calcDeductionAmount(Long memberId, BigDecimal orderAmount, int points) { + OrderDeductionPointsDTO core = getMemberUsablePoints(memberId, orderAmount); + if (!core.getUsable()) { + throw new BadRequestException(core.getUnusableReason()); + } + if (points < core.getMinDeductionPoints()) { + throw new BadRequestException(StrUtil.format("使用积分不能低于使用门槛(每次最少使用{}积分)", core.getMinDeductionPoints())); + } + if (points > core.getMaxUsablePoints()) { + throw new BadRequestException(StrUtil.format("使用积分不能超过最大使用限制{}", core.getMaxUsablePoints())); + } + BigDecimal mul = NumberUtil.mul(new BigDecimal("0.01"), core.getEquivalentPoints()); + int minPoints = NumberUtil.round(mul, 0, RoundingMode.CEILING).intValue(); + if (points < minPoints) { + throw new BadRequestException(StrUtil.format("使用积分不能低于{}(0.01元)", minPoints)); + } + BigDecimal money = NumberUtil.mul(points, NumberUtil.div(BigDecimal.ONE, core.getEquivalentPoints())); + return NumberUtil.roundDown(money, 2); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean deductPoints(Long memberId, int points, String content, Long orderId) { + TbMemberPoints entity = initMemberPoints(memberId); + // 扣除账户积分 + entity.setAccountPoints(entity.getAccountPoints() - points); + entity.setLastPointsChangeTime(new Date()); + entity.setLastFloatPoints(-points); + + // 记录积分变动记录 + TbMemberPointsLog log = new TbMemberPointsLog(); + log.setShopId(entity.getShopId()); + log.setMemberId(entity.getMemberId()); + log.setMemberName(entity.getMemberName()); + log.setAvatarUrl(entity.getAvatarUrl()); + log.setMobile(entity.getMobile()); + log.setContent(content); + log.setFloatType("subtract"); + log.setFloatPoints(-points); + log.setCreateTime(new Date()); + // 有关联订单的需要回置订单表的相关积分使用字段 + if (orderId != null) { + TbOrderInfo orderInfo = tbOrderInfoMapper.selectById(orderId); + if (orderInfo != null) { + log.setOrderNo(orderInfo.getOrderNo()); + // TODO 是否需要回执“使用的积分数量(points_num)”和“积分抵扣金额(points_discount_amount)”,目前不清楚是创建订单的时候置入还是支付完成后回调时置入需要商议后决定 + } + } + super.updateById(entity); + tbMemberPointsLogMapper.insert(log); + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean addPoints(Long memberId, int points, String content, Long orderId) { + TbMemberPoints entity = initMemberPoints(memberId); + // 增加账户积分 + entity.setAccountPoints(entity.getAccountPoints() + points); + entity.setLastPointsChangeTime(new Date()); + entity.setLastFloatPoints(points); + // 记录积分变动记录 + TbMemberPointsLog log = new TbMemberPointsLog(); + log.setShopId(entity.getShopId()); + log.setMemberId(entity.getMemberId()); + log.setMemberName(entity.getMemberName()); + log.setAvatarUrl(entity.getAvatarUrl()); + log.setMobile(entity.getMobile()); + log.setContent(content); + log.setFloatType("add"); + log.setFloatPoints(points); + log.setCreateTime(new Date()); + // 有关联订单的需要回置订单表的相关积分使用字段 + if (orderId != null) { + TbOrderInfo orderInfo = tbOrderInfoMapper.selectById(orderId); + if (orderInfo != null) { + log.setOrderNo(orderInfo.getOrderNo()); + } + } + super.updateById(entity); + tbMemberPointsLogMapper.insert(log); + return true; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void consumeAwardPoints(Long memberId, Long orderId) { + TbOrderInfo orderInfo = tbOrderInfoMapper.selectById(orderId); + if (orderInfo == null) { + throw new BadRequestException("订单不存在"); + } + BigDecimal payAmount = orderInfo.getPayAmount(); + if (NumberUtil.isLessOrEqual(payAmount, BigDecimal.ZERO)) { + return; + } + TbPointsBasicSetting basicSetting = tbPointsBasicSettingService.getByShopId(Convert.toLong(orderInfo.getShopId())); + if (basicSetting == null) { + return; + } + Integer enableRewards = basicSetting.getEnableRewards(); + if (enableRewards == 0) { + return; + } + BigDecimal consumeAmount = basicSetting.getConsumeAmount(); + if (consumeAmount == null) { + return; + } + if (NumberUtil.isLessOrEqual(consumeAmount, BigDecimal.ZERO)) { + return; + } + BigDecimal awardPoints = NumberUtil.roundDown(NumberUtil.div(payAmount, consumeAmount), 0); + addPoints(memberId, awardPoints.intValue(), StrUtil.format("消费¥{}送{}积分", payAmount, awardPoints.intValue()), orderId); + } + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsBasicSettingServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsBasicSettingServiceImpl.java new file mode 100644 index 00000000..072bf653 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsBasicSettingServiceImpl.java @@ -0,0 +1,51 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.hutool.core.lang.Assert; +import cn.ysk.cashier.exception.BadRequestException; +import cn.ysk.cashier.mybatis.entity.TbPointsBasicSetting; +import cn.ysk.cashier.mybatis.mapper.TbPointsBasicSettingMapper; +import cn.ysk.cashier.mybatis.service.TbPointsBasicSettingService; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; + +/** + * 积分基本设置 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Service +public class TbPointsBasicSettingServiceImpl extends ServiceImpl implements TbPointsBasicSettingService { + + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean save(TbPointsBasicSetting entity) { + try { + Assert.notNull(entity.getShopId(), "{}({})不能为空", "店铺id","shopId"); + Assert.notNull(entity.getEnableRewards(), "{}({})不能为空", "开启消费赠送积分","enableRewards"); + Assert.notNull(entity.getConsumeAmount(), "{}({})不能为空", "每消费xx元赠送1积分","consumeAmount"); + Assert.notNull(entity.getEnableDeduction(), "{}({})不能为空", "开启下单积分抵扣","enableDeduction"); + Assert.notNull(entity.getMinDeductionPoint(), "{}({})不能为空", "下单积分抵扣门槛","minDeductionPoint"); + Assert.notNull(entity.getMaxDeductionRatio(), "{}({})不能为空", "下单最高抵扣比例","maxDeductionRatio"); + Assert.notNull(entity.getEquivalentPoints(), "{}({})不能为空", "下单抵扣积分比例","equivalentPoints"); + Assert.notNull(entity.getEnablePointsMall(), "{}({})不能为空", "开启积分商城","enablePointsMall"); + Assert.notEmpty(entity.getBrowseMode(), "{}({})不能为空", "浏览模式","browseMode"); + } catch (IllegalArgumentException e) { + throw new BadRequestException(e.getMessage()); + } + entity.setCreateTime(new Date()); + super.remove(Wrappers.lambdaQuery().eq(TbPointsBasicSetting::getShopId, entity.getShopId())); + super.save(entity); + return true; + } + + @Override + public TbPointsBasicSetting getByShopId(Long shopId) { + return super.getOne(Wrappers.lambdaQuery().eq(TbPointsBasicSetting::getShopId, shopId)); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java new file mode 100644 index 00000000..532f9e90 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java @@ -0,0 +1,195 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.map.MapProxy; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; +import cn.ysk.cashier.exception.BadRequestException; +import cn.ysk.cashier.mybatis.entity.*; +import cn.ysk.cashier.mybatis.mapper.*; +import cn.ysk.cashier.mybatis.service.TbPointsExchangeRecordService; +import cn.ysk.cashier.utils.PageUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 积分兑换记录 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Service +public class TbPointsExchangeRecordServiceImpl extends ServiceImpl implements TbPointsExchangeRecordService { + + @Resource + private TbPointsBasicSettingMapper tbPointsBasicSettingMapper; + + @Resource + private TbPointsGoodsSettingMapper tbPointsGoodsSettingMapper; + + @Resource + private TbMemberPointsMapper tbMemberPointsMapper; + + @Resource + private TbMemberPointsLogMapper tbMemberPointsLogMapper; + + private LambdaQueryWrapper getWrapper(Map params) { + MapProxy mapProxy = MapProxy.create(params); + String keywords = mapProxy.getStr("keywords"); + String beginDate = mapProxy.getStr("beginDate"); + String endDate = mapProxy.getStr("endDate"); + TbPointsExchangeRecord param = BeanUtil.toBean(params, TbPointsExchangeRecord.class); + + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.eq(TbPointsExchangeRecord::getShopId, param.getShopId()); + wrapper.eq(StrUtil.isNotEmpty(param.getPickupMethod()), TbPointsExchangeRecord::getPickupMethod, param.getPickupMethod()); + wrapper.eq(StrUtil.isNotEmpty(param.getStatus()), TbPointsExchangeRecord::getStatus, param.getStatus()); + wrapper.eq(param.getMemberId() != null, TbPointsExchangeRecord::getMemberId, param.getMemberId()); + if (StrUtil.isNotEmpty(keywords)) { + wrapper.nested(i -> i.like(TbPointsExchangeRecord::getOrderNo, keywords).or().like(TbPointsExchangeRecord::getCouponCode, keywords)); + } + if (StrUtil.isNotEmpty(beginDate)) { + wrapper.apply("create_time >= str_to_date({0}, '%Y-%m-%d %H:%i:%s')", beginDate + " 00:00:00"); + } + if (StrUtil.isNotEmpty(endDate)) { + wrapper.apply("create_time <= str_to_date({0}, '%Y-%m-%d %H:%i:%s')", endDate + " 23:59:59"); + } + wrapper.orderByDesc(TbPointsExchangeRecord::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); + LambdaQueryWrapper wrapper = getWrapper(params); + Page page = super.page(new Page<>(pageNum, pageSize), wrapper); + return PageUtil.toPlusPage(page.getRecords(), Convert.toInt(page.getTotal())); + } + + @Override + public TbPointsExchangeRecord get(Long id) { + return super.getById(id); + } + + @Override + public void checkout(String couponCode) { + if (StrUtil.isBlank(couponCode)) { + throw new BadRequestException("兑换券券码不能为空"); + } + TbPointsExchangeRecord entity = super.getOne(Wrappers.lambdaQuery().eq(TbPointsExchangeRecord::getCouponCode, couponCode)); + if (entity == null) { + throw new BadRequestException("兑换券券码无效"); + } + entity.setStatus("done"); + entity.setUpdateTime(new Date()); + super.updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public TbPointsExchangeRecord exchange(TbPointsExchangeRecord record) { + try { + Assert.notNull(record.getShopId(), "{}({})不能为空", "店铺id", "shopId"); + Assert.notNull(record.getPointsGoodsId(), "{}({})不能为空", "积分商品id", "pointsGoodsId"); + Assert.notEmpty(record.getPickupMethod(), "{}({})不能为空", "领取方式", "pickupMethod"); + Assert.notNull(record.getMemberId(), "{}({})不能为空", "会员id", "memberId"); + Assert.notEmpty(record.getMemberName(), "{}({})不能为空", "会员名称", "memberName"); + Assert.notEmpty(record.getMobile(), "{}({})不能为空", "手机号码", "mobile"); + } catch (IllegalArgumentException e) { + throw new BadRequestException(e.getMessage()); + } + TbPointsBasicSetting basic = tbPointsBasicSettingMapper.selectOne(Wrappers.lambdaQuery().eq(TbPointsBasicSetting::getShopId, record.getShopId())); + if (basic == null) { + throw new BadRequestException("未配置积分锁客基本设置"); + } + if (basic.getEnablePointsMall() != 1) { + throw new BadRequestException("积分商城未开启"); + } + TbPointsGoodsSetting goods = tbPointsGoodsSettingMapper.selectById(record.getPointsGoodsId()); + if (goods == null) { + throw new BadRequestException("兑换的商品信息不存在"); + } + record.setPointsGoodsName(goods.getGoodsName()); + record.setGoodsImageUrl(goods.getGoodsImageUrl()); + + Integer status = goods.getStatus(); + if (status != 1) { + throw new BadRequestException("兑换的商品已下架"); + } + Integer quantity = goods.getQuantity(); + if (quantity <= 0) { + throw new BadRequestException("兑换的商品库存不足"); + } + TbMemberPoints memberPoints = tbMemberPointsMapper.selectOne(Wrappers.lambdaQuery().eq(TbMemberPoints::getMobile, record.getMobile())); + if (memberPoints == null) { + throw new BadRequestException("该会员积分不足无法兑换这个商品"); + } + Integer accountPoints = memberPoints.getAccountPoints(); + Integer requiredPoints = goods.getRequiredPoints(); + if (accountPoints < requiredPoints) { + throw new BadRequestException("该会员积分不足无法兑换这个商品"); + } + BigDecimal extraPrice = goods.getExtraPrice(); + record.setExtraPaymentAmount(extraPrice); + record.setSpendPoints(requiredPoints); + Snowflake seqNo = IdUtil.getSnowflake(0, 0); + String orderNo = DateUtil.format(new Date(), "yyyyMMddHH") + StrUtil.subSuf(seqNo.nextIdStr(), -12); + record.setOrderNo(orderNo); + record.setCouponCode(IdUtil.getSnowflakeNextIdStr()); + record.setStatus("waiting"); + record.setCreateTime(new Date()); + // 生成订单 + super.save(record); + // 扣减积分 + memberPoints.setAccountPoints(accountPoints - requiredPoints); + memberPoints.setLastPointsChangeTime(new Date()); + memberPoints.setLastFloatPoints(-requiredPoints); + tbMemberPointsMapper.updateById(memberPoints); + // 扣减库存 + goods.setQuantity(quantity - 1); + goods.setUpdateTime(new Date()); + tbPointsGoodsSettingMapper.updateById(goods); + // 记录积分浮动流水 + TbMemberPointsLog log = new TbMemberPointsLog(); + log.setShopId(record.getShopId()); + log.setMemberId(record.getMemberId()); + log.setMemberName(record.getMemberName()); + log.setMobile(record.getMobile()); + log.setAvatarUrl(record.getAvatarUrl()); + log.setContent(StrUtil.format("兑换商品:{} * {}", record.getPointsGoodsName(), "1")); + log.setFloatType("subtract"); + log.setFloatPoints(-requiredPoints); + log.setCreateTime(new Date()); + tbMemberPointsLogMapper.insert(log); + return record; + } + + @Override + public Map total(Map params) { + LambdaQueryWrapper wrapper = getWrapper(params); + wrapper.select(TbPointsExchangeRecord::getCount, TbPointsExchangeRecord::getTotalAmount); + TbPointsExchangeRecord summary = baseMapper.selectOne(wrapper); + Map result = new HashMap<>(2); + result.put("count", summary.getCount()); + result.put("totalAmount", NumberUtil.null2Zero(summary.getTotalAmount())); + return result; + } + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsGoodsSettingServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsGoodsSettingServiceImpl.java new file mode 100644 index 00000000..65833485 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsGoodsSettingServiceImpl.java @@ -0,0 +1,94 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.map.MapProxy; +import cn.hutool.core.util.StrUtil; +import cn.ysk.cashier.exception.BadRequestException; +import cn.ysk.cashier.mybatis.entity.TbPointsGoodsSetting; +import cn.ysk.cashier.mybatis.mapper.TbPointsGoodsSettingMapper; +import cn.ysk.cashier.mybatis.service.TbPointsGoodsSettingService; +import cn.ysk.cashier.utils.PageUtil; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.Map; + +/** + * 积分商品设置 + * + * @author Tankaikai tankaikai@aliyun.com + * @since 2.0 2024-10-25 + */ +@Service +public class TbPointsGoodsSettingServiceImpl extends ServiceImpl implements TbPointsGoodsSettingService { + + + @Override + public Map page(Map params) { + MapProxy mapProxy = MapProxy.create(params); + int pageNum = mapProxy.getInt("page", 1); + int pageSize = mapProxy.getInt("size", 10); + TbPointsGoodsSetting param = BeanUtil.toBean(params, TbPointsGoodsSetting.class); + Page pg = new Page<>(pageNum, pageSize); + pg.addOrder(OrderItem.desc("sort")); + Page page = baseMapper.selectPage(pg, + Wrappers.lambdaQuery() + .eq(TbPointsGoodsSetting::getShopId, param.getShopId()) + .like(StrUtil.isNotEmpty(param.getGoodsName()), TbPointsGoodsSetting::getGoodsName, param.getGoodsName()) + .like(StrUtil.isNotEmpty(param.getGoodsCategory()), TbPointsGoodsSetting::getGoodsCategory, param.getGoodsCategory()) + .eq(param.getStatus() != null, TbPointsGoodsSetting::getStatus, param.getStatus()) + .orderByDesc(TbPointsGoodsSetting::getId) + ); + return PageUtil.toPlusPage(page.getRecords(), Convert.toInt(page.getTotal())); + } + + @Override + public boolean save(TbPointsGoodsSetting entity) { + try { + Assert.notNull(entity.getShopId(), "{}({})不能为空", "店铺id", "shopId"); + Assert.notEmpty(entity.getGoodsCategory(), "{}({})不能为空", "商品类型", "goodsCategory"); + Assert.notEmpty(entity.getGoodsName(), "{}({})不能为空", "商品名称", "goodsName"); + //Assert.notNull(entity.getGoodsImageUrl(), "{}({})不能为空", "商品图片URL","goodsImageUrl"); + Assert.notNull(entity.getRequiredPoints(), "{}({})不能为空", "所需积分", "requiredPoints"); + Assert.notNull(entity.getExtraPrice(), "{}({})不能为空", "额外价格", "extraPrice"); + Assert.notNull(entity.getSort(), "{}({})不能为空", "排序(权重)", "sort"); + Assert.notNull(entity.getQuantity(), "{}({})不能为空", "数量", "quantity"); + //Assert.notEmpty(entity.getGoodsDescription(), "{}({})不能为空", "商品详情","goodsDescription"); + Assert.notNull(entity.getStatus(), "{}({})不能为空", "是否上架", "status"); + } catch (IllegalArgumentException e) { + throw new BadRequestException(e.getMessage()); + } + entity.setCreateTime(new Date()); + return super.save(entity); + } + + @Override + public boolean update(TbPointsGoodsSetting dto) { + try { + Assert.notNull(dto.getId(), "{}不能为空", "商品id"); + Assert.notNull(dto.getShopId(), "{}({})不能为空", "店铺id", "shopId"); + Assert.notEmpty(dto.getGoodsCategory(), "{}({})不能为空", "商品类型", "goodsCategory"); + Assert.notEmpty(dto.getGoodsName(), "{}({})不能为空", "商品名称", "goodsName"); + //Assert.notNull(entity.getGoodsImageUrl(), "{}({})不能为空", "商品图片URL","goodsImageUrl"); + Assert.notNull(dto.getRequiredPoints(), "{}({})不能为空", "所需积分", "requiredPoints"); + Assert.notNull(dto.getExtraPrice(), "{}({})不能为空", "额外价格", "extraPrice"); + Assert.notNull(dto.getSort(), "{}({})不能为空", "排序(权重)", "sort"); + Assert.notNull(dto.getQuantity(), "{}({})不能为空", "数量", "quantity"); + //Assert.notEmpty(entity.getGoodsDescription(), "{}({})不能为空", "商品详情","goodsDescription"); + Assert.notNull(dto.getStatus(), "{}({})不能为空", "是否上架", "status"); + } catch (IllegalArgumentException e) { + throw new BadRequestException(e.getMessage()); + } + TbPointsGoodsSetting entity = super.getById(dto.getId()); + BeanUtil.copyProperties(dto, entity, CopyOptions.create().setIgnoreNullValue(false).setIgnoreProperties("createTime")); + entity.setUpdateTime(new Date()); + return super.updateById(entity); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/resources/mapper/plus/TbMemberPointsDao.xml b/eladmin-system/src/main/resources/mapper/plus/TbMemberPointsDao.xml new file mode 100644 index 00000000..2d0c97c1 --- /dev/null +++ b/eladmin-system/src/main/resources/mapper/plus/TbMemberPointsDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eladmin-system/src/main/resources/mapper/plus/TbMemberPointsLogDao.xml b/eladmin-system/src/main/resources/mapper/plus/TbMemberPointsLogDao.xml new file mode 100644 index 00000000..e491c1f3 --- /dev/null +++ b/eladmin-system/src/main/resources/mapper/plus/TbMemberPointsLogDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eladmin-system/src/main/resources/mapper/plus/TbPointsBasicSettingDao.xml b/eladmin-system/src/main/resources/mapper/plus/TbPointsBasicSettingDao.xml new file mode 100644 index 00000000..e9449ec2 --- /dev/null +++ b/eladmin-system/src/main/resources/mapper/plus/TbPointsBasicSettingDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eladmin-system/src/main/resources/mapper/plus/TbPointsExchangeRecordDao.xml b/eladmin-system/src/main/resources/mapper/plus/TbPointsExchangeRecordDao.xml new file mode 100644 index 00000000..c9e6387b --- /dev/null +++ b/eladmin-system/src/main/resources/mapper/plus/TbPointsExchangeRecordDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/eladmin-system/src/main/resources/mapper/plus/TbPointsGoodsSettingDao.xml b/eladmin-system/src/main/resources/mapper/plus/TbPointsGoodsSettingDao.xml new file mode 100644 index 00000000..120e2743 --- /dev/null +++ b/eladmin-system/src/main/resources/mapper/plus/TbPointsGoodsSettingDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 264da3c5b3080c656505a2a7b9c8349b29e667f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Tue, 29 Oct 2024 09:56:41 +0800 Subject: [PATCH 028/165] =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eladmin-system/pom.xml | 6 +- .../mybatis/entity/TbPointsGoodsSetting.java | 115 +++++++++--------- 2 files changed, 62 insertions(+), 59 deletions(-) diff --git a/eladmin-system/pom.xml b/eladmin-system/pom.xml index 33891504..2b543b9e 100644 --- a/eladmin-system/pom.xml +++ b/eladmin-system/pom.xml @@ -106,11 +106,13 @@ 6.1.4 + @@ -120,12 +122,12 @@ com.baomidou mybatis-plus-generator - 3.5.3.1 + 3.5.7 com.baomidou mybatis-plus-boot-starter - 3.5.3.1 + 3.5.7 diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java index d3292cfe..62fe7277 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java @@ -1,5 +1,6 @@ package cn.ysk.cashier.mybatis.entity; + import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import lombok.EqualsAndHashCode; @@ -14,64 +15,64 @@ import java.util.Date; * @since 2.0 2024-10-25 */ @Data -@EqualsAndHashCode(callSuper=false) +@EqualsAndHashCode(callSuper = false) @TableName("tb_points_goods_setting") public class TbPointsGoodsSetting { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * id - */ - @TableId(type = IdType.AUTO) - private Long id; - /** - * 店铺id - */ - private Long shopId; - /** - * 商品类型 physical-实物 coupon-优惠劵 - */ - private String goodsCategory; - /** - * 商品名称 - */ - private String goodsName; - /** - * 商品图片URL - */ - @TableField(updateStrategy = FieldStrategy.ALWAYS) - private String goodsImageUrl; - /** - * 所需积分 - */ - private Integer requiredPoints; - /** - * 额外价格 - */ - private BigDecimal extraPrice; - /** - * 排序(权重),数字越高,显示约靠前 - */ - private Integer sort; - /** - * 数量 - */ - private Integer quantity; - /** - * 商品详情 - */ - @TableField(updateStrategy = FieldStrategy.ALWAYS) - private String goodsDescription; - /** - * 是否上架 1-是 0-否 - */ - private Integer status; - /** - * 创建时间 - */ - private Date createTime; - /** - * 更新时间 - */ - private Date updateTime; + /** + * id + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * 店铺id + */ + private Long shopId; + /** + * 商品类型 physical-实物 coupon-优惠劵 + */ + private String goodsCategory; + /** + * 商品名称 + */ + private String goodsName; + /** + * 商品图片URL + */ + @TableField(value = "goods_image_url", updateStrategy = FieldStrategy.ALWAYS) + private String goodsImageUrl; + /** + * 所需积分 + */ + private Integer requiredPoints; + /** + * 额外价格 + */ + private BigDecimal extraPrice; + /** + * 排序(权重),数字越高,显示约靠前 + */ + private Integer sort; + /** + * 数量 + */ + private Integer quantity; + /** + * 商品详情 + */ + @TableField(value = "goods_description", updateStrategy = FieldStrategy.ALWAYS) + private String goodsDescription; + /** + * 是否上架 1-是 0-否 + */ + private Integer status; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; } \ No newline at end of file From 46be2c0f6389bcd4465291e5403035ff008dd4bc Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Tue, 29 Oct 2024 14:54:52 +0800 Subject: [PATCH 029/165] =?UTF-8?q?fix:=20=E9=80=80=E6=AC=BE=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E4=B8=8D=E5=87=86=E7=A1=AE=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/shopimpl/TbShopTableServiceImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index ef17fb6c..82b93771 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -2033,7 +2033,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { } - private TbOrderInfo updateReturnOrderInfo(ReturnOrderDTO returnOrderDTO, TbOrderInfo oldOrderInfo, boolean isOnline) { + private HashMap updateReturnOrderInfo(ReturnOrderDTO returnOrderDTO, TbOrderInfo oldOrderInfo, boolean isOnline) { ArrayList detailIds = new ArrayList<>(); HashMap returnNumMap = new HashMap<>(); returnOrderDTO.getOrderDetails().forEach(item -> { @@ -2127,7 +2127,10 @@ public class TbShopTableServiceImpl implements TbShopTableService { updateStockAndRecord(detailList); mpOrderDetailService.updateBatchById(detailList); - return returnOrder; + HashMap data = new HashMap<>(); + data.put("returnOrder", returnOrder); + data.put("returnAmount", returnAmount); + return data; } private void updateStockAndRecord(List orderDetailList) { @@ -2187,7 +2190,9 @@ public class TbShopTableServiceImpl implements TbShopTableService { // TODO 密码校验 } - TbOrderInfo returnOrderInfo = updateReturnOrderInfo(returnOrderDTO, orderInfo, true); + HashMap returnInfoData = updateReturnOrderInfo(returnOrderDTO, orderInfo, true); + TbOrderInfo returnOrderInfo = (TbOrderInfo) returnInfoData.get("returnOrder"); + BigDecimal returnAmount = (BigDecimal) returnInfoData.get("returnAmount"); String shopId = orderInfo.getShopId(); String payType = orderInfo.getPayType(); @@ -2199,7 +2204,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { orderInfo.setStatus("refund"); // 储值卡支付退款 } else if ("deposit".equals(payType)) { - orderInfoService.depositReturn(Integer.valueOf(orderInfo.getUserId()), Integer.valueOf(orderInfo.getShopId()), returnOrderInfo.getRefundAmount()); + orderInfoService.depositReturn(Integer.valueOf(orderInfo.getUserId()), Integer.valueOf(orderInfo.getShopId()), returnAmount); orderInfo.setStatus("refund"); mpOrderDetailService.updateStatusByOrderIdAndIds(OrderStatusEnums.REFUNDING, OrderStatusEnums.REFUND, returnOrderDTO.getOrderId(), returnOrderDTO.getOrderDetails().stream().map(ReturnOrderDTO.OrderDetail::getId).collect(Collectors.toList())); From 5cb7e9bdfb553ac921bef10badb33653370ac6f6 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Wed, 30 Oct 2024 14:52:52 +0800 Subject: [PATCH 030/165] =?UTF-8?q?=E9=94=80=E5=94=AE=E7=BB=9F=E8=AE=A1=20?= =?UTF-8?q?=E6=95=88=E7=8E=87=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/SummaryByDayController.java | 2 + .../order/TbOrderDetailRepository.java | 9 ++-- .../service/impl/SummaryServiceImpl.java | 51 ++++++++++++++++--- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryByDayController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryByDayController.java index 315888f7..28592d0f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryByDayController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryByDayController.java @@ -1,5 +1,6 @@ package cn.ysk.cashier.controller.shop; +import cn.ysk.cashier.annotation.rest.AnonymousGetMapping; import cn.ysk.cashier.dto.ShopSummaryDto; import cn.ysk.cashier.service.SummaryService; import cn.ysk.cashier.vo.TbOrderPayCountVo; @@ -33,6 +34,7 @@ public class SummaryByDayController { @GetMapping + @AnonymousGetMapping public Page shopSummary(ShopSummaryDto summaryDto, @RequestParam(required = false, defaultValue = "0") Integer page, @RequestParam(required = false, defaultValue = "10") Integer size) { diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/order/TbOrderDetailRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/order/TbOrderDetailRepository.java index fe3ab82f..8429d37f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/order/TbOrderDetailRepository.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/repository/order/TbOrderDetailRepository.java @@ -36,7 +36,7 @@ public interface TbOrderDetailRepository extends JpaRepository searchDetailByOrderIds(@Param("ids")List ids); @Query("SELECT new cn.ysk.cashier.vo.TbOrderSalesCountByDayV2Vo(" + - "info.productName,pro.id, cate.name,'', " + + "info.productName,pro.id, cate.name,pro.typeEnum, " + "SUM(CASE WHEN orders.orderType!='return' THEN info.num ELSE 0 END) as salesNum, " + "SUM(CASE WHEN orders.orderType='return' THEN info.num ELSE 0 END), " + "SUM(CASE WHEN orders.orderType!='return' THEN info.priceAmount ELSE 0 END), " + @@ -82,15 +82,16 @@ public interface TbOrderDetailRepository extends JpaRepository :startTime AND info.createTime < :endTime " + "AND (info.status = 'closed' OR info.status = 'refund') " + "GROUP BY info.productId, info.productSkuId " + "ORDER BY salesNum DESC") - List queryTbOrderSalesCountBySku(@Param("shopId") Integer shopId,@Param("proId")Integer proId, @Param("startTime") Date startTime, @Param("endTime") Date endTime); - + List queryTbOrderSalesCountBySku(@Param("shopId") Integer shopId + , @Param("startTime") Date startTime, @Param("endTime") Date endTime); @Query("SELECT new cn.ysk.cashier.vo.TbOrderSalesCountByDayVo(" + "info.productName, info.productSkuName, cate.name, unit.name,info.price," + "SUM(CASE WHEN orders.orderType!='return' THEN info.num ELSE 0 END) as salesNum, " + 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 b89fe541..aacb65f7 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 @@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -35,6 +36,7 @@ import java.time.Instant; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.concurrent.CompletableFuture; import java.util.function.Function; import java.util.stream.Collectors; @@ -333,12 +335,45 @@ public class SummaryServiceImpl implements SummaryService { summaryDto.setStartTime(DateUtil.toDate(DateUtil.fromTimeStamp(1704038400L))); summaryDto.setEndTime(new Date()); } - Page products = detailRepository.queryTbOrderSalesCountByProduct(Integer.valueOf(summaryDto.getShopId()), summaryDto.getCateId(), summaryDto.getProName(), summaryDto.getStartTime(), summaryDto.getEndTime(), pageable); - for (TbOrderSalesCountByDayV2Vo product : products) { - List skus = detailRepository.queryTbOrderSalesCountBySku(Integer.valueOf(summaryDto.getShopId()), product.getProductId(), summaryDto.getStartTime(), summaryDto.getEndTime()); - product.setSkus(skus); + + // 使用 CompletableFuture 并行执行两个数据库查询 + CompletableFuture> productsFuture = CompletableFuture.supplyAsync(() -> { + try { + return detailRepository.queryTbOrderSalesCountByProduct(Integer.valueOf(summaryDto.getShopId()), summaryDto.getCateId(), summaryDto.getProName(), summaryDto.getStartTime(), summaryDto.getEndTime(), pageable); + } catch (Exception e) { + log.error("查询 products 时发生错误", e); + return null; + } + }); + CompletableFuture> skusFuture = CompletableFuture.supplyAsync(() -> { + try { + return detailRepository.queryTbOrderSalesCountBySku(Integer.valueOf(summaryDto.getShopId()), summaryDto.getStartTime(), summaryDto.getEndTime()); + } catch (Exception e) { + log.error("查询 skus 时发生错误", e); + return null; + } + }); + try { + // 等待两个查询都完成后执行后续逻辑 + return CompletableFuture.allOf(productsFuture, skusFuture).thenApply(v -> { + Page products = productsFuture.join(); + List skus = skusFuture.join(); + if (products!= null && skus!= null) { + Map> collect = skus.stream().collect(Collectors.groupingBy(TbOrderSalesCountByDayV2Vo::getProductId)); + for (TbOrderSalesCountByDayV2Vo product : products) { + if ("sku".equals(product.getTypeEnum())) { + product.setSkus(collect.get(product.getProductId())); + } + } + return (Page) products; + } else { + return null; + } + }).join(); + } catch (Exception e) { + log.error("处理查询结果时发生错误", e); + return null; } - return (Page)products; } @Override @@ -353,10 +388,12 @@ public class SummaryServiceImpl implements SummaryService { } List products = detailRepository.queryTbOrderSalesCountByProduct(Integer.valueOf(summaryDto.getShopId()), summaryDto.getCateId(), summaryDto.getProName(), summaryDto.getStartTime(), summaryDto.getEndTime()); + List proSkus = detailRepository.queryTbOrderSalesCountBySku(Integer.valueOf(summaryDto.getShopId()), + summaryDto.getStartTime(), summaryDto.getEndTime()); + Map> collect = proSkus.stream().collect(Collectors.groupingBy(TbOrderSalesCountByDayV2Vo::getProductId)); for (TbOrderSalesCountByDayV2Vo product : products) { if("sku".equals(product.getTypeEnum())){ - List skus = detailRepository.queryTbOrderSalesCountBySku(Integer.valueOf(summaryDto.getShopId()), product.getProductId(), summaryDto.getStartTime(), summaryDto.getEndTime()); - product.setSkus(skus); + product.setSkus(collect.get(product.getProductId())); } } for (TbOrderSalesCountByDayV2Vo product : products) { From 7c1415663d9b3f01931a9b50e539a4fe1d0517c6 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 30 Oct 2024 15:04:17 +0800 Subject: [PATCH 031/165] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A0?= =?UTF-8?q?=E5=8F=B0=E6=A1=8C=E5=88=87=E6=8D=A2=E5=B0=B1=E9=A4=90=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E8=B4=AD=E7=89=A9=E8=BD=A6=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index bffc184e..121a430e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -2024,12 +2024,12 @@ public class TbShopTableServiceImpl implements TbShopTableService { .in(TbCashierCart::getId, choseModelDTO.getCartIds()) .eq(TbCashierCart::getShopId, choseModelDTO.getShopId()) .set(TbCashierCart::getTableId, choseModelDTO.getTableId()) - .set(TbCashierCart::getUseType, choseModelDTO.getUseType()) + .set(TbCashierCart::getUseType, StrUtil.isNotBlank(choseModelDTO.getTableId()) ? choseModelDTO.getUseType() : TableConstant.OrderInfo.UseType.NONE_TABLE.getValue()) .set(TbCashierCart::getIsPack, "false") .set(TbCashierCart::getPackFee, BigDecimal.ZERO)); return orderDetailMapper.update(null, new LambdaUpdateWrapper() .in(TbOrderDetail::getCartId, choseModelDTO.getCartIds()) - .set(TbOrderDetail::getUseType, choseModelDTO.getUseType()) + .set(TbOrderDetail::getUseType, StrUtil.isNotBlank(choseModelDTO.getTableId()) ? choseModelDTO.getUseType() : TableConstant.OrderInfo.UseType.NONE_TABLE.getValue()) .set(TbOrderDetail::getPackAmount, BigDecimal.ZERO)); } From dcfb79c87af49afb79d597814d3fb48e16eb1853 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Wed, 30 Oct 2024 15:11:38 +0800 Subject: [PATCH 032/165] =?UTF-8?q?=E8=80=97=E6=9D=90=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=88=97=E8=A1=A8=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/cons/service/impl/TbConsInfoFlowServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) 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 b8be6ec8..78f0b2d7 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 @@ -114,6 +114,8 @@ public class TbConsInfoFlowServiceImpl implements TbConsInfoFlowService { criteria.setBizCode(Arrays.asList("stockIn","cancelCart","init","stockIn","checkStockIn","stockOtherIn","cancelCart","createCart","stockout","checkStockOut","frmLoss")); break; } + }else { + criteria.setBizCode(Arrays.asList("stockIn","cancelCart","init","stockIn","checkStockIn","stockOtherIn","cancelCart","createCart","stockout","checkStockOut","frmLoss")); } Sort sort = Sort.by(Sort.Direction.DESC, "id"); Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort); From 40b63bff4d53931d10e3fc3f84cf46215183e090 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Wed, 30 Oct 2024 15:24:43 +0800 Subject: [PATCH 033/165] =?UTF-8?q?=E5=89=AF=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/cons/domain/SuppFlow.java | 2 + .../ysk/cashier/cons/domain/TbConsInfo.java | 7 + .../ysk/cashier/cons/domain/TbConsInfoV2.java | 10 +- .../cashier/cons/domain/ViewConsSuppFlow.java | 139 ------------------ .../cons/repository/TbConUnitRepository.java | 13 -- .../ViewConsSuppFlowRepository.java | 13 -- .../cons/rest/TbConUnitController.java | 82 ----------- .../cons/rest/ViewConsSuppFlowController.java | 64 -------- .../cons/service/TbConUnitService.java | 70 --------- .../cons/service/ViewConsSuppFlowService.java | 66 --------- .../cons/service/dto/TbConUnitDto.java | 52 ------- .../service/dto/TbConUnitQueryCriteria.java | 25 ---- .../cons/service/dto/TbConsInfoDto.java | 21 +-- .../cons/service/dto/ViewConsSuppFlowDto.java | 87 ----------- .../dto/ViewConsSuppFlowQueryCriteria.java | 43 ------ .../service/impl/TbConUnitServiceImpl.java | 138 ----------------- .../service/impl/TbConsInfoServiceImpl.java | 31 ++-- .../impl/ViewConsSuppFlowServiceImpl.java | 109 -------------- .../service/mapstruct/TbConUnitMapper.java | 16 -- .../mapstruct/ViewConsSuppFlowMapper.java | 16 -- 20 files changed, 40 insertions(+), 964 deletions(-) delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConsSuppFlow.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/repository/TbConUnitRepository.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/repository/ViewConsSuppFlowRepository.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConUnitController.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConsSuppFlowController.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/service/TbConUnitService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/service/ViewConsSuppFlowService.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConUnitDto.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConUnitQueryCriteria.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConsSuppFlowDto.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConsSuppFlowQueryCriteria.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConUnitServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConsSuppFlowServiceImpl.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/service/mapstruct/TbConUnitMapper.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/cons/service/mapstruct/ViewConsSuppFlowMapper.java diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/SuppFlow.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/SuppFlow.java index a41b2991..3baa92e7 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/SuppFlow.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/SuppFlow.java @@ -31,6 +31,8 @@ public class SuppFlow implements Serializable { public static class ConInfos{ private Integer conInfoId; + private String unit; + private BigDecimal price; private BigDecimal stockNumber; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java index f28ad88e..e2231b25 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java @@ -53,6 +53,13 @@ public class TbConsInfo implements Serializable { @ApiModelProperty(value = "单位值") private String conUnit; + @Column(name = "`con_unit_two`") + @ApiModelProperty(value = "单位值") + private String conUnitTwo; + + @Column(name = "`con_unit_two_convert`") + @ApiModelProperty(value = "单位换算") + private BigDecimal conUnitTwoConvert; @Column(name = "`laster_in_stock`") @ApiModelProperty(value = "最近一次入库量") diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoV2.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoV2.java index 6696efb4..111aeb04 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoV2.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoV2.java @@ -47,7 +47,7 @@ public class TbConsInfoV2 implements Serializable { @ApiModelProperty(value = "库存值") private BigDecimal stockNumber; -// @Column(name = "`balance`") + // @Column(name = "`balance`") @ApiModelProperty(value = "实际库存值") private BigDecimal balance; @@ -55,6 +55,14 @@ public class TbConsInfoV2 implements Serializable { @ApiModelProperty(value = "单位值") private String conUnit; + @Column(name = "`con_unit_two`") + @ApiModelProperty(value = "单位值") + private String conUnitTwo; + + @Column(name = "`con_unit_two_convert`") + @ApiModelProperty(value = "单位换算") + private BigDecimal conUnitTwoConvert; + @Column(name = "`laster_in_stock`") @ApiModelProperty(value = "最近一次入库量") diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConsSuppFlow.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConsSuppFlow.java deleted file mode 100644 index 0aa98001..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/ViewConsSuppFlow.java +++ /dev/null @@ -1,139 +0,0 @@ -/* -* 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.domain; - -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 javax.validation.constraints.*; -import java.sql.Timestamp; -import java.math.BigDecimal; -import java.io.Serializable; - -/** -* @author admin -* @date 2024-07-03 -**/ -@Entity -@Data -@Table(name="view_cons_supp_flow") -public class ViewConsSuppFlow implements Serializable { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "`id`") - @ApiModelProperty(value = "id") - private Integer id; - - @Column(name = "`con_info_id`",nullable = false) - @NotNull - @ApiModelProperty(value = "conInfoId") - private Integer conInfoId; - - @Column(name = "`shop_id`") - @ApiModelProperty(value = "店铺id") - private Integer shopId; - - @Column(name = "`sku_id`") - @ApiModelProperty(value = "skuId") - private Integer skuId; - - @Column(name = "`product_id`") - @ApiModelProperty(value = "productId") - private Integer productId; - - @Column(name = "`supplier_id`",nullable = false) - @NotNull - @ApiModelProperty(value = "supplierId") - private Integer supplierId; - - @Column(name = "`type`",nullable = false) - @NotBlank - @ApiModelProperty(value = "出入库类型: in 入库 out 出库") - private String type; - - @Column(name = "`stock_number`",nullable = false) - @NotNull - @ApiModelProperty(value = "数量") - private BigDecimal stockNumber; - - @Column(name = "`price`",nullable = false) - @NotNull - @ApiModelProperty(value = "进价") - private BigDecimal price; - - @Column(name = "`amount`",nullable = false) - @NotNull - @ApiModelProperty(value = "小计") - private BigDecimal amount; - - @Column(name = "`balance`",nullable = false) - @NotNull - @ApiModelProperty(value = "剩余库存") - private BigDecimal balance; - - @Column(name = "`accounts_payable`",nullable = false) - @NotNull - @ApiModelProperty(value = "应付款") - private BigDecimal accountsPayable; - - @Column(name = "`actual_payment`",nullable = false) - @NotNull - @ApiModelProperty(value = "实付款") - private BigDecimal actualPayment; - - @Column(name = "`payment_time`") - @ApiModelProperty(value = "paymentTime") - private Timestamp paymentTime; - - @Column(name = "`create_time`") - @ApiModelProperty(value = "createTime") - private Timestamp createTime; - - @Column(name = "`update_time`") - @ApiModelProperty(value = "updateTime") - private Timestamp updateTime; - - @Column(name = "`con_name`") - @ApiModelProperty(value = "耗材名称") - private String conName; - - @Column(name = "`con_code`") - @ApiModelProperty(value = "耗材代码") - private String conCode; - - @Column(name = "`con_type_name`") - @ApiModelProperty(value = "耗材类型名称") - private String conTypeName; - - @Column(name = "`purveyor_name`") - @ApiModelProperty(value = "联系人名字") - private String purveyorName; - - @Column(name = "`address`") - @ApiModelProperty(value = "供应商地址") - private String address; - - @Column(name = "`purveyor_telephone`") - @ApiModelProperty(value = "联系人电话") - private String purveyorTelephone; - - public void copy(ViewConsSuppFlow source){ - BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); - } -} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/repository/TbConUnitRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/repository/TbConUnitRepository.java deleted file mode 100644 index c18295b6..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/repository/TbConUnitRepository.java +++ /dev/null @@ -1,13 +0,0 @@ -package cn.ysk.cashier.cons.repository; - -import cn.ysk.cashier.cons.domain.TbConUnit; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2024-07-12 -**/ -public interface TbConUnitRepository extends JpaRepository, JpaSpecificationExecutor { -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/repository/ViewConsSuppFlowRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/repository/ViewConsSuppFlowRepository.java deleted file mode 100644 index ca6903b8..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/repository/ViewConsSuppFlowRepository.java +++ /dev/null @@ -1,13 +0,0 @@ -package cn.ysk.cashier.cons.repository; - -import cn.ysk.cashier.cons.domain.ViewConsSuppFlow; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2024-07-03 -**/ -public interface ViewConsSuppFlowRepository extends JpaRepository, JpaSpecificationExecutor { -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConUnitController.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConUnitController.java deleted file mode 100644 index 1b572f8c..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/TbConUnitController.java +++ /dev/null @@ -1,82 +0,0 @@ -package cn.ysk.cashier.cons.rest; - -import cn.hutool.core.util.ObjectUtil; -import cn.ysk.cashier.annotation.Log; -import cn.ysk.cashier.cons.domain.TbConUnit; -import cn.ysk.cashier.cons.service.TbConUnitService; -import cn.ysk.cashier.cons.service.dto.TbConUnitQueryCriteria; -import org.springframework.data.domain.Pageable; -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 java.sql.Timestamp; -import java.util.Objects; -import javax.servlet.http.HttpServletResponse; - -/** -* @author admin -* @date 2024-07-12 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "耗材单位添加管理") -@RequestMapping("/api/tbConUnit") -public class TbConUnitController { - - private final TbConUnitService tbConUnitService; - - @Log("导出数据") - @ApiOperation("导出数据") - @GetMapping(value = "/download") - public void exportTbConUnit(HttpServletResponse response, TbConUnitQueryCriteria criteria) throws IOException { - tbConUnitService.download(tbConUnitService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询耗材单位添加") - public ResponseEntity queryTbConUnit(TbConUnitQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(tbConUnitService.queryAll(criteria,pageable),HttpStatus.OK); - } - - @PostMapping - @Log("新增耗材单位添加") - @ApiOperation("新增耗材单位添加") - public ResponseEntity createTbConUnit(@Validated @RequestBody TbConUnit resources){ - - if(ObjectUtil.isEmpty(resources.getParentId())|| Objects.isNull(resources.getParentId())){ - resources.setParentId(0); - } - resources.setStatus("0"); - resources.setCreateTime(new Timestamp(System.currentTimeMillis())); - return new ResponseEntity<>(tbConUnitService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @Log("修改耗材单位添加") - @ApiOperation("修改耗材单位添加") - public ResponseEntity updateTbConUnit(@Validated @RequestBody TbConUnit resources){ - - resources.setUpdateTime(new Timestamp(System.currentTimeMillis())); - tbConUnitService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @Log("删除耗材单位添加") - @ApiOperation("删除耗材单位添加") - public ResponseEntity deleteTbConUnit(@RequestBody Integer[] ids) { - tbConUnitService.deleteAll(ids); - return new ResponseEntity<>(HttpStatus.OK); - } - - - - @RequestMapping("queryTbConUnitInfo") - public ResponseEntity queryTbConUnitInfo(TbConUnitQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(tbConUnitService.queryAllInfo(criteria,pageable),HttpStatus.OK); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConsSuppFlowController.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConsSuppFlowController.java deleted file mode 100644 index 2c51372b..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/rest/ViewConsSuppFlowController.java +++ /dev/null @@ -1,64 +0,0 @@ -package cn.ysk.cashier.cons.rest; - -import cn.ysk.cashier.annotation.Log; -import cn.ysk.cashier.cons.domain.ViewConsSuppFlow; -import cn.ysk.cashier.cons.service.ViewConsSuppFlowService; -import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowQueryCriteria; -import org.springframework.data.domain.Pageable; -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; - -/** -* @author admin -* @date 2024-07-03 -**/ -@RestController -@RequiredArgsConstructor -@Api(tags = "出入库记录管理") -@RequestMapping("/api/viewConsSuppFlow") -public class ViewConsSuppFlowController { - - private final ViewConsSuppFlowService viewConsSuppFlowService; - - @Log("导出数据") - @ApiOperation("导出数据") - @GetMapping(value = "/download") - public void exportViewConsSuppFlow(HttpServletResponse response, ViewConsSuppFlowQueryCriteria criteria) throws IOException { - viewConsSuppFlowService.download(viewConsSuppFlowService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询出入库记录") - public ResponseEntity queryViewConsSuppFlow(ViewConsSuppFlowQueryCriteria criteria, Pageable pageable){ - return new ResponseEntity<>(viewConsSuppFlowService.queryAll(criteria,pageable),HttpStatus.OK); - } - - @PostMapping - @Log("新增出入库记录") - @ApiOperation("新增出入库记录") - public ResponseEntity createViewConsSuppFlow(@Validated @RequestBody ViewConsSuppFlow resources){ - return new ResponseEntity<>(viewConsSuppFlowService.create(resources),HttpStatus.CREATED); - } - - @PutMapping - @Log("修改出入库记录") - @ApiOperation("修改出入库记录") - public ResponseEntity updateViewConsSuppFlow(@Validated @RequestBody ViewConsSuppFlow resources){ - viewConsSuppFlowService.update(resources); - return new ResponseEntity<>(HttpStatus.NO_CONTENT); - } - - @DeleteMapping - @Log("删除出入库记录") - @ApiOperation("删除出入库记录") - public ResponseEntity deleteViewConsSuppFlow(@RequestBody Integer[] ids) { - viewConsSuppFlowService.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/service/TbConUnitService.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/TbConUnitService.java deleted file mode 100644 index 57f11561..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/TbConUnitService.java +++ /dev/null @@ -1,70 +0,0 @@ -package cn.ysk.cashier.cons.service; - -import cn.ysk.cashier.cons.domain.TbConUnit; -import cn.ysk.cashier.cons.service.dto.TbConUnitDto; -import cn.ysk.cashier.cons.service.dto.TbConUnitQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @author admin -* @date 2024-07-12 -**/ -public interface TbConUnitService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(TbConUnitQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(TbConUnitQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return TbConUnitDto - */ - TbConUnitDto findById(Integer id); - - /** - * 创建 - * @param resources / - * @return TbConUnitDto - */ - TbConUnitDto create(TbConUnit resources); - - /** - * 编辑 - * @param resources / - */ - void update(TbConUnit resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Integer[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; - - - - Map queryAllInfo(TbConUnitQueryCriteria criteria, Pageable pageable); -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/ViewConsSuppFlowService.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/ViewConsSuppFlowService.java deleted file mode 100644 index f3710e55..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/ViewConsSuppFlowService.java +++ /dev/null @@ -1,66 +0,0 @@ -package cn.ysk.cashier.cons.service; - -import cn.ysk.cashier.cons.domain.ViewConsSuppFlow; -import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowDto; -import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowQueryCriteria; -import org.springframework.data.domain.Pageable; -import java.util.Map; -import java.util.List; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @author admin -* @date 2024-07-03 -**/ -public interface ViewConsSuppFlowService { - - /** - * 查询数据分页 - * @param criteria 条件 - * @param pageable 分页参数 - * @return Map - */ - Map queryAll(ViewConsSuppFlowQueryCriteria criteria, Pageable pageable); - - /** - * 查询所有数据不分页 - * @param criteria 条件参数 - * @return List - */ - List queryAll(ViewConsSuppFlowQueryCriteria criteria); - - /** - * 根据ID查询 - * @param id ID - * @return ViewConsSuppFlowDto - */ - ViewConsSuppFlowDto findById(Integer id); - - /** - * 创建 - * @param resources / - * @return ViewConsSuppFlowDto - */ - ViewConsSuppFlowDto create(ViewConsSuppFlow resources); - - /** - * 编辑 - * @param resources / - */ - void update(ViewConsSuppFlow resources); - - /** - * 多选删除 - * @param ids / - */ - void deleteAll(Integer[] ids); - - /** - * 导出数据 - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConUnitDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConUnitDto.java deleted file mode 100644 index 83f0b899..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConUnitDto.java +++ /dev/null @@ -1,52 +0,0 @@ -/* -* 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 javax.validation.constraints.NotNull; -import java.sql.Timestamp; -import java.math.BigDecimal; -import java.io.Serializable; - -/** -* @author admin -* @date 2024-07-12 -**/ -@Data -public class TbConUnitDto implements Serializable { - - private Integer id; - - /** 主单位名称 */ - private String name; - - /** 主单位值 */ - private BigDecimal value; - - private Integer parentId; - - private String isConsume; - - /** 状态 1 启用 0 禁用 */ - private String status; - - private Timestamp createTime; - - private Timestamp updateTime; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConUnitQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConUnitQueryCriteria.java deleted file mode 100644 index 17259f4f..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConUnitQueryCriteria.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.ysk.cashier.cons.service.dto; - -import lombok.Data; -import java.util.List; -import cn.ysk.cashier.annotation.Query; - -/** -* @author admin -* @date 2024-07-12 -**/ -@Data -public class TbConUnitQueryCriteria{ - - /** 模糊 */ - @Query(type = Query.Type.INNER_LIKE) - private String name; - - /** 精确 */ - @Query - private Integer parentId; - - /** 精确 */ - @Query - private String status; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java index d4773b5b..a4b0bf17 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java @@ -1,24 +1,7 @@ -/* -* 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; @@ -53,6 +36,10 @@ public class TbConsInfoDto implements Serializable { /** 单位值 */ private String conUnit; + private String conUnitTwo; + + private BigDecimal conUnitTwoConvert; + /** 最近一次入库量 */ private BigDecimal lasterInStock; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConsSuppFlowDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConsSuppFlowDto.java deleted file mode 100644 index e71a6a13..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConsSuppFlowDto.java +++ /dev/null @@ -1,87 +0,0 @@ -/* -* 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 lombok.Data; -import java.sql.Timestamp; -import java.math.BigDecimal; -import java.io.Serializable; - -/** -* @author admin -* @date 2024-07-03 -**/ -@Data -public class ViewConsSuppFlowDto implements Serializable { - - private Integer id; - - private Integer conInfoId; - - /** 店铺id */ - private Integer shopId; - - private Integer skuId; - - private Integer productId; - - private Integer supplierId; - - /** 出入库类型: in 入库 out 出库 */ - private String type; - - /** 数量 */ - private BigDecimal stockNumber; - - /** 进价 */ - private BigDecimal price; - - /** 小计 */ - private BigDecimal amount; - - /** 剩余库存 */ - private BigDecimal balance; - - /** 应付款 */ - private BigDecimal accountsPayable; - - /** 实付款 */ - private BigDecimal actualPayment; - - private Timestamp paymentTime; - - private Timestamp createTime; - - private Timestamp updateTime; - - /** 耗材名称 */ - private String conName; - - /** 耗材代码 */ - private String conCode; - - /** 耗材类型名称 */ - private String conTypeName; - - /** 联系人名字 */ - private String purveyorName; - - /** 供应商地址 */ - private String address; - - /** 联系人电话 */ - private String purveyorTelephone; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConsSuppFlowQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConsSuppFlowQueryCriteria.java deleted file mode 100644 index b36dccdc..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/ViewConsSuppFlowQueryCriteria.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.ysk.cashier.cons.service.dto; - -import cn.ysk.cashier.utils.JSONUtil; -import lombok.Data; -import java.util.List; -import cn.ysk.cashier.annotation.Query; - -/** -* @author admin -* @date 2024-07-03 -**/ -@Data -public class ViewConsSuppFlowQueryCriteria{ - - /** 精确 */ - @Query - private Integer conInfoId; - - /** 精确 */ - @Query - private String type; - - /** 模糊 */ - @Query(type = Query.Type.INNER_LIKE) - private String conName; - - /** 精确 */ - @Query - private String conCode; - - /** 精确 */ - @Query - private String conTypeName; - - /** 模糊 */ - @Query(type = Query.Type.INNER_LIKE) - private String purveyorName; - - - public static void main(String[] args){ - System.out.println(JSONUtil.toJSONString(new ViewConsSuppFlowQueryCriteria())); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConUnitServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConUnitServiceImpl.java deleted file mode 100644 index ac7d4697..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConUnitServiceImpl.java +++ /dev/null @@ -1,138 +0,0 @@ -package cn.ysk.cashier.cons.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import cn.ysk.cashier.cons.domain.TbConUnit; -import cn.ysk.cashier.cons.service.dto.ConUnitPO; -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 lombok.RequiredArgsConstructor; -import cn.ysk.cashier.cons.repository.TbConUnitRepository; -import cn.ysk.cashier.cons.service.TbConUnitService; -import cn.ysk.cashier.cons.service.dto.TbConUnitDto; -import cn.ysk.cashier.cons.service.dto.TbConUnitQueryCriteria; -import cn.ysk.cashier.cons.service.mapstruct.TbConUnitMapper; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; - -import java.util.*; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author admin -* @date 2024-07-12 -**/ -@Service -@RequiredArgsConstructor -public class TbConUnitServiceImpl implements TbConUnitService { - - private final TbConUnitRepository tbConUnitRepository; - private final TbConUnitMapper tbConUnitMapper; - - @Override - public Map queryAll(TbConUnitQueryCriteria criteria, Pageable pageable){ - Page page = tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(tbConUnitMapper::toDto)); - } - - @Override - public List queryAll(TbConUnitQueryCriteria criteria){ - return tbConUnitMapper.toDto(tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public TbConUnitDto findById(Integer id) { - TbConUnit tbConUnit = tbConUnitRepository.findById(id).orElseGet(TbConUnit::new); - ValidationUtil.isNull(tbConUnit.getId(),"TbConUnit","id",id); - return tbConUnitMapper.toDto(tbConUnit); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public TbConUnitDto create(TbConUnit resources) { - return tbConUnitMapper.toDto(tbConUnitRepository.save(resources)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(TbConUnit resources) { - TbConUnit tbConUnit = tbConUnitRepository.findById(resources.getId()).orElseGet(TbConUnit::new); - ValidationUtil.isNull( tbConUnit.getId(),"TbConUnit","id",resources.getId()); - tbConUnit.copy(resources); - tbConUnitRepository.save(tbConUnit); - } - - @Override - public void deleteAll(Integer[] ids) { - for (Integer id : ids) { - tbConUnitRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (TbConUnitDto tbConUnit : all) { - Map map = new LinkedHashMap<>(); - map.put("主单位名称", tbConUnit.getName()); - map.put("主单位值", tbConUnit.getValue()); - map.put("状态 1 启用 0 禁用", tbConUnit.getStatus()); - map.put(" createTime", tbConUnit.getCreateTime()); - map.put(" updateTime", tbConUnit.getUpdateTime()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } - - @Override - public Map queryAllInfo(TbConUnitQueryCriteria criteria, Pageable pageable) { - List list=new ArrayList<>(); - if(ObjectUtil.isEmpty(criteria.getParentId())){ - criteria.setParentId(0); - } - Page page = tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - if(Objects.nonNull(page)&&Objects.nonNull(page.getContent())){ - page.getContent().parallelStream().forEach(it->{ - ConUnitPO po=new ConUnitPO(); - po.setId(it.getId()); - po.setName(it.getName()); - po.setValue(it.getValue()); - po.setIsConsume(it.getIsConsume()); - po.setCreateTime(it.getCreateTime()); - po.setUpdateTime(it.getUpdateTime()); - - criteria.setParentId(it.getId()); - criteria.setName(null); - criteria.setStatus(null); - Page childPage = tbConUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - if(Objects.nonNull(childPage)&&Objects.nonNull(childPage.getContent())){ - List list1=new ArrayList<>(); - for (TbConUnit tbConUnit : childPage.getContent()) { - ConUnitPO child=new ConUnitPO(); - child.setId(tbConUnit.getId()); - child.setName(tbConUnit.getName()); - child.setValue(tbConUnit.getValue()); - child.setIsConsume(tbConUnit.getIsConsume()); - child.setCreateTime(tbConUnit.getCreateTime()); - child.setUpdateTime(tbConUnit.getUpdateTime()); - list1.add(child); - } - po.setChildConUnit(list1); - } - list.add(po); - }); - } - Map map = new LinkedHashMap<>(2); - map.put("content",list); - map.put("totalElements",page.getTotalElements()); - return map; - - } -} \ No newline at end of file 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 2b6e42f3..3b7a1451 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 @@ -229,6 +229,11 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { log.info("耗材信息不存在"); continue; } + BigDecimal changeStock = conInfos.getStockNumber(); + //副单位的实际修改值 + if (StringUtils.isNotBlank(conInfos.getUnit()) && conInfos.getUnit().equals(info.getConUnitTwo())) { + changeStock = conInfos.getStockNumber().multiply(info.getConUnitTwoConvert()).setScale(2, BigDecimal.ROUND_HALF_UP); + } TbConsSuppFlow suppFlow = new TbConsSuppFlow(); @@ -246,17 +251,17 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { suppFlow.setShopId(resources.getShopId()); suppFlow.setSupplierId(Objects.isNull(resources.getSupplierId()) ? 0 : resources.getSupplierId()); suppFlow.setType(resources.getType()); - suppFlow.setStockNumber(conInfos.getStockNumber()); - + suppFlow.setStockNumber(changeStock); + //实际库存 BigDecimal amount = info.getStockNumber().subtract(info.getStockConsume()); if ("in".equals(resources.getType())) { stockOperate.setSubType(1); - info.setStockNumber(info.getStockNumber().add(conInfos.getStockNumber())); - info.setLasterInStock(conInfos.getStockNumber()); + info.setStockNumber(info.getStockNumber().add(changeStock)); + info.setLasterInStock(changeStock); - suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).add(conInfos.getStockNumber())); + suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).add(changeStock)); flow.setBizCode("stockIn"); @@ -268,19 +273,19 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment()))); purveyorTransact.setType("cons_in"); - object.put("number", conInfos.getStockNumber()); + object.put("number", changeStock); } else if ("out".equals(resources.getType())) { stockOperate.setSubType(-1); - if (conInfos.getStockNumber().compareTo(info.getStockNumber().subtract(info.getStockConsume())) > 0) { + if (changeStock.compareTo(amount) > 0) { throw new BadRequestException("出库数量大于现有的库存数量"); } - info.setStockNumber(info.getStockNumber().subtract(conInfos.getStockNumber())); + info.setStockNumber(info.getStockNumber().subtract(changeStock)); - suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).subtract(conInfos.getStockNumber())); + suppFlow.setBalance(info.getStockNumber().subtract(info.getStockConsume()).subtract(changeStock)); flow.setBizCode("stockout"); @@ -292,7 +297,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { purveyorTransact.setWaitAmount((resources.getAccountsPayable().subtract(resources.getActualPayment())).negate()); purveyorTransact.setType("cons_out"); - object.put("number", conInfos.getStockNumber()); + object.put("number", changeStock); } else { throw new BadRequestException("错误操作类型"); @@ -302,7 +307,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { object.put("stockNumber", amount); object.put("name", info.getConName()); - object.put("unitName", info.getConUnit()); + object.put("unitName", StringUtils.isBlank(conInfos.getUnit()) ? info.getConUnit() : conInfos.getUnit()); array.add(object); suppFlow.setPrice(conInfos.getPrice()); @@ -319,7 +324,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { } purveyorTransact.setPaidAt(System.currentTimeMillis()); - + //供应商 purveyorTransactRepository.save(purveyorTransact); if (resources.getSupplierId() != null) { tbShopPurveyorRepository.upLastTransactAt(resources.getSupplierId().toString()); @@ -333,7 +338,7 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { flow.setConsId(info.getId()); flow.setShopId(info.getShopId()); flow.setConName(info.getConName()); - flow.setAmount(conInfos.getStockNumber()); + flow.setAmount(changeStock); flow.setRemark(resources.getRemark()); flow.setBalance(info.getStockNumber().subtract(info.getStockConsume())); flow.setOperator(SecurityUtils.getCurrentUserNickName()); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConsSuppFlowServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConsSuppFlowServiceImpl.java deleted file mode 100644 index f65f68ad..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/ViewConsSuppFlowServiceImpl.java +++ /dev/null @@ -1,109 +0,0 @@ -package cn.ysk.cashier.cons.service.impl; - -import cn.ysk.cashier.cons.domain.ViewConsSuppFlow; -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 lombok.RequiredArgsConstructor; -import cn.ysk.cashier.cons.repository.ViewConsSuppFlowRepository; -import cn.ysk.cashier.cons.service.ViewConsSuppFlowService; -import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowDto; -import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowQueryCriteria; -import cn.ysk.cashier.cons.service.mapstruct.ViewConsSuppFlowMapper; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; -import java.util.List; -import java.util.Map; -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.LinkedHashMap; - -/** -* @website https://eladmin.vip -* @description 服务实现 -* @author admin -* @date 2024-07-03 -**/ -@Service -@RequiredArgsConstructor -public class ViewConsSuppFlowServiceImpl implements ViewConsSuppFlowService { - - private final ViewConsSuppFlowRepository viewConsSuppFlowRepository; - private final ViewConsSuppFlowMapper viewConsSuppFlowMapper; - - @Override - public Map queryAll(ViewConsSuppFlowQueryCriteria criteria, Pageable pageable){ - Page page = viewConsSuppFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); - return PageUtil.toPage(page.map(viewConsSuppFlowMapper::toDto)); - } - - @Override - public List queryAll(ViewConsSuppFlowQueryCriteria criteria){ - return viewConsSuppFlowMapper.toDto(viewConsSuppFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); - } - - @Override - @Transactional - public ViewConsSuppFlowDto findById(Integer id) { - ViewConsSuppFlow viewConsSuppFlow = viewConsSuppFlowRepository.findById(id).orElseGet(ViewConsSuppFlow::new); - ValidationUtil.isNull(viewConsSuppFlow.getId(),"ViewConsSuppFlow","id",id); - return viewConsSuppFlowMapper.toDto(viewConsSuppFlow); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public ViewConsSuppFlowDto create(ViewConsSuppFlow resources) { - return viewConsSuppFlowMapper.toDto(viewConsSuppFlowRepository.save(resources)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(ViewConsSuppFlow resources) { - ViewConsSuppFlow viewConsSuppFlow = viewConsSuppFlowRepository.findById(resources.getId()).orElseGet(ViewConsSuppFlow::new); - ValidationUtil.isNull( viewConsSuppFlow.getId(),"ViewConsSuppFlow","id",resources.getId()); - viewConsSuppFlow.copy(resources); - viewConsSuppFlowRepository.save(viewConsSuppFlow); - } - - @Override - public void deleteAll(Integer[] ids) { - for (Integer id : ids) { - viewConsSuppFlowRepository.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (ViewConsSuppFlowDto viewConsSuppFlow : all) { - Map map = new LinkedHashMap<>(); - map.put(" conInfoId", viewConsSuppFlow.getConInfoId()); - map.put("店铺id", viewConsSuppFlow.getShopId()); - map.put(" skuId", viewConsSuppFlow.getSkuId()); - map.put(" productId", viewConsSuppFlow.getProductId()); - map.put(" supplierId", viewConsSuppFlow.getSupplierId()); - map.put("出入库类型: in 入库 out 出库", viewConsSuppFlow.getType()); - map.put("数量", viewConsSuppFlow.getStockNumber()); - map.put("进价", viewConsSuppFlow.getPrice()); - map.put("小计", viewConsSuppFlow.getAmount()); - map.put("剩余库存", viewConsSuppFlow.getBalance()); - map.put("应付款", viewConsSuppFlow.getAccountsPayable()); - map.put("实付款", viewConsSuppFlow.getActualPayment()); - map.put(" paymentTime", viewConsSuppFlow.getPaymentTime()); - map.put(" createTime", viewConsSuppFlow.getCreateTime()); - map.put(" updateTime", viewConsSuppFlow.getUpdateTime()); - map.put("耗材名称", viewConsSuppFlow.getConName()); - map.put("耗材代码", viewConsSuppFlow.getConCode()); - map.put("耗材类型名称", viewConsSuppFlow.getConTypeName()); - map.put("联系人名字", viewConsSuppFlow.getPurveyorName()); - map.put("供应商地址", viewConsSuppFlow.getAddress()); - map.put("联系人电话", viewConsSuppFlow.getPurveyorTelephone()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/mapstruct/TbConUnitMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/mapstruct/TbConUnitMapper.java deleted file mode 100644 index 915e25e3..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/mapstruct/TbConUnitMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.ysk.cashier.cons.service.mapstruct; - -import cn.ysk.cashier.base.BaseMapper; -import cn.ysk.cashier.cons.domain.TbConUnit; -import cn.ysk.cashier.cons.service.dto.TbConUnitDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @author admin -* @date 2024-07-12 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface TbConUnitMapper extends BaseMapper { - -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/mapstruct/ViewConsSuppFlowMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/mapstruct/ViewConsSuppFlowMapper.java deleted file mode 100644 index d8b4a83a..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/mapstruct/ViewConsSuppFlowMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.ysk.cashier.cons.service.mapstruct; - -import cn.ysk.cashier.base.BaseMapper; -import cn.ysk.cashier.cons.domain.ViewConsSuppFlow; -import cn.ysk.cashier.cons.service.dto.ViewConsSuppFlowDto; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** -* @author admin -* @date 2024-07-03 -**/ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface ViewConsSuppFlowMapper extends BaseMapper { - -} \ No newline at end of file From 93845145f3406dfc134373082ce41cdd8d777632 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 30 Oct 2024 15:51:45 +0800 Subject: [PATCH 034/165] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=97=A0?= =?UTF-8?q?=E5=8F=B0=E6=A1=8C=E5=88=87=E6=8D=A2=E5=B0=B1=E9=A4=90=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E8=B4=AD=E7=89=A9=E8=BD=A6=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/shopimpl/TbShopTableServiceImpl.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 121a430e..33df018a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1996,11 +1996,14 @@ public class TbShopTableServiceImpl implements TbShopTableService { cashierCarts.forEach(item -> { TbProduct product = productMap.get(item.getProductId()); // 设置打包费 - item.setPackFee(product.getPackFee() != null ? - product.getPackFee().multiply(BigDecimal.valueOf(item.getNumber())) : BigDecimal.ZERO); - item.setTableId(""); - item.setUseType(OrderUseTypeEnum.TAKEOUT.getValue()); - item.setIsPack("true"); + mpCashierCartService.update(new LambdaUpdateWrapper() + .eq(TbCashierCart::getId, item.getId()) + .set(TbCashierCart::getPackFee, product.getPackFee() != null ? + product.getPackFee().multiply(BigDecimal.valueOf(item.getNumber())) : BigDecimal.ZERO) + .set(TbCashierCart::getTableId, null) + .set(TbCashierCart::getUseType, OrderUseTypeEnum.TAKEOUT.getValue()) + .set(TbCashierCart::getIsPack, "true")); + }); List detailList = orderDetailMapper.selectList(new LambdaQueryWrapper() @@ -2017,8 +2020,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { if (!detailList.isEmpty()) { mpOrderDetailService.updateBatchById(detailList); } - - return mpCashierCartService.updateBatchById(cashierCarts); + return true; } else { cashierCartMapper.update(null, new LambdaUpdateWrapper() .in(TbCashierCart::getId, choseModelDTO.getCartIds()) From 8ef801afa1a32892548dcd81e4bd7ea4515bb377 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 30 Oct 2024 16:00:46 +0800 Subject: [PATCH 035/165] =?UTF-8?q?fix:=20=E8=8E=B7=E5=8F=96=E8=B4=AD?= =?UTF-8?q?=E7=89=A9=E8=BD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 33df018a..61752900 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -780,7 +780,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { if (!shopEatTypeInfoDTO.isTakeout()) { if (StrUtil.isBlank(tableId)) { - queryWrapper.isNull(TbCashierCart::getTableId); + queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, "")); } else { queryWrapper.eq(TbCashierCart::getTableId, tableId); } From b4e5eda9f74ebf15f0d6b8ee7c18df1e6425bc13 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 30 Oct 2024 16:04:15 +0800 Subject: [PATCH 036/165] =?UTF-8?q?fix:=20=E8=8E=B7=E5=8F=96=E8=B4=AD?= =?UTF-8?q?=E7=89=A9=E8=BD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 61752900..a7b5d631 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1126,7 +1126,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { } queryWrapper.eq(TbCashierCart::getTableId, createOrderDTO.getTableId()); } else { - queryWrapper.isNull(TbCashierCart::getTableId); + queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, "")); } } From f386405aaa81553be255780932f7c9c514e5d3e8 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 30 Oct 2024 17:11:39 +0800 Subject: [PATCH 037/165] =?UTF-8?q?fix:=20=E5=A4=96=E5=B8=A6=E4=B8=8B?= =?UTF-8?q?=E5=8D=95=E6=AC=A1=E6=95=B0=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index db20e847..19fa6ebc 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -120,7 +120,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { private TbOrderInfo getCurrentOrder(ShopEatTypeInfoDTO eatTypeInfoDTO) { // 获取当前台桌最新订单,先付款模式不获取 - if (eatTypeInfoDTO.isDineInBefore()) { + if (eatTypeInfoDTO.isDineInBefore() || eatTypeInfoDTO.isTakeout()) { return null; } List orderInfoList = orderInfoMapper.selectPage(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(1, 1), new LambdaQueryWrapper() From 6630141a99ca76a40b89a69cd42cda67b21e81ee Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 30 Oct 2024 17:48:24 +0800 Subject: [PATCH 038/165] =?UTF-8?q?fix:=20=E9=80=89=E6=8B=A9=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E4=BF=9D=E5=AD=98=E4=BC=9A=E5=91=98=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/service/TbPayService.java | 2 +- .../service/impl/TbPayServiceImpl.java | 7 +++--- .../impl/shopimpl/TbShopTableServiceImpl.java | 25 ++++++++++++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/TbPayService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/TbPayService.java index c73da59f..e2dfd181 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/TbPayService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/TbPayService.java @@ -12,7 +12,7 @@ import java.math.BigDecimal; public interface TbPayService { TbOrderInfo scanPay(Integer shopId, String code, Integer merchantId, Integer memberId, BigDecimal payMount, TbOrderInfo orderInfo); - void vipPay(BigDecimal payMount, Integer vipUserId); + void vipPay(BigDecimal payMount, Integer userId, Integer vipUserId); TbOrderInfo cashPay(PayDTO payDTO); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbPayServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbPayServiceImpl.java index c4b55781..c1db2f3d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbPayServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbPayServiceImpl.java @@ -306,18 +306,19 @@ public class TbPayServiceImpl implements TbPayService { } @Override - public void vipPay(BigDecimal payMount, Integer vipUserId) { + public void vipPay(BigDecimal payMount, Integer userId, Integer vipUserId) { // 扣减会员余额 TbShopUser shopUser = shopUserMapper.selectOne(new LambdaUpdateWrapper() .eq(TbShopUser::getStatus, 1) - .eq(TbShopUser::getId, vipUserId)); + .eq(TbShopUser::getId, vipUserId) + .eq(TbShopUser::getUserId, userId)); if (shopUser == null) { throw new BadRequestException("用户不存在或已被禁用"); } - long flag = shopUserMapper.decrBalance(vipUserId, payMount); + long flag = shopUserMapper.decrBalance(shopUser.getId(), payMount); if (flag < 1) { throw new BadRequestException("余额不足或扣除余额失败"); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 0e2c0604..c7241c53 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -117,6 +117,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { private final PayService payService; private final TbOrderInfoService orderInfoService; private final MpOrderInfoService mpOrderInfoService; + private final TbShopUserMapper tbShopUserMapper; private TbOrderInfo getCurrentOrder(ShopEatTypeInfoDTO eatTypeInfoDTO) { // 获取当前台桌最新订单,先付款模式不获取 @@ -1247,6 +1248,15 @@ public class TbShopTableServiceImpl implements TbShopTableService { if (orderId != null) { orderInfo = orderInfoMapper.selectById(orderId); } + + TbShopUser shopUser = null; + if (StrUtil.isNotBlank(createOrderDTO.getVipUserId())) { + shopUser = tbShopUserMapper.selectById(createOrderDTO.getVipUserId()); + if (shopUser == null) { + throw new BadRequestException("用户不存在"); + } + } + // 是否是第一次创建订单 boolean isFirst = false; // 修改订单信息 @@ -1270,7 +1280,8 @@ public class TbShopTableServiceImpl implements TbShopTableService { orderInfo.setSeatCount(seatCart.getNumber()); } if (StrUtil.isNotBlank(createOrderDTO.getVipUserId())) { - orderInfo.setUserId(createOrderDTO.getVipUserId()); + orderInfo.setMemberId(createOrderDTO.getVipUserId()); + orderInfo.setUserId(shopUser.getUserId()); } orderInfo.setSendType(shopEatTypeInfoDTO.getSendType()); // 存在新添加的商品,增加下单次数 @@ -1306,6 +1317,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { orderInfo.setUseType(shopEatTypeInfoDTO.getUseType()); if (StrUtil.isNotBlank(createOrderDTO.getVipUserId())) { orderInfo.setUserId(createOrderDTO.getVipUserId()); + orderInfo.setUserId(shopUser.getUserId()); } if (seatCart != null) { orderInfo.setSeatAmount(seatCart.getTotalAmount()); @@ -1607,7 +1619,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { if (payDTO.getVipUserId() != null) { orderInfo.setUserId(String.valueOf(payDTO.getVipUserId())); } - tbPayServiceImpl.vipPay(finalAmount, Integer.valueOf(orderInfo.getUserId())); + tbPayServiceImpl.vipPay(finalAmount, Integer.valueOf(orderInfo.getUserId()), payDTO.getVipUserId()); orderInfo.setPayOrderNo("vipPay".concat(SnowFlakeUtil.generateOrderNo())); orderInfo.setPayType("deposit"); break; @@ -1749,16 +1761,23 @@ public class TbShopTableServiceImpl implements TbShopTableService { .in(TbCashierCart::getPlatformType, OrderPlatformTypeEnum.PC.getValue(), OrderPlatformTypeEnum.CASH.getValue()); } + TbShopUser shopUser = tbShopUserMapper.selectById(updateVipDTO.getVipUserId()); + if (shopUser == null) { + throw new BadRequestException("用户信息不存在"); + } + List tbCashierCarts = cashierCartMapper.selectList(queryWrapper.isNotNull(TbCashierCart::getOrderId)); if (!tbCashierCarts.isEmpty()) { Integer orderId = tbCashierCarts.get(0).getOrderId(); if (updateVipDTO.getType() == 0) { return orderInfoMapper.update(null, new LambdaUpdateWrapper() .eq(TbOrderInfo::getId, orderId) - .set(TbOrderInfo::getUserId, updateVipDTO.getVipUserId())); + .set(TbOrderInfo::getUserId, shopUser.getUserId()) + .set(TbOrderInfo::getMemberId, updateVipDTO.getVipUserId())); } else { return orderInfoMapper.update(null, new LambdaUpdateWrapper() .eq(TbOrderInfo::getId, orderId) + .set(TbOrderInfo::getUserId, null) .set(TbOrderInfo::getUserId, null)); } } From 31f20090e5a176ba84de033e78e9414cbbfe606e Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 30 Oct 2024 17:59:52 +0800 Subject: [PATCH 039/165] =?UTF-8?q?fix:=20=E9=80=89=E6=8B=A9=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E4=BF=9D=E5=AD=98=E4=BC=9A=E5=91=98=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/ysk/cashier/service/TbPayService.java | 3 ++- .../java/cn/ysk/cashier/service/impl/TbPayServiceImpl.java | 7 ++++--- .../service/impl/shopimpl/TbShopTableServiceImpl.java | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/TbPayService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/TbPayService.java index e2dfd181..6fc11b4f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/TbPayService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/TbPayService.java @@ -3,6 +3,7 @@ package cn.ysk.cashier.service; import cn.ysk.cashier.dto.ScanPayDTO; import cn.ysk.cashier.dto.shoptable.PayDTO; import cn.ysk.cashier.pojo.order.TbOrderInfo; +import cn.ysk.cashier.pojo.shop.TbShopUser; import javax.validation.constraints.Max; import javax.validation.constraints.Min; @@ -12,7 +13,7 @@ import java.math.BigDecimal; public interface TbPayService { TbOrderInfo scanPay(Integer shopId, String code, Integer merchantId, Integer memberId, BigDecimal payMount, TbOrderInfo orderInfo); - void vipPay(BigDecimal payMount, Integer userId, Integer vipUserId); + TbShopUser vipPay(BigDecimal payMount, Integer vipUserId); TbOrderInfo cashPay(PayDTO payDTO); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbPayServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbPayServiceImpl.java index c1db2f3d..3bed9280 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbPayServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/TbPayServiceImpl.java @@ -306,13 +306,12 @@ public class TbPayServiceImpl implements TbPayService { } @Override - public void vipPay(BigDecimal payMount, Integer userId, Integer vipUserId) { + public TbShopUser vipPay(BigDecimal payMount, Integer vipUserId) { // 扣减会员余额 TbShopUser shopUser = shopUserMapper.selectOne(new LambdaUpdateWrapper() .eq(TbShopUser::getStatus, 1) - .eq(TbShopUser::getId, vipUserId) - .eq(TbShopUser::getUserId, userId)); + .eq(TbShopUser::getId, vipUserId)); if (shopUser == null) { throw new BadRequestException("用户不存在或已被禁用"); @@ -333,6 +332,8 @@ public class TbPayServiceImpl implements TbPayService { userFlow.setType("-"); shopUserFlowMapper.insert(userFlow); + return shopUser; + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index c7241c53..0dde792c 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1619,7 +1619,9 @@ public class TbShopTableServiceImpl implements TbShopTableService { if (payDTO.getVipUserId() != null) { orderInfo.setUserId(String.valueOf(payDTO.getVipUserId())); } - tbPayServiceImpl.vipPay(finalAmount, Integer.valueOf(orderInfo.getUserId()), payDTO.getVipUserId()); + TbShopUser shopUser = tbPayServiceImpl.vipPay(finalAmount, payDTO.getVipUserId()); + orderInfo.setMemberId(String.valueOf(shopUser.getId())); + orderInfo.setUserId(shopUser.getUserId()); orderInfo.setPayOrderNo("vipPay".concat(SnowFlakeUtil.generateOrderNo())); orderInfo.setPayType("deposit"); break; From c1145538dc96825dbbac66f364e536e80822ada1 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 30 Oct 2024 18:01:29 +0800 Subject: [PATCH 040/165] =?UTF-8?q?fix:=20=E4=B8=8B=E5=8D=95=E6=AC=A1?= =?UTF-8?q?=E6=95=B0=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 0dde792c..2d0e0fc7 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -121,7 +121,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { private TbOrderInfo getCurrentOrder(ShopEatTypeInfoDTO eatTypeInfoDTO) { // 获取当前台桌最新订单,先付款模式不获取 - if (eatTypeInfoDTO.isDineInBefore() || eatTypeInfoDTO.isTakeout()) { + if (!eatTypeInfoDTO.isDineInAfter()) { return null; } List orderInfoList = orderInfoMapper.selectPage(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(1, 1), new LambdaQueryWrapper() From b363044282572d332979b54af7bd85b6e3cc6786 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 30 Oct 2024 18:06:48 +0800 Subject: [PATCH 041/165] =?UTF-8?q?fix:=20=E9=80=80=E6=AC=BE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index 215e2cbf..ad2c362a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -606,7 +606,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { if (user == null) { throw new BadRequestException("用户信息不存在"); } - tbMShopUserMapper.incrBalance(userId, shopId, returnAmount, cn.hutool.core.date.DateUtil.current()); + tbMShopUserMapper.incrBalance(user.getId(), shopId, returnAmount, cn.hutool.core.date.DateUtil.current()); TbShopUserFlow flow = new TbShopUserFlow(); flow.setShopUserId(user.getId()); From 1017b69a894250c969bdf5def7ede24ee52850be Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 30 Oct 2024 18:28:41 +0800 Subject: [PATCH 042/165] =?UTF-8?q?fix:=20=E8=AE=A2=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E8=BF=94=E5=9B=9E=E5=AE=A2=E5=BA=A7=E8=B4=B9=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/order/TbOrderInfoServiceImpl.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index ad2c362a..f0d728d0 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -325,12 +325,11 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { // dto.setRefundAmount(tbOrderInfos.stream().map(TbOrderInfo::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add)); // } dto.setDetailList(details); - List tbCashierCarts = tbCashierCartMapper.selectList(new LambdaQueryWrapper() - .eq(TbCashierCart::getOrderId, id) - .eq(TbCashierCart::getUseType, tbOrderInfo.getUseType()) - .eq(TbCashierCart::getProductId, TableConstant.CART_SEAT_ID) - .orderByDesc(TbCashierCart::getId)); - TbCashierCart cashierCart = tbCashierCarts.isEmpty() ? null : tbCashierCarts.get(0); + List tbCashierCarts = tbOrderDetailMapper.selectList(new LambdaQueryWrapper() + .eq(TbOrderDetail::getOrderId, id) + .eq(TbOrderDetail::getProductId, TableConstant.CART_SEAT_ID) + .orderByDesc(TbOrderDetail::getId)); + TbOrderDetail cashierCart = tbCashierCarts.isEmpty() ? null : tbCashierCarts.get(0); Map map = BeanUtil.beanToMap(cashierCart, false, false); if (cashierCart != null) { map.put("cartId", cashierCart.getId()); From 05dc07010752da077731329e7ada66129798a30e Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 09:30:05 +0800 Subject: [PATCH 043/165] =?UTF-8?q?fix:=20=E5=88=9B=E5=BB=BA=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=8F=96=E9=A4=90=E7=A0=81=E5=A2=9E=E5=8A=A0=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 2d0e0fc7..07612849 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1392,9 +1392,8 @@ public class TbShopTableServiceImpl implements TbShopTableService { addGlobalCode(cn.ysk.cashier.utils.DateUtils.getDay(), "pc", String.valueOf(createOrderDTO.getShopId())); } - if (shopEatTypeInfoDTO.isIncrMaterId() && "pending".equals(orderInfo.getStatus())) { + if (shopEatTypeInfoDTO.isIncrMaterId() || "pending".equals(orderInfo.getStatus())) { String key = RedisConstant.getMasterIdKey(createOrderDTO.getShopId(), cn.ysk.cashier.utils.DateUtils.getDay(), orderInfo.getTableId()); - ; redisTemplate.delete(key); } } From ec3d76f73df851c8aaeb813aad5d702f1b94ba76 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 09:34:22 +0800 Subject: [PATCH 044/165] =?UTF-8?q?fix:=20=E9=80=80=E8=8F=9C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 07612849..60b43815 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -651,7 +651,8 @@ public class TbShopTableServiceImpl implements TbShopTableService { // 会员点单 TbCashierCart cashierCart = cashierCartMapper.selectOne(new LambdaQueryWrapper() .eq(TbCashierCart::getShopId, removeCartDTO.getShopId()) - .in(TbCashierCart::getStatus, OrderStatusEnums.CREATE.getValue()) +// .in(TbCashierCart::getStatus, OrderStatusEnums.CREATE.getValue()) + .ne(TbCashierCart::getStatus, TableConstant.OrderInfo.Status.RETURN.getValue()) .isNotNull(TbCashierCart::getOrderId) .eq(TbCashierCart::getId, removeCartDTO.getCartId())); From ce93f7593d3862279d930670b7bdddf637456a6a Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 09:55:16 +0800 Subject: [PATCH 045/165] =?UTF-8?q?fix:=20=E9=80=80=E8=8F=9C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 60b43815..8a125222 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -653,7 +653,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { .eq(TbCashierCart::getShopId, removeCartDTO.getShopId()) // .in(TbCashierCart::getStatus, OrderStatusEnums.CREATE.getValue()) .ne(TbCashierCart::getStatus, TableConstant.OrderInfo.Status.RETURN.getValue()) - .isNotNull(TbCashierCart::getOrderId) +// .isNotNull(TbCashierCart::getOrderId) .eq(TbCashierCart::getId, removeCartDTO.getCartId())); if (cashierCart == null) { @@ -672,7 +672,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { TbOrderDetail orderDetail = orderDetailMapper.selectOne(new LambdaQueryWrapper() .eq(TbOrderDetail::getCartId, cashierCart.getId())); - if (cashierCart.getProductId().equals("-999")) { + if (false && cashierCart.getProductId().equals("-999")) { cashierCartMapper.deleteById(cashierCart.getId()); cashierCartMapper.update(null, new LambdaUpdateWrapper() .eq(TbCashierCart::getId, cashierCart.getId()) From a9ea2cdc82c357799eba1486b35480670debde64 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 10:01:26 +0800 Subject: [PATCH 046/165] =?UTF-8?q?fix:=20=E9=80=80=E8=8F=9C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/cons/TableConstant.java | 147 +++++++++++++++++- .../impl/shopimpl/TbShopTableServiceImpl.java | 10 +- 2 files changed, 154 insertions(+), 3 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/TableConstant.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/TableConstant.java index f9ea2835..ac2e0605 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/TableConstant.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/TableConstant.java @@ -2,10 +2,57 @@ package cn.ysk.cashier.cons; import lombok.Getter; +import java.util.Objects; + public interface TableConstant { String CART_SEAT_ID = "-999"; + class ShopTable { + @Getter + public enum State { + IDLE("idle"), CLOSED("closed"), PAYING("paying"), PENDING("pending"), USING("using"), CLEANING("cleaning"); + private final String value; + + State(String value) { + this.value = value; + } + } + } + + class CashierCart { + public static final String ID = "-999"; + + @Getter + public enum Status { + REFUNDING("refunding"), REFUND("refund"), CLOSED("closed"), CREATE("create"), + UNPAID("unpaid"), PAYING("paying"), RETURN("return"), CANCEL("cancel"); + private final String value; + Status(String value) { + this.value = value; + } + public boolean equalsVals(String value) { + return this.value.equals(value); + } + } + + @Getter + public enum UseType { + TAKEOUT("takeout"), + DINE_IN_AFTER("dine-in-after"), + DINE_IN_BEFORE("dine-in-before"); + private final String value; + + UseType(String value) { + this.value = value; + } + + public boolean equalsVals(String value) { + return this.value.equals(value); + } + } + } + class OrderInfo { @Getter public enum Status { @@ -21,7 +68,36 @@ public interface TableConstant { @Getter public enum UseType { TAKEOUT("takeout"), - NONE_TABLE("dine-in"), + DINE_IN_AFTER("dine-in-after"), + DINE_IN_BEFORE("dine-in-before"), NONE_TABLE("dine-in"); + private final String value; + + UseType(String value) { + this.value = value; + } + + public boolean equalsVals(String value) { + return this.value.equals(value); + } + } + } + + class FreeDineRecord { + @Getter + public enum State { + WAIT_PAY(0), + SUCCESS_PAY(1), + FAIL_PAY(2); + private final Integer value; + + State(Integer value) { + this.value = value; + } + } + + @Getter + public enum UseType { + TAKEOUT("takeout"), DINE_IN_AFTER("dine-in-after"), DINE_IN_BEFORE("dine-in-before"); private final String value; @@ -35,4 +111,73 @@ public interface TableConstant { } } } + + class ShopInfo { + @Getter + public enum EatModel { + TAKEOUT("takeout"), + DINE_IN("dine-in"); + private final String value; + + EatModel(String value) { + this.value = value; + } + + public boolean equalsVals(String value) { + return this.value.equals(value); + } + } + } + + class MemberIn { + @Getter + public enum Type { + NORMAL(0), + FREE_DINE(1); + private final Integer value; + + Type(Integer value) { + this.value = value; + } + + public boolean equalsVals(Integer value) { + return Objects.equals(this.value, value); + } + } + } + + class ActivateOutRecord { + @Getter + public enum Type { + // 满减 + FULL_REDUCTION(1), + // 商品 + PRODUCT(2); + private final Integer value; + + Type(Integer value) { + this.value = value; + } + + public boolean equalsVals(Integer value) { + return Objects.equals(this.value, value); + } + } + @Getter + public enum Status { + CREATE("create"), + CANCEL("cancel"), + // 商品 + CLOSED("closed"); + private final String value; + + Status(String value) { + this.value = value; + } + + public boolean equalsVals(String value) { + return this.value.equals(value); + } + } + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 8a125222..07814cbf 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -648,6 +648,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { @Override public void returnCart(ReturnCartDTO removeCartDTO) { + boolean isSeatCart = TableConstant.CashierCart.ID.equals(removeCartDTO.getCartId().toString()); // 会员点单 TbCashierCart cashierCart = cashierCartMapper.selectOne(new LambdaQueryWrapper() .eq(TbCashierCart::getShopId, removeCartDTO.getShopId()) @@ -668,6 +669,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { throw new BadRequestException("此商品还未下单,无需退单"); } + // 餐位费直接删除 TbOrderDetail orderDetail = orderDetailMapper.selectOne(new LambdaQueryWrapper() .eq(TbOrderDetail::getCartId, cashierCart.getId())); @@ -701,7 +703,9 @@ public class TbShopTableServiceImpl implements TbShopTableService { .eq(TbOrderDetail::getId, tbOrderDetail.getId()) .set(TbOrderDetail::getUpdateTime, DateUtil.date()) .set(TbOrderDetail::getStatus, "return")); - rabbitMsgUtils.printDishesTicket(tbOrderDetail.getOrderId(), true, tbOrderDetail); + if (TableConstant.OrderInfo.UseType.DINE_IN_AFTER.equalsVals(tbOrderDetail.getUseType()) && !isSeatCart) { + rabbitMsgUtils.printDishesTicket(tbOrderDetail.getOrderId(), true, tbOrderDetail); + } } else { //生成退菜的购物车记录 TbCashierCart returnCart = BeanUtil.copyProperties(cashierCart, TbCashierCart.class); @@ -726,7 +730,9 @@ public class TbShopTableServiceImpl implements TbShopTableService { cashierCartMapper.updateNumAmountStatus(cashierCart.getId(), cashierCart.getStatus(), -returnCart.getNumber()); orderDetailMapper.updateNumAmountStatus(orderDetail.getId(), orderDetail.getStatus(), -returnCart.getNumber()); - rabbitMsgUtils.printDishesTicket(returnOrderDetail.getOrderId(), true, returnOrderDetail); + if (TableConstant.OrderInfo.UseType.DINE_IN_AFTER.equalsVals(tbOrderDetail.getUseType()) && !isSeatCart) { + rabbitMsgUtils.printDishesTicket(returnOrderDetail.getOrderId(), true, returnOrderDetail); + } } } From 34460c0f0da99a8b1069486d8098b2e4531d6c21 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 10:15:58 +0800 Subject: [PATCH 047/165] =?UTF-8?q?fix:=20=E9=80=80=E8=8F=9C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index f0d728d0..8be5c359 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -332,7 +332,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { TbOrderDetail cashierCart = tbCashierCarts.isEmpty() ? null : tbCashierCarts.get(0); Map map = BeanUtil.beanToMap(cashierCart, false, false); if (cashierCart != null) { - map.put("cartId", cashierCart.getId()); + map.put("cartId", cashierCart.getCartId()); TbOrderDetail orderDetail = details.stream().filter(item -> item.getCartId().equals(cashierCart.getId())).findFirst().orElse(null); map.put("id", orderDetail != null ? orderDetail.getId() : null); } From 8888c130837bcd694f85563330b2fbb9d0737ec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Thu, 31 Oct 2024 10:28:47 +0800 Subject: [PATCH 048/165] =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TbPointsGoodsSettingController.java | 9 ++++++- .../mybatis/entity/TbMemberPoints.java | 17 ++++++------- .../mybatis/entity/TbPointsGoodsSetting.java | 8 +++++++ .../service/TbPointsGoodsSettingService.java | 2 ++ .../impl/TbMemberPointsServiceImpl.java | 24 +++++++------------ .../TbPointsExchangeRecordServiceImpl.java | 7 ++++++ .../impl/TbPointsGoodsSettingServiceImpl.java | 6 +++++ 7 files changed, 48 insertions(+), 25 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsGoodsSettingController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsGoodsSettingController.java index 96017cfb..b703e0d9 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsGoodsSettingController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/points/TbPointsGoodsSettingController.java @@ -34,7 +34,7 @@ public class TbPointsGoodsSettingController { @GetMapping("{id}") @ApiOperation("信息") - public ResponseEntity get(@PathVariable("id") Integer id) { + public ResponseEntity get(@PathVariable("id") Long id) { TbPointsGoodsSetting data = tbPointsGoodsSettingService.getById(id); return ResponseEntity.ok().body(data); } @@ -52,4 +52,11 @@ public class TbPointsGoodsSettingController { boolean ret = tbPointsGoodsSettingService.update(dto); return ResponseEntity.ok().body(ret); } + + @DeleteMapping("{id}") + @ApiOperation("删除") + public ResponseEntity delete(@PathVariable("id") Long id) { + tbPointsGoodsSettingService.delete(id); + return ResponseEntity.ok().build(); + } } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java index db2d0286..e274d687 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java @@ -1,8 +1,6 @@ package cn.ysk.cashier.mybatis.entity; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import lombok.EqualsAndHashCode; @@ -16,7 +14,7 @@ import java.util.Date; */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("tb_member_points") +@TableName("tb_shop_user") public class TbMemberPoints { private static final long serialVersionUID = 1L; @@ -32,33 +30,36 @@ public class TbMemberPoints { /** * 会员id */ + @TableField(value = "id", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER) private Long memberId; /** * 会员名称 */ + @TableField("name") private String memberName; /** * 会员头像 */ + @TableField("head_img") private String avatarUrl; /** * 手机号码 */ + @TableField("telephone") private String mobile; /** * 账户积分 */ + @TableField("account_points") private Integer accountPoints; /** - * 创建时间 - */ - private Date createTime; - /** * 最近一次积分变动时间 */ + @TableField("last_points_change_time") private Date lastPointsChangeTime; /** * 最近一次浮动积分 */ + @TableField("last_float_points") private Integer lastFloatPoints; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java index 62fe7277..ba123948 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java @@ -63,6 +63,10 @@ public class TbPointsGoodsSetting { */ @TableField(value = "goods_description", updateStrategy = FieldStrategy.ALWAYS) private String goodsDescription; + /** + * 累计兑换数量 + */ + private Integer totalExchangeCount; /** * 是否上架 1-是 0-否 */ @@ -75,4 +79,8 @@ public class TbPointsGoodsSetting { * 更新时间 */ private Date updateTime; + /** + * 逻辑删除标志 1-是 0-否 + */ + private Integer delFlag; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsGoodsSettingService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsGoodsSettingService.java index d0422283..d5e715f2 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsGoodsSettingService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbPointsGoodsSettingService.java @@ -19,4 +19,6 @@ public interface TbPointsGoodsSettingService extends IServicelambdaQuery().eq(TbMemberPoints::getMemberId, memberId)); if (entity == null) { - entity = new TbMemberPoints(); - entity.setCreateTime(new Date()); + throw new BadRequestException("会员信息不存在"); + } + if(entity.getAccountPoints() == null){ entity.setAccountPoints(0); } - entity.setShopId(Long.valueOf(shopUser.getShopId())); - entity.setMemberId(Long.valueOf(shopUser.getId())); - entity.setMemberName(shopUser.getName()); - entity.setAvatarUrl(shopUser.getHeadImg()); - entity.setMobile(shopUser.getTelephone()); - super.saveOrUpdate(entity); + super.updateById(entity); return entity; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java index 532f9e90..52d823be 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java @@ -126,6 +126,9 @@ public class TbPointsExchangeRecordServiceImpl extends ServiceImpllambdaUpdate().set(TbPointsGoodsSetting::getDelFlag, 1).eq(TbPointsGoodsSetting::getId, id)); + } } \ No newline at end of file From 921015488e1a3f06c82d5a8d50d759d47b25cf52 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 10:29:23 +0800 Subject: [PATCH 049/165] =?UTF-8?q?fix:=20=E9=80=80=E8=8F=9C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbShopTableServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 07814cbf..da6b2445 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1151,9 +1151,10 @@ public class TbShopTableServiceImpl implements TbShopTableService { seatCart = allCashierCart; } - if (OrderStatusEnums.CREATE.getValue().equals(allCashierCart.getStatus())) { - cashierCarts.add(allCashierCart); - } +// if (OrderStatusEnums.CREATE.getValue().equals(allCashierCart.getStatus())) { +// cashierCarts.add(allCashierCart); +// } + cashierCarts.add(allCashierCart); } if (StrUtil.isNotBlank(createOrderDTO.getTableId()) From d944a9cc82ece208a82912019587d13b09049ca5 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 10:39:15 +0800 Subject: [PATCH 050/165] =?UTF-8?q?fix:=20=E5=B0=B1=E9=A4=90=E4=BA=BA?= =?UTF-8?q?=E6=95=B0=E9=80=89=E6=8B=A9=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index da6b2445..89c25043 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1905,6 +1905,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { tbCashierCart.setUseType(choseCountDTO.getUseType()); tbCashierCartMapper.insert(tbCashierCart); } else { + tbCashierCart.setStatus(TableConstant.CashierCart.Status.CREATE.getValue()); tbCashierCart.setTotalAmount(new BigDecimal(choseCountDTO.getNum()).multiply(shopInfo.getTableFee())); tbCashierCart.setNumber(choseCountDTO.getNum()); tbCashierCart.setTotalNumber(choseCountDTO.getNum()); From f6b0055bdb5696336861700805ab0026219f1fe8 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 11:12:13 +0800 Subject: [PATCH 051/165] =?UTF-8?q?fix:=20=E8=AE=A2=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E8=8E=B7=E5=8F=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/order/TbOrderInfoServiceImpl.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index 8be5c359..4d250dda 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -329,14 +329,8 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { .eq(TbOrderDetail::getOrderId, id) .eq(TbOrderDetail::getProductId, TableConstant.CART_SEAT_ID) .orderByDesc(TbOrderDetail::getId)); - TbOrderDetail cashierCart = tbCashierCarts.isEmpty() ? null : tbCashierCarts.get(0); - Map map = BeanUtil.beanToMap(cashierCart, false, false); - if (cashierCart != null) { - map.put("cartId", cashierCart.getCartId()); - TbOrderDetail orderDetail = details.stream().filter(item -> item.getCartId().equals(cashierCart.getId())).findFirst().orElse(null); - map.put("id", orderDetail != null ? orderDetail.getId() : null); - } - dto.setSeatInfo(map); + TbOrderDetail cashierDetail = tbCashierCarts.isEmpty() ? null : tbCashierCarts.get(0); + dto.setSeatInfo(cashierDetail); Map data = BeanUtil.beanToMap(tbOrderInfo, false, false); data.putAll(BeanUtil.beanToMap(dto, false, false)); data.put("refundAmount", tbOrderInfo.getRefundAmount()); From f7ca147e4996629fe89e037fddda1bdd8c2338aa Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 14:10:13 +0800 Subject: [PATCH 052/165] =?UTF-8?q?1.=20=E5=88=9B=E5=BB=BA=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=80=80=E6=AC=BE=E8=AE=A2=E5=8D=95=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=BC=9A=E8=A2=AB=E8=A6=86=E7=9B=96=E4=BF=AE=E5=A4=8D=202.=20?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E7=A7=AF=E5=88=86=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/dto/shoptable/CreateOrderDTO.java | 6 ++ .../mybatis/service/MpCashierCartService.java | 9 ++ .../mybatis/service/MpOrderDetailService.java | 8 ++ .../impl/MpCashierCartServiceImpl.java | 39 +++++++-- .../impl/MpOrderDetailServiceImpl.java | 7 ++ .../ysk/cashier/pojo/order/TbOrderInfo.java | 10 +++ .../impl/shopimpl/TbShopTableServiceImpl.java | 82 +++++++++---------- 7 files changed, 111 insertions(+), 50 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/CreateOrderDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/CreateOrderDTO.java index 6cae5fd5..73dfde96 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/CreateOrderDTO.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/CreateOrderDTO.java @@ -4,6 +4,8 @@ import lombok.Data; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; @Data public class CreateOrderDTO { @@ -18,4 +20,8 @@ public class CreateOrderDTO { @NotEmpty private String useType; private String vipUserId; + // 使用的优惠券 + private List userCouponIds = new ArrayList<>(); + // 使用的积分抵扣数量 + private Integer pointsNum ; } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java index 43e679e2..3df120e9 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java @@ -1,6 +1,7 @@ package cn.ysk.cashier.mybatis.service; import cn.ysk.cashier.cons.TableConstant; +import cn.ysk.cashier.dto.shoptable.ShopEatTypeInfoDTO; import cn.ysk.cashier.enums.OrderStatusEnums; import cn.ysk.cashier.pojo.order.TbCashierCart; import com.baomidou.mybatisplus.extension.service.IService; @@ -55,5 +56,13 @@ public interface MpCashierCartService extends IService { * @param orderId 订单id */ boolean updateStateByOrderId(TableConstant.OrderInfo.Status status, Integer orderId); + + /** + * 根据店就餐模式查询购物车 + * @param shopEatTypeInfoDTO 就餐模式 + * @return 购物车信息 + */ + List selectByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId); + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java index 8d766da5..49ec5ada 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java @@ -42,5 +42,13 @@ public interface MpOrderDetailService extends IService { */ List selectByOrderId(Integer orderId); + /** + * 根据购物车id和订单id查询订单详情 + * @param shopId 店铺id + * @param cartIdList 购物车id + * @param orderId 订单id + * @return 详情信息 + */ + List selectByCartIdOrOrderId(Integer shopId, ArrayList cartIdList, Integer orderId); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java index 24864521..6375f994 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java @@ -3,16 +3,16 @@ package cn.ysk.cashier.mybatis.service.impl; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import cn.ysk.cashier.cons.TableConstant; -import cn.ysk.cashier.enums.OrderStatusEnums; -import cn.ysk.cashier.enums.OrderUseTypeEnum; -import cn.ysk.cashier.enums.ShopInfoEatModelEnum; -import cn.ysk.cashier.enums.ShopInfoRegisterlEnum; +import cn.ysk.cashier.dto.shoptable.ShopEatTypeInfoDTO; +import cn.ysk.cashier.enums.*; import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mybatis.mapper.MpShopInfoMapper; +import cn.ysk.cashier.mybatis.mapper.MpShopTableMapper; import cn.ysk.cashier.mybatis.mapper.TbCashierCartMapper; import cn.ysk.cashier.mybatis.service.MpCashierCartService; import cn.ysk.cashier.pojo.order.TbCashierCart; import cn.ysk.cashier.pojo.shop.TbShopInfo; +import cn.ysk.cashier.pojo.shop.TbShopTable; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -32,8 +32,11 @@ import java.util.List; public class MpCashierCartServiceImpl extends ServiceImpl implements MpCashierCartService { private final MpShopInfoMapper mpShopInfoMapper; - public MpCashierCartServiceImpl(MpShopInfoMapper mpShopInfoMapper) { + private final MpShopTableMapper shopTableMapper; + + public MpCashierCartServiceImpl(MpShopInfoMapper mpShopInfoMapper, MpShopTableMapper shopTableMapper) { this.mpShopInfoMapper = mpShopInfoMapper; + this.shopTableMapper = shopTableMapper; } @Override @@ -93,5 +96,31 @@ public class MpCashierCartServiceImpl extends ServiceImpl selectByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .eq(TbCashierCart::getShopId, shopEatTypeInfoDTO.getShopId()) + .eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType()) + .in(TbCashierCart::getStatus, "create", "return") + .gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime()) + .and(q -> q.eq(TbCashierCart::getMasterId, masterId).or().isNull(TbCashierCart::getMasterId)); + + // 非堂食校验台桌状态 + TbShopTable tbShopTable; + if (shopEatTypeInfoDTO.isTakeout()) { + queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, "")) + .in(TbCashierCart::getPlatformType, OrderPlatformTypeEnum.PC.getValue(), OrderPlatformTypeEnum.CASH.getValue()); + } else { + if (StrUtil.isNotBlank(shopEatTypeInfoDTO.getTableId())) { + + queryWrapper.eq(TbCashierCart::getTableId, shopEatTypeInfoDTO.getTableId()); + } else { + queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, "")); + } + + } + return list(queryWrapper); + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java index d6d9b89c..2db52b2f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java @@ -46,5 +46,12 @@ public class MpOrderDetailServiceImpl extends ServiceImpl() .eq(TbOrderDetail::getOrderId, orderId)); } + + @Override + public List selectByCartIdOrOrderId(Integer shopId, ArrayList cartIdList, Integer orderId) { + return list(new LambdaQueryWrapper() + .and(q -> q.in(TbOrderDetail::getCartId, cartIdList).or().eq(TbOrderDetail::getOrderId, orderId)) + .eq(TbOrderDetail::getShopId, shopId)); + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java index f685be5d..00c63939 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java @@ -240,6 +240,16 @@ public class TbOrderInfo implements Serializable { @Column(name = "`refund_remark`") private String refundRemark; + + // 积分折扣金额 + private BigDecimal pointsDiscountAmount; + // 使用的积分数量 + private Integer pointsNum; + // 用户优惠券id + private String activateInInfoList; + // 优惠券折扣金额 + private BigDecimal activateInDiscountAmount; + public void copy(TbOrderInfo source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 89c25043..c53e855d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -11,6 +11,7 @@ import cn.ysk.cashier.config.security.security.TokenProvider; import cn.ysk.cashier.cons.RedisConstant; import cn.ysk.cashier.cons.TableConstant; import cn.ysk.cashier.cons.rabbit.RabbitConstants; +import cn.ysk.cashier.dto.points.OrderDeductionPointsDTO; import cn.ysk.cashier.dto.shop.TbShopTableDto; import cn.ysk.cashier.dto.shop.TbShopTableQueryCriteria; import cn.ysk.cashier.dto.shoptable.*; @@ -18,10 +19,7 @@ import cn.ysk.cashier.enums.*; import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mapper.shop.TbShopTableMapper; import cn.ysk.cashier.mybatis.mapper.*; -import cn.ysk.cashier.mybatis.service.MpCashierCartService; -import cn.ysk.cashier.mybatis.service.MpOrderDetailService; -import cn.ysk.cashier.mybatis.service.MpOrderInfoService; -import cn.ysk.cashier.mybatis.service.MpShopTableService; +import cn.ysk.cashier.mybatis.service.*; import cn.ysk.cashier.pojo.TbShopPayType; import cn.ysk.cashier.pojo.order.TbCashierCart; import cn.ysk.cashier.pojo.order.TbOrderDetail; @@ -98,6 +96,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { private final MpShopTableService mpShopTableService; private final MpShopUnitMapper mpShopUnitMapper; private final MpProductStockDetailMapper mpProductStockDetailMapper; + private final TbMemberPointsService memberPointsService; /** @@ -1107,50 +1106,30 @@ public class TbShopTableServiceImpl implements TbShopTableService { TbShopInfo shopInfo = shopInfoRepository.findById(createOrderDTO.getShopId()).orElse(null); if (shopInfo == null) throw new BadRequestException("店铺信息不存在"); + // 非堂食校验台桌状态 + TbShopTable tbShopTable = null; + if (StrUtil.isNotBlank(createOrderDTO.getTableId())) { + tbShopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper() + .eq(TbShopTable::getQrcode, createOrderDTO.getTableId()) + .in(TbShopTable::getStatus, "idle", "using")); + } + if (tbShopTable == null) { + throw new BadRequestException("台桌未开台或不存在"); + } + // 就餐模式信息 ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(createOrderDTO.getShopId(), createOrderDTO.getTableId(), createOrderDTO.getUseType()); - // 传递orderId直接取否则取当前缓存id Integer orderId = shopEatTypeInfoDTO.isDineInAfter() ? getCurrentOrderId(shopEatTypeInfoDTO) : null; - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(TbCashierCart::getShopId, createOrderDTO.getShopId()) - .eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType()) - .in(TbCashierCart::getStatus, "create", "return") - .gt(TbCashierCart::getCreatedAt, DateUtil.offsetDay(DateUtil.date(), -1).getTime()) - .and(q -> q.eq(TbCashierCart::getMasterId, createOrderDTO.getMasterId()).or().isNull(TbCashierCart::getMasterId)); - - // 非堂食校验台桌状态 - TbShopTable tbShopTable = null; - if (shopEatTypeInfoDTO.isTakeout()) { - queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, "")) - .in(TbCashierCart::getPlatformType, OrderPlatformTypeEnum.PC.getValue(), OrderPlatformTypeEnum.CASH.getValue()); - } else { - if (StrUtil.isNotBlank(createOrderDTO.getTableId())) { - tbShopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper() - .eq(TbShopTable::getQrcode, createOrderDTO.getTableId()) - .in(TbShopTable::getStatus, "idle", "using")); - if (tbShopTable == null) { - throw new BadRequestException("台桌未开台或不存在"); - } - queryWrapper.eq(TbCashierCart::getTableId, createOrderDTO.getTableId()); - } else { - queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, "")); - } - - } - - List allCashierCarts = cashierCartMapper - .selectList(queryWrapper); - + List allCashierCarts = mpCashierCartService.selectByShopEatType(shopEatTypeInfoDTO, createOrderDTO.getMasterId()); List cashierCarts = new ArrayList<>(); TbCashierCart seatCart = null; for (TbCashierCart allCashierCart : allCashierCarts) { if (TableConstant.CART_SEAT_ID.equals(allCashierCart.getProductId())) { seatCart = allCashierCart; } - // if (OrderStatusEnums.CREATE.getValue().equals(allCashierCart.getStatus())) { // cashierCarts.add(allCashierCart); // } @@ -1176,12 +1155,8 @@ public class TbShopTableServiceImpl implements TbShopTableService { cartIdList.add(tbCashierCart.getId()); } // 查询历史orderDetail - Integer finalOrderId = orderId; - LambdaQueryWrapper query = new LambdaQueryWrapper() - .and(q -> q.in(TbOrderDetail::getCartId, cartIdList).or().eq(TbOrderDetail::getOrderId, finalOrderId)) - .eq(TbOrderDetail::getShopId, createOrderDTO.getShopId()); + List oldOrderDetailList = mpOrderDetailService.selectByCartIdOrOrderId(createOrderDTO.getShopId(), cartIdList, orderId); - List oldOrderDetailList = orderDetailMapper.selectList(query); ArrayList removeOrderDetailIds = new ArrayList<>(); ArrayList removeOrderDetailList = new ArrayList<>(); HashMap oldOrderDetailMap = new HashMap<>(); @@ -1203,7 +1178,6 @@ public class TbShopTableServiceImpl implements TbShopTableService { List orderDetails = new ArrayList<>(); List addOrderDetails = new ArrayList<>(); - boolean hasNewInfo = false; for (TbCashierCart cashierCart : cashierCarts) { if (!"return".equals(cashierCart.getStatus())) { @@ -1239,7 +1213,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { orderDetail.setProductName(cashierCart.getName()); orderDetail.setShopId(Integer.valueOf(cashierCart.getShopId())); orderDetail.setPackAmount(cashierCart.getPackFee()); - orderDetail.setStatus("unpaid"); + orderDetail.setStatus(TableConstant.CashierCart.Status.RETURN.equalsVals(cashierCart.getStatus()) ? cashierCart.getStatus() : "unpaid"); orderDetail.setUseType(shopEatTypeInfoDTO.getUseType()); orderDetail.setProductImg(cashierCart.getCoverImg()); orderDetail.setCartId(cashierCart.getId()); @@ -1250,7 +1224,6 @@ public class TbShopTableServiceImpl implements TbShopTableService { orderDetails.add(orderDetail); } - // 查询订单 TbOrderInfo orderInfo = null; if (orderId != null) { @@ -1275,7 +1248,6 @@ public class TbShopTableServiceImpl implements TbShopTableService { orderInfo.setSettlementAmount(totalAmount); orderInfo.setAmount(totalAmount); orderInfo.setOriginAmount(totalAmount); -// orderInfo.setStatus("unpaid"); orderInfo.setOrderAmount(totalAmount); orderInfo.setRemark(createOrderDTO.getNote()); orderInfo.setFreightAmount(feeAmount); @@ -1449,6 +1421,26 @@ public class TbShopTableServiceImpl implements TbShopTableService { } + private void calculateOrderCouponAndPoints(TbOrderInfo orderInfo, List userCouponList, Integer pointsNum) { + BigDecimal shouldPayAmount = BigDecimal.ZERO; + if (pointsNum != null) { + Long memberId = Long.valueOf(orderInfo.getMemberId()); + OrderDeductionPointsDTO memberUsablePoints = memberPointsService.getMemberUsablePoints(memberId, orderInfo.getOrderAmount()); + if (!memberUsablePoints.getUsable()) { + throw new BadRequestException(memberUsablePoints.getUnusableReason()); + } + if (pointsNum < memberUsablePoints.getMinDeductionPoints() || pointsNum > memberUsablePoints.getMaxUsablePoints()) { + throw new BadRequestException("可抵扣积分区间为: [" + memberUsablePoints.getMinDeductionPoints() + "-" + memberUsablePoints.getMaxUsablePoints() + "]"); + } + + BigDecimal discountAmount = memberPointsService.calcDeductionAmount(memberId, orderInfo.getOrderAmount(), pointsNum); + orderInfo.setPointsNum(pointsNum); + orderInfo.setPointsDiscountAmount(discountAmount); + shouldPayAmount = shouldPayAmount.subtract(discountAmount); + memberPointsService.deductPoints(memberId, pointsNum, "霸王餐充值抵扣", Long.valueOf(orderInfo.getId())); + } + } + @Override public Object pending(PendingDTO pendingDTO) { From 80d990de1727c811c13c55245bd9a875c25d75c9 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 14:17:24 +0800 Subject: [PATCH 053/165] =?UTF-8?q?1.=20=E5=8F=96=E6=B6=88=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/shopimpl/TbShopTableServiceImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index c53e855d..fad25b5b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1439,6 +1439,10 @@ public class TbShopTableServiceImpl implements TbShopTableService { shouldPayAmount = shouldPayAmount.subtract(discountAmount); memberPointsService.deductPoints(memberId, pointsNum, "霸王餐充值抵扣", Long.valueOf(orderInfo.getId())); } + + if (!userCouponList.isEmpty()) { + + } } @@ -1762,15 +1766,16 @@ public class TbShopTableServiceImpl implements TbShopTableService { .in(TbCashierCart::getPlatformType, OrderPlatformTypeEnum.PC.getValue(), OrderPlatformTypeEnum.CASH.getValue()); } - TbShopUser shopUser = tbShopUserMapper.selectById(updateVipDTO.getVipUserId()); - if (shopUser == null) { - throw new BadRequestException("用户信息不存在"); - } + List tbCashierCarts = cashierCartMapper.selectList(queryWrapper.isNotNull(TbCashierCart::getOrderId)); if (!tbCashierCarts.isEmpty()) { Integer orderId = tbCashierCarts.get(0).getOrderId(); if (updateVipDTO.getType() == 0) { + TbShopUser shopUser = tbShopUserMapper.selectById(updateVipDTO.getVipUserId()); + if (shopUser == null) { + throw new BadRequestException("用户信息不存在"); + } return orderInfoMapper.update(null, new LambdaUpdateWrapper() .eq(TbOrderInfo::getId, orderId) .set(TbOrderInfo::getUserId, shopUser.getUserId()) From 479a286040c34d369894e19c1e4549f52e4b1af9 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 14:18:27 +0800 Subject: [PATCH 054/165] =?UTF-8?q?1.=20=E5=8F=96=E6=B6=88=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index fad25b5b..c31fa9a1 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1766,8 +1766,6 @@ public class TbShopTableServiceImpl implements TbShopTableService { .in(TbCashierCart::getPlatformType, OrderPlatformTypeEnum.PC.getValue(), OrderPlatformTypeEnum.CASH.getValue()); } - - List tbCashierCarts = cashierCartMapper.selectList(queryWrapper.isNotNull(TbCashierCart::getOrderId)); if (!tbCashierCarts.isEmpty()) { Integer orderId = tbCashierCarts.get(0).getOrderId(); From 1f412710e7aa197d7632c6b2f8ee5eb1c76c2ac3 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Thu, 31 Oct 2024 14:23:07 +0800 Subject: [PATCH 055/165] =?UTF-8?q?1.=20=E5=8F=96=E6=B6=88=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbShopTableServiceImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index c31fa9a1..cab93224 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -97,6 +97,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { private final MpShopUnitMapper mpShopUnitMapper; private final MpProductStockDetailMapper mpProductStockDetailMapper; private final TbMemberPointsService memberPointsService; + private final TbShopCouponService shopCouponService; /** @@ -1112,10 +1113,11 @@ public class TbShopTableServiceImpl implements TbShopTableService { tbShopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper() .eq(TbShopTable::getQrcode, createOrderDTO.getTableId()) .in(TbShopTable::getStatus, "idle", "using")); + if (tbShopTable == null) { + throw new BadRequestException("台桌未开台或不存在"); + } } - if (tbShopTable == null) { - throw new BadRequestException("台桌未开台或不存在"); - } + // 就餐模式信息 ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(createOrderDTO.getShopId(), createOrderDTO.getTableId(), createOrderDTO.getUseType()); @@ -1782,7 +1784,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { return orderInfoMapper.update(null, new LambdaUpdateWrapper() .eq(TbOrderInfo::getId, orderId) .set(TbOrderInfo::getUserId, null) - .set(TbOrderInfo::getUserId, null)); + .set(TbOrderInfo::getMemberId, null)); } } return true; From 362c737c4b815e8708695d832adda97009a58bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Thu, 31 Oct 2024 14:47:43 +0800 Subject: [PATCH 056/165] =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/entity/TbMemberPoints.java | 2 + .../mybatis/entity/TbMemberPointsLog.java | 2 + .../mybatis/entity/TbPointsBasicSetting.java | 2 + .../entity/TbPointsExchangeRecord.java | 153 +++++++++--------- .../mybatis/entity/TbPointsGoodsSetting.java | 3 + ...LogDao.xml => TbMemberPointsLogMapper.xml} | 0 ...PointsDao.xml => TbMemberPointsMapper.xml} | 0 ...Dao.xml => TbPointsBasicSettingMapper.xml} | 0 ...o.xml => TbPointsExchangeRecordMapper.xml} | 0 ...Dao.xml => TbPointsGoodsSettingMapper.xml} | 0 10 files changed, 87 insertions(+), 75 deletions(-) rename eladmin-system/src/main/resources/mapper/plus/{TbMemberPointsLogDao.xml => TbMemberPointsLogMapper.xml} (100%) rename eladmin-system/src/main/resources/mapper/plus/{TbMemberPointsDao.xml => TbMemberPointsMapper.xml} (100%) rename eladmin-system/src/main/resources/mapper/plus/{TbPointsBasicSettingDao.xml => TbPointsBasicSettingMapper.xml} (100%) rename eladmin-system/src/main/resources/mapper/plus/{TbPointsExchangeRecordDao.xml => TbPointsExchangeRecordMapper.xml} (100%) rename eladmin-system/src/main/resources/mapper/plus/{TbPointsGoodsSettingDao.xml => TbPointsGoodsSettingMapper.xml} (100%) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java index e274d687..08072dae 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPoints.java @@ -1,6 +1,7 @@ package cn.ysk.cashier.mybatis.entity; import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.EqualsAndHashCode; @@ -56,6 +57,7 @@ public class TbMemberPoints { * 最近一次积分变动时间 */ @TableField("last_points_change_time") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date lastPointsChangeTime; /** * 最近一次浮动积分 diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPointsLog.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPointsLog.java index ac430835..c86808ed 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPointsLog.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMemberPointsLog.java @@ -3,6 +3,7 @@ package cn.ysk.cashier.mybatis.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.EqualsAndHashCode; @@ -64,5 +65,6 @@ public class TbMemberPointsLog { /** * 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsBasicSetting.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsBasicSetting.java index b9b5432a..daa71be3 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsBasicSetting.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsBasicSetting.java @@ -3,6 +3,7 @@ package cn.ysk.cashier.mybatis.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.EqualsAndHashCode; @@ -65,5 +66,6 @@ public class TbPointsBasicSetting { /** * 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsExchangeRecord.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsExchangeRecord.java index dfd5fc3a..07c18390 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsExchangeRecord.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsExchangeRecord.java @@ -1,6 +1,7 @@ package cn.ysk.cashier.mybatis.entity; import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.EqualsAndHashCode; @@ -14,84 +15,86 @@ import java.util.Date; * @since 2.0 2024-10-25 */ @Data -@EqualsAndHashCode(callSuper=false) +@EqualsAndHashCode(callSuper = false) @TableName("tb_points_exchange_record") public class TbPointsExchangeRecord { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * id - */ - @TableId(type = IdType.AUTO) - private Long id; - /** - * 订单编号 - */ - private String orderNo; - /** - * 店铺id - */ - private Long shopId; - /** - * 积分商品id - */ - private Long pointsGoodsId; - /** - * 积分商品名称 - */ - private String pointsGoodsName; - /** - * 商品图片URL - */ - private String goodsImageUrl; - /** - * 领取方式 self-自取 post-邮寄 - */ - private String pickupMethod; - /** - * 会员id - */ - private Long memberId; - /** - * 会员名称 - */ - private String memberName; - /** - * 手机号码 - */ - private String mobile; - /** - * 会员头像 - */ - private String avatarUrl; - /** - * 消耗积分 - */ - private Integer spendPoints; - /** - * 额外支付 - */ - private BigDecimal extraPaymentAmount; - /** - * 兑换券券码 - */ - private String couponCode; - /** - * 状态 waiting-待自取 done-已完成 - */ - private String status; - /** - * 创建时间(下单时间) - */ - private Date createTime; - /** - * 更新时间(核销时间) - */ - private Date updateTime; + /** + * id + */ + @TableId(type = IdType.AUTO) + private Long id; + /** + * 订单编号 + */ + private String orderNo; + /** + * 店铺id + */ + private Long shopId; + /** + * 积分商品id + */ + private Long pointsGoodsId; + /** + * 积分商品名称 + */ + private String pointsGoodsName; + /** + * 商品图片URL + */ + private String goodsImageUrl; + /** + * 领取方式 self-自取 post-邮寄 + */ + private String pickupMethod; + /** + * 会员id + */ + private Long memberId; + /** + * 会员名称 + */ + private String memberName; + /** + * 手机号码 + */ + private String mobile; + /** + * 会员头像 + */ + private String avatarUrl; + /** + * 消耗积分 + */ + private Integer spendPoints; + /** + * 额外支付 + */ + private BigDecimal extraPaymentAmount; + /** + * 兑换券券码 + */ + private String couponCode; + /** + * 状态 waiting-待自取 done-已完成 + */ + private String status; + /** + * 创建时间(下单时间) + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + /** + * 更新时间(核销时间) + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; - @TableField(value = "count(*)", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER) - private Long count; + @TableField(value = "count(*)", select = false, insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER) + private Long count; - @TableField(value = "sum(extra_payment_amount)", insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER) - private BigDecimal totalAmount; + @TableField(value = "sum(extra_payment_amount)", select = false, insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER) + private BigDecimal totalAmount; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java index ba123948..666dbc69 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbPointsGoodsSetting.java @@ -2,6 +2,7 @@ package cn.ysk.cashier.mybatis.entity; import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import lombok.EqualsAndHashCode; @@ -74,10 +75,12 @@ public class TbPointsGoodsSetting { /** * 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; /** * 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; /** * 逻辑删除标志 1-是 0-否 diff --git a/eladmin-system/src/main/resources/mapper/plus/TbMemberPointsLogDao.xml b/eladmin-system/src/main/resources/mapper/plus/TbMemberPointsLogMapper.xml similarity index 100% rename from eladmin-system/src/main/resources/mapper/plus/TbMemberPointsLogDao.xml rename to eladmin-system/src/main/resources/mapper/plus/TbMemberPointsLogMapper.xml diff --git a/eladmin-system/src/main/resources/mapper/plus/TbMemberPointsDao.xml b/eladmin-system/src/main/resources/mapper/plus/TbMemberPointsMapper.xml similarity index 100% rename from eladmin-system/src/main/resources/mapper/plus/TbMemberPointsDao.xml rename to eladmin-system/src/main/resources/mapper/plus/TbMemberPointsMapper.xml diff --git a/eladmin-system/src/main/resources/mapper/plus/TbPointsBasicSettingDao.xml b/eladmin-system/src/main/resources/mapper/plus/TbPointsBasicSettingMapper.xml similarity index 100% rename from eladmin-system/src/main/resources/mapper/plus/TbPointsBasicSettingDao.xml rename to eladmin-system/src/main/resources/mapper/plus/TbPointsBasicSettingMapper.xml diff --git a/eladmin-system/src/main/resources/mapper/plus/TbPointsExchangeRecordDao.xml b/eladmin-system/src/main/resources/mapper/plus/TbPointsExchangeRecordMapper.xml similarity index 100% rename from eladmin-system/src/main/resources/mapper/plus/TbPointsExchangeRecordDao.xml rename to eladmin-system/src/main/resources/mapper/plus/TbPointsExchangeRecordMapper.xml diff --git a/eladmin-system/src/main/resources/mapper/plus/TbPointsGoodsSettingDao.xml b/eladmin-system/src/main/resources/mapper/plus/TbPointsGoodsSettingMapper.xml similarity index 100% rename from eladmin-system/src/main/resources/mapper/plus/TbPointsGoodsSettingDao.xml rename to eladmin-system/src/main/resources/mapper/plus/TbPointsGoodsSettingMapper.xml From 5eab49b8448c492677bea05330bf723c3ab2f1a1 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 31 Oct 2024 15:10:56 +0800 Subject: [PATCH 057/165] =?UTF-8?q?=E7=9B=98=E7=82=B9=E5=87=BA=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/cons/service/impl/TbConCheckServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e32e43c6..d4358b77 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 @@ -75,7 +75,7 @@ public class TbConCheckServiceImpl implements TbConCheckService { } TbConsInfoFlow flow=new TbConsInfoFlow(); - if(consInfo.getStockNumber().compareTo(resources.getStockNumber())>=0){ + if((consInfo.getStockNumber().subtract(consInfo.getStockConsume())).compareTo(resources.getStockNumber())>=0){ flow.setBizCode("checkStockOut"); flow.setBizName("盘点出库"); flow.setBizType("-"); From 2e9c25d8a8f80f1799b3634af9458d03ffa92c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Thu, 31 Oct 2024 15:24:33 +0800 Subject: [PATCH 058/165] =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/service/impl/TbMemberPointsLogServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsLogServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsLogServiceImpl.java index 0c9009d9..3070f8b3 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsLogServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMemberPointsLogServiceImpl.java @@ -33,6 +33,7 @@ public class TbMemberPointsLogServiceImpl extends ServiceImpl wrapper = Wrappers.lambdaQuery(); wrapper.eq(TbMemberPointsLog::getShopId, param.getShopId()); + wrapper.eq(param.getMemberId() != null, TbMemberPointsLog::getMemberId, param.getMemberId()); wrapper.like(StrUtil.isNotEmpty(param.getMemberName()), TbMemberPointsLog::getMemberName, param.getMemberName()); wrapper.like(StrUtil.isNotEmpty(param.getMobile()), TbMemberPointsLog::getMobile, param.getMobile()); wrapper.like(StrUtil.isNotEmpty(param.getContent()), TbMemberPointsLog::getContent, param.getContent()); From 97a8a5472dba7456cbce8e3b394de82ac9953d0e Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 1 Nov 2024 09:40:03 +0800 Subject: [PATCH 059/165] =?UTF-8?q?=E5=A4=9A=E4=BD=99=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4=20=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- eladmin-system/pom.xml | 10 ++- .../ysk/cashier/dto/BotButtonConfigDto.java | 37 -------- .../dto/BotButtonConfigQueryCriteria.java | 32 ------- .../java/cn/ysk/cashier/dto/BotConfigDto.java | 40 --------- .../cashier/dto/BotConfigQueryCriteria.java | 36 -------- .../java/cn/ysk/cashier/dto/BotUserDto.java | 87 ------------------- .../cn/ysk/cashier/dto/BotUserFlowDto.java | 54 ------------ .../cashier/dto/BotUserFlowQueryCriteria.java | 40 --------- .../ysk/cashier/dto/BotUserQueryCriteria.java | 48 ---------- 9 files changed, 8 insertions(+), 376 deletions(-) delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/BotButtonConfigDto.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/BotButtonConfigQueryCriteria.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/BotConfigDto.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/BotConfigQueryCriteria.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserDto.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserFlowDto.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserFlowQueryCriteria.java delete mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserQueryCriteria.java diff --git a/eladmin-system/pom.xml b/eladmin-system/pom.xml index 2b543b9e..cb0749ce 100644 --- a/eladmin-system/pom.xml +++ b/eladmin-system/pom.xml @@ -167,9 +167,15 @@ - pro + pre - pro + pre + + + + prod + + prod diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotButtonConfigDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotButtonConfigDto.java deleted file mode 100644 index b555cae6..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotButtonConfigDto.java +++ /dev/null @@ -1,37 +0,0 @@ -/* -* 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.dto; - -import lombok.Data; -import java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author admin -* @date 2023-10-31 -**/ -@Data -public class BotButtonConfigDto implements Serializable { - - private Integer id; - - /** 按钮名称 */ - private String buttonName; - - /** 按钮值 */ - private String buttonValue; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotButtonConfigQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotButtonConfigQueryCriteria.java deleted file mode 100644 index d789fd09..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotButtonConfigQueryCriteria.java +++ /dev/null @@ -1,32 +0,0 @@ -/* -* 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.dto; - -import lombok.Data; -import cn.ysk.cashier.annotation.Query; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-31 -**/ -@Data -public class BotButtonConfigQueryCriteria{ - - /** 精确 */ - @Query - private String buttonName; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotConfigDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotConfigDto.java deleted file mode 100644 index 1426d65d..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotConfigDto.java +++ /dev/null @@ -1,40 +0,0 @@ -/* -* 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.dto; - -import lombok.Data; -import java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author admin -* @date 2023-10-31 -**/ -@Data -public class BotConfigDto implements Serializable { - - private Integer id; - - /** 元素键值 */ - private String configKey; - - /** 元素值 */ - private String configValue; - - /** 描述 */ - private String remark; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotConfigQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotConfigQueryCriteria.java deleted file mode 100644 index ce14acb3..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotConfigQueryCriteria.java +++ /dev/null @@ -1,36 +0,0 @@ -/* -* 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.dto; - -import lombok.Data; -import cn.ysk.cashier.annotation.Query; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-31 -**/ -@Data -public class BotConfigQueryCriteria{ - - /** 精确 */ - @Query - private String configKey; - - /** 精确 */ - @Query - private String configValue; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserDto.java deleted file mode 100644 index 93ee777f..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserDto.java +++ /dev/null @@ -1,87 +0,0 @@ -/* -* 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.dto; - -import lombok.Data; -import java.sql.Timestamp; -import java.math.BigDecimal; -import java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author admin -* @date 2023-10-30 -**/ -@Data -public class BotUserDto implements Serializable { - - private Integer id; - - private Integer fatherId; - - /** 父级电报号 */ - private String fatherTelegramId; - - /** 电报号 */ - private String userTelegramId; - - /** 用户名称 */ - private String userName; - - /** 组电报号 */ - private String groupTelegramId; - - /** 用户代码 */ - private String userCode; - - private String userPayPass; - - private String bombStatus; - - /** 用户状态 */ - private String botStatus; - - /** 总充值 */ - private BigDecimal usdtRechargeTotal; - - /** 总提现 */ - private BigDecimal usdtWithdrawTotal; - - /** 总资金 */ - private BigDecimal balance; - - /** 冻结资金 */ - private BigDecimal freezeBalance; - - /** 版本号 */ - private Integer version; - - /** 创建时间 */ - private Timestamp createTime; - - /** 更新时间 */ - private Timestamp updateTime; - - /** 语言 */ - private String userLanguage; - - /** 质押资金 */ - private BigDecimal chipBalance; - - /** 绑定时间 */ - private Timestamp fatherBindTime; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserFlowDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserFlowDto.java deleted file mode 100644 index cc5a0e83..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserFlowDto.java +++ /dev/null @@ -1,54 +0,0 @@ -/* -* 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.dto; - -import lombok.Data; -import java.sql.Timestamp; -import java.math.BigDecimal; -import java.io.Serializable; - -/** -* @website https://eladmin.vip -* @description / -* @author admin -* @date 2023-10-30 -**/ -@Data -public class BotUserFlowDto implements Serializable { - - private Integer id; - - /** 电报号 */ - private String userTelegramId; - - /** 用户名称 */ - private String userName; - - /** 业务代码 */ - private String bizCode; - - /** 变动金额 */ - private BigDecimal amount; - - /** 变动前金额 */ - private BigDecimal oldBalance; - - /** 变动后金额 */ - private BigDecimal newBalance; - - /** 创建时间 */ - private Timestamp createTime; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserFlowQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserFlowQueryCriteria.java deleted file mode 100644 index d629ccf6..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserFlowQueryCriteria.java +++ /dev/null @@ -1,40 +0,0 @@ -/* -* 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.dto; - -import lombok.Data; -import cn.ysk.cashier.annotation.Query; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-30 -**/ -@Data -public class BotUserFlowQueryCriteria{ - - /** 精确 */ - @Query - private String userTelegramId; - - /** 精确 */ - @Query - private String userName; - - /** 精确 */ - @Query - private String bizCode; -} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserQueryCriteria.java deleted file mode 100644 index e174c66c..00000000 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/BotUserQueryCriteria.java +++ /dev/null @@ -1,48 +0,0 @@ -/* -* 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.dto; - -import lombok.Data; -import cn.ysk.cashier.annotation.Query; - -/** -* @website https://eladmin.vip -* @author admin -* @date 2023-10-30 -**/ -@Data -public class BotUserQueryCriteria{ - - /** 精确 */ - @Query - private String fatherTelegramId; - - /** 精确 */ - @Query - private String userTelegramId; - - /** 精确 */ - @Query - private String userName; - - /** 精确 */ - @Query - private String userCode; - - /** 精确 */ - @Query - private String botStatus; -} \ No newline at end of file From cdeb5e003c60589fd2da0883338330cbb359c007 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 1 Nov 2024 13:46:10 +0800 Subject: [PATCH 060/165] =?UTF-8?q?=E5=A4=9A=E4=BD=99=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/ysk/cashier/controller/shop/SummaryController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryController.java index efd3df02..7b814e1e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryController.java @@ -26,7 +26,6 @@ public class SummaryController { //营业板块 上 @PostMapping("/trade") - @AnonymousPostMapping private Object shopSummaryDate(@RequestBody BaseQueryDto param) { return summaryService.trade(param); } From 086eb3523b7df63ebee34fd104fa01ab7ceb61af Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Fri, 1 Nov 2024 16:51:51 +0800 Subject: [PATCH 061/165] =?UTF-8?q?1.=20=E8=AE=A2=E5=8D=95=E8=A1=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java index 00c63939..dc8a40c8 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java @@ -246,9 +246,11 @@ public class TbOrderInfo implements Serializable { // 使用的积分数量 private Integer pointsNum; // 用户优惠券id - private String activateInInfoList; + private String userCouponInfoList; // 优惠券折扣金额 - private BigDecimal activateInDiscountAmount; + private BigDecimal productCouponDiscountAmount; + // 满减抵扣金额 + private BigDecimal fullCouponDiscountAmount; public void copy(TbOrderInfo source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); From 6f6085343f6f306eba88860155323c8d2c3116fc Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Mon, 4 Nov 2024 10:27:23 +0800 Subject: [PATCH 062/165] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/ysk/cashier/cons/domain/TbConsInfo.java | 4 ++++ .../java/cn/ysk/cashier/cons/domain/TbConsInfoV2.java | 4 ++++ .../cons/service/impl/TbConsInfoServiceImpl.java | 10 +++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java index e2231b25..64e0b5ad 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java @@ -61,6 +61,10 @@ public class TbConsInfo implements Serializable { @ApiModelProperty(value = "单位换算") private BigDecimal conUnitTwoConvert; + @Column(name = "`default_unit`") + @ApiModelProperty(value = "默认入库单位") + private String defaultUnit; + @Column(name = "`laster_in_stock`") @ApiModelProperty(value = "最近一次入库量") private BigDecimal lasterInStock; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoV2.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoV2.java index 111aeb04..7874d061 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoV2.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfoV2.java @@ -63,6 +63,10 @@ public class TbConsInfoV2 implements Serializable { @ApiModelProperty(value = "单位换算") private BigDecimal conUnitTwoConvert; + @Column(name = "`default_unit`") + @ApiModelProperty(value = "默认入库单位") + private String defaultUnit; + @Column(name = "`laster_in_stock`") @ApiModelProperty(value = "最近一次入库量") 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 3b7a1451..ab6a429d 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 @@ -231,10 +231,18 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { } BigDecimal changeStock = conInfos.getStockNumber(); //副单位的实际修改值 - if (StringUtils.isNotBlank(conInfos.getUnit()) && conInfos.getUnit().equals(info.getConUnitTwo())) { + if(StringUtils.isNotBlank(conInfos.getUnit())){ + info.setDefaultUnit(conInfos.getUnit()); + if(conInfos.getUnit().equals(info.getConUnitTwo())){ + changeStock = conInfos.getStockNumber().multiply(info.getConUnitTwoConvert()).setScale(2, BigDecimal.ROUND_HALF_UP); + } + }else if(info.getConUnitTwo().equals(info.getDefaultUnit())) { + info.setDefaultUnit(info.getConUnitTwo()); changeStock = conInfos.getStockNumber().multiply(info.getConUnitTwoConvert()).setScale(2, BigDecimal.ROUND_HALF_UP); } + + TbConsSuppFlow suppFlow = new TbConsSuppFlow(); TbConsInfoFlow flow = new TbConsInfoFlow(); From 8aad5da1048cf45aea7485752e891093286b52e0 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Mon, 4 Nov 2024 10:53:42 +0800 Subject: [PATCH 063/165] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java | 1 + 1 file changed, 1 insertion(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java index a4b0bf17..40276438 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java @@ -39,6 +39,7 @@ public class TbConsInfoDto implements Serializable { private String conUnitTwo; private BigDecimal conUnitTwoConvert; + private String defaultUnit; /** 最近一次入库量 */ private BigDecimal lasterInStock; From 7c572d7384f00c723d763160dcfc13260137dbbb Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Mon, 4 Nov 2024 11:12:27 +0800 Subject: [PATCH 064/165] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E7=A7=AF=E5=88=86=E4=BC=98=E6=83=A0=E5=88=B8=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/cons/TableConstant.java | 7 +- .../controller/TbShopCouponController.java | 6 + .../controller/product/TbPlaceController.java | 10 +- .../cashier/dto/order/OrderCartInfoDTO.java | 19 + .../cashier/dto/order/OrderCouponInfoDTO.java | 20 + .../ysk/cashier/dto/order/OrderPriceDTO.java | 20 + .../cashier/dto/order/UserCouponInfoDTO.java | 12 + .../cashier/dto/shoptable/CreateOrderDTO.java | 12 +- .../cn/ysk/cashier/dto/shoptable/PayDTO.java | 11 +- .../cashier/dto/shoptable/UpdateVipDTO.java | 2 +- .../mapper/TbActivateInRecordMapper.java | 16 +- .../mapper/TbActivateOutRecordMapper.java | 3 +- .../mybatis/service/MpCashierCartService.java | 6 + .../mybatis/service/MpOrderDetailService.java | 8 +- .../mybatis/service/MpOrderInfoService.java | 31 +- .../mybatis/service/MpShopUserService.java | 16 + .../mybatis/service/TbShopCouponService.java | 33 + .../impl/MpCashierCartServiceImpl.java | 10 + .../impl/MpOrderDetailServiceImpl.java | 10 +- .../service/impl/MpOrderInfoServiceImpl.java | 8 + .../service/impl/MpShopUserServiceImpl.java | 23 + .../service/impl/TbShopCouponServiceImpl.java | 140 ++- .../ysk/cashier/pojo/order/TbCashierCart.java | 2 + .../ysk/cashier/pojo/order/TbOrderInfo.java | 2 +- .../shop/TbPlussShopStaffRepository.java | 5 +- .../impl/shopimpl/TbShopTableServiceImpl.java | 953 ++++++++++++------ .../cn/ysk/cashier/vo/ActivateInInfoVO.java | 15 + .../cn/ysk/cashier/vo/TbUserCouponVo.java | 5 + 28 files changed, 1066 insertions(+), 339 deletions(-) create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderCartInfoDTO.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderCouponInfoDTO.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderPriceDTO.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/dto/order/UserCouponInfoDTO.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpShopUserService.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpShopUserServiceImpl.java create mode 100644 eladmin-system/src/main/java/cn/ysk/cashier/vo/ActivateInInfoVO.java diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/TableConstant.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/TableConstant.java index ac2e0605..1244125a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/TableConstant.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/TableConstant.java @@ -57,12 +57,17 @@ public interface TableConstant { @Getter public enum Status { REFUNDING("refunding"), REFUND("refund"), CLOSED("closed"), CREATE("create"), - UNPAID("unpaid"), PAYING("paying"), RETURN("return"); + UNPAID("unpaid"), PAYING("paying"), RETURN("return"), FINAL("final"); private final String value; Status(String value) { this.value = value; } + + public boolean equalsVals(String value) { + return this.value.equals(value); + } + } @Getter diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java index bae5fed1..9184405f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/TbShopCouponController.java @@ -90,5 +90,11 @@ public class TbShopCouponController { tbShopCouponService.deleteReceive(ids); return new ResponseEntity<>(HttpStatus.OK); } + + @GetMapping("activateByOrderId") + @ApiOperation("根据订单id获取可用优惠券信息") + public ResponseEntity activateByOrderIds(@RequestParam Integer shopId, @RequestParam Integer orderId, @RequestParam(required = false) Integer memberId) { + return ResponseEntity.ok(tbShopCouponService.getActivateByOrderIds(shopId, orderId, memberId)); + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java index 0103d389..59ec269f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/product/TbPlaceController.java @@ -175,8 +175,14 @@ public class TbPlaceController { JSONObject userInfo = JSON.parseObject(JSON.toJSONString(redisUtils.get("online-token-" + token))); String userName = userInfo.getString("userName"); String shopId = userInfo.getString("shopId"); - TbPlussShopStaff shopStaff = staffRepository.queryByAccount(userName, shopId); - TbMerchantAccount merchantAccount = tbMerchantAccountMapper.selectOne(Wrappers.lambdaQuery().eq(TbMerchantAccount::getAccount, shopStaff.getAccount())); + TbPlussShopStaff shopStaff; + if (userName.contains("@")) { + shopStaff = staffRepository.queryMasterAccount(shopId); + }else { + shopStaff = staffRepository.queryByAccount(userName, shopId); + } + TbMerchantAccount merchantAccount = tbMerchantAccountMapper.selectOne(Wrappers.lambdaQuery() + .eq(TbMerchantAccount::getAccount, shopStaff.getAccount())); Integer accountId = merchantAccount.getId(); Integer staffId = shopStaff.getId(); List onlineUserList = tbTokenRepository.findListByAccountIdAndStaffId(accountId, staffId); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderCartInfoDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderCartInfoDTO.java new file mode 100644 index 00000000..ad5ab1ed --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderCartInfoDTO.java @@ -0,0 +1,19 @@ +package cn.ysk.cashier.dto.order; + +import cn.ysk.cashier.pojo.order.TbCashierCart; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +@Data +public class OrderCartInfoDTO { + private BigDecimal totalAmount = BigDecimal.ZERO; + private BigDecimal newAddTotalAmount = BigDecimal.ZERO; + private List newCashierCarts = new ArrayList<>(); + private List cashierCarts = new ArrayList<>(); + private List cashierCartIds = new ArrayList<>(); + private Integer orderId; + private TbCashierCart seatCart; +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderCouponInfoDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderCouponInfoDTO.java new file mode 100644 index 00000000..e7895609 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderCouponInfoDTO.java @@ -0,0 +1,20 @@ +package cn.ysk.cashier.dto.order; + +import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord; +import cn.ysk.cashier.pojo.shop.TbShopUser; +import cn.ysk.cashier.vo.TbUserCouponVo; +import lombok.Data; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +@Data +public class OrderCouponInfoDTO { + private TbShopUser shopUser; + private List outRecordList = new ArrayList<>(); + // 满减优惠券 + private HashMap fullReductionCouponMap = new HashMap<>(); + // 商品优惠券 + private HashMap productCouponMap = new HashMap<>(); +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderPriceDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderPriceDTO.java new file mode 100644 index 00000000..b7b4249a --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/OrderPriceDTO.java @@ -0,0 +1,20 @@ +package cn.ysk.cashier.dto.order; + +import cn.ysk.cashier.pojo.order.TbOrderDetail; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +@Data +public class OrderPriceDTO { + private BigDecimal originAmount = BigDecimal.ZERO; + private BigDecimal totalAmount = BigDecimal.ZERO; + private BigDecimal packAmount = BigDecimal.ZERO; + private boolean hasNewInfo = false; + private List newOrderDetailList = new ArrayList<>(); + private List removeOrderDetailList = new ArrayList<>(); + private List removeOrderDetailIds = new ArrayList<>(); + private List orderDetailList = new ArrayList<>(); +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/UserCouponInfoDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/UserCouponInfoDTO.java new file mode 100644 index 00000000..0266aeea --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/order/UserCouponInfoDTO.java @@ -0,0 +1,12 @@ +package cn.ysk.cashier.dto.order; + +import lombok.Data; + +import javax.validation.constraints.Min; + +@Data +public class UserCouponInfoDTO { + private Integer userCouponId; + @Min(1) + private Integer num; +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/CreateOrderDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/CreateOrderDTO.java index 73dfde96..558fd8b8 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/CreateOrderDTO.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/CreateOrderDTO.java @@ -1,7 +1,11 @@ package cn.ysk.cashier.dto.shoptable; +import cn.ysk.cashier.dto.order.UserCouponInfoDTO; import lombok.Data; +import org.springframework.validation.annotation.Validated; +import javax.validation.Valid; +import javax.validation.constraints.Min; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.util.ArrayList; @@ -19,9 +23,11 @@ public class CreateOrderDTO { private Integer orderId; @NotEmpty private String useType; - private String vipUserId; + private Integer vipUserId; // 使用的优惠券 - private List userCouponIds = new ArrayList<>(); + @Valid + private List userCouponInfos = new ArrayList<>(); // 使用的积分抵扣数量 - private Integer pointsNum ; + private Integer pointsNum; + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PayDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PayDTO.java index aafea9f8..7402fc5a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PayDTO.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/PayDTO.java @@ -1,11 +1,15 @@ package cn.ysk.cashier.dto.shoptable; +import cn.ysk.cashier.dto.order.UserCouponInfoDTO; import lombok.Data; +import javax.validation.Valid; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; +import java.util.ArrayList; +import java.util.List; @Data public class PayDTO { @@ -20,6 +24,11 @@ public class PayDTO { private Double discount; private Integer vipUserId; private String code; - private String token; + // 使用的优惠券 + @Valid + private List userCouponInfos = new ArrayList<>(); + // 使用的积分抵扣数量 + private Integer pointsNum; + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/UpdateVipDTO.java b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/UpdateVipDTO.java index 693c2c76..ba1a6f0b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/UpdateVipDTO.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/dto/shoptable/UpdateVipDTO.java @@ -13,7 +13,7 @@ public class UpdateVipDTO { private String tableId; @NotNull private String masterId; - + private Integer orderId; private Integer vipUserId; @NotNull @Range(min = 0, max = 1) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java index 4401388e..7a384e26 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.ysk.cashier.mybatis.entity.TbActivateInRecord; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; import java.util.List; @@ -17,7 +18,9 @@ import java.util.List; public interface TbActivateInRecordMapper extends BaseMapper { @Select("SELECT" + - " inRecord.coupon_id as id," + + " inRecord.id as id," + + " inRecord.full_amount as fullAmount," + + " inRecord.discount_amount as discountAmount," + " inRecord.coupon_id as couponId," + " pro.id as proId," + " CASE" + @@ -34,14 +37,19 @@ public interface TbActivateInRecordMapper extends BaseMapper " inRecord.vip_user_id = #{vipUserId}" + " and inRecord.shop_id = #{shopId}" + " and inRecord.over_num != 0" + - " and inRecord.use_start_time < now()" + - " and inRecord.use_end_time > now()" + + " and inRecord.use_start_time < now()" + + " and inRecord.use_end_time > now()" + " order by inRecord.use_end_time asc") List queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId); - @Select("update tb_activate_in_record" + + @Update("update tb_activate_in_record" + " set over_num = #{overNum}" + " where id = #{id}") int updateOverNum(@Param("id") Integer id, @Param("overNum") Integer overNum); + + @Update("update tb_activate_in_record" + + " set over_num = over_num-#{overNum}" + + " where id = #{id} and over_num-#{overNum} >= 0") + int decrOverNum(@Param("id") Integer id, @Param("overNum") Integer decrOverNum); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateOutRecordMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateOutRecordMapper.java index ba81e80a..59ff3064 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateOutRecordMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateOutRecordMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; /** * 活动赠送商品使用记录表(TbActivateOutRecord)表数据库访问层 @@ -13,7 +14,7 @@ import org.apache.ibatis.annotations.Select; */ public interface TbActivateOutRecordMapper extends BaseMapper { - @Select("update tb_activate_out_record" + + @Update("update tb_activate_out_record" + " set ref_num = ref_num + #{refNum}" + " where id = #{id}") int updateRefNum(@Param("id") Integer id, @Param("refNum") Integer refNum); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java index 3df120e9..ded16692 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpCashierCartService.java @@ -64,5 +64,11 @@ public interface MpCashierCartService extends IService { */ List selectByShopEatType(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId); + /** + * 根据订单id和状态获取购物车数据 + * @param orderId 订单id + * @param status 状态 可为空 + */ + List selectByOrderIdAndState(Integer orderId, TableConstant.OrderInfo.Status status); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java index 49ec5ada..2030b662 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderDetailService.java @@ -1,5 +1,6 @@ package cn.ysk.cashier.mybatis.service; +import cn.ysk.cashier.cons.TableConstant; import cn.ysk.cashier.dto.shoptable.ReturnOrderDTO; import cn.ysk.cashier.enums.OrderStatusEnums; import cn.ysk.cashier.pojo.order.TbFullOrderDetail; @@ -42,6 +43,11 @@ public interface MpOrderDetailService extends IService { */ List selectByOrderId(Integer orderId); + /** + * 根据订单id和状态获取订单详情 + */ + List selectByOrderIdAndState(Integer orderId, TableConstant.OrderInfo.Status state); + /** * 根据购物车id和订单id查询订单详情 * @param shopId 店铺id @@ -49,6 +55,6 @@ public interface MpOrderDetailService extends IService { * @param orderId 订单id * @return 详情信息 */ - List selectByCartIdOrOrderId(Integer shopId, ArrayList cartIdList, Integer orderId); + List selectByCartIdOrOrderId(Integer shopId, List cartIdList, Integer orderId); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java index d20c67d3..fe49c351 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpOrderInfoService.java @@ -1,5 +1,6 @@ package cn.ysk.cashier.mybatis.service; +import cn.ysk.cashier.cons.TableConstant; import cn.ysk.cashier.enums.OrderStatusEnums; import cn.ysk.cashier.pojo.order.TbOrderDetail; import cn.ysk.cashier.pojo.order.TbOrderInfo; @@ -15,19 +16,29 @@ import java.util.List; */ public interface MpOrderInfoService extends IService { - /** - * 根据原始订单查询退款订单 - * @param orderId 原始订单id - * @return 对应的退款订单 - */ - TbOrderInfo selectReturnOrderByOrderId(Integer orderId); + /** + * 根据原始订单查询退款订单 + * + * @param orderId 原始订单id + * @return 对应的退款订单 + */ + TbOrderInfo selectReturnOrderByOrderId(Integer orderId); + + /** + * 修改订单的就餐类型和tableId + * + * @param orderId 订单id + * @param useType 就餐类型 + * @return 是否成功 + */ + boolean updateTableIdAndUseTypeById(Integer orderId, String useType, String tableId); /** - * 修改订单的就餐类型和tableId + * 根据状态和id获取订单信息 * @param orderId 订单id - * @param useType 就餐类型 - * @return 是否成功 + * @param status 状态枚举 */ - boolean updateTableIdAndUseTypeById(Integer orderId, String useType, String tableId); + TbOrderInfo selectOrderByIdAndState(Integer orderId, TableConstant.OrderInfo.Status status); + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpShopUserService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpShopUserService.java new file mode 100644 index 00000000..199ba7dc --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/MpShopUserService.java @@ -0,0 +1,16 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.enums.TableStateEnum; +import cn.ysk.cashier.pojo.shop.TbShopTable; +import cn.ysk.cashier.pojo.shop.TbShopUser; +import com.baomidou.mybatisplus.extension.service.IService; + +public interface MpShopUserService extends IService { + /** + * 根据店铺id和用户id查询会员信息 + * @param userId 用户id + * @param shopId 店铺id + * @return 会员信息 + */ + TbShopUser selectByUserIdAndShopId(Integer userId, Integer shopId); +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java index a635fb40..3fccc20e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopCouponService.java @@ -2,18 +2,26 @@ package cn.ysk.cashier.mybatis.service; import cn.ysk.cashier.dto.CouponDto; import cn.ysk.cashier.dto.QueryReceiveDto; +import cn.ysk.cashier.mybatis.entity.TbActivateInRecord; import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord; import cn.ysk.cashier.mybatis.entity.TbCouponProduct; import cn.ysk.cashier.mybatis.vo.TbShopCouponVo; +import cn.ysk.cashier.pojo.order.TbCashierCart; +import cn.ysk.cashier.pojo.order.TbOrderDetail; +import cn.ysk.cashier.pojo.order.TbOrderInfo; +import cn.ysk.cashier.pojo.shop.TbShopUser; import cn.ysk.cashier.vo.QueryReceiveVo; +import cn.ysk.cashier.vo.TbUserCouponVo; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import cn.ysk.cashier.mybatis.entity.TbShopCoupon; import cn.ysk.cashier.dto.TbShopCouponQueryCriteria; import org.springframework.http.ResponseEntity; +import java.math.BigDecimal; import java.util.List; import java.util.Map; +import java.util.Set; /** * 优惠券(TbShopCoupon)表服务接口 @@ -30,6 +38,16 @@ public interface TbShopCouponService extends IService { boolean update(TbShopCouponVo param); boolean delete(Integer[] ids); + + /** + * 根据金额获取可用优惠券数据 + * @param tbShopUser 店铺id + * @param orderAmount 用户id + * @param productIds 商品id + * @return 优惠券信息 + */ + List getActivateCoupon(TbShopUser tbShopUser, BigDecimal orderAmount, Integer shopId, Set productIds); + boolean deleteReceive(Integer[] ids); ResponseEntity find(CouponDto param); @@ -39,5 +57,20 @@ public interface TbShopCouponService extends IService { boolean refund(List param); List findActivatePros(Integer couponId); + + /** + * 根据优惠券id查询优惠券信息 + * @param couponIds 优惠券id + */ + List selectByIds(List couponIds); + + /** + * 根据订单id获取当前用户可用优惠券信息 + * @param shopId 店铺id + * @param orderId 订单id + * @param memberId 会员id + */ + Object getActivateByOrderIds(Integer shopId, Integer orderId, Integer memberId); + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java index 6375f994..da4e44fa 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpCashierCartServiceImpl.java @@ -15,6 +15,7 @@ import cn.ysk.cashier.pojo.shop.TbShopInfo; import cn.ysk.cashier.pojo.shop.TbShopTable; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; @@ -122,5 +123,14 @@ public class MpCashierCartServiceImpl extends ServiceImpl selectByOrderIdAndState(Integer orderId, TableConstant.OrderInfo.Status status) { + LambdaQueryChainWrapper queryChainWrapper = lambdaQuery().eq(TbCashierCart::getOrderId, orderId); + if (status != null) { + queryChainWrapper.eq(TbCashierCart::getStatus, status.getValue()); + } + return queryChainWrapper.list(); + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java index 2db52b2f..eedafbf7 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderDetailServiceImpl.java @@ -1,5 +1,6 @@ package cn.ysk.cashier.mybatis.service.impl; +import cn.ysk.cashier.cons.TableConstant; import cn.ysk.cashier.dto.shoptable.ReturnOrderDTO; import cn.ysk.cashier.enums.OrderStatusEnums; import cn.ysk.cashier.mybatis.mapper.TbOrderDetailMapper; @@ -48,7 +49,14 @@ public class MpOrderDetailServiceImpl extends ServiceImpl selectByCartIdOrOrderId(Integer shopId, ArrayList cartIdList, Integer orderId) { + public List selectByOrderIdAndState(Integer orderId, TableConstant.OrderInfo.Status state) { + return list(new LambdaQueryWrapper() + .eq(TbOrderDetail::getStatus, state.getValue()) + .eq(TbOrderDetail::getOrderId, orderId)); + } + + @Override + public List selectByCartIdOrOrderId(Integer shopId, List cartIdList, Integer orderId) { return list(new LambdaQueryWrapper() .and(q -> q.in(TbOrderDetail::getCartId, cartIdList).or().eq(TbOrderDetail::getOrderId, orderId)) .eq(TbOrderDetail::getShopId, shopId)); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java index ea67276a..3251aa54 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpOrderInfoServiceImpl.java @@ -1,5 +1,6 @@ package cn.ysk.cashier.mybatis.service.impl; +import cn.ysk.cashier.cons.TableConstant; import cn.ysk.cashier.mybatis.mapper.TbCashierCartMapper; import cn.ysk.cashier.mybatis.mapper.TbOrderInfoMapper; import cn.ysk.cashier.mybatis.service.MpCashierCartService; @@ -33,5 +34,12 @@ public class MpOrderInfoServiceImpl extends ServiceImpl() + .eq(TbOrderInfo::getId, orderId) + .eq(TbOrderInfo::getStatus, status.getValue())); + } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpShopUserServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpShopUserServiceImpl.java new file mode 100644 index 00000000..4873f9c0 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/MpShopUserServiceImpl.java @@ -0,0 +1,23 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.ysk.cashier.enums.TableStateEnum; +import cn.ysk.cashier.mybatis.mapper.MpShopTableMapper; +import cn.ysk.cashier.mybatis.mapper.TbShopUserMapper; +import cn.ysk.cashier.mybatis.service.MpShopTableService; +import cn.ysk.cashier.mybatis.service.MpShopUserService; +import cn.ysk.cashier.pojo.shop.TbShopTable; +import cn.ysk.cashier.pojo.shop.TbShopUser; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class MpShopUserServiceImpl extends ServiceImpl implements MpShopUserService { + @Override + public TbShopUser selectByUserIdAndShopId(Integer userId, Integer shopId) { + return getOne(new LambdaQueryWrapper() + .eq(TbShopUser::getUserId, userId) + .eq(TbShopUser::getShopId, shopId)); + } +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index ce4b3b1a..1a3926da 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -4,17 +4,19 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; +import cn.ysk.cashier.cons.TableConstant; import cn.ysk.cashier.dto.CouponDto; import cn.ysk.cashier.dto.QueryReceiveDto; import cn.ysk.cashier.dto.TbShopCouponQueryCriteria; +import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mybatis.entity.*; import cn.ysk.cashier.mybatis.mapper.TbActivateInRecordMapper; import cn.ysk.cashier.mybatis.mapper.TbActivateOutRecordMapper; +import cn.ysk.cashier.mybatis.mapper.TbMShopUserMapper; import cn.ysk.cashier.mybatis.mapper.TbShopCouponMapper; -import cn.ysk.cashier.mybatis.service.TbActivateInRecordService; -import cn.ysk.cashier.mybatis.service.TbCouponProductService; -import cn.ysk.cashier.mybatis.service.TbShopCouponService; +import cn.ysk.cashier.mybatis.service.*; import cn.ysk.cashier.mybatis.vo.TbShopCouponVo; +import cn.ysk.cashier.pojo.order.TbCashierCart; import cn.ysk.cashier.pojo.order.TbOrderDetail; import cn.ysk.cashier.pojo.order.TbOrderInfo; import cn.ysk.cashier.pojo.product.TbProduct; @@ -70,6 +72,19 @@ public class TbShopCouponServiceImpl extends ServiceImpl page = new Page<>(criteria.getPage(), criteria.getSize()); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq("shop_id", criteria.getShopId()); - if (criteria.getType()!=null) { + if (criteria.getType() != null) { wrapper.eq("type", criteria.getType()); } wrapper.orderByDesc("create_time"); @@ -149,6 +164,72 @@ public class TbShopCouponServiceImpl extends ServiceImpl getActivateCoupon(TbShopUser tbShopUser, BigDecimal orderAmount, Integer shopId, Set productIds) { + List tbUserCouponVos = inRecordMapper.queryByVipIdAndShopId(tbShopUser.getId(), shopId); + if (tbUserCouponVos.isEmpty()) { + return tbUserCouponVos; + } + String week = DateUtil.dayOfWeekEnum(new Date()).toChinese("周"); + LocalTime now = LocalTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); + //券id 券使用描述 + Map coupons = new HashMap<>(); + for (TbUserCouponVo tbUserCouponVo : tbUserCouponVos) { + if (!coupons.containsKey(tbUserCouponVo.getCouponId())) { + setCouponInfo(coupons, tbUserCouponVo, orderAmount, week, now, formatter); + } + JsonObject couponJson = coupons.get(tbUserCouponVo.getCouponId()); + tbUserCouponVo.setUseRestrictions(couponJson.get("useRestrictions").toString()); + if (tbUserCouponVo.getType().equals(1)) { + tbUserCouponVo.setUse(couponJson.get("isUse").getAsBoolean()); + } else if (tbUserCouponVo.getType().equals(2) && couponJson.get("isUse").getAsBoolean()) { + if (!productIds.contains(tbUserCouponVo.getProId().toString())) { + tbUserCouponVo.setUse(false); + } + } + } + tbUserCouponVos.sort(Comparator.comparing(TbUserCouponVo::isUse).reversed().thenComparing(TbUserCouponVo::getExpireTime)); + return tbUserCouponVos; + } + + private void setCouponInfo(Map coupons, TbUserCouponVo tbUserCouponVo, BigDecimal amount, String week, LocalTime now, DateTimeFormatter formatter) { + JsonObject json = new JsonObject(); + boolean isUse = true; + TbShopCoupon tbShopCoupon = getById(tbUserCouponVo.getCouponId()); + StringBuilder useRestrictions = new StringBuilder("每天 "); + if (tbShopCoupon.getType().equals(1)) { + if (amount.compareTo(new BigDecimal(tbShopCoupon.getFullAmount())) < 0) { + isUse = false; + } + } + if (StringUtils.isNotBlank(tbShopCoupon.getUserDays())) { + String[] split = tbShopCoupon.getUserDays().split(","); + if (split.length != 7) { + useRestrictions = new StringBuilder(tbShopCoupon.getUserDays() + " "); + } + if (!tbShopCoupon.getUserDays().contains(week)) { + isUse = false; + } + } + if (tbShopCoupon.getUseTimeType().equals("custom")) { + if (now.isBefore(tbShopCoupon.getUseStartTime()) || now.isAfter(tbShopCoupon.getUseEndTime())) { + isUse = false; + } + useRestrictions.append( + tbShopCoupon.getUseStartTime().format(formatter) + + "-" + + tbShopCoupon.getUseEndTime().format(formatter)); + } else { + useRestrictions.append("全时段"); + } + useRestrictions.append(" 可用"); + json.addProperty("isUse", isUse); + json.addProperty("useRestrictions", useRestrictions.toString()); + + coupons.put(tbUserCouponVo.getCouponId(), json); + } + @Override public ResponseEntity find(CouponDto param) { @@ -225,14 +306,15 @@ public class TbShopCouponServiceImpl extends ServiceImpl param) { + public boolean use(Integer shopId, Integer orderId, Integer vipUserId, List param) { for (TbActivateOutRecord outRecord : param) { TbActivateInRecord inRecord = inRecordMapper.selectById(outRecord.getGiveId()); inRecord.setOverNum(inRecord.getOverNum() - outRecord.getUseNum()); @@ -251,14 +333,15 @@ public class TbShopCouponServiceImpl extends ServiceImpl param) { for (TbActivateOutRecord outRecord : param) { outRecord.setUpdateTime(new Date()); - outRecordMapper.updateRefNum(outRecord.getId(),outRecord.getRefNum()); + outRecordMapper.updateRefNum(outRecord.getId(), outRecord.getRefNum()); TbActivateInRecord inRecord = inRecordMapper.selectById(outRecord.getGiveId()); inRecord.setOverNum(inRecord.getOverNum() + outRecord.getRefNum()); inRecordMapper.updateOverNum(inRecord.getId(), inRecord.getOverNum()); @@ -284,5 +367,46 @@ public class TbShopCouponServiceImpl extends ServiceImpl(); } + + @Override + public List selectByIds(List couponIds) { + return listByIds(couponIds); + } + + @Override + public Object getActivateByOrderIds(Integer shopId, Integer orderId, Integer memberId) { + TbOrderInfo orderInfo = mpOrderInfoService.selectOrderByIdAndState(orderId, TableConstant.OrderInfo.Status.UNPAID); + if (orderInfo == null) { + throw new BadRequestException("订单信息不存在"); + } + + if (memberId == null) { + memberId = Integer.valueOf(orderInfo.getMemberId()); + } + + TbShopUser shopUser = shopUserService.getById(memberId); + if (shopUser == null) { + throw new BadRequestException("用户信息不存在"); + } + + List cashierCarts = mpCashierCartService.selectByOrderIdAndState(orderId, TableConstant.OrderInfo.Status.UNPAID); + List activateCouponList = getActivateCoupon(shopUser, orderInfo.getOrderAmount(), shopId, cashierCarts.stream().map(TbCashierCart::getProductId).collect(Collectors.toSet())); + // 将优惠券分类为满减和商品 + ArrayList fullReductionCoupon = new ArrayList<>(); + ArrayList productCoupon = new ArrayList<>(); + activateCouponList.forEach(item -> { + if (TableConstant.ActivateOutRecord.Type.FULL_REDUCTION.equalsVals(item.getType())) { + fullReductionCoupon.add(item); + } else { + productCoupon.add(item); + } + }); + return new HashMap(){{ + put("fullReductionCoupon", fullReductionCoupon); + put("productCoupon", productCoupon); + }}; + } + + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbCashierCart.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbCashierCart.java index e437561b..164d8beb 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbCashierCart.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbCashierCart.java @@ -163,6 +163,8 @@ public class TbCashierCart implements Serializable { private String useType; @Column(name = "platform_type") private String platformType; + // 优惠券id + private Integer userCouponId; public void copy(TbCashierCart source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java index dc8a40c8..2e3313af 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/order/TbOrderInfo.java @@ -246,7 +246,7 @@ public class TbOrderInfo implements Serializable { // 使用的积分数量 private Integer pointsNum; // 用户优惠券id - private String userCouponInfoList; + private String couponInfoList; // 优惠券折扣金额 private BigDecimal productCouponDiscountAmount; // 满减抵扣金额 diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbPlussShopStaffRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbPlussShopStaffRepository.java index 00876641..c33366b8 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbPlussShopStaffRepository.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbPlussShopStaffRepository.java @@ -38,4 +38,7 @@ public interface TbPlussShopStaffRepository extends JpaRepository() - .eq(TbShopTable::getQrcode, createOrderDTO.getTableId()) - .in(TbShopTable::getStatus, "idle", "using")); - if (tbShopTable == null) { - throw new BadRequestException("台桌未开台或不存在"); - } + TbShopUser shopUser = null; + if (createOrderDTO.getVipUserId() != null) { + shopUser = tbShopUserMapper.selectById(createOrderDTO.getVipUserId()); } - + TbShopTable shopTable = checkTableState(createOrderDTO); // 就餐模式信息 ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(createOrderDTO.getShopId(), createOrderDTO.getTableId(), createOrderDTO.getUseType()); - // 传递orderId直接取否则取当前缓存id - Integer orderId = shopEatTypeInfoDTO.isDineInAfter() ? - getCurrentOrderId(shopEatTypeInfoDTO) : null; - List allCashierCarts = mpCashierCartService.selectByShopEatType(shopEatTypeInfoDTO, createOrderDTO.getMasterId()); - List cashierCarts = new ArrayList<>(); - TbCashierCart seatCart = null; - for (TbCashierCart allCashierCart : allCashierCarts) { - if (TableConstant.CART_SEAT_ID.equals(allCashierCart.getProductId())) { - seatCart = allCashierCart; - } -// if (OrderStatusEnums.CREATE.getValue().equals(allCashierCart.getStatus())) { -// cashierCarts.add(allCashierCart); -// } - cashierCarts.add(allCashierCart); + OrderCartInfoDTO cartInfoDTO = getCartForCreateOrder(shopEatTypeInfoDTO, createOrderDTO.getMasterId()); + if (cartInfoDTO.getOrderId() == null) { + createOrderDTO.setOrderId(shopEatTypeInfoDTO.isDineInAfter() ? + getCurrentOrderId(shopEatTypeInfoDTO) : null); } - - if (StrUtil.isNotBlank(createOrderDTO.getTableId()) - && (cashierCarts.isEmpty() || - (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart != null && cashierCarts.size() < 2) - || (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart == null))) { - throw new BadRequestException("购物车为空或未选择餐位费,请先添加商品或选择餐位费"); - } - - if (cashierCarts.isEmpty()) { - throw new BadRequestException("购物车为空"); - } - - ArrayList cartIdList = new ArrayList<>(); - for (TbCashierCart tbCashierCart : cashierCarts) { - if (tbCashierCart.getOrderId() != null) { - orderId = tbCashierCart.getOrderId(); - } - cartIdList.add(tbCashierCart.getId()); - } - // 查询历史orderDetail - List oldOrderDetailList = mpOrderDetailService.selectByCartIdOrOrderId(createOrderDTO.getShopId(), cartIdList, orderId); - - ArrayList removeOrderDetailIds = new ArrayList<>(); - ArrayList removeOrderDetailList = new ArrayList<>(); - HashMap oldOrderDetailMap = new HashMap<>(); - oldOrderDetailList.forEach(item -> { - if (cartIdList.contains(item.getCartId())) { - oldOrderDetailMap.put(item.getOrderId().toString() + item.getCartId(), item); - } else { - removeOrderDetailIds.add(item.getId()); - removeOrderDetailList.add(item); - } - }); - - BigDecimal totalAmount = BigDecimal.ZERO; - BigDecimal packAMount = BigDecimal.ZERO; - BigDecimal feeAmount = BigDecimal.ZERO; - BigDecimal saleAmount = BigDecimal.ZERO; - // 当前下单次数 - int placeNum = getCurrentPlaceNum(shopEatTypeInfoDTO); - List orderDetails = new ArrayList<>(); - List addOrderDetails = new ArrayList<>(); - - boolean hasNewInfo = false; - for (TbCashierCart cashierCart : cashierCarts) { - if (!"return".equals(cashierCart.getStatus())) { - totalAmount = totalAmount.add(cashierCart.getTotalAmount()); - packAMount = packAMount.add(cashierCart.getPackFee()); - feeAmount = cashierCart.getPackFee(); - } - - TbProductSku productSku = productSkuRepository.findById(Integer.valueOf(cashierCart.getSkuId())).orElse(null); - TbOrderDetail orderDetail = null; - if (cashierCart.getOrderId() != null) { - orderDetail = oldOrderDetailMap.get(cashierCart.getOrderId().toString() + cashierCart.getId()); - } - - if (orderDetail == null) { - orderDetail = new TbOrderDetail(); - hasNewInfo = true; - addOrderDetails.add(orderDetail); - } - - if (Objects.nonNull(productSku)) { - saleAmount = saleAmount.add(productSku.getSalePrice()); - orderDetail.setProductSkuName(productSku.getSpecSnap()); - } - - orderDetail.setNote(cashierCart.getNote()); - orderDetail.setCreateTime(DateUtil.date().toTimestamp()); - orderDetail.setNum(cashierCart.getNumber()); - orderDetail.setPrice(cashierCart.getSalePrice()); - orderDetail.setPriceAmount(cashierCart.getTotalAmount()); - orderDetail.setProductId(Integer.valueOf(cashierCart.getProductId())); - orderDetail.setProductSkuId(Integer.valueOf(cashierCart.getSkuId())); - orderDetail.setProductName(cashierCart.getName()); - orderDetail.setShopId(Integer.valueOf(cashierCart.getShopId())); - orderDetail.setPackAmount(cashierCart.getPackFee()); - orderDetail.setStatus(TableConstant.CashierCart.Status.RETURN.equalsVals(cashierCart.getStatus()) ? cashierCart.getStatus() : "unpaid"); - orderDetail.setUseType(shopEatTypeInfoDTO.getUseType()); - orderDetail.setProductImg(cashierCart.getCoverImg()); - orderDetail.setCartId(cashierCart.getId()); - if (cashierCart.getOrderId() != null) { - orderId = cashierCart.getOrderId(); - } - orderDetail.setOrderId(orderId); - orderDetails.add(orderDetail); - } - // 查询订单 TbOrderInfo orderInfo = null; - if (orderId != null) { - orderInfo = orderInfoMapper.selectById(orderId); + if (cartInfoDTO.getOrderId() != null) { + orderInfo = orderInfoMapper.selectById(cartInfoDTO.getOrderId()); } - TbShopUser shopUser = null; - if (StrUtil.isNotBlank(createOrderDTO.getVipUserId())) { - shopUser = tbShopUserMapper.selectById(createOrderDTO.getVipUserId()); - if (shopUser == null) { - throw new BadRequestException("用户不存在"); - } - } +// OrderCouponInfoDTO couponInfo = null; +// if (createOrderDTO.getUserCouponInfos().isEmpty() && createOrderDTO.getVipUserId() != null) { +// // 获取优惠券信息 +// couponInfo = getCouponInfo(createOrderDTO, orderInfo, cartInfoDTO.getNewAddTotalAmount(), cartInfoDTO.getCashierCarts()); +// +// // 根据优惠券信息重新计算购物车相关价格 +// calcCartPriceWithCoupon(cartInfoDTO.getNewCashierCarts(), couponInfo, couponInfo.getShopUser().getId()); +// } + + // 创建订单详情 + OrderPriceDTO detailPriceDTO = createOrderDetailWithCoupon(cartInfoDTO.getCashierCarts(), cartInfoDTO.getOrderId(), createOrderDTO.getShopId(), true); // 是否是第一次创建订单 - boolean isFirst = false; - // 修改订单信息 - if (orderInfo != null) { - // 更新取餐号 - orderInfo.setOutNumber(updateOutNumber(String.valueOf(createOrderDTO.getShopId())).toString()); - orderInfo.setUpdatedAt(System.currentTimeMillis()); - orderInfo.setSettlementAmount(totalAmount); - orderInfo.setAmount(totalAmount); - orderInfo.setOriginAmount(totalAmount); - orderInfo.setOrderAmount(totalAmount); - orderInfo.setRemark(createOrderDTO.getNote()); - orderInfo.setFreightAmount(feeAmount); - orderInfo.setProductAmount(saleAmount); - orderInfo.setTradeDay(DateUtils.getDay()); - orderInfo.setUseType(shopEatTypeInfoDTO.getUseType()); - orderInfo.setCreatedAt(DateUtil.current()); - if (seatCart != null) { - orderInfo.setSeatAmount(seatCart.getTotalAmount()); - orderInfo.setSeatCount(seatCart.getNumber()); - } - if (StrUtil.isNotBlank(createOrderDTO.getVipUserId())) { - orderInfo.setMemberId(createOrderDTO.getVipUserId()); - orderInfo.setUserId(shopUser.getUserId()); - } - orderInfo.setSendType(shopEatTypeInfoDTO.getSendType()); - // 存在新添加的商品,增加下单次数 - if (hasNewInfo) { - orderInfo.setPlaceNum(placeNum); - } - orderInfoMapper.updateById(orderInfo); - } else { - isFirst = true; - String orderNo = generateOrderNumber(null); - orderInfo = new TbOrderInfo(); - orderInfo.setOrderNo(orderNo); - orderInfo.setAmount(totalAmount); - orderInfo.setPayAmount(BigDecimal.ZERO); - orderInfo.setPackFee(packAMount); - orderInfo.setSettlementAmount(totalAmount); - orderInfo.setOriginAmount(totalAmount); - orderInfo.setProductAmount(saleAmount); - orderInfo.setOrderAmount(totalAmount); - orderInfo.setFreightAmount(feeAmount); - orderInfo.setTableId(createOrderDTO.getTableId()); - orderInfo.setSendType("table"); - orderInfo.setOrderType("cash"); - orderInfo.setShopId(createOrderDTO.getShopId().toString()); - orderInfo.setRefundAble(1); - orderInfo.setTradeDay(cn.ysk.cashier.utils.DateUtils.getDay()); - orderInfo.setMasterId(createOrderDTO.getMasterId()); - orderInfo.setOutNumber(createOrderDTO.getMasterId()); - orderInfo.setRemark(createOrderDTO.getNote()); - orderInfo.setCreatedAt(DateUtil.current()); - orderInfo.setTableName(tbShopTable != null ? tbShopTable.getName() : null); - orderInfo.setPlaceNum(placeNum); - orderInfo.setUseType(shopEatTypeInfoDTO.getUseType()); - if (StrUtil.isNotBlank(createOrderDTO.getVipUserId())) { - orderInfo.setUserId(createOrderDTO.getVipUserId()); - orderInfo.setUserId(shopUser.getUserId()); - } - if (seatCart != null) { - orderInfo.setSeatAmount(seatCart.getTotalAmount()); - orderInfo.setSeatCount(seatCart.getNumber()); - } - orderInfo.setSendType(shopEatTypeInfoDTO.getSendType()); - TbMerchantAccount merchantAccount = merchantAccountMapper.selectOne(new LambdaQueryWrapper() - .eq(TbMerchantAccount::getShopId, createOrderDTO.getShopId()) - .eq(TbMerchantAccount::getStatus, 1)); - if (merchantAccount == null) { - throw new BadRequestException("商户信息不存在"); - } - orderInfo.setMerchantId(merchantAccount.getId().toString()); - orderInfoMapper.insert(orderInfo); - } + orderInfo = createOrderWithAction(createOrderDTO, detailPriceDTO, shopEatTypeInfoDTO, + orderInfo, cartInfoDTO.getSeatCart(), shopUser, shopTable); - // 添加订单详细数据 - orderId = orderInfo.getId(); - for (TbOrderDetail orderDetail : orderDetails) { - orderDetail.setOrderId(orderId); - if (orderDetail.getPlaceNum() == null) { - orderDetail.setPlaceNum(placeNum); - } - } - // 删除已经移除购物车的订单 修改并保存数据 - if (!orderDetails.isEmpty()) { - mpOrderDetailService.saveOrUpdateBatch(orderDetails); - } + // 修改订单详情并打票 + updateDetailAndPrint(orderInfo, detailPriceDTO, shopEatTypeInfoDTO); - // 更新购物车记录的orderId - for (TbCashierCart cashierCart : cashierCarts) { - if (!"-999".equals(cashierCart.getProductId())) { - TbProduct product = productMapper.selectById(cashierCart.getProductId()); - TbProductSku productSku = productSkuRepository.findById(Integer.valueOf(cashierCart.getSkuId())).orElse(null); - - log.info("下单,开始校验库存预警,购物车id:{}", cashierCart.getId()); - CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(productSku, product, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber())); - // 已经添加的商品,修改数量 - updateStock(cashierCart); - } - - cashierCart.setOrderId(orderId); - cashierCart.setUpdatedAt(System.currentTimeMillis()); - cashierCart.setStatus("pending".equals(orderInfo.getStatus()) ? "refund" : cashierCart.getStatus()); - if (cashierCart.getPlaceNum() == null) { - cashierCart.setPlaceNum(placeNum); - } - - // 先付费模式,结束购物车状态 - if (!shopEatTypeInfoDTO.isDineInAfter() || StrUtil.isBlank(createOrderDTO.getTableId())) { - cashierCart.setStatus("final"); - } - cashierCartMapper.updateById(cashierCart); - } - - // 菜品票 - if (!addOrderDetails.isEmpty() && shopEatTypeInfoDTO.isDineInAfter()) { - rabbitMsgUtils.printDishesTicket(orderInfo.getId(), false, addOrderDetails.toArray(new TbOrderDetail[0])); - } - - if (!removeOrderDetailIds.isEmpty()) { - // 退单票 - orderDetailMapper.deleteBatchIds(removeOrderDetailIds); - if (shopEatTypeInfoDTO.isDineInAfter()) { - rabbitMsgUtils.printDishesTicket(orderInfo.getId(), true, removeOrderDetailList.toArray(new TbOrderDetail[0])); - } - } - - if (isFirst) { - // 后付费,不增加当前台桌取餐号 - if (!shopEatTypeInfoDTO.isIncrMaterId()) { - addGlobalCode(cn.ysk.cashier.utils.DateUtils.getDay(), "pc", String.valueOf(createOrderDTO.getShopId())); - } - - if (shopEatTypeInfoDTO.isIncrMaterId() || "pending".equals(orderInfo.getStatus())) { - String key = RedisConstant.getMasterIdKey(createOrderDTO.getShopId(), cn.ysk.cashier.utils.DateUtils.getDay(), orderInfo.getTableId()); - redisTemplate.delete(key); - } - } + // 修改购物车状态和库存 + updateCartAndStock(cartInfoDTO.getNewCashierCarts(), orderInfo, shopEatTypeInfoDTO); // 推送耗材信息 - pushConsMsg(orderInfo, cashierCarts); + pushConsMsg(orderInfo, cartInfoDTO.getNewCashierCarts()); - if (!shopEatTypeInfoDTO.isTakeout() && StrUtil.isNotBlank(createOrderDTO.getTableId())) { - // 清空台桌信息 - if (shopEatTypeInfoDTO.isDineInBefore()) { - mpShopTableMapper.update(null, new LambdaUpdateWrapper() - .eq(TbShopTable::getShopId, createOrderDTO.getShopId()) - .eq(TbShopTable::getQrcode, createOrderDTO.getTableId()) - .set(TbShopTable::getProductNum, 0) - .set(TbShopTable::getTotalAmount, 0) - .set(TbShopTable::getRealAmount, 0) - .set(TbShopTable::getUseNum, 0) - .set(TbShopTable::getStatus, TableStateEnum.IDLE.getState())); - // 设置台桌信息 - } else { - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper() - .eq(TbShopTable::getShopId, createOrderDTO.getShopId()) - .eq(TbShopTable::getQrcode, createOrderDTO.getTableId()) - .set(TbShopTable::getProductNum, cashierCarts.size()) - .set(TbShopTable::getTotalAmount, orderInfo.getOrderAmount()) - .set(TbShopTable::getRealAmount, orderInfo.getOrderAmount()) - .set(TbShopTable::getUseNum, seatCart != null ? seatCart.getNumber() : null) - .set(TbShopTable::getStatus, TableStateEnum.USING.getState()); - if (isFirst) { - wrapper.set(TbShopTable::getUseTime, DateUtil.date()); - } - mpShopTableMapper.update(null, wrapper); + updateTableState(shopEatTypeInfoDTO, orderInfo, cartInfoDTO.getCashierCarts(), cartInfoDTO.getSeatCart()); - } - } - - - if (StrUtil.isNotBlank(createOrderDTO.getTableId())) { - String tableCartKey = RedisConstant.getTableCartKey(createOrderDTO.getTableId(), createOrderDTO.getShopId().toString()); - redisTemplate.delete(tableCartKey); - } return orderInfo; }, stringRedisTemplate, RedisConstant.getLockKey(RedisConstant.CREATE_ORDER, createOrderDTO.getShopId(), createOrderDTO.getTableId(), createOrderDTO.getMasterId(), createOrderDTO.getUseType())); } - private void calculateOrderCouponAndPoints(TbOrderInfo orderInfo, List userCouponList, Integer pointsNum) { + private BigDecimal calcCartPriceWithCoupon(List newCashierCarts, OrderCouponInfoDTO couponInfoDTO, Integer memberId, TbOrderInfo orderInfo) { + ArrayList balanceCartList = new ArrayList<>(); + BigDecimal discountAmount = BigDecimal.ZERO; + HashMap couponMap = new HashMap<>(); + couponInfoDTO.getProductCouponMap().values().forEach(item -> { + couponMap.put(item.getProId().toString(), item); + }); + HashMap usedCouponMap = new HashMap<>(); + ArrayList outRecords = new ArrayList<>(); + for (TbCashierCart cashierCart : newCashierCarts) { + TbUserCouponVo couponVo = couponMap.get(cashierCart.getProductId()); + boolean useCoupon; + if (couponVo != null) { + if (cashierCart.getNumber() < couponVo.getCurrentUseNum()) { + throw new BadRequestException("商品数量: {},小于优惠券使用数量: {}", cashierCart.getNumber(), couponVo.getCurrentUseNum()); + } + usedCouponMap.put(Integer.valueOf(cashierCart.getProductId()), couponVo); + // 优惠券数量小于购物车数量,分割购物车数据 + if (cashierCart.getNumber() > couponVo.getCurrentUseNum()) { + BigDecimal currentUseNum = BigDecimal.valueOf(couponVo.getCurrentUseNum()); + BigDecimal cartNum = BigDecimal.valueOf(cashierCart.getNumber()); + int balanceNum = cashierCart.getTotalNumber() - couponVo.getCurrentUseNum(); + BigDecimal singlePackFee = cashierCart.getPackFee().divide(cartNum, RoundingMode.HALF_UP); + cashierCart.setPackFee(singlePackFee.multiply(currentUseNum)); + cashierCart.setTotalAmount(cashierCart.getSalePrice().multiply(currentUseNum).add(singlePackFee.multiply(currentUseNum))); + cashierCart.setNumber(couponVo.getCurrentUseNum()); + cashierCart.setTotalNumber(couponVo.getCurrentUseNum()); + cashierCart.setUserCouponId(couponVo.getId()); + discountAmount = discountAmount.add(cashierCart.getTotalAmount()); + + // 创建结余购物车 + TbCashierCart balanceCart = BeanUtil.copyProperties(cashierCart, TbCashierCart.class); + BigDecimal num = BigDecimal.valueOf(balanceNum); + balanceCart.setUserCouponId(null); + balanceCart.setId(null); + balanceCart.setNumber(balanceNum); + balanceCart.setTotalNumber(balanceNum); + balanceCart.setPackFee(singlePackFee.multiply(num)); + balanceCart.setTotalAmount(cashierCart.getSalePrice().multiply(num).add(balanceCart.getPackFee())); + balanceCartList.add(balanceCart); + } else { + discountAmount = discountAmount.add(cashierCart.getTotalAmount()); + cashierCart.setUserCouponId(couponVo.getId()); + } + // 消耗并返还商品优惠券 + Integer shopId = Integer.valueOf(cashierCart.getShopId()); + TbActivateOutRecord tbActivateOutRecord = new TbActivateOutRecord(); + tbActivateOutRecord.setShopId(shopId); + tbActivateOutRecord.setGiveId(couponVo.getId()); + tbActivateOutRecord.setVipUserId(memberId); + tbActivateOutRecord.setType(TableConstant.ActivateOutRecord.Type.FULL_REDUCTION.getValue()); + tbActivateOutRecord.setUseNum(couponVo.getCurrentUseNum()); + tbActivateOutRecord.setStatus(TableConstant.ActivateOutRecord.Status.CLOSED.getValue()); + tbActivateOutRecord.setCreateTime(DateUtil.date()); + tbActivateOutRecord.setRefNum(0); + outRecords.add(tbActivateOutRecord); + } + } + + if (!balanceCartList.isEmpty()) { + newCashierCarts.addAll(balanceCartList); + mpCashierCartService.saveBatch(balanceCartList); + } + // 更新购物车信息 + mpCashierCartService.updateBatchById(newCashierCarts); + + couponInfoDTO.setOutRecordList(outRecords); + couponInfoDTO.setProductCouponMap(usedCouponMap); + + return discountAmount; + } + + private OrderCouponInfoDTO getCouponInfo(Integer memberId, Integer shopId, List userCouponInfoDTOList, BigDecimal orderAmount, Set productIds) { + OrderCouponInfoDTO infoDTO = new OrderCouponInfoDTO(); + // 查询优惠券信息 + TbShopUser shopUser = null; + if (memberId != null) { + shopUser = tbShopUserMapper.selectById(memberId); + if (shopUser == null) { + throw new BadRequestException("用户不存在"); + } + // 获取当前用户可用的优惠券 + List activateCouponList = shopCouponService.getActivateCoupon(shopUser, orderAmount, shopId, productIds); + // 将优惠券分类为满减和商品 + HashMap fullReductionCoupon = new HashMap<>(); + HashMap productCoupon = new HashMap<>(); + if (activateCouponList.isEmpty()) { + throw new BadRequestException("未查询到相关优惠券"); + } + activateCouponList.forEach(item -> { + if (TableConstant.ActivateOutRecord.Type.FULL_REDUCTION.equalsVals(item.getType())) { + fullReductionCoupon.put(item.getId(), item); + } else { + productCoupon.put(item.getId(), item); + } + }); + + userCouponInfoDTOList.forEach(item -> { + TbUserCouponVo couponVo = fullReductionCoupon.get(item.getUserCouponId()); + if (couponVo != null) { + if (couponVo.getNum() < item.getNum()) { + throw new BadRequestException(couponVo.getName() + "数量不足: " + couponVo.getNum()); + } + couponVo.setCurrentUseNum(item.getNum()); + infoDTO.getFullReductionCouponMap().put(couponVo.getId(), couponVo); + return; + } + couponVo = productCoupon.get(item.getUserCouponId()); + if (couponVo == null) { + throw new BadRequestException("存在不可用优惠券"); + } + couponVo.setCurrentUseNum(item.getNum()); + infoDTO.getProductCouponMap().put(item.getUserCouponId(), couponVo); + }); + + } + infoDTO.setShopUser(shopUser); + + return infoDTO; + } + + private OrderCartInfoDTO getCartForCreateOrder(ShopEatTypeInfoDTO shopEatTypeInfoDTO, String masterId) { + OrderCartInfoDTO cartInfoDTO = new OrderCartInfoDTO(); + + List allCashierCarts = mpCashierCartService.selectByShopEatType(shopEatTypeInfoDTO, masterId); + TbCashierCart seatCart = null; + for (TbCashierCart cashierCart : allCashierCarts) { + if (TableConstant.CART_SEAT_ID.equals(cashierCart.getProductId())) { + seatCart = cashierCart; + cartInfoDTO.setSeatCart(cashierCart); + } + if (OrderStatusEnums.CREATE.getValue().equals(cashierCart.getStatus())) { + cartInfoDTO.getNewCashierCarts().add(cashierCart); + } + cartInfoDTO.getCashierCarts().add(cashierCart); + } + + if (StrUtil.isNotBlank(shopEatTypeInfoDTO.getTableId()) + && (cartInfoDTO.getCashierCarts().isEmpty() || + (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart != null && cartInfoDTO.getCashierCarts().size() < 2) + || (shopEatTypeInfoDTO.isNeedSeatFee() && !shopEatTypeInfoDTO.isTakeout() && seatCart == null))) { + throw new BadRequestException("购物车为空或未选择餐位费,请先添加商品或选择餐位费"); + } + + if (cartInfoDTO.getCashierCarts().isEmpty()) { + throw new BadRequestException("购物车为空"); + } + + ArrayList cartIdList = new ArrayList<>(); + // 订单总价 + for (TbCashierCart tbCashierCart : cartInfoDTO.getCashierCarts()) { + if (tbCashierCart.getOrderId() != null) { + cartInfoDTO.setOrderId(tbCashierCart.getOrderId()); + } + cartIdList.add(tbCashierCart.getId()); + if (TableConstant.CashierCart.Status.CREATE.equalsVals(tbCashierCart.getStatus())) { + cartInfoDTO.setNewAddTotalAmount(cartInfoDTO.getNewAddTotalAmount().add(tbCashierCart.getTotalAmount())); + } + + cartInfoDTO.setTotalAmount(cartInfoDTO.getTotalAmount().add(tbCashierCart.getTotalAmount())); + } + cartInfoDTO.setCashierCartIds(cartIdList); + return cartInfoDTO; + } + + private boolean consumeAndReturnProductCoupon(List outRecordList, Integer memberId, TbOrderInfo orderInfo) { + boolean use = shopCouponService.use(Integer.valueOf(orderInfo.getShopId()), orderInfo.getId(), memberId, outRecordList); + if (!use) { + throw new BadRequestException("消耗券失败"); + } + + // 返还优惠券 + if (StrUtil.isNotBlank(orderInfo.getCouponInfoList())) { + OrderCouponInfoDTO couponInfoDTO = JSONObject.parseObject(orderInfo.getCouponInfoList(), OrderCouponInfoDTO.class); + // 券返还 + if (!couponInfoDTO.getOutRecordList().isEmpty()) { + return shopCouponService.refund(couponInfoDTO.getOutRecordList()); + } + } + + return true; + } + + /** + * 根据商品优惠券 + * + * @param fullCashierCarts + * @param orderId + * @param shopId + * @param updateState + * @return + */ + private OrderPriceDTO createOrderDetailWithCoupon(List fullCashierCarts, Integer orderId, Integer shopId, boolean updateState) { + OrderPriceDTO priceDTO = new OrderPriceDTO(); + + List cartIds = fullCashierCarts.stream().map(TbCashierCart::getId).collect(Collectors.toList()); + // 查询历史orderDetail + List oldOrderDetailList = mpOrderDetailService + .selectByCartIdOrOrderId(shopId, cartIds, orderId); + HashMap oldOrderDetailMap = new HashMap<>(); + oldOrderDetailList.forEach(item -> { + if (cartIds.contains(item.getCartId())) { + oldOrderDetailMap.put(item.getOrderId().toString() + item.getCartId(), item); + } else { + priceDTO.getRemoveOrderDetailIds().add(item.getId()); + priceDTO.getRemoveOrderDetailList().add(item); + } + }); + + for (TbCashierCart cashierCart : fullCashierCarts) { + // 已经退款和使用优惠券的商品不进行统计金额 + if (!"return".equals(cashierCart.getStatus()) && cashierCart.getUserCouponId() == null) { + priceDTO.setTotalAmount(priceDTO.getTotalAmount().add(cashierCart.getTotalAmount())); + priceDTO.setPackAmount(priceDTO.getPackAmount().add(cashierCart.getPackFee())); + priceDTO.setOriginAmount(priceDTO.getOriginAmount().add(cashierCart.getTotalAmount())); + } + + TbProductSku productSku = productSkuRepository.findById(Integer.valueOf(cashierCart.getSkuId())).orElse(null); + TbOrderDetail orderDetail = null; + if (cashierCart.getOrderId() != null) { + orderDetail = oldOrderDetailMap.get(cashierCart.getOrderId().toString() + cashierCart.getId()); + } + + if (orderDetail == null) { + orderDetail = new TbOrderDetail(); + priceDTO.setHasNewInfo(true); + priceDTO.getNewOrderDetailList().add(orderDetail); + } + + if (Objects.nonNull(productSku)) { + orderDetail.setProductSkuName(productSku.getSpecSnap()); + } + + orderDetail.setNote(cashierCart.getNote()); + orderDetail.setCreateTime(DateUtil.date().toTimestamp()); + orderDetail.setNum(cashierCart.getNumber()); + orderDetail.setPrice(cashierCart.getSalePrice()); + orderDetail.setPriceAmount(cashierCart.getTotalAmount()); + orderDetail.setProductId(Integer.valueOf(cashierCart.getProductId())); + orderDetail.setProductSkuId(Integer.valueOf(cashierCart.getSkuId())); + orderDetail.setProductName(cashierCart.getName()); + orderDetail.setShopId(Integer.valueOf(cashierCart.getShopId())); + orderDetail.setPackAmount(cashierCart.getPackFee()); + if (updateState) { + orderDetail.setStatus(TableConstant.CashierCart.Status.RETURN.equalsVals(cashierCart.getStatus()) ? cashierCart.getStatus() : "unpaid"); + } + orderDetail.setUseType(cashierCart.getUseType()); + orderDetail.setProductImg(cashierCart.getCoverImg()); + orderDetail.setCartId(cashierCart.getId()); + if (cashierCart.getOrderId() != null) { + orderId = cashierCart.getOrderId(); + } + orderDetail.setOrderId(orderId); + priceDTO.getOrderDetailList().add(orderDetail); + } + return priceDTO; + } + + private TbOrderInfo createOrderWithAction(CreateOrderDTO createOrderDTO, OrderPriceDTO priceDTO, ShopEatTypeInfoDTO eatTypeInfoDTO, + TbOrderInfo orderInfo, TbCashierCart seatCart, TbShopUser shopUser, TbShopTable shopTable) { + int placeNum = getCurrentPlaceNum(eatTypeInfoDTO); + boolean isFirst = false; + // 修改订单信息 + if (orderInfo == null) { + isFirst = true; + String orderNo = generateOrderNumber(null); + orderInfo = new TbOrderInfo(); + orderInfo.setOrderNo(orderNo); + orderInfo.setCreatedAt(DateUtil.current()); + orderInfo.setTradeDay(cn.ysk.cashier.utils.DateUtils.getDay()); + orderInfo.setRefundAble(1); + orderInfo.setOrderType("cash"); + orderInfo.setShopId(createOrderDTO.getShopId().toString()); + orderInfo.setTableId(createOrderDTO.getTableId()); + orderInfo.setTableName(shopTable != null ? shopTable.getName() : null); + orderInfo.setMasterId(createOrderDTO.getMasterId()); + TbMerchantAccount merchantAccount = merchantAccountMapper.selectOne(new LambdaQueryWrapper() + .eq(TbMerchantAccount::getShopId, createOrderDTO.getShopId()) + .eq(TbMerchantAccount::getStatus, 1)); + if (merchantAccount == null) { + throw new BadRequestException("商户信息不存在"); + } + orderInfo.setMerchantId(merchantAccount.getId().toString()); + } + // 更新取餐号 + orderInfo.setOutNumber(updateOutNumber(String.valueOf(createOrderDTO.getShopId())).toString()); + orderInfo.setUpdatedAt(System.currentTimeMillis()); + orderInfo.setSettlementAmount(priceDTO.getTotalAmount()); + orderInfo.setAmount(priceDTO.getTotalAmount()); + orderInfo.setOriginAmount(priceDTO.getOriginAmount()); + orderInfo.setOrderAmount(priceDTO.getTotalAmount()); + orderInfo.setRemark(createOrderDTO.getNote()); + orderInfo.setFreightAmount(BigDecimal.ZERO); + orderInfo.setProductAmount(BigDecimal.ZERO); + orderInfo.setTradeDay(DateUtils.getDay()); + orderInfo.setUseType(eatTypeInfoDTO.getUseType()); + orderInfo.setCreatedAt(DateUtil.current()); + if (seatCart != null) { + orderInfo.setSeatAmount(seatCart.getTotalAmount()); + orderInfo.setSeatCount(seatCart.getNumber()); + } + if (createOrderDTO.getVipUserId() != null) { + orderInfo.setMemberId(String.valueOf(shopUser.getId())); + orderInfo.setUserId(shopUser.getUserId()); + } + orderInfo.setSendType(eatTypeInfoDTO.getSendType()); + // 存在新添加的商品,增加下单次数 + if (priceDTO.isHasNewInfo()) { + orderInfo.setPlaceNum(placeNum); + } + orderInfoMapper.insertOrUpdate(orderInfo); + + if (isFirst) { + // 后付费,不增加当前台桌取餐号 + if (!eatTypeInfoDTO.isIncrMaterId()) { + addGlobalCode(cn.ysk.cashier.utils.DateUtils.getDay(), "pc", String.valueOf(createOrderDTO.getShopId())); + } + + if (eatTypeInfoDTO.isIncrMaterId() || "pending".equals(orderInfo.getStatus())) { + String key = RedisConstant.getMasterIdKey(createOrderDTO.getShopId(), cn.ysk.cashier.utils.DateUtils.getDay(), orderInfo.getTableId()); + redisTemplate.delete(key); + } + } + + return orderInfo; + } + + private void updateDetailAndPrint(TbOrderInfo orderInfo, OrderPriceDTO priceDTO, ShopEatTypeInfoDTO shopEatTypeInfoDTO) { + // 添加订单详细数据 + Integer orderId = orderInfo.getId(); + for (TbOrderDetail orderDetail : priceDTO.getOrderDetailList()) { + orderDetail.setOrderId(orderId); + if (orderDetail.getPlaceNum() == null) { + orderDetail.setPlaceNum(orderInfo.getPlaceNum()); + } + } + // 删除已经移除购物车的订单 修改并保存数据 + if (!priceDTO.getOrderDetailList().isEmpty()) { + mpOrderDetailService.saveOrUpdateBatch(priceDTO.getOrderDetailList()); + } + + // 菜品票 + if (!priceDTO.getNewOrderDetailList().isEmpty() && shopEatTypeInfoDTO.isDineInAfter()) { + rabbitMsgUtils.printDishesTicket(orderInfo.getId(), false, priceDTO.getNewOrderDetailList().toArray(new TbOrderDetail[0])); + } + + if (!priceDTO.getRemoveOrderDetailIds().isEmpty()) { + // 退单票 + orderDetailMapper.deleteBatchIds(priceDTO.getRemoveOrderDetailIds()); + if (shopEatTypeInfoDTO.isDineInAfter()) { + rabbitMsgUtils.printDishesTicket(orderInfo.getId(), true, priceDTO.getRemoveOrderDetailList().toArray(new TbOrderDetail[0])); + } + } + } + + private void updateCartAndStock(List newAddCashierCarts, TbOrderInfo orderInfo, ShopEatTypeInfoDTO shopEatTypeInfoDTO) { + // 更新购物车记录的orderId + for (TbCashierCart cashierCart : newAddCashierCarts) { + if (!"-999".equals(cashierCart.getProductId())) { + TbProduct product = productMapper.selectById(cashierCart.getProductId()); + TbProductSku productSku = productSkuRepository.findById(Integer.valueOf(cashierCart.getSkuId())).orElse(null); + + log.info("下单,开始校验库存预警,购物车id:{}", cashierCart.getId()); + CompletableFuture.runAsync(() -> checkWarnLineAndSendMsg(productSku, product, Integer.valueOf(cashierCart.getShopId()), cashierCart.getNumber())); + // 已经添加的商品,修改数量 + updateStock(cashierCart); + } + + cashierCart.setOrderId(orderInfo.getId()); + cashierCart.setUpdatedAt(System.currentTimeMillis()); + cashierCart.setStatus("pending".equals(orderInfo.getStatus()) ? "refund" : cashierCart.getStatus()); + if (cashierCart.getPlaceNum() == null) { + cashierCart.setPlaceNum(orderInfo.getPlaceNum()); + } + + // 先付费模式,结束购物车状态 + if (!shopEatTypeInfoDTO.isDineInAfter() || StrUtil.isBlank(shopEatTypeInfoDTO.getTableId())) { + cashierCart.setStatus("final"); + } + cashierCartMapper.updateById(cashierCart); + } + } + + + private void updateTableState(ShopEatTypeInfoDTO shopEatTypeInfoDTO, TbOrderInfo orderInfo, List fullCashierCarts, TbCashierCart seatCart) { + if (!shopEatTypeInfoDTO.isTakeout() && StrUtil.isNotBlank(shopEatTypeInfoDTO.getTableId())) { + // 清空台桌信息 + if (shopEatTypeInfoDTO.isDineInBefore()) { + mpShopTableMapper.update(null, new LambdaUpdateWrapper() + .eq(TbShopTable::getShopId, shopEatTypeInfoDTO.getShopId()) + .eq(TbShopTable::getQrcode, shopEatTypeInfoDTO.getTableId()) + .set(TbShopTable::getProductNum, 0) + .set(TbShopTable::getTotalAmount, 0) + .set(TbShopTable::getRealAmount, 0) + .set(TbShopTable::getUseNum, 0) + .set(TbShopTable::getStatus, TableStateEnum.IDLE.getState())); + // 设置台桌信息 + } else { + LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper() + .eq(TbShopTable::getShopId, shopEatTypeInfoDTO.getShopId()) + .eq(TbShopTable::getQrcode, shopEatTypeInfoDTO.getTableId()) + .set(TbShopTable::getProductNum, fullCashierCarts.size()) + .set(TbShopTable::getTotalAmount, orderInfo.getOrderAmount()) + .set(TbShopTable::getRealAmount, orderInfo.getOrderAmount()) + .set(TbShopTable::getUseNum, seatCart != null ? seatCart.getNumber() : null) + .set(TbShopTable::getStatus, TableStateEnum.USING.getState()); + if (orderInfo.getPlaceNum() == 1) { + wrapper.set(TbShopTable::getUseTime, DateUtil.date()); + } + mpShopTableMapper.update(null, wrapper); + + } + } + + if (StrUtil.isNotBlank(shopEatTypeInfoDTO.getTableId())) { + String tableCartKey = RedisConstant.getTableCartKey(shopEatTypeInfoDTO.getTableId(), shopEatTypeInfoDTO.getShopId().toString()); + redisTemplate.delete(tableCartKey); + } + } + + private TbShopTable checkTableState(CreateOrderDTO createOrderDTO) { + + // 非堂食校验台桌状态 + TbShopTable tbShopTable = null; + if (StrUtil.isNotBlank(createOrderDTO.getTableId())) { + tbShopTable = mpShopTableMapper.selectOne(new LambdaQueryWrapper() + .eq(TbShopTable::getQrcode, createOrderDTO.getTableId()) + .in(TbShopTable::getStatus, "idle", "using")); + if (tbShopTable == null) { + throw new BadRequestException("台桌未开台或不存在"); + } + } + return tbShopTable; + } + + private void calculateOrderCouponAndPoints(TbOrderInfo orderInfo, List mineUserCouponList, Integer pointsNum) { BigDecimal shouldPayAmount = BigDecimal.ZERO; if (pointsNum != null) { Long memberId = Long.valueOf(orderInfo.getMemberId()); @@ -1442,8 +1628,42 @@ public class TbShopTableServiceImpl implements TbShopTableService { memberPointsService.deductPoints(memberId, pointsNum, "霸王餐充值抵扣", Long.valueOf(orderInfo.getId())); } - if (!userCouponList.isEmpty()) { + if (!mineUserCouponList.isEmpty()) { + CouponDto couponDto = new CouponDto(); + couponDto.setShopId(Integer.valueOf(orderInfo.getShopId())); + couponDto.setUserId(Integer.valueOf(orderInfo.getUserId())); + couponDto.setStatus(1); + couponDto.setOrderId(orderInfo.getId()); + List userCouponList = (List) shopCouponService.find(couponDto).getBody(); + if (userCouponList == null || userCouponList.isEmpty()) { + throw new BadRequestException("存在不可用优惠券"); + } + ArrayList activateInInfoVOS = new ArrayList<>(); + for (Integer userCouponId : mineUserCouponList) { + TbUserCouponVo userCouponVo = userCouponList.stream().filter(item -> item.getId().equals(userCouponId)).findFirst().orElse(null); + if (userCouponVo == null) { + throw new BadRequestException("存在不可用优惠券"); + } + + shouldPayAmount = shouldPayAmount.subtract(userCouponVo.getDiscountAmount()); + ActivateInInfoVO activateInInfoVO = new ActivateInInfoVO() + .setId(userCouponVo.getId()) + .setCouponId(userCouponVo.getCouponId()) + .setType(userCouponVo.getType()) + .setNum(1); + activateInInfoVOS.add(activateInInfoVO); + } + + List tbShopCoupons = shopCouponService.listByIds(activateInInfoVOS.stream().map(ActivateInInfoVO::getCouponId).collect(Collectors.toList())); + if (tbShopCoupons.size() != mineUserCouponList.size()) { + throw new BadRequestException("存在不可用优惠券"); + } + + // 设置优惠券信息 + orderInfo.setCouponInfoList(JSONObject.toJSONString(activateInInfoVOS)); + orderInfo.setUserCouponAmount(BigDecimal.valueOf(tbShopCoupons.stream().map(TbShopCoupon::getDiscountAmount).reduce(0, Integer::sum))); +// record.setCouponInfo(JSONObject.toJSONString(userCouponList)); } } @@ -1588,7 +1808,115 @@ public class TbShopTableServiceImpl implements TbShopTableService { return payTypeRepository.findByShopId(String.valueOf(shopId)); } + private TbActivateOutRecord calcOrderInfoDiscount(PayDTO payDTO, TbOrderInfo orderInfo, OrderCouponInfoDTO couponInfo) { + if (payDTO.getVipUserId() != null) { + BigDecimal finalAmount = orderInfo.getOrderAmount(); + TbActivateOutRecord tbActivateOutRecord = null; + if (!couponInfo.getFullReductionCouponMap().isEmpty()) { + TbUserCouponVo couponVo = couponInfo.getFullReductionCouponMap().values().stream().findFirst().orElse(null); + finalAmount =finalAmount.subtract(couponVo.getDiscountAmount()); + orderInfo.setFullCouponDiscountAmount(couponVo.getDiscountAmount()); + + tbActivateOutRecord = new TbActivateOutRecord(); + tbActivateOutRecord.setShopId(Integer.valueOf(orderInfo.getShopId())); + tbActivateOutRecord.setGiveId(couponVo.getId()); + tbActivateOutRecord.setVipUserId(payDTO.getVipUserId()); + tbActivateOutRecord.setType(TableConstant.ActivateOutRecord.Type.FULL_REDUCTION.getValue()); + tbActivateOutRecord.setUseNum(couponVo.getCurrentUseNum()); + tbActivateOutRecord.setStatus(TableConstant.ActivateOutRecord.Status.CLOSED.getValue()); + tbActivateOutRecord.setCreateTime(DateUtil.date()); + tbActivateOutRecord.setRefNum(0); + + } + + // 计算积分优惠 + if (payDTO.getPointsNum() != null && payDTO.getPointsNum() != 0) { + BigDecimal discountPointsAmount = calcPointsDiscountAndReturn(orderInfo, payDTO.getPointsNum()); + finalAmount = finalAmount.subtract(discountPointsAmount); + orderInfo.setPointsDiscountAmount(discountPointsAmount); + } + + if (finalAmount.compareTo(BigDecimal.ZERO) < 0) { + finalAmount = BigDecimal.ZERO; + orderInfo.setFullCouponDiscountAmount(orderInfo.getOrderAmount()); + } + + orderInfo.setSettlementAmount(finalAmount); + orderInfo.setOrderAmount(finalAmount); + orderInfo.setAmount(finalAmount); + + return tbActivateOutRecord; + } + + return null; + + } + + private BigDecimal calcPointsDiscountAndReturn(TbOrderInfo orderInfo, int pointsNum) { + Long memberId = Long.valueOf(orderInfo.getMemberId()); + + if (orderInfo.getPointsNum() != null && orderInfo.getPointsNum() != 0) { + memberPointsService.addPoints(memberId, orderInfo.getPointsNum(), "用户未支付订单积分返还: " + orderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId())); + } + + OrderDeductionPointsDTO memberUsablePoints = memberPointsService.getMemberUsablePoints(memberId, orderInfo.getOrderAmount()); + if (!memberUsablePoints.getUsable()) { + throw new BadRequestException(memberUsablePoints.getUnusableReason()); + } + if (pointsNum < memberUsablePoints.getMinDeductionPoints() || pointsNum > memberUsablePoints.getMaxUsablePoints()) { + throw new BadRequestException("可抵扣积分区间为: [" + memberUsablePoints.getMinDeductionPoints() + "-" + memberUsablePoints.getMaxUsablePoints() + "]"); + } + + BigDecimal discountAmount = memberPointsService.calcDeductionAmount(memberId, orderInfo.getOrderAmount(), pointsNum); + orderInfo.setPointsNum(pointsNum); + orderInfo.setPointsDiscountAmount(discountAmount); + memberPointsService.deductPoints(memberId, pointsNum, "订单积分抵扣" + discountAmount + "元", Long.valueOf(orderInfo.getId())); + return discountAmount; + } + + private void calcDiscountAndUpdateInfo(PayDTO payDTO, TbOrderInfo orderInfo) { + Set productIdSet = new HashSet<>(); + List cashierCarts = mpCashierCartService.selectByOrderIdAndState(orderInfo.getId(), null); + ArrayList activateCartInfo = new ArrayList<>(); + for (TbCashierCart cashierCart : cashierCarts) { + productIdSet.add(cashierCart.getProductId()); + if (TableConstant.OrderInfo.Status.CREATE.equalsVals(cashierCart.getStatus()) || TableConstant.OrderInfo.Status.FINAL.equalsVals(cashierCart.getStatus())) { + activateCartInfo.add(cashierCart); + } + } + + // 获取优惠券信息 + OrderCouponInfoDTO couponInfo = new OrderCouponInfoDTO(); + if (!payDTO.getUserCouponInfos().isEmpty()) { + couponInfo = getCouponInfo(payDTO.getVipUserId(), payDTO.getShopId(), payDTO.getUserCouponInfos(), + orderInfo.getOrderAmount(), productIdSet); + } + + BigDecimal productDiscount = calcCartPriceWithCoupon(activateCartInfo, couponInfo, payDTO.getVipUserId(), orderInfo); + orderInfo.setProductCouponDiscountAmount(productDiscount); + + OrderPriceDTO priceDTO = createOrderDetailWithCoupon(activateCartInfo, orderInfo.getId(), payDTO.getShopId(), false); + orderInfo.setUpdatedAt(System.currentTimeMillis()); + orderInfo.setSettlementAmount(priceDTO.getTotalAmount()); + orderInfo.setAmount(priceDTO.getTotalAmount()); + orderInfo.setOrderAmount(priceDTO.getTotalAmount()); + + // 计算订单优惠 + TbActivateOutRecord outRecord = calcOrderInfoDiscount(payDTO, orderInfo, couponInfo); + if (outRecord != null) { + couponInfo.getOutRecordList().add(outRecord); + } + + // 消耗优惠券并返回上次未使用的券 + consumeAndReturnProductCoupon(couponInfo.getOutRecordList(), payDTO.getVipUserId(), orderInfo); + + orderInfo.setCouponInfoList(JSONObject.toJSONString(couponInfo)); + // 更新订单信息 + + } + @Override + @Transactional public Object pay(PayDTO payDTO) { return Utils.runFunAndCheckKey(() -> { long count = tbShopPayTypeMapper.selectCount(new LambdaQueryWrapper() @@ -1599,9 +1927,13 @@ public class TbShopTableServiceImpl implements TbShopTableService { throw new BadRequestException("未知支付方式"); } - TbOrderInfo orderInfo = orderInfoMapper.selectById(payDTO.getOrderId()); + // 计算优惠券价格信息 + if (payDTO.getVipUserId() != null) { + calcDiscountAndUpdateInfo(payDTO, orderInfo); + } + if (ObjectUtil.isEmpty(orderInfo)) { throw new BadRequestException("订单不存在"); } @@ -1770,7 +2102,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { List tbCashierCarts = cashierCartMapper.selectList(queryWrapper.isNotNull(TbCashierCart::getOrderId)); if (!tbCashierCarts.isEmpty()) { - Integer orderId = tbCashierCarts.get(0).getOrderId(); + Integer orderId = updateVipDTO.getOrderId(); if (updateVipDTO.getType() == 0) { TbShopUser shopUser = tbShopUserMapper.selectById(updateVipDTO.getVipUserId()); if (shopUser == null) { @@ -2025,9 +2357,9 @@ public class TbShopTableServiceImpl implements TbShopTableService { TbProduct product = productMap.get(item.getProductId()); // 设置打包费 mpCashierCartService.update(new LambdaUpdateWrapper() - .eq(TbCashierCart::getId, item.getId()) + .eq(TbCashierCart::getId, item.getId()) .set(TbCashierCart::getPackFee, product.getPackFee() != null ? - product.getPackFee().multiply(BigDecimal.valueOf(item.getNumber())) : BigDecimal.ZERO) + product.getPackFee().multiply(BigDecimal.valueOf(item.getNumber())) : BigDecimal.ZERO) .set(TbCashierCart::getTableId, null) .set(TbCashierCart::getUseType, OrderUseTypeEnum.TAKEOUT.getValue()) .set(TbCashierCart::getIsPack, "true")); @@ -2121,7 +2453,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { .add(returnPackFee)); orderDetail.setPackAmount(returnPackFee); orderDetail.setRefundNumber(returnNum); - orderDetail.setStatus("refunding"); + orderDetail.setStatus(isOnline ? "refunding" : "refund"); } if (returnAmount.compareTo(BigDecimal.ZERO) <= 0) { @@ -2141,7 +2473,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { returnOrder.setOrderNo(orderNo); returnOrder.setRefundAmount(returnAmount); returnOrder.setOrderType("return"); - returnOrder.setStatus("refunding"); + returnOrder.setStatus(isOnline ? "refunding" : "refund"); returnOrder.setUpdatedAt(null); returnOrder.setSystemTime(DateUtil.current()); returnOrder.setCreatedAt(DateUtil.current()); @@ -2221,12 +2553,11 @@ public class TbShopTableServiceImpl implements TbShopTableService { if ("1".equals(shopInfo.getIsReturn())) { // TODO 密码校验 } - - HashMap returnInfoData = updateReturnOrderInfo(returnOrderDTO, orderInfo, true); + String payType = orderInfo.getPayType(); + HashMap returnInfoData = updateReturnOrderInfo(returnOrderDTO, orderInfo, "scanCode".equals(payType) || "wx_lite".equals(payType)); TbOrderInfo returnOrderInfo = (TbOrderInfo) returnInfoData.get("returnOrder"); BigDecimal returnAmount = (BigDecimal) returnInfoData.get("returnAmount"); String shopId = orderInfo.getShopId(); - String payType = orderInfo.getPayType(); // // 线上退款 orderInfo.setRefundAmount(returnOrderInfo.getRefundAmount()); @@ -2264,6 +2595,20 @@ public class TbShopTableServiceImpl implements TbShopTableService { long cartCount = mpCashierCartService.countByTableId(shopId, tableId, OrderStatusEnums.CREATE, OrderStatusEnums.RETURN); Map map = BeanUtil.beanToMap(tbShopTable, false, false); map.put("cartCount", cartCount); + + TbOrderInfo orderInfo = null; + if (StrUtil.isNotBlank(tbShopTable.getQrcode())) { + try { + + ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(tbShopTable.getShopId(), tbShopTable.getQrcode()); + orderInfo = getCurrentOrder(shopEatTypeInfoDTO); + } catch (Exception e) { + log.info(e.getMessage()); + } + } + map.put("orderId", orderInfo == null ? null : orderInfo.getId()); + map.put("useType", orderInfo == null ? null : orderInfo.getUseType()); + map.put("masterId", orderInfo == null ? null : orderInfo.getMasterId()); return map; } return null; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/vo/ActivateInInfoVO.java b/eladmin-system/src/main/java/cn/ysk/cashier/vo/ActivateInInfoVO.java new file mode 100644 index 00000000..9bf08cea --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/vo/ActivateInInfoVO.java @@ -0,0 +1,15 @@ +package cn.ysk.cashier.vo; + +import lombok.Data; +import lombok.experimental.Accessors; + +@Data +@Accessors(chain = true) +public class ActivateInInfoVO { + private Integer id; + private Integer couponId; + private Integer num; + // 1满减 2商品 + private Integer type; +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java index 459ac51c..76af2bfb 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java @@ -2,11 +2,14 @@ package cn.ysk.cashier.vo; import lombok.Data; +import java.math.BigDecimal; import java.util.Date; @Data public class TbUserCouponVo { private Integer id; + private BigDecimal fullAmount; + private BigDecimal discountAmount; private Integer couponId; private Integer proId; //优惠券名称 @@ -20,6 +23,8 @@ public class TbUserCouponVo { private Long expireTime; private String useRestrictions; private boolean isUse = false; + //当前使用数量 + private Integer currentUseNum; public void setEndTime(Date endTime) { From b401f23ec494307dd2e2b7a1238355e102565c89 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Mon, 4 Nov 2024 13:26:31 +0800 Subject: [PATCH 065/165] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E7=A7=AF=E5=88=86=E4=BC=98=E6=83=A0=E5=88=B8=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/shopimpl/TbShopTableServiceImpl.java | 43 ++++++++++++++----- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index d3ed33cf..0f6cbfe8 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1186,14 +1186,24 @@ public class TbShopTableServiceImpl implements TbShopTableService { for (TbCashierCart cashierCart : newCashierCarts) { TbUserCouponVo couponVo = couponMap.get(cashierCart.getProductId()); boolean useCoupon; - if (couponVo != null) { + if (couponVo != null && couponVo.getCurrentUseNum() > 0) { + BigDecimal currentUseNum = BigDecimal.ZERO; if (cashierCart.getNumber() < couponVo.getCurrentUseNum()) { - throw new BadRequestException("商品数量: {},小于优惠券使用数量: {}", cashierCart.getNumber(), couponVo.getCurrentUseNum()); + currentUseNum = BigDecimal.valueOf(couponVo.getCurrentUseNum()); + BigDecimal cartNum = BigDecimal.valueOf(cashierCart.getNumber()); + BigDecimal singlePackFee = cashierCart.getPackFee().divide(cartNum, RoundingMode.HALF_UP); + cashierCart.setPackFee(singlePackFee.multiply(currentUseNum)); + cashierCart.setTotalAmount(cashierCart.getSalePrice().multiply(currentUseNum).add(singlePackFee.multiply(currentUseNum))); + cashierCart.setNumber(couponVo.getCurrentUseNum()); + cashierCart.setTotalNumber(couponVo.getCurrentUseNum()); + cashierCart.setUserCouponId(couponVo.getId()); + discountAmount = discountAmount.add(cashierCart.getTotalAmount()); + couponVo.setCurrentUseNum(couponVo.getCurrentUseNum() - cashierCart.getNumber()); } usedCouponMap.put(Integer.valueOf(cashierCart.getProductId()), couponVo); // 优惠券数量小于购物车数量,分割购物车数据 if (cashierCart.getNumber() > couponVo.getCurrentUseNum()) { - BigDecimal currentUseNum = BigDecimal.valueOf(couponVo.getCurrentUseNum()); + currentUseNum = BigDecimal.valueOf(couponVo.getCurrentUseNum()); BigDecimal cartNum = BigDecimal.valueOf(cashierCart.getNumber()); int balanceNum = cashierCart.getTotalNumber() - couponVo.getCurrentUseNum(); BigDecimal singlePackFee = cashierCart.getPackFee().divide(cartNum, RoundingMode.HALF_UP); @@ -1203,6 +1213,8 @@ public class TbShopTableServiceImpl implements TbShopTableService { cashierCart.setTotalNumber(couponVo.getCurrentUseNum()); cashierCart.setUserCouponId(couponVo.getId()); discountAmount = discountAmount.add(cashierCart.getTotalAmount()); + couponVo.setCurrentUseNum(couponVo.getCurrentUseNum() - cashierCart.getNumber()); + // 创建结余购物车 TbCashierCart balanceCart = BeanUtil.copyProperties(cashierCart, TbCashierCart.class); @@ -1215,8 +1227,10 @@ public class TbShopTableServiceImpl implements TbShopTableService { balanceCart.setTotalAmount(cashierCart.getSalePrice().multiply(num).add(balanceCart.getPackFee())); balanceCartList.add(balanceCart); } else { + currentUseNum = BigDecimal.valueOf(cashierCart.getNumber()); discountAmount = discountAmount.add(cashierCart.getTotalAmount()); cashierCart.setUserCouponId(couponVo.getId()); + couponVo.setCurrentUseNum(couponVo.getCurrentUseNum() - cashierCart.getNumber()); } // 消耗并返还商品优惠券 Integer shopId = Integer.valueOf(cashierCart.getShopId()); @@ -1225,7 +1239,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { tbActivateOutRecord.setGiveId(couponVo.getId()); tbActivateOutRecord.setVipUserId(memberId); tbActivateOutRecord.setType(TableConstant.ActivateOutRecord.Type.FULL_REDUCTION.getValue()); - tbActivateOutRecord.setUseNum(couponVo.getCurrentUseNum()); + tbActivateOutRecord.setUseNum(currentUseNum.toBigInteger().intValue()); tbActivateOutRecord.setStatus(TableConstant.ActivateOutRecord.Status.CLOSED.getValue()); tbActivateOutRecord.setCreateTime(DateUtil.date()); tbActivateOutRecord.setRefNum(0); @@ -1339,22 +1353,28 @@ public class TbShopTableServiceImpl implements TbShopTableService { return cartInfoDTO; } - private boolean consumeAndReturnProductCoupon(List outRecordList, Integer memberId, TbOrderInfo orderInfo) { + private void consumeCoupon(List outRecordList, Integer memberId, TbOrderInfo orderInfo) { boolean use = shopCouponService.use(Integer.valueOf(orderInfo.getShopId()), orderInfo.getId(), memberId, outRecordList); if (!use) { throw new BadRequestException("消耗券失败"); } + } + private void returnCoupon(TbOrderInfo orderInfo) { // 返还优惠券 if (StrUtil.isNotBlank(orderInfo.getCouponInfoList())) { OrderCouponInfoDTO couponInfoDTO = JSONObject.parseObject(orderInfo.getCouponInfoList(), OrderCouponInfoDTO.class); // 券返还 if (!couponInfoDTO.getOutRecordList().isEmpty()) { - return shopCouponService.refund(couponInfoDTO.getOutRecordList()); + couponInfoDTO.getOutRecordList().forEach(item -> { + item.setRefNum(item.getUseNum()); + }); + shopCouponService.refund(couponInfoDTO.getOutRecordList()); + couponInfoDTO.setOutRecordList(new ArrayList<>()); + orderInfo.setCouponInfoList(JSONObject.toJSONString(couponInfoDTO)); } } - return true; } /** @@ -1875,6 +1895,9 @@ public class TbShopTableServiceImpl implements TbShopTableService { } private void calcDiscountAndUpdateInfo(PayDTO payDTO, TbOrderInfo orderInfo) { + // 返还上次使用的券 + returnCoupon(orderInfo); + Set productIdSet = new HashSet<>(); List cashierCarts = mpCashierCartService.selectByOrderIdAndState(orderInfo.getId(), null); ArrayList activateCartInfo = new ArrayList<>(); @@ -1908,7 +1931,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { } // 消耗优惠券并返回上次未使用的券 - consumeAndReturnProductCoupon(couponInfo.getOutRecordList(), payDTO.getVipUserId(), orderInfo); + consumeCoupon(couponInfo.getOutRecordList(), payDTO.getVipUserId(), orderInfo); orderInfo.setCouponInfoList(JSONObject.toJSONString(couponInfo)); // 更新订单信息 @@ -1916,7 +1939,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { } @Override - @Transactional +// @Transactional public Object pay(PayDTO payDTO) { return Utils.runFunAndCheckKey(() -> { long count = tbShopPayTypeMapper.selectCount(new LambdaQueryWrapper() @@ -1983,7 +2006,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { if (!isOnline) { orderInfo.setPaidTime(DateUtil.current()); orderInfo.setPayAmount(finalAmount); - orderInfo.setStatus("closed"); +// orderInfo.setStatus("closed"); if (payDTO.getDiscount() != null) { orderInfo.setDiscountRatio(BigDecimal.valueOf(payDTO.getDiscount())); orderInfo.setDiscountAmount(orderInfo.getAmount().subtract(finalAmount)); From 062a0cc2f493f0378ed9da831161a335fa0b9fd6 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Mon, 4 Nov 2024 13:37:20 +0800 Subject: [PATCH 066/165] =?UTF-8?q?fix:=20=E9=80=89=E6=8B=A9=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbShopTableServiceImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 0f6cbfe8..da6cfe08 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -2126,6 +2126,13 @@ public class TbShopTableServiceImpl implements TbShopTableService { List tbCashierCarts = cashierCartMapper.selectList(queryWrapper.isNotNull(TbCashierCart::getOrderId)); if (!tbCashierCarts.isEmpty()) { Integer orderId = updateVipDTO.getOrderId(); + if (orderId == null) { + for (TbCashierCart item : tbCashierCarts) { + if (item.getOrderId() != null) { + orderId = item.getOrderId(); + } + } + } if (updateVipDTO.getType() == 0) { TbShopUser shopUser = tbShopUserMapper.selectById(updateVipDTO.getVipUserId()); if (shopUser == null) { From 9b1f80286786b7b198a537336e7b074a098dbb15 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Mon, 4 Nov 2024 13:56:19 +0800 Subject: [PATCH 067/165] =?UTF-8?q?fix:=20=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/mybatis/service/impl/TbShopCouponServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index 1a3926da..3dfd63b4 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -380,6 +380,10 @@ public class TbShopCouponServiceImpl extends ServiceImpl Date: Mon, 4 Nov 2024 14:27:41 +0800 Subject: [PATCH 068/165] =?UTF-8?q?fix:=20=E4=BC=9A=E5=91=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/shopimpl/TbShopTableServiceImpl.java | 74 +++++++++---------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index da6cfe08..3b71181f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1834,7 +1834,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { TbActivateOutRecord tbActivateOutRecord = null; if (!couponInfo.getFullReductionCouponMap().isEmpty()) { TbUserCouponVo couponVo = couponInfo.getFullReductionCouponMap().values().stream().findFirst().orElse(null); - finalAmount =finalAmount.subtract(couponVo.getDiscountAmount()); + finalAmount = finalAmount.subtract(couponVo.getDiscountAmount()); orderInfo.setFullCouponDiscountAmount(couponVo.getDiscountAmount()); tbActivateOutRecord = new TbActivateOutRecord(); @@ -2109,47 +2109,45 @@ public class TbShopTableServiceImpl implements TbShopTableService { @Override public Object updateVip(UpdateVipDTO updateVipDTO) { - ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(updateVipDTO.getShopId(), updateVipDTO.getTableId()); - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .in(TbCashierCart::getStatus, "create", "return") - .eq(TbCashierCart::getShopId, updateVipDTO.getShopId()) - .eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType()) - .and(q -> q.eq(TbCashierCart::getMasterId, updateVipDTO.getMasterId()).or().isNull(TbCashierCart::getMasterId)); + Integer orderId = updateVipDTO.getOrderId(); + if (orderId == null) { + ShopEatTypeInfoDTO shopEatTypeInfoDTO = checkEatModel(updateVipDTO.getShopId(), updateVipDTO.getTableId()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() + .in(TbCashierCart::getStatus, "create", "return") + .eq(TbCashierCart::getShopId, updateVipDTO.getShopId()) + .eq(TbCashierCart::getUseType, shopEatTypeInfoDTO.getUseType()) + .and(q -> q.eq(TbCashierCart::getMasterId, updateVipDTO.getMasterId()).or().isNull(TbCashierCart::getMasterId)); - if (!shopEatTypeInfoDTO.isTakeout()) { - queryWrapper.eq(TbCashierCart::getTableId, updateVipDTO.getTableId()); - } else { - queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, "")) - .in(TbCashierCart::getPlatformType, OrderPlatformTypeEnum.PC.getValue(), OrderPlatformTypeEnum.CASH.getValue()); - } - - List tbCashierCarts = cashierCartMapper.selectList(queryWrapper.isNotNull(TbCashierCart::getOrderId)); - if (!tbCashierCarts.isEmpty()) { - Integer orderId = updateVipDTO.getOrderId(); - if (orderId == null) { - for (TbCashierCart item : tbCashierCarts) { - if (item.getOrderId() != null) { - orderId = item.getOrderId(); - } - } - } - if (updateVipDTO.getType() == 0) { - TbShopUser shopUser = tbShopUserMapper.selectById(updateVipDTO.getVipUserId()); - if (shopUser == null) { - throw new BadRequestException("用户信息不存在"); - } - return orderInfoMapper.update(null, new LambdaUpdateWrapper() - .eq(TbOrderInfo::getId, orderId) - .set(TbOrderInfo::getUserId, shopUser.getUserId()) - .set(TbOrderInfo::getMemberId, updateVipDTO.getVipUserId())); + if (!shopEatTypeInfoDTO.isTakeout()) { + queryWrapper.eq(TbCashierCart::getTableId, updateVipDTO.getTableId()); } else { - return orderInfoMapper.update(null, new LambdaUpdateWrapper() - .eq(TbOrderInfo::getId, orderId) - .set(TbOrderInfo::getUserId, null) - .set(TbOrderInfo::getMemberId, null)); + queryWrapper.and(q -> q.isNull(TbCashierCart::getTableId).or().eq(TbCashierCart::getTableId, "")) + .in(TbCashierCart::getPlatformType, OrderPlatformTypeEnum.PC.getValue(), OrderPlatformTypeEnum.CASH.getValue()); + } + + List tbCashierCarts = cashierCartMapper.selectList(queryWrapper.isNotNull(TbCashierCart::getOrderId)); + for (TbCashierCart item : tbCashierCarts) { + if (item.getOrderId() != null) { + orderId = item.getOrderId(); + } } } - return true; + + if (updateVipDTO.getType() == 0) { + TbShopUser shopUser = tbShopUserMapper.selectById(updateVipDTO.getVipUserId()); + if (shopUser == null) { + throw new BadRequestException("用户信息不存在"); + } + return orderInfoMapper.update(null, new LambdaUpdateWrapper() + .eq(TbOrderInfo::getId, orderId) + .set(TbOrderInfo::getUserId, shopUser.getUserId()) + .set(TbOrderInfo::getMemberId, updateVipDTO.getVipUserId())); + } else { + return orderInfoMapper.update(null, new LambdaUpdateWrapper() + .eq(TbOrderInfo::getId, orderId) + .set(TbOrderInfo::getUserId, null) + .set(TbOrderInfo::getMemberId, null)); + } } From b45709cca103c4a8b05df420a2aab14cb780ccc7 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Mon, 4 Nov 2024 14:33:33 +0800 Subject: [PATCH 069/165] =?UTF-8?q?fix:=20=E4=BC=9A=E5=91=98=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 3b71181f..e9c583fc 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -2006,7 +2006,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { if (!isOnline) { orderInfo.setPaidTime(DateUtil.current()); orderInfo.setPayAmount(finalAmount); -// orderInfo.setStatus("closed"); + orderInfo.setStatus("closed"); if (payDTO.getDiscount() != null) { orderInfo.setDiscountRatio(BigDecimal.valueOf(payDTO.getDiscount())); orderInfo.setDiscountAmount(orderInfo.getAmount().subtract(finalAmount)); From 5d77e0c3d5a076723016674ae1336df2f9b9659e Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Mon, 4 Nov 2024 17:45:45 +0800 Subject: [PATCH 070/165] =?UTF-8?q?=E5=A4=9A=E4=BD=99=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java | 3 --- .../java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java | 1 - .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 3 --- 3 files changed, 7 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java index 64e0b5ad..bf2072af 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/domain/TbConsInfo.java @@ -106,9 +106,6 @@ public class TbConsInfo implements Serializable { @ApiModelProperty(value = "是否检测库存") private String isCheck; - @Transient - private List> product; - public void copy(TbConsInfo source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java index 40276438..e536c8ee 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoDto.java @@ -72,5 +72,4 @@ public class TbConsInfoDto implements Serializable { private String isCheck; - private List> product; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index e9c583fc..dcdeeed7 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -23,7 +23,6 @@ import cn.ysk.cashier.dto.shoptable.*; import cn.ysk.cashier.enums.*; import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mapper.shop.TbShopTableMapper; -import cn.ysk.cashier.mybatis.entity.TbActivateInRecord; import cn.ysk.cashier.mybatis.entity.TbActivateOutRecord; import cn.ysk.cashier.mybatis.entity.TbShopCoupon; import cn.ysk.cashier.mybatis.mapper.*; @@ -47,14 +46,12 @@ import cn.ysk.cashier.service.order.TbOrderInfoService; import cn.ysk.cashier.service.shop.TbShopTableService; import cn.ysk.cashier.utils.*; import cn.ysk.cashier.vo.ActivateInInfoVO; -import cn.ysk.cashier.vo.CouponVO; import cn.ysk.cashier.vo.PendingCountVO; import cn.ysk.cashier.vo.TbUserCouponVo; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.dianguang.cloud.ossservice.model.DateUtils; -import com.sun.org.apache.xml.internal.serialize.OutputFormat; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; From 54291604bd690c257b0b5f8c51ded58931ebecdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Tue, 5 Nov 2024 09:31:32 +0800 Subject: [PATCH 071/165] =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TbPointsExchangeRecordServiceImpl.java | 2 +- .../cn/ysk/cashier/pojo/shop/TbShopUser.java | 29 +++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java index 52d823be..a4002001 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbPointsExchangeRecordServiceImpl.java @@ -140,7 +140,7 @@ public class TbPointsExchangeRecordServiceImpl extends ServiceImpllambdaQuery().eq(TbMemberPoints::getMobile, record.getMobile())); + TbMemberPoints memberPoints = tbMemberPointsMapper.selectOne(Wrappers.lambdaQuery().eq(TbMemberPoints::getMemberId, record.getMemberId())); if (memberPoints == null) { throw new BadRequestException("该会员积分不足无法兑换这个商品"); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopUser.java b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopUser.java index 61e60bae..e8bab126 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopUser.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/pojo/shop/TbShopUser.java @@ -1,14 +1,18 @@ 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 com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + import javax.persistence.*; -import javax.validation.constraints.*; -import java.math.BigDecimal; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; +import java.math.BigDecimal; import java.sql.Timestamp; +import java.util.Date; /** * @website https://eladmin.vip @@ -141,7 +145,22 @@ public class TbShopUser implements Serializable { @Column(name = "`join_time`") private Timestamp joinTime; - + /** + * 账户积分 + */ + @Column(name = "`account_points`") + private Integer accountPoints; + /** + * 最近一次积分变动时间 + */ + @Column(name = "`last_points_change_time`") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date lastPointsChangeTime; + /** + * 最近一次浮动积分 + */ + @Column(name = "`last_float_points`") + private Integer lastFloatPoints; public void copy(TbShopUser source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); From 029213e068169f05a8b7887d914f6b10fe29b997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=AD=E5=87=AF=E5=87=AF?= Date: Tue, 5 Nov 2024 09:39:15 +0800 Subject: [PATCH 072/165] =?UTF-8?q?=E7=A7=AF=E5=88=86=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/mybatis/mapper/ShopUserMapper.java | 2 +- .../impl/shopimpl/TbShopUserServiceImpl.java | 3 +++ .../java/cn/ysk/cashier/vo/ShopUserInfoVo.java | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ShopUserMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ShopUserMapper.java index e3d0f92d..1a418c64 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ShopUserMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/ShopUserMapper.java @@ -15,7 +15,7 @@ public interface ShopUserMapper extends BaseMapper { @Select("") + Page selectAllByShare(@Param("param") TbShopShareRecordQueryCriteria param, Page page); +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopShareRecordService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopShareRecordService.java new file mode 100644 index 00000000..aa79a529 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopShareRecordService.java @@ -0,0 +1,22 @@ +package cn.ysk.cashier.mybatis.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import cn.ysk.cashier.mybatis.entity.TbShopShareRecord; +import cn.ysk.cashier.dto.TbShopShareRecordQueryCriteria; + +import java.util.Map; + +/** + * (TbShopShareRecord)表服务接口 + * + * @author ww + * @since 2024-11-08 09:17:37 + */ +public interface TbShopShareRecordService extends IService { + + Map selectAllByShare(TbShopShareRecordQueryCriteria criteria); + + void give(TbShopShareRecord shareRecord, Integer userId); + +} + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index 3dfd63b4..b2e6a849 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -72,6 +72,8 @@ public class TbShopCouponServiceImpl extends ServiceImpl param) { for (TbActivateOutRecord outRecord : param) { TbActivateInRecord inRecord = inRecordMapper.selectById(outRecord.getGiveId()); + if (inRecord.getSource().equals("invited")) { + TbShopShareRecord shareRecord = shareRecordService.getById(inRecord.getSourceActId()); + if (shareRecord.getMethod().equals("use")) { + shareRecord.setStatus(3); + shareRecordService.give(shareRecord,shareRecord.getInvitedId()); + shareRecordService.updateById(shareRecord); + } + } + inRecord.setOverNum(inRecord.getOverNum() - outRecord.getUseNum()); inRecordMapper.updateOverNum(inRecord.getId(), inRecord.getOverNum()); diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java new file mode 100644 index 00000000..c536e378 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java @@ -0,0 +1,122 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.ysk.cashier.mybatis.entity.*; +import cn.ysk.cashier.mybatis.mapper.*; +import cn.ysk.cashier.mybatis.service.TbCouponProductService; +import cn.ysk.cashier.pojo.shop.TbShopUser; +import cn.ysk.cashier.repository.shop.TbShopUserRepository; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.ysk.cashier.mybatis.service.TbShopShareRecordService; +import org.springframework.stereotype.Service; +import org.apache.commons.lang3.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import cn.ysk.cashier.dto.TbShopShareRecordQueryCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import cn.ysk.cashier.utils.PageUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * (TbShopShareRecord)表服务实现类 + * + * @author ww + * @since 2024-11-08 09:17:37 + */ +@Service("tbShopShareRecordService") +public class TbShopShareRecordServiceImpl extends ServiceImpl implements TbShopShareRecordService { + + @Autowired + private TbShopShareRecordMapper tbShopShareRecordmapper; + @Autowired + private TbShopShareMapper tbShopShareMapper; + @Autowired + private TbShopUserRepository shopUserRepository; + @Autowired + private TbShopCouponMapper couponMapper; + @Autowired + private TbCouponProductMapper couProductMapper; + @Autowired + private TbActivateInRecordMapper inRecordMapper; + + @Override + public Map selectAllByShare(TbShopShareRecordQueryCriteria criteria) { + Page ipage = tbShopShareRecordmapper.selectAllByShare(criteria,new Page<>(criteria.getPage(), criteria.getSize())); + return PageUtil.toPage(ipage.getRecords(), ipage.getTotal()); + } + + @Override + public void give(TbShopShareRecord shareRecord, Integer userId) { + TbShopShare shopShare = tbShopShareMapper.selectById(shareRecord.getShareId()); + TbShopUser tbShopUser = shopUserRepository.selectByUserIdAndShopId(userId.toString(), shopShare.getShopId().toString()); + if (userId.equals(shareRecord.getInvitedId())) { + giveCoupon(shopShare, tbShopUser, shopShare.getRewardCoupons()); + } else if (userId.equals(shareRecord.getBeInvitedId())) { + giveCoupon(shopShare, tbShopUser, shopShare.getNewCoupons()); + } + } + + + public void giveCoupon(TbShopShare shopShare, TbShopUser tbShopUser, List coupons) { + for (TbShopShare.ShareCoupons newCoupon : coupons) { + TbShopCoupon tbShopCoupon = couponMapper.selectById(newCoupon.getCouponId()); + Date start = new Date(); + Date end = new Date(); + if ("fixed".equals(tbShopCoupon.getValidityType())) { + //固定时间 + end = DateUtil.offsetDay(new Date(), tbShopCoupon.getValidDays()); + } else if ("custom".equals(tbShopCoupon.getValidityType())) { + //自定义时间 + start = tbShopCoupon.getValidStartTime(); + end = tbShopCoupon.getValidEndTime(); + } + if (tbShopCoupon != null) { + List actGiveRecords = new ArrayList<>(); + if (tbShopCoupon.getType() == 1) { + //满减 + TbActivateInRecord record = new TbActivateInRecord(); + record.setVipUserId(Integer.valueOf(tbShopUser.getId())); + record.setCouponId(tbShopCoupon.getId()); + record.setName("满" + tbShopCoupon.getFullAmount() + "减" + tbShopCoupon.getDiscountAmount()); + record.setFullAmount(tbShopCoupon.getFullAmount()); + record.setDiscountAmount(tbShopCoupon.getDiscountAmount()); + record.setType(1); + record.setNum(newCoupon.getCouponNum()); + record.setOverNum(newCoupon.getCouponNum()); + record.setShopId(Integer.valueOf(tbShopUser.getShopId())); + record.setSourceActId(shopShare.getId()); + record.setUseStartTime(start); + record.setUseEndTime(end); + record.setSource("invited"); + actGiveRecords.add(record); + } else if (tbShopCoupon.getType() == 2) { + //商品卷 + List tbCouponProducts = couProductMapper.queryAllByCouponId(tbShopCoupon.getId()); + for (TbCouponProduct actPro : tbCouponProducts) { + TbActivateInRecord record = new TbActivateInRecord(); + record.setVipUserId(Integer.valueOf(tbShopUser.getId())); + record.setCouponId(tbShopCoupon.getId()); + record.setName("商品卷"); + record.setType(2); + record.setProId(actPro.getProductId()); + record.setNum(actPro.getNum() * tbShopCoupon.getNumber()); + record.setOverNum(actPro.getNum() * tbShopCoupon.getNumber()); + record.setShopId(Integer.valueOf(tbShopUser.getShopId())); + record.setSourceActId(shopShare.getId()); + record.setUseStartTime(start); + record.setUseEndTime(end); + record.setSource("invited"); + actGiveRecords.add(record); + } + } + inRecordMapper.insert(actGiveRecords); + } + } + + } +} + From 5e3caeda30acb4d70ee0adab6a2c27046f4537a9 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 8 Nov 2024 18:01:53 +0800 Subject: [PATCH 111/165] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E9=A2=86?= =?UTF-8?q?=E5=8F=96=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java index 8f67d9d4..7e934fbe 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java @@ -33,10 +33,10 @@ public interface TbShopCouponMapper extends BaseMapper { " " + " and (vip.name like concat('%', #{param.value}, '%') or vip.telephone like concat('%', #{param.value}, '%')) " + " " + - " " + + " " + " and record.over_num != record.num " + " " + - " " + + " " + " and record.over_num = record.num " + " " + " " + From 0d5a8b66caac5d748fcd3425736004fc980cfbe2 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Fri, 8 Nov 2024 18:14:41 +0800 Subject: [PATCH 112/165] =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=20=E6=9D=A5?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/mybatis/mapper/TbShopCouponMapper.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java index 7e934fbe..7d415b2a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopCouponMapper.java @@ -21,8 +21,15 @@ public interface TbShopCouponMapper extends BaseMapper { @Select("") + List queActByCouponId(@Param("couponId") Integer couponId); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index 023a6d64..560fef57 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -10,10 +10,7 @@ import cn.ysk.cashier.dto.QueryReceiveDto; import cn.ysk.cashier.dto.TbShopCouponQueryCriteria; import cn.ysk.cashier.exception.BadRequestException; import cn.ysk.cashier.mybatis.entity.*; -import cn.ysk.cashier.mybatis.mapper.TbActivateInRecordMapper; -import cn.ysk.cashier.mybatis.mapper.TbActivateOutRecordMapper; -import cn.ysk.cashier.mybatis.mapper.TbMShopUserMapper; -import cn.ysk.cashier.mybatis.mapper.TbShopCouponMapper; +import cn.ysk.cashier.mybatis.mapper.*; import cn.ysk.cashier.mybatis.service.*; import cn.ysk.cashier.mybatis.vo.TbShopCouponVo; import cn.ysk.cashier.pojo.order.TbCashierCart; @@ -59,6 +56,8 @@ public class TbShopCouponServiceImpl extends ServiceImpl tbActivates = activateMapper.queActByCouponId(id); + if(CollectionUtil.isNotEmpty(tbActivates)){ + throw new BadRequestException("该优惠券已关联活动,请解绑后删除"); + } + } tbShopCouponmapper.deleteBatchIds(Arrays.asList(ids)); for (Integer id : ids) { couProductService.remove(new LambdaQueryWrapper().eq(TbCouponProduct::getCouponId, id)); From 1d2ef2fdf518b17fadc516f88fae04d3fb6d698d Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Wed, 13 Nov 2024 18:23:42 +0800 Subject: [PATCH 151/165] =?UTF-8?q?=E5=A5=96=E5=8A=B1=E5=88=B8=E4=B8=8D?= =?UTF-8?q?=E5=8F=97=20=E4=BC=98=E6=83=A0=E5=88=B8=E5=8F=91=E6=94=BE?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E7=9A=84=E9=99=90=E5=88=B6=20=E4=B8=8D?= =?UTF-8?q?=E6=89=A3=E9=99=A4=E5=8F=91=E6=94=BE=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/TbShopShareRecordServiceImpl.java | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java index c536e378..e79672d3 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java @@ -54,14 +54,14 @@ public class TbShopShareRecordServiceImpl extends ServiceImpl coupons) { + public void giveCoupon(TbShopShare shopShare, TbShopUser tbShopUser, List coupons, boolean isReward) { for (TbShopShare.ShareCoupons newCoupon : coupons) { TbShopCoupon tbShopCoupon = couponMapper.selectById(newCoupon.getCouponId()); Date start = new Date(); @@ -91,7 +91,11 @@ public class TbShopShareRecordServiceImpl extends ServiceImpl Date: Thu, 14 Nov 2024 10:34:35 +0800 Subject: [PATCH 152/165] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=20=E7=BD=AE=E7=A9=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/service/impl/TbActivateServiceImpl.java | 11 ++++++++++- .../service/impl/TbShopShareRecordServiceImpl.java | 8 +++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java index f7a25436..23583aff 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java @@ -6,6 +6,7 @@ import cn.ysk.cashier.mybatis.mapper.TbActivateMapper; import cn.ysk.cashier.mybatis.service.TbActivateService; import cn.ysk.cashier.mybatis.service.TbShopCouponService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -44,7 +45,15 @@ public class TbActivateServiceImpl extends ServiceImpl 0) { - activateMapper.updateById(activate); + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("id", activate.getId()).setEntity(activate); + if (Objects.isNull(activate.getCouponId())) { + updateWrapper.set("couponId", null); + } + if (Objects.isNull(activate.getGiftPoints())) { + updateWrapper.set("giftPoints", null); + } + activateMapper.update(updateWrapper); } else { activateMapper.insert(activate); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java index e79672d3..fbadec6a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopShareRecordServiceImpl.java @@ -54,14 +54,14 @@ public class TbShopShareRecordServiceImpl extends ServiceImpl coupons, boolean isReward) { + public void giveCoupon(TbShopShare shopShare, TbShopUser tbShopUser, List coupons ,Integer flowId, boolean isReward) { for (TbShopShare.ShareCoupons newCoupon : coupons) { TbShopCoupon tbShopCoupon = couponMapper.selectById(newCoupon.getCouponId()); Date start = new Date(); @@ -89,6 +89,7 @@ public class TbShopShareRecordServiceImpl extends ServiceImpl Date: Thu, 14 Nov 2024 10:39:19 +0800 Subject: [PATCH 153/165] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=20=E7=BD=AE=E7=A9=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/mybatis/service/impl/TbActivateServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java index 23583aff..92d10c13 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java @@ -48,10 +48,10 @@ public class TbActivateServiceImpl extends ServiceImpl updateWrapper = new UpdateWrapper<>(); updateWrapper.eq("id", activate.getId()).setEntity(activate); if (Objects.isNull(activate.getCouponId())) { - updateWrapper.set("couponId", null); + updateWrapper.set("coupon_id", null); } if (Objects.isNull(activate.getGiftPoints())) { - updateWrapper.set("giftPoints", null); + updateWrapper.set("gift_points", null); } activateMapper.update(updateWrapper); } else { From e84d6557966d274a313c1cc19448fa9a708a4808 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 14 Nov 2024 10:43:12 +0800 Subject: [PATCH 154/165] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=20=E7=BD=AE=E7=A9=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java index 92d10c13..175c8810 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java @@ -46,7 +46,7 @@ public class TbActivateServiceImpl extends ServiceImpl 0) { UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.eq("id", activate.getId()).setEntity(activate); + updateWrapper.setEntity(activate); if (Objects.isNull(activate.getCouponId())) { updateWrapper.set("coupon_id", null); } From 65c9667d9fbe07dde3bd5311c9cba9d72b30aac7 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 14 Nov 2024 10:59:17 +0800 Subject: [PATCH 155/165] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=20=E7=BD=AE=E7=A9=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/ysk/cashier/mybatis/entity/TbActivate.java | 3 +++ .../mybatis/service/impl/TbActivateServiceImpl.java | 10 +--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivate.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivate.java index 4fdc0ef0..d3596a4c 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivate.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbActivate.java @@ -1,6 +1,7 @@ package cn.ysk.cashier.mybatis.entity; import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.FieldStrategy; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.extension.activerecord.Model; @@ -17,10 +18,12 @@ public class TbActivate extends Model { //赠送金额 private Integer giftAmount; //赠送积分 + @TableField(updateStrategy = FieldStrategy.ALWAYS) private Integer giftPoints; //是否使用优惠卷 0否 1是 private Integer isUseCoupon; //优惠卷id + @TableField(updateStrategy = FieldStrategy.ALWAYS) private Integer couponId; @TableField(exist = false) private String couponName; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java index 175c8810..af45a72c 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java @@ -45,15 +45,7 @@ public class TbActivateServiceImpl extends ServiceImpl 0) { - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.setEntity(activate); - if (Objects.isNull(activate.getCouponId())) { - updateWrapper.set("coupon_id", null); - } - if (Objects.isNull(activate.getGiftPoints())) { - updateWrapper.set("gift_points", null); - } - activateMapper.update(updateWrapper); + activateMapper.updateById(activate); } else { activateMapper.insert(activate); } From 08351e626045780a07572e3440cf6c212ec1f9d6 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 14 Nov 2024 11:22:21 +0800 Subject: [PATCH 156/165] =?UTF-8?q?=E6=B4=BB=E5=8A=A8=20=E7=BD=AE=E7=A9=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TbActivateServiceImpl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java index af45a72c..ab47c3e1 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbActivateServiceImpl.java @@ -45,8 +45,22 @@ public class TbActivateServiceImpl extends ServiceImpl 0) { + if(activate.getIsUseCoupon()==0){ + activate.setCouponId(null); + } else if (activate.getIsUseCoupon()==1) { + if (activate.getCouponId() == null) { + throw new RuntimeException("优惠券不能为空"); + } + } activateMapper.updateById(activate); } else { + if(activate.getIsUseCoupon()==0){ + activate.setCouponId(null); + } else if (activate.getIsUseCoupon()==1) { + if (activate.getCouponId() == null) { + throw new RuntimeException("优惠券不能为空"); + } + } activateMapper.insert(activate); } } From 42775cae36ea5ac786b6539ab73a38d9db844057 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 14 Nov 2024 13:53:10 +0800 Subject: [PATCH 157/165] =?UTF-8?q?=E6=9C=AA=E4=BD=BF=E7=94=A8=E5=88=B8=20?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E7=94=A8=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java | 5 +++++ .../mybatis/service/impl/TbShopCouponServiceImpl.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java index 676a0c34..ece33c8c 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java @@ -44,6 +44,11 @@ public interface TbActivateInRecordMapper extends BaseMapper " order by inRecord.use_end_time asc") List queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId); + @Select("SELECT sum( over_num ) from tb_activate_in_record" + + " where coupon_id = #{couponId} and now() < use_end_time group by coupon_id ") + int countNoUseCoupon(@Param("couponId") Integer couponId); + + @Update("update tb_activate_in_record" + " set over_num = #{overNum}" + " where id = #{id}") diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index 560fef57..b2a80ac0 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -160,6 +160,10 @@ public class TbShopCouponServiceImpl extends ServiceImpl 0) { + throw new BadRequestException("该优惠券有发放后未使用,无法删除"); + } } tbShopCouponmapper.deleteBatchIds(Arrays.asList(ids)); for (Integer id : ids) { From aba8d9b52466a21bf6c0d0fe5661c61a7957b51e Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 14 Nov 2024 14:15:09 +0800 Subject: [PATCH 158/165] =?UTF-8?q?=E6=9C=AA=E4=BD=BF=E7=94=A8=E5=88=B8=20?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E7=94=A8=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java index ece33c8c..2b47b89b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java @@ -45,7 +45,8 @@ public interface TbActivateInRecordMapper extends BaseMapper List queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId); @Select("SELECT sum( over_num ) from tb_activate_in_record" + - " where coupon_id = #{couponId} and now() < use_end_time group by coupon_id ") + " where coupon_id = #{couponId} " + + " and now() < use_end_time group by coupon_id ") int countNoUseCoupon(@Param("couponId") Integer couponId); From 2e4ef9a0a53768c2e23685ed44f77c282b3aeedd Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Thu, 14 Nov 2024 14:18:00 +0800 Subject: [PATCH 159/165] =?UTF-8?q?=E6=9C=AA=E4=BD=BF=E7=94=A8=E5=88=B8=20?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E7=94=A8=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/mybatis/mapper/TbActivateInRecordMapper.java | 2 +- .../mybatis/service/impl/TbShopCouponServiceImpl.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java index 2b47b89b..ddcc059d 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbActivateInRecordMapper.java @@ -47,7 +47,7 @@ public interface TbActivateInRecordMapper extends BaseMapper @Select("SELECT sum( over_num ) from tb_activate_in_record" + " where coupon_id = #{couponId} " + " and now() < use_end_time group by coupon_id ") - int countNoUseCoupon(@Param("couponId") Integer couponId); + Integer countNoUseCoupon(@Param("couponId") Integer couponId); @Update("update tb_activate_in_record" + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java index b2a80ac0..3554e500 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopCouponServiceImpl.java @@ -157,11 +157,11 @@ public class TbShopCouponServiceImpl extends ServiceImpl tbActivates = activateMapper.queActByCouponId(id); - if(CollectionUtil.isNotEmpty(tbActivates)){ + if (CollectionUtil.isNotEmpty(tbActivates)) { throw new BadRequestException("该优惠券已关联活动,请解绑后删除"); } - int i = inRecordMapper.countNoUseCoupon(id); - if (i > 0) { + Integer i = inRecordMapper.countNoUseCoupon(id); + if (i != null && i > 0) { throw new BadRequestException("该优惠券有发放后未使用,无法删除"); } } @@ -254,7 +254,7 @@ public class TbShopCouponServiceImpl extends ServiceImpl coupons = new HashMap<>(); for (TbUserCouponVo tbUserCouponVo : tbUserCouponVos) { if (!coupons.containsKey(tbUserCouponVo.getCouponId())) { - setCouponInfo(coupons, tbUserCouponVo, null, week ,now, formatter); + setCouponInfo(coupons, tbUserCouponVo, null, week, now, formatter); } JsonObject couponJson = coupons.get(tbUserCouponVo.getCouponId()); tbUserCouponVo.setUseRestrictions(couponJson.get("useRestrictions").toString()); From 934871830a04a21c3f689ed7ea37e2e976f15141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Fri, 15 Nov 2024 10:07:21 +0800 Subject: [PATCH 160/165] =?UTF-8?q?feat:=20=E8=AE=A2=E5=8D=95=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=97=B6=E9=97=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index c3f88d75..df696112 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1561,7 +1561,6 @@ public class TbShopTableServiceImpl implements TbShopTableService { orderInfo.setProductAmount(BigDecimal.ZERO); orderInfo.setTradeDay(DateUtils.getDay()); orderInfo.setUseType(eatTypeInfoDTO.getUseType()); - orderInfo.setCreatedAt(DateUtil.current()); if (seatCart != null) { orderInfo.setSeatAmount(seatCart.getTotalAmount()); orderInfo.setSeatCount(seatCart.getNumber()); From e0626530e08de5028fda7e2327e95de9dd20dca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Fri, 15 Nov 2024 10:10:12 +0800 Subject: [PATCH 161/165] =?UTF-8?q?feat:=20=E8=AE=A2=E5=8D=95=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=97=B6=E9=97=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index 73569f7e..f7a953ac 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -704,7 +704,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { .set(TbOrderInfo::getCouponInfoList, null) .set(TbOrderInfo::getPointsNum, 0) .set(TbOrderInfo::getUpdatedAt, cn.hutool.core.date.DateUtil.current()) - .set(TbOrderInfo::getStatus, "cancel")); + .set(TbOrderInfo::getStatus, "cancelled")); }catch (Exception e) { log.error("取消订单失败: 订单信息: {}", orderInfo); log.error("异常信息: ", e); From 641b5cb0a95ab9ae1e4329821d434b70852955dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Fri, 15 Nov 2024 14:24:22 +0800 Subject: [PATCH 162/165] =?UTF-8?q?feat:=20=E8=AE=A2=E5=8D=95=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cashier/service/impl/shopimpl/TbShopTableServiceImpl.java | 4 ++++ .../src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index df696112..33d05fac 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -1270,6 +1270,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { tbActivateOutRecord.setRefNum(0); outRecords.add(tbActivateOutRecord); + couponVo.setFinalDiscountAmount(discountAmount); // 优惠券未消耗完毕 if (balanceCart != null && getCanUseCoupon(couponMap, balanceCart.getProductId()) != null) { discountAmount = reduceProCoupon(couponMap, balanceCart, usedCouponMap, discountAmount, balanceCartList, outRecords, memberId); @@ -1355,6 +1356,7 @@ public class TbShopTableServiceImpl implements TbShopTableService { throw new BadRequestException("存在不可用优惠券"); } couponVo.setCurrentUseNum(item.getNum()); + couponVo.setFinalUseNum(item.getNum()); infoDTO.getProductCouponMap().put(item.getUserCouponId(), couponVo); }); @@ -1917,6 +1919,8 @@ public class TbShopTableServiceImpl implements TbShopTableService { tbActivateOutRecord.setCreateTime(DateUtil.date()); tbActivateOutRecord.setRefNum(0); + couponVo.setFinalDiscountAmount(couponVo.getDiscountAmount()); + } // 计算积分优惠 diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java index 760a3fb0..ea03ff86 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/vo/TbUserCouponVo.java @@ -29,6 +29,8 @@ public class TbUserCouponVo { private boolean isUse = false; //当前使用数量 private Integer currentUseNum; + private Integer finalUseNum; + private BigDecimal finalDiscountAmount = new BigDecimal(0); public void setEndTime(Date endTime) { @@ -37,4 +39,5 @@ public class TbUserCouponVo { expireTime=endTime.getTime(); } } + } From ab78aa6ac8cfc89967a889da998d9e7ad6322e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Fri, 15 Nov 2024 14:27:41 +0800 Subject: [PATCH 163/165] =?UTF-8?q?feat:=20=E8=AE=A2=E5=8D=95=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/shopimpl/TbShopTableServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java index 33d05fac..fe28005b 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java @@ -2034,7 +2034,13 @@ public class TbShopTableServiceImpl implements TbShopTableService { // 消耗优惠券并返回上次未使用的券 consumeCoupon(couponInfo.getOutRecordList(), payDTO.getVipUserId(), orderInfo); - orderInfo.setCouponInfoList(JSONObject.toJSONString(couponInfo)); + couponInfo.setProductCouponMap(BeanUtil.copyProperties(couponInfo.getProductCouponMap(), HashMap.class)); + HashMap map = new HashMap<>(); + map.put("outRecordList", couponInfo.getOutRecordList()); + map.put("fullReductionCoupon", couponInfo.getFullReductionCouponMap().values()); + map.put("productCoupon", couponInfo.getProductCouponMap().values()); + orderInfo.setCouponInfoList(JSONObject.toJSONString(map)); +// orderInfo.setCouponInfoList(JSONObject.toJSONString(couponInfo)); // 修改订单detail mpOrderDetailService.saveOrUpdateBatch(priceDTO.getOrderDetailList()); From 7995746c5dd82bf697a68c69421bf10556df097f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Fri, 15 Nov 2024 14:48:17 +0800 Subject: [PATCH 164/165] =?UTF-8?q?feat:=20=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=BF=87=E6=9C=9F=E8=BF=94=E8=BF=98=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/order/TbOrderInfoServiceImpl.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index f7a953ac..34ac129a 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -450,6 +450,25 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { keys.add(CacheKey.PRODUCT_SKU + detail.getShopId() + ":" + detail.getId()); } + // 查询是否消耗了积分优惠券返还对应的卷或商品 + if (tbOrderInfo.getCouponInfoList() != null) { + OrderCouponInfoDTO couponInfoDTO = JSONObject.parseObject(tbOrderInfo.getCouponInfoList(), OrderCouponInfoDTO.class); + // 券返还 + if (!couponInfoDTO.getOutRecordList().isEmpty()) { + couponInfoDTO.getOutRecordList().forEach(item -> { + item.setRefNum(item.getUseNum()); + }); + shopCouponService.refund(couponInfoDTO.getOutRecordList()); + couponInfoDTO.setOutRecordList(new ArrayList<>()); + tbOrderInfo.setCouponInfoList(null); + } + } + + // 返还积分 + if (tbOrderInfo.getPointsNum() != null && tbOrderInfo.getPointsNum() != 0 && tbOrderInfo.getMemberId() != null) { + memberPointsService.addPoints(Long.valueOf(tbOrderInfo.getMemberId()), tbOrderInfo.getPointsNum(), "订单取消返还: " + tbOrderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId())); + } + mpCashierCartService.updateStateByOrderId(TableConstant.OrderInfo.Status.CLOSED, tbOrderInfo.getId()); String[] keysArray = keys.toArray(new String[keys.size()]); redisUtils.del(keysArray); @@ -653,7 +672,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { return; } TbOrderInfo returnOrder = orderInfoMapper.selectOne(new LambdaQueryWrapper() - .eq(TbOrderInfo::getStatus, "refunding") + .eq(TbOrderInfo::getStatus, "refunding") .eq(TbOrderInfo::getSource, orderInfo.getId())); if (returnOrder == null) { log.warn("订单信息不存在: {}", payOrderId); @@ -705,7 +724,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { .set(TbOrderInfo::getPointsNum, 0) .set(TbOrderInfo::getUpdatedAt, cn.hutool.core.date.DateUtil.current()) .set(TbOrderInfo::getStatus, "cancelled")); - }catch (Exception e) { + } catch (Exception e) { log.error("取消订单失败: 订单信息: {}", orderInfo); log.error("异常信息: ", e); } From 2f5d902a9b5e8d82b293f1e9c9e255d59db8d884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Fri, 15 Nov 2024 14:49:01 +0800 Subject: [PATCH 165/165] =?UTF-8?q?feat:=20=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=BF=87=E6=9C=9F=E8=BF=94=E8=BF=98=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java index 34ac129a..7f016b97 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/order/TbOrderInfoServiceImpl.java @@ -466,7 +466,8 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService { // 返还积分 if (tbOrderInfo.getPointsNum() != null && tbOrderInfo.getPointsNum() != 0 && tbOrderInfo.getMemberId() != null) { - memberPointsService.addPoints(Long.valueOf(tbOrderInfo.getMemberId()), tbOrderInfo.getPointsNum(), "订单取消返还: " + tbOrderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId())); + memberPointsService.addPoints(Long.valueOf(tbOrderInfo.getMemberId()), tbOrderInfo.getPointsNum(), + "订单取消返还: " + tbOrderInfo.getPointsNum() + "积分", Long.valueOf(tbOrderInfo.getId())); } mpCashierCartService.updateStateByOrderId(TableConstant.OrderInfo.Status.CLOSED, tbOrderInfo.getId());