Merge branch 'ww' into test

# Conflicts:
#	eladmin-system/src/main/resources/mapper/TbActivateMapper.xml
This commit is contained in:
wangw 2024-10-24 15:29:05 +08:00
commit 473a8eaca5
107 changed files with 866 additions and 6320 deletions

191
LICENSE
View File

@ -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.

View File

@ -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/)

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>eladmin</artifactId>
<groupId>cn.ysk.cashier</groupId>
<version>2.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eladmin-generator</artifactId>
<name>代码生成模块</name>
<properties>
<configuration.version>1.10</configuration.version>
</properties>
<dependencies>
<dependency>
<groupId>cn.ysk.cashier</groupId>
<artifactId>eladmin-common</artifactId>
<version>2.6</version>
</dependency>
<!--模板引擎-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-configuration/commons-configuration -->
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>${configuration.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<ColumnInfo,Long> {
/**
* 查询表信息
* @param tableName 表格名
* @return 表信息
*/
List<ColumnInfo> findByTableNameOrderByIdAsc(String tableName);
}

View File

@ -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<GenConfig,Long> {
/**
* 查询表配置
* @param tableName 表名
* @return /
*/
GenConfig findByTableName(String tableName);
}

View File

@ -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<Object> queryGenConfig(@PathVariable String tableName){
return new ResponseEntity<>(genConfigService.find(tableName), HttpStatus.OK);
}
@PutMapping
@ApiOperation("修改")
public ResponseEntity<Object> updateGenConfig(@Validated @RequestBody GenConfig genConfig){
return new ResponseEntity<>(genConfigService.update(genConfig.getTableName(), genConfig),HttpStatus.OK);
}
}

View File

@ -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<Object> queryAllTables(){
return new ResponseEntity<>(generatorService.getTables(), HttpStatus.OK);
}
@ApiOperation("查询数据库数据")
@GetMapping(value = "/tables")
public ResponseEntity<Object> 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<Object> queryColumns(@RequestParam String tableName){
List<ColumnInfo> columnInfos = generatorService.getColumns(tableName);
return new ResponseEntity<>(PageUtil.toPage(columnInfos,columnInfos.size()), HttpStatus.OK);
}
@ApiOperation("保存字段数据")
@PutMapping
public ResponseEntity<HttpStatus> saveColumn(@RequestBody List<ColumnInfo> columnInfos){
generatorService.save(columnInfos);
return new ResponseEntity<>(HttpStatus.OK);
}
@ApiOperation("同步字段数据")
@PostMapping(value = "sync")
public ResponseEntity<HttpStatus> syncColumn(@RequestBody List<String> 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<Object> 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);
}
}

View File

@ -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);
}

View File

@ -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<ColumnInfo> getColumns(String name);
/**
* 同步表数据
* @param columnInfos /
* @param columnInfoList /
*/
void sync(List<ColumnInfo> columnInfos, List<ColumnInfo> columnInfoList);
/**
* 保持数据
* @param columnInfos /
*/
void save(List<ColumnInfo> columnInfos);
/**
* 获取所有table
* @return /
*/
Object getTables();
/**
* 代码生成
* @param genConfig 配置信息
* @param columns 字段信息
*/
void generator(GenConfig genConfig, List<ColumnInfo> columns);
/**
* 预览
* @param genConfig 配置信息
* @param columns 字段信息
* @return /
*/
ResponseEntity<Object> preview(GenConfig genConfig, List<ColumnInfo> columns);
/**
* 打包下载
* @param genConfig 配置信息
* @param columns 字段信息
* @param request /
* @param response /
*/
void download(GenConfig genConfig, List<ColumnInfo> columns, HttpServletRequest request, HttpServletResponse response);
/**
* 查询数据库的表字段数据数据
* @param table /
* @return /
*/
List<ColumnInfo> query(String table);
}

View File

@ -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);
}
}

View File

@ -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<TableInfo> 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<ColumnInfo> getColumns(String tableName) {
List<ColumnInfo> columnInfos = columnInfoRepository.findByTableNameOrderByIdAsc(tableName);
if (CollectionUtil.isNotEmpty(columnInfos)) {
return columnInfos;
} else {
columnInfos = query(tableName);
return columnInfoRepository.saveAll(columnInfos);
}
}
@Override
public List<ColumnInfo> 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<ColumnInfo> 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<ColumnInfo> columnInfos, List<ColumnInfo> columnInfoList) {
// 第一种情况数据库类字段改变或者新增字段
for (ColumnInfo columnInfo : columnInfoList) {
// 根据字段名称查找
List<ColumnInfo> 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<ColumnInfo> 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<ColumnInfo> columnInfos) {
columnInfoRepository.saveAll(columnInfos);
}
@Override
public void generator(GenConfig genConfig, List<ColumnInfo> 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<Object> preview(GenConfig genConfig, List<ColumnInfo> columns) {
if (genConfig.getId() == null) {
throw new BadRequestException(CONFIG_MESSAGE);
}
List<Map<String, Object>> genList = GenUtil.preview(columns, genConfig);
return new ResponseEntity<>(genList, HttpStatus.OK);
}
@Override
public void download(GenConfig genConfig, List<ColumnInfo> 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("打包失败");
}
}
}

View File

@ -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;
}
}

View File

@ -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<String> getAdminTemplateNames() {
List<String> 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<String> getFrontTemplateNames() {
List<String> templateNames = new ArrayList<>();
templateNames.add("index");
templateNames.add("api");
return templateNames;
}
public static List<Map<String, Object>> preview(List<ColumnInfo> columns, GenConfig genConfig) {
Map<String, Object> genMap = getGenMap(columns, genConfig);
List<Map<String, Object>> genList = new ArrayList<>();
// 获取后端模版
List<String> templates = getAdminTemplateNames();
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
for (String templateName : templates) {
Map<String, Object> 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<String, Object> 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<ColumnInfo> 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<String, Object> genMap = getGenMap(columns, genConfig);
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
// 生成后端代码
List<String> 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<ColumnInfo> columnInfos, GenConfig genConfig) throws IOException {
Map<String, Object> genMap = getGenMap(columnInfos, genConfig);
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
// 生成后端代码
List<String> 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<String, Object> getGenMap(List<ColumnInfo> columnInfos, GenConfig genConfig) {
// 存储模版字段数据
Map<String, Object> 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<Map<String, Object>> columns = new ArrayList<>();
// 保存查询字段的信息
List<Map<String, Object>> queryColumns = new ArrayList<>();
// 存储字典信息
List<String> dicts = new ArrayList<>();
// 存储 between 信息
List<Map<String, Object>> betweens = new ArrayList<>();
// 存储不为空的字段信息
List<Map<String, Object>> isNotNullColumns = new ArrayList<>();
for (ColumnInfo column : columnInfos) {
Map<String, Object> 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<String, Object> 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();
}
}
}

View File

@ -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<Object> queryBotButtonConfig(BotButtonConfigQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(botButtonConfigService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@ApiOperation("新增buttonConfig")
@PreAuthorize("@el.check('botButtonConfig:add')")
public ResponseEntity<Object> createBotButtonConfig(@Validated @RequestBody BotButtonConfig resources){
return new ResponseEntity<>(botButtonConfigService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改buttonConfig")
@PreAuthorize("@el.check('botButtonConfig:edit')")
public ResponseEntity<Object> updateBotButtonConfig(@Validated @RequestBody BotButtonConfig resources){
botButtonConfigService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@ApiOperation("删除buttonConfig")
@PreAuthorize("@el.check('botButtonConfig:del')")
public ResponseEntity<Object> deleteBotButtonConfig(@RequestBody Integer[] ids) {
botButtonConfigService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -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<Object> queryBotConfig(BotConfigQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(botConfigService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@ApiOperation("新增botConfig")
@PreAuthorize("@el.check('botConfig:add')")
public ResponseEntity<Object> createBotConfig(@Validated @RequestBody BotConfig resources){
return new ResponseEntity<>(botConfigService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改botConfig")
@PreAuthorize("@el.check('botConfig:edit')")
public ResponseEntity<Object> updateBotConfig(@Validated @RequestBody BotConfig resources){
botConfigService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@ApiOperation("删除botConfig")
@PreAuthorize("@el.check('botConfig:del')")
public ResponseEntity<Object> deleteBotConfig(@RequestBody Integer[] ids) {
botConfigService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -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<Object> queryBotUser(BotUserQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(botUserService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@ApiOperation("新增BotUserController")
@PreAuthorize("@el.check('botUser:add')")
public ResponseEntity<Object> createBotUser(@Validated @RequestBody BotUser resources){
return new ResponseEntity<>(botUserService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改BotUserController")
@PreAuthorize("@el.check('botUser:edit')")
public ResponseEntity<Object> updateBotUser(@Validated @RequestBody BotUser resources){
botUserService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@ApiOperation("删除BotUserController")
@PreAuthorize("@el.check('botUser:del')")
public ResponseEntity<Object> deleteBotUser(@RequestBody Integer[] ids) {
botUserService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -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<Object> queryBotUserFlow(BotUserFlowQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(botUserFlowService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@ApiOperation("新增accountFlow")
@PreAuthorize("@el.check('botUserFlow:add')")
public ResponseEntity<Object> createBotUserFlow(@Validated @RequestBody BotUserFlow resources){
return new ResponseEntity<>(botUserFlowService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改accountFlow")
@PreAuthorize("@el.check('botUserFlow:edit')")
public ResponseEntity<Object> updateBotUserFlow(@Validated @RequestBody BotUserFlow resources){
botUserFlowService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@ApiOperation("删除accountFlow")
@PreAuthorize("@el.check('botUserFlow:del')")
public ResponseEntity<Object> deleteBotUserFlow(@RequestBody Integer[] ids) {
botUserFlowService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -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<Object> 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<Object> createTbRenewalsPayLog(@Validated @RequestBody TbRenewalsPayLog resources){
return new ResponseEntity<>(tbRenewalsPayLogService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改/shop/renewals")
@PreAuthorize("@el.check('tbRenewalsPayLog:edit')")
public ResponseEntity<Object> 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<Object> deleteTbRenewalsPayLog(@RequestBody Integer[] ids) {
tbRenewalsPayLogService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -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<Object> 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<Object> queryActivatePros(@PathVariable("couponId") Integer couponId){
return new ResponseEntity<>(tbShopCouponService.findActivatePros(couponId),HttpStatus.OK);
}
@PostMapping
@ApiOperation("新增")
public ResponseEntity<Object> 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<Object> 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<Object> delete(@RequestParam("id") Integer id) {
tbShopCouponService.delete(id);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -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<String, Object> params) {
MapProxy mapProxy = MapProxy.create(params);
String shopId = mapProxy.getStr("shopId");

View File

@ -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<Object> queryTbMerchantCoupon(TbMerchantCouponQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbMerchantCouponService.queryAll(criteria,pageable),HttpStatus.OK);
}
@GetMapping("/{id}")
@ApiOperation("查询优惠卷")
public ResponseEntity<Object> 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<Object> createTbMerchantCoupon(@Validated @RequestBody TbMerchantCoupon resources){
return new ResponseEntity<>(tbMerchantCouponService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改商家优惠卷:#resources.title")
public ResponseEntity<Object> updateTbMerchantCoupon(@Validated @RequestBody TbMerchantCoupon resources){
tbMerchantCouponService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@Log("删除商家优惠卷:#ids")
public ResponseEntity<Object> deleteTbMerchantCoupon(@RequestBody Integer[] ids) {
tbMerchantCouponService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -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<Object> 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<Object> createTbReceiptSales(@Validated @RequestBody TbReceiptSales resources){
return new ResponseEntity<>(tbReceiptSalesService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改/shop/receiptSales")
@PreAuthorize("@el.check('tbReceiptSales:edit')")
public ResponseEntity<Object> 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<Object> deleteTbReceiptSales(@RequestBody Integer[] ids) {
tbReceiptSalesService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -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<Object> 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<Object> createTbShopCashSpread(@Validated @RequestBody TbShopCashSpread resources){
return new ResponseEntity<>(tbShopCashSpreadService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改/shop/spread")
@PreAuthorize("@el.check('tbShopCashSpread:edit')")
public ResponseEntity<Object> 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<Object> deleteTbShopCashSpread(@RequestBody String[] ids) {
tbShopCashSpreadService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -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<Object> 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<Object> createTbShopCurrency(@Validated @RequestBody TbShopCurrency resources){
return new ResponseEntity<>(tbShopCurrencyService.create(resources),HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改/shop/currency")
public ResponseEntity<Object> updateTbShopCurrency(@Validated @RequestBody TbShopCurrency resources){
tbShopCurrencyService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@DeleteMapping
@ApiOperation("删除/shop/currency")
public ResponseEntity<Object> deleteTbShopCurrency(@RequestBody Integer[] ids) {
tbShopCurrencyService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -5,7 +5,7 @@ import java.util.Date;
import lombok.Data;
/**
* 活动赠送商品表(TbActivateProduct)表查询类
* 活动赠送商品表(TbCouponProduct)表查询类
*
* @author ww
* @since 2024-08-20 11:27:40

View File

@ -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;
}

View File

@ -199,4 +199,7 @@ public class TbShopInfoDto implements Serializable {
//程序码(零点八零首页)
private String smallQrcode;
private String paymentQrcode;
private Integer isMemberPrice;
private String consumeColony;
}

View File

@ -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<BotButtonConfigDto, BotButtonConfig> {
}

View File

@ -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<BotConfigDto, BotConfig> {
}

View File

@ -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<BotUserFlowDto, BotUserFlow> {
}

View File

@ -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<BotUserDto, BotUser> {
}

View File

@ -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<TbRenewalsPayLogDto, TbRenewalsPayLog> {
}

View File

@ -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<TbMerchantCouponDto, TbMerchantCoupon> {
}

View File

@ -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<TbReceiptSalesDto, TbReceiptSales> {
}

View File

@ -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<TbShopCashSpreadDto, TbShopCashSpread> {
}

View File

@ -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<TbShopCurrencyDto, TbShopCurrency> {
}

View File

@ -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<Activate> {
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<TbActivateProduct> products;
}

View File

@ -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<TbActivate> {
@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;
}
}

View File

@ -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<TbActivateInRecord> {
@ -18,8 +20,18 @@ public class TbActivateInRecord extends Model<TbActivateInRecord> {
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<TbActivateInRecord> {
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<TbActivateInRecord> {
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<TbActivateInRecord> {
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<TbActivateInRecord> {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getCouponJson() {
return couponJson;
}
public void setCouponJson(String couponJson) {
this.couponJson = couponJson;
}
}

View File

@ -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<TbActivateOutRecord> {
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<TbActivateOutRecord> {
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<TbActivateOutRecord> {
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<TbActivateOutRecord> {
this.refNum = refNum;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getStatus() {
return status;
}

View File

@ -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<TbActivateProduct> {
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;
}
}

View File

@ -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<TbCouponProduct> {
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;
}

View File

@ -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<TbShopCoupon> {
//自增
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;
}
}

View File

@ -150,6 +150,12 @@ public class TbShopExtend extends Model<TbShopExtend> {
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";

View File

@ -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<TbUserStorage> {
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;
}

View File

@ -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<Activate> {
}

View File

@ -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<TbActivateProduct> {
public interface TbCouponProductMapper extends BaseMapper<TbCouponProduct> {
}

View File

@ -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<TbShopCoupon> {
}

View File

@ -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<TbUserStorage> {
}

View File

@ -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<Object> 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<Object> 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<Object> upActivate(@RequestBody TbActivate activate){
tbActivateService.modifyActivate(activate);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/activate/{activateId}")
@ApiOperation("查询活动赠送商品")
public ResponseEntity<Object> queryActivatePros(@PathVariable("activateId") Integer activateId){
return new ResponseEntity<>(shopService.findActivatePros(activateId),HttpStatus.OK);
}
/**
* @param params

View File

@ -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<ActivateProsVo> findActivatePros(Integer activate);
}

View File

@ -10,4 +10,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface TbActivateService extends IService<TbActivate> {
Object findActivate(String shopId);
void modifyActivate(TbActivate activate);
}

View File

@ -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<TbActivateProduct> {
public interface TbCouponProductService extends IService<TbCouponProduct> {
}

View File

@ -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<TbShopCoupon> {
Map<String, Object> queryAll(TbShopCouponQueryCriteria criteria);
TbShopCoupon findById (Integer id);
boolean update(TbShopCouponVo param);
boolean delete(Integer id);
List<TbCouponProduct> findActivatePros(Integer couponId);
}

View File

@ -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<TbUserStorage> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("shop_id", shopId);
if (StringUtils.isNotEmpty(account)) {
queryWrapper.eq("account", account);
}
IPage<TbUserStorage> 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<TbMerchantAccount> wrapper = new QueryWrapper<>();
wrapper.eq("account", userName);
TbMerchantAccount merchantAccount = tbMerchantAccountMapper.selectOne(wrapper);
QueryWrapper<TbUserStorage> 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<TbMerchantAccount> wrapper = new QueryWrapper<>();
wrapper.eq("account", userName);
TbMerchantAccount merchantAccount = tbMerchantAccountMapper.selectOne(wrapper);
QueryWrapper<TbUserStorage> 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<Activate> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("shop_id",shopId);
queryWrapper.orderByDesc("id");
List<Activate> 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<Integer> collect = new ArrayList<>();
for (TbActivateProduct product : activate.getProducts()) {
product.setActivateId(activate.getId());
if (product.getId() != null) collect.add(product.getId());
}
QueryWrapper<TbActivateProduct> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("activate_id",activate.getId());
List<TbActivateProduct> actProducts = actProductService.list(queryWrapper);
for (TbActivateProduct actProduct : actProducts) {
if (!collect.contains(actProduct.getId())) {
actProductService.removeById(actProduct.getId());
}
}
actProductService.saveOrUpdateBatch(activate.getProducts());
}else {
LambdaQueryWrapper<TbActivateProduct> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TbActivateProduct::getActivateId, activate.getId()); // 条件年龄等于30
actProductService.remove(queryWrapper);
}
}
@Override
public List<ActivateProsVo> findActivatePros(Integer activateId) {
QueryWrapper<TbActivateProduct> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("activate_id", activateId);
List<TbActivateProduct> actProducts = actProductService.list(queryWrapper);
if (!CollectionUtils.isEmpty(actProducts)) {
Map<Integer, Integer> map = actProducts.stream().collect(
Collectors.toMap(
TbActivateProduct::getProductId,
TbActivateProduct::getNum,
(existing, replacement) -> existing));
if (!CollectionUtils.isEmpty(map)) {
List<TbProduct> products = tbProductRepository.findByIds(new ArrayList<>(map.keySet()));
List<ActivateProsVo> 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<>();
}
}

View File

@ -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<TbActivateProductMapper, TbActivateProduct> implements TbActivateProductService {
}

View File

@ -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<TbActivateMapper, TbActivate>
implements TbActivateService{
public class TbActivateServiceImpl extends ServiceImpl<TbActivateMapper, TbActivate> implements TbActivateService{
@Autowired
private TbActivateMapper activateMapper;
@Override
public Object findActivate(String shopId) {
QueryWrapper<TbActivate> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("shop_id",shopId);
queryWrapper.orderByDesc("id");
List<TbActivate> 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);
}
}
}

View File

@ -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<TbCouponProductMapper, TbCouponProduct> implements TbCouponProductService {
}

View File

@ -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<TbShopCouponMapper, TbShopCoupon> implements TbShopCouponService {
@Autowired
private TbShopCouponMapper tbShopCouponmapper;
@Autowired
private TbCouponProductService couProductService;
@Autowired
private TbProductRepository tbProductRepository;
@Override
public Map<String, Object> queryAll(TbShopCouponQueryCriteria criteria) {
Page<TbShopCoupon> page = new Page<>(criteria.getPage(), criteria.getSize());
QueryWrapper<TbShopCoupon> 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<TbShopCoupon> 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<TbCouponProduct> 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<Integer> collect = new ArrayList<>();
for (TbCouponProduct product : param.getProducts()) {
product.setCouponId(param.getId());
if (product.getId() != null) collect.add(product.getId());
}
QueryWrapper<TbCouponProduct> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("coupon_id", param.getId());
List<TbCouponProduct> actProducts = couProductService.list(queryWrapper);
for (TbCouponProduct actProduct : actProducts) {
if (!collect.contains(actProduct.getId())) {
couProductService.removeById(actProduct.getId());
}
}
couProductService.saveOrUpdateBatch(param.getProducts());
} else {
LambdaQueryWrapper<TbCouponProduct> 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<TbCouponProduct>().eq(TbCouponProduct::getCouponId, id));
return true;
}
public List<TbCouponProduct> findActivatePros(Integer couponId) {
QueryWrapper<TbCouponProduct> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("coupon_id", couponId);
List<TbCouponProduct> 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<>();
}
}

View File

@ -86,7 +86,7 @@ public class TbShopExtendServiceImpl extends ServiceImpl<TbShopExtendMapper, TbS
public Page<TbShopExtend> checkAndInitialize(Page<TbShopExtend> ipage, Integer shopId) {
List<TbShopExtend> newRecords = new ArrayList<>();
List<String> requiredAutokeys = Arrays.asList("index_bg", "my_bg", "member_bg", "shopinfo_bg");
List<String> 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<TbShopExtendMapper, TbS
case "shopinfo_bg":
shopExtend.setTitle("商品列表");
break;
case "ticket_logo":
shopExtend.setTitle("小票logo");
break;
}
}
Set<String> existingAutokeys = shopExtends.stream()

View File

@ -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;
}
}

View File

@ -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<TbCouponProduct> products = new ArrayList<>();
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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;
}
}

View File

@ -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 = "打印会员开关 01")
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 = "打印会员余额开关 01")
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));
}
}

View File

@ -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));
}
}

View File

@ -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 = "小数位012")
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));
}
}

View File

@ -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;

View File

@ -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<BotButtonConfig, Integer>, JpaSpecificationExecutor<BotButtonConfig> {
}

View File

@ -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<BotConfig, Integer>, JpaSpecificationExecutor<BotConfig> {
}

View File

@ -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<BotUserFlow, Integer>, JpaSpecificationExecutor<BotUserFlow> {
}

View File

@ -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<BotUser, Integer>, JpaSpecificationExecutor<BotUser> {
}

View File

@ -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<TbRenewalsPayLog, Integer>, JpaSpecificationExecutor<TbRenewalsPayLog> {
}

View File

@ -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<TbMerchantCoupon, Integer>, JpaSpecificationExecutor<TbMerchantCoupon> {
}

View File

@ -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<TbReceiptSales, Integer>, JpaSpecificationExecutor<TbReceiptSales> {
}

View File

@ -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<TbShopCashSpread, String>, JpaSpecificationExecutor<TbShopCashSpread> {
@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);
}

View File

@ -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<TbShopCurrency, Integer>, JpaSpecificationExecutor<TbShopCurrency> {
@Query("SELECT currency from TbShopCurrency currency where currency.shopId = :shopId")
TbShopCurrency findByShopId(@Param("shopId")String shopId);
}

View File

@ -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<String,Object>
*/
Map<String,Object> queryAll(BotButtonConfigQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<BotButtonConfigDto>
*/
List<BotButtonConfigDto> 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<BotButtonConfigDto> all, HttpServletResponse response) throws IOException;
}

View File

@ -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<String,Object>
*/
Map<String,Object> queryAll(BotConfigQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<BotConfigDto>
*/
List<BotConfigDto> 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<BotConfigDto> all, HttpServletResponse response) throws IOException;
}

View File

@ -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<String,Object>
*/
Map<String,Object> queryAll(BotUserFlowQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<BotUserFlowDto>
*/
List<BotUserFlowDto> 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<BotUserFlowDto> all, HttpServletResponse response) throws IOException;
}

View File

@ -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<String,Object>
*/
Map<String,Object> queryAll(BotUserQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<BotUserDto>
*/
List<BotUserDto> 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<BotUserDto> all, HttpServletResponse response) throws IOException;
}

View File

@ -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<String,Object>
*/
Map<String,Object> queryAll(TbRenewalsPayLogQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbRenewalsPayLogDto>
*/
List<TbRenewalsPayLogDto> 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<TbRenewalsPayLogDto> all, HttpServletResponse response) throws IOException;
}

View File

@ -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<String,Object> queryAll(BotButtonConfigQueryCriteria criteria, Pageable pageable){
Page<BotButtonConfig> page = botButtonConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(botButtonConfigMapper::toDto));
}
@Override
public List<BotButtonConfigDto> 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<BotButtonConfigDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (BotButtonConfigDto botButtonConfig : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("按钮名称", botButtonConfig.getButtonName());
map.put("按钮值", botButtonConfig.getButtonValue());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@ -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<String,Object> queryAll(BotConfigQueryCriteria criteria, Pageable pageable){
Page<BotConfig> page = botConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(botConfigMapper::toDto));
}
@Override
public List<BotConfigDto> 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<BotConfigDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (BotConfigDto botConfig : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("元素键值", botConfig.getConfigKey());
map.put("元素值", botConfig.getConfigValue());
map.put("描述", botConfig.getRemark());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@ -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<String,Object> queryAll(BotUserFlowQueryCriteria criteria, Pageable pageable){
Page<BotUserFlow> page = botUserFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(botUserFlowMapper::toDto));
}
@Override
public List<BotUserFlowDto> 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<BotUserFlowDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (BotUserFlowDto botUserFlow : all) {
Map<String,Object> 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);
}
}

View File

@ -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<String,Object> queryAll(BotUserQueryCriteria criteria, Pageable pageable){
Page<BotUser> page = botUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(botUserMapper::toDto));
}
@Override
public List<BotUserDto> 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<BotUserDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (BotUserDto botUser : all) {
Map<String,Object> 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);
}
}

View File

@ -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<String,Object> queryAll(TbRenewalsPayLogQueryCriteria criteria, Pageable pageable){
Page<TbRenewalsPayLog> page = tbRenewalsPayLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbRenewalsPayLogMapper::toDto));
}
@Override
public List<TbRenewalsPayLogDto> 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<TbRenewalsPayLogDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbRenewalsPayLogDto tbRenewalsPayLog : all) {
Map<String,Object> 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);
}
}

View File

@ -423,16 +423,12 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
outRecordService.update(lambdaUpdateWrapper);
List<TbOrderDetail> details = tbOrderDetailRepository.searchDetailByOrderId(tbOrderInfo.getId());
Set<String> 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

View File

@ -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());
}

View File

@ -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<String,Object> queryAll(TbMerchantCouponQueryCriteria criteria, Pageable pageable){
Page<TbMerchantCoupon> page = tbMerchantCouponRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
List<CouponVO> objects = new ArrayList<>();
for (TbMerchantCoupon o :page.getContent()) {
CouponVO couponVO = new CouponVO();
BeanUtils.copyProperties(o,couponVO);
if (!o.getRelationIds().isEmpty()) {
List<Integer> integers = new ArrayList<>();
integers.add(Integer.valueOf(o.getRelationIds()));
List<TbProduct> byIds = tbProductRepository.findByIds(integers);
couponVO.setName(byIds.get(0).getName());
couponVO.setCoverImg(byIds.get(0).getCoverImg());
}
objects.add(couponVO);
}
HashMap<String, Object> couponvoMap = new HashMap<>();
couponvoMap.put("content", objects);
couponvoMap.put("totalElements", page.getTotalElements());
return couponvoMap;
// return PageUtil.toPage(page.map(tbMerchantCouponMapper::toDto));
}
@Override
public List<TbMerchantCouponDto> 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<TbMerchantCouponDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbMerchantCouponDto tbMerchantCoupon : all) {
Map<String,Object> 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);
}
}

View File

@ -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<String,Object> queryAll(TbReceiptSalesQueryCriteria criteria, Pageable pageable){
Page<TbReceiptSales> page = tbReceiptSalesRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbReceiptSalesMapper::toDto));
}
@Override
public List<TbReceiptSalesDto> 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<TbReceiptSalesDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbReceiptSalesDto tbReceiptSales : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("标题", tbReceiptSales.getTitle());
map.put("是否显示公司Logo", tbReceiptSales.getLogo());
map.put("打印联系电话等信息", tbReceiptSales.getShowContactInfo());
map.put("打印会员开关 01", tbReceiptSales.getShowMember());
map.put("打印会员编号开关", tbReceiptSales.getShowMemberCode());
map.put("打印会员积分", tbReceiptSales.getShowMemberScore());
map.put("打印会员余额开关 01", 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);
}
}

View File

@ -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<String,Object> queryAll(TbShopCashSpreadQueryCriteria criteria, Pageable pageable){
Page<TbShopCashSpread> page = tbShopCashSpreadRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbShopCashSpreadMapper::toDto));
}
@Override
public List<TbShopCashSpreadDto> 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<TbShopCashSpreadDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopCashSpreadDto tbShopCashSpread : all) {
Map<String,Object> 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);
}
}

View File

@ -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<String,Object> queryAll(TbShopCurrencyQueryCriteria criteria, Pageable pageable){
Page<TbShopCurrency> page = tbShopCurrencyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbShopCurrencyMapper::toDto));
}
@Override
public List<TbShopCurrencyDto> 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<TbShopCurrencyDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopCurrencyDto tbShopCurrency : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("店铺Id", tbShopCurrency.getShopId());
map.put("备用金", tbShopCurrency.getPrepareAmount());
map.put("货币单位 ¥,$", tbShopCurrency.getCurrency());
map.put("小数位012", 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);
}
}

Some files were not shown because too many files have changed in this diff Show More